Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_utils.py37 linesDownload Raw Back to click
1from __future__ import annotations2 3import enum4import typing as t5 6 7class Sentinel(enum.Enum):8    """Enum used to define sentinel values.9 10    .. seealso::11 12        `PEP 661 - Sentinel Values <https://peps.python.org/pep-0661/>`_.13    """14 15    UNSET = object()16    FLAG_NEEDS_VALUE = object()17 18    def __repr__(self) -> str:19        return f"{self.__class__.__name__}.{self.name}"20 21 22UNSET = Sentinel.UNSET23"""Sentinel used to indicate that a value is not set."""24 25FLAG_NEEDS_VALUE = Sentinel.FLAG_NEEDS_VALUE26"""Sentinel used to indicate an option was passed as a flag without a27value but is not a flag option.28 29``Option.consume_value`` uses this to prompt or use the ``flag_value``.30"""31 32T_UNSET = t.Literal[UNSET]  # type: ignore[valid-type]33"""Type hint for the :data:`UNSET` sentinel value."""34 35T_FLAG_NEEDS_VALUE = t.Literal[FLAG_NEEDS_VALUE]  # type: ignore[valid-type]36"""Type hint for the :data:`FLAG_NEEDS_VALUE` sentinel value."""37 
codekingpro/portable-devtools · Team Ai