bpo-40257: Tweak docstrings for special generic aliases. (GH-20022)

* Add the terminating period.
* Omit module name for builtin types.
This commit is contained in:
Serhiy Storchaka 2020-05-10 15:14:27 +03:00 committed by GitHub
parent 0122d48681
commit 2fbc57af85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -753,7 +753,10 @@ class _SpecialGenericAlias(_BaseGenericAlias, _root=True):
name = origin.__name__
super().__init__(origin, inst=inst, name=name)
self._nparams = nparams
self.__doc__ = f'A generic version of {origin.__module__}.{origin.__qualname__}'
if origin.__module__ == 'builtins':
self.__doc__ = f'A generic version of {origin.__qualname__}.'
else:
self.__doc__ = f'A generic version of {origin.__module__}.{origin.__qualname__}.'
@_tp_cache
def __getitem__(self, params):