From 2358f8efe9379de0702551ef007bfd7b71698065 Mon Sep 17 00:00:00 2001 From: Kevin M Granger Date: Mon, 8 Aug 2022 19:33:29 -0400 Subject: [PATCH] Fix docs for NOTHING --- docs/api.rst | 1 + src/attr/_make.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index a609833c5..f7298118b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -28,6 +28,7 @@ Core Therefore if a class, method, or function claims that it has been added in an older version, it is only available in the ``attr`` namespace. .. autodata:: attrs.NOTHING + :no-value: .. autofunction:: attrs.define diff --git a/src/attr/_make.py b/src/attr/_make.py index c436f390f..c5ce07a02 100644 --- a/src/attr/_make.py +++ b/src/attr/_make.py @@ -49,13 +49,13 @@ class _Nothing(enum.Enum): """ - Sentinel class to indicate the lack of a value when ``None`` is ambiguous. + Sentinel to indicate the lack of a value when ``None`` is ambiguous. - This is an Enum so that the single variant can be used as a `Literal` for - type checking tools. + If extending attrs, you can use ``typing.Literal[NOTHING]`` to show + that a value may be ``NOTHING``. .. versionchanged:: 21.1.0 ``bool(NOTHING)`` is now False. - .. versionchanged:: 22.2.0 ``NOTHING`` is now an `enum.Enum` variant. + .. versionchanged:: 22.2.0 ``NOTHING`` is now an ``enum.Enum`` variant. """ NOTHING = enum.auto()