IPython/utils/sentinel.py
raw| 1 | """Sentinel class for constants with useful reprs""" |
| 2 | |
| 3 | # Copyright (c) IPython Development Team. |
| 4 | # Distributed under the terms of the Modified BSD License. |
| 5 | |
| 6 | |
| 7 | class Sentinel: |
| 8 | def __init__(self, name: str, module: str, docstring: str | None = None) -> None: |
| 9 | self.name = name |
| 10 | self.module = module |
| 11 | if docstring: |
| 12 | self.__doc__ = docstring |
| 13 | |
| 14 | def __repr__(self) -> str: |
| 15 | return str(self.module) + "." + self.name |