Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/traitlets/utils/sentinel.py: 79%
14 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 06:09 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-20 06:09 +0000
1"""Sentinel class for constants with useful reprs"""
3# Copyright (c) IPython Development Team.
4# Distributed under the terms of the Modified BSD License.
5from __future__ import annotations
7import typing as t
10class Sentinel:
11 def __init__(self, name: str, module: t.Any, docstring: str | None = None) -> None:
12 self.name = name
13 self.module = module
14 if docstring:
15 self.__doc__ = docstring
17 def __repr__(self) -> str:
18 return str(self.module) + "." + self.name
20 def __copy__(self) -> Sentinel:
21 return self
23 def __deepcopy__(self, memo: t.Any) -> Sentinel:
24 return self