File: sentinel.py

package info (click to toggle)
ipython 9.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 8,624 kB
  • sloc: python: 45,268; sh: 317; makefile: 168
file content (15 lines) | stat: -rw-r--r-- 454 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Sentinel class for constants with useful reprs"""

# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.


class Sentinel:
    def __init__(self, name: str, module: str, docstring: str | None = None) -> None:
        self.name = name
        self.module = module
        if docstring:
            self.__doc__ = docstring

    def __repr__(self) -> str:
        return str(self.module) + "." + self.name