From: Vladimír Vondruš Date: Mon, 11 May 2020 12:45:38 +0000 (+0200) Subject: documentation/python: ignore more stuff added by typing. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=01ea5ad52eb8e85b018027a5d540f5822ebfebba;p=blog.git documentation/python: ignore more stuff added by typing. --- 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)