From 01ea5ad52eb8e85b018027a5d540f5822ebfebba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 11 May 2020 14:45:38 +0200 Subject: [PATCH] documentation/python: ignore more stuff added by typing. --- documentation/python.py | 7 +++++++ .../inspect_annotations.AContainer.html | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/documentation/python.py b/documentation/python.py index 9faf2346..d6d9139f 100755 --- a/documentation/python.py +++ b/documentation/python.py @@ -440,6 +440,13 @@ def crawl_class(state: State, path: List[str], class_): if name.startswith('__'): # ... don't have their own docs if (name, object.__doc__) in _filtered_builtin_functions: continue + # are added by typing.Generic on Py3.7+. Like above, can't + # use isinstance(object, Generic) because "Class + # typing.Generic cannot be used with class or instance + # checks" and there's nothing else to catch on, so this + # filters out all undocumented cases of these two + if sys.version_info >= (3, 7) and name in ['__init_subclass__', '__class_getitem__'] and not object.__doc__: + continue # ... or are auto-generated by attrs if state.config['ATTRS_COMPATIBILITY']: if (name, object.__doc__) in _filtered_attrs_functions: continue diff --git a/documentation/test_python/inspect_annotations/inspect_annotations.AContainer.html b/documentation/test_python/inspect_annotations/inspect_annotations.AContainer.html index 4a447c39..fcc0e6e5 100644 --- a/documentation/test_python/inspect_annotations/inspect_annotations.AContainer.html +++ b/documentation/test_python/inspect_annotations/inspect_annotations.AContainer.html @@ -37,14 +37,6 @@

Special methods

-
- def __class_getitem__(params) -
-
-
- def __init_subclass__(*args, **kwargs) -
-
def __new__(cls, *args, **kwds)
-- 2.30.2