use a upper-case name for the list of singleton names

This commit is contained in:
Keewis
2020-08-01 13:25:28 +02:00
parent ccd24aa00f
commit 02ff1cc290

View File

@@ -50,7 +50,7 @@ _token_regex = re.compile(
r'|"(?:\\"|[^"])*"' r'|"(?:\\"|[^"])*"'
r"|'(?:\\'|[^'])*')" r"|'(?:\\'|[^'])*')"
) )
_singletons = ("None", "True", "False", "Ellipsis") _SINGLETONS = ("None", "True", "False", "Ellipsis")
class GoogleDocstring: class GoogleDocstring:
@@ -934,7 +934,7 @@ def _convert_numpy_type_spec(_type: str, location: str = None, translations: dic
translation = translations.get(obj, obj) translation = translations.get(obj, obj)
# use :class: (the default) only if obj is not a standard singleton # use :class: (the default) only if obj is not a standard singleton
if translation in _singletons and default_translation == ":class:`%s`": if translation in _SINGLETONS and default_translation == ":class:`%s`":
default_translation = ":obj:`%s`" default_translation = ":obj:`%s`"
elif translation == "..." and default_translation == ":class:`%s`": elif translation == "..." and default_translation == ":class:`%s`":
# allow referencing the builtin ... # allow referencing the builtin ...