sentinel.py 454 B

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