| Total Complexity | 6 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | class DocWrapper: |
||
| 2 | def __init__(self, doc=None): |
||
| 3 | self.doc = doc |
||
| 4 | |||
| 5 | @classmethod |
||
| 6 | def wrap_class(cls, klass): |
||
| 7 | """Wrapp a classes docstring to conceal it from instances.""" |
||
| 8 | klass.__doc__ = cls(klass.__doc__) |
||
| 9 | return klass |
||
| 10 | |||
| 11 | def __get__(self, instance, owner): |
||
| 12 | if instance is None: |
||
| 13 | return self.doc |
||
| 14 | return vars(instance).get("__doc__") |
||
| 15 | |||
| 16 | def __set__(self, instance, value): |
||
| 17 | vars(instance)["__doc__"] = value |
||
| 18 | |||
| 19 | def __delete__(self, instance): |
||
| 20 | vars(instance).pop("__doc__", None) |
||
| 21 |