chiark / gitweb /
documentation/python: ignore more stuff added by typing.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 11 May 2020 12:45:38 +0000 (14:45 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 11 May 2020 12:45:38 +0000 (14:45 +0200)
documentation/python.py
documentation/test_python/inspect_annotations/inspect_annotations.AContainer.html

index 9faf23461819f10824432ee229361f16e74731b0..d6d9139fecf45197e5bda307e231bfb8b36f3723 100755 (executable)
@@ -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
index 4a447c39cd7d962af638de67d20853918b74c794..fcc0e6e59c34bbe68f969831f95723b078a5de2e 100644 (file)
         <section id="dunder-methods">
           <h2><a href="#dunder-methods">Special methods</a></h2>
           <dl class="m-doc">
-            <dt id="__class_getitem__">
-              <span class="m-doc-wrap-bumper">def <a href="#__class_getitem__" class="m-doc-self">__class_getitem__</a>(</span><span class="m-doc-wrap">params)</span>
-            </dt>
-            <dd></dd>
-            <dt id="__init_subclass__">
-              <span class="m-doc-wrap-bumper">def <a href="#__init_subclass__" class="m-doc-self">__init_subclass__</a>(</span><span class="m-doc-wrap">*args, **kwargs)</span>
-            </dt>
-            <dd></dd>
             <dt id="__new__">
               <span class="m-doc-wrap-bumper">def <a href="#__new__" class="m-doc-self">__new__</a>(</span><span class="m-doc-wrap">cls, *args, **kwds)</span>
             </dt>