summaryrefslogtreecommitdiff
path: root/sphinx/util/inspect.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix #9879: autodoc: AttributeError for object having invalid __doc__Takeshi KOMIYA2021-11-221-2/+9
|
* Fix #9838: autodoc: AttributeError is raised for lru_cacheTakeshi KOMIYA2021-11-211-2/+11
|
* Fix #9757: autodoc_inherit_docstrings does not effect to overriden classmethodsTakeshi KOMIYA2021-10-301-1/+3
|
* Fix #9756: autodoc: Crashed if classmethod does not have __func__ attributeTakeshi KOMIYA2021-10-231-1/+1
|
* Fix #9607: autodoc: Incorrect base class detectionTakeshi KOMIYA2021-09-201-0/+15
| | | | | | | | | In case of the descendants of generic class, the value of obj.__orig_bases__ is incorrect because it returns original base arguments for the child of the generic class instead of the target class itself. This uses obj.__dict__ to get the correct __orig_bases__ information.
* Close #9639: autodoc: Support asynchronous generator functionsTakeshi KOMIYA2021-09-171-1/+2
|
* FIX: do not try to compute the boolean value of a numpy arrayThomas A Caswell2021-08-061-2/+3
| | | | | If there is a numpy array as a class attribute, then `bool(meth)` will raise.
* Merge branch '4.1.x' into 4.xTakeshi KOMIYA2021-07-231-5/+8
|\
| * Fix #9489: autodoc: Custom types using typing.NewType are brokenTakeshi KOMIYA2021-07-231-5/+8
| | | | | | | | | | | | At the HEAD of 3.10, the implementation of ``typing.NewType`` has been changed to the class based. To follow the change, this uses ``isinstance`` on ``sphinx.util.inspect:isNewType()`.
* | Close #9445: autodoc: Support class propertiesTakeshi KOMIYA2021-07-171-1/+12
|/ | | | | Since python 3.9, `classmethod` starts to support creating a "class property". This supports to generate document for it.
* Close #9272: autodoc: Render enum values for the default argument value betterTakeshi KOMIYA2021-05-301-2/+5
|
* Fix #9250: autodoc: The inherited method not having docstring is wrongly parsedTakeshi KOMIYA2021-05-231-8/+17
| | | | | | `sphinx.util.inspect.getdoc()` clean the docstring up if the method is inherited and not having docstring. That causes indentations are removed on processing it.
* Close #8588: autodoc: autodoc_type_aliases supports dotted nameTakeshi KOMIYA2021-05-031-3/+84
| | | | | It allows users to define an alias for a class with module name like `foo.bar.BazClass`.
* Merge branch '3.x'Takeshi KOMIYA2021-04-111-2/+12
|\
| * Fix autodoc: Async staticmethods/ classmethods are considered as not asyncTakeshi KOMIYA2021-04-111-2/+12
| | | | | | | | | | | | | | | | | | | | Since 3.10.0a7, the instances of staticmethod and classmethod have `__wrapped__` attribute. It confuses sphinx.util.inspect:iscoroutinefunction(). refs: * https://docs.python.org/3.10/whatsnew/3.10.html#other-language-changes * https://bugs.python.org/issue43682
* | refactor: Add Optional to type annotationsTakeshi KOMIYA2021-04-081-1/+1
| |
* | refactor: use raw Type for type annotationsTakeshi KOMIYA2021-04-041-2/+2
| |
* | Fix #8917: autodoc: Raises a warning if function has wrong __globals__ valueTakeshi KOMIYA2021-02-261-3/+12
| | | | | | | | | | | | `sphinx.util.inspect:signature()` crashes with AttributeError when subject has wrong `__globals__` value. This ignores the error on building.
* | Merge branch '3.x' into master_with_merged_3.xjfbu2021-02-021-16/+3
|\ \ | |/
| * refactor: AttributeError handling for getslots() is not neededTakeshi KOMIYA2021-01-311-1/+0
| |
| * refactor: AttributeError handling for getall() is not neededTakeshi KOMIYA2021-01-311-1/+0
| |
| * refactor: AttributeError handling for getannotations() is not neededTakeshi KOMIYA2021-01-311-4/+1
| |
| * refactor: AttributeError handling for getmro() is not neededTakeshi KOMIYA2021-01-311-10/+2
| | | | | | | | | | | | | | | | Internally, sphinx.util.inspect.getmro() uses `safe_getattr()` with the `default` keyword. Therefore it never raises AttributeError even if the subject raises an error on accessing `__mro__` attribute. This fixes the wrong its usage.
* | Merge branch '3.x'Takeshi KOMIYA2021-01-221-2/+15
|\ \ | |/
| * Fix #8693: autodoc: Default values for overloads are rendered as stringTakeshi KOMIYA2021-01-171-2/+15
| | | | | | | | | | | | | | | | | | The default values for overloaded functions are rendered as string literal unexpectedly because autodoc extracts code snippets from the source code, not actual value (ex. int, ellipsis, and so on). This introduces a simple wrapper class; `DefaultValue` to render these code snippets like actual values, not string literals.
* | Merge branch '3.x'Takeshi KOMIYA2021-01-011-1/+1
|\ \ | |/
| * A happy new year!Takeshi KOMIYA2021-01-011-1/+1
| | | | | | | | | | | | | | .. note:: $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \; $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
* | Merge branch '3.x'Takeshi KOMIYA2020-12-291-0/+1
|\ \ | |/
| * doc: Update docstring of getslots()Takeshi KOMIYA2020-12-221-0/+1
| |
* | Merge branch '3.x'Takeshi KOMIYA2020-12-201-1/+17
|\ \ | |/
| * refactor: Move _getmro() to sphinx.util.inspect moduleTakeshi KOMIYA2020-12-171-0/+16
| |
* | Merge branch '3.x'Takeshi KOMIYA2020-12-141-1/+1
|\ \ | |/
| * refactor: pretty change for isproperty()Takeshi KOMIYA2020-12-121-1/+1
| | | | | | | | It is more readable to use `>=` to compare versions.
* | Fix importing errorTakeshi KOMIYA2020-11-221-1/+1
| |
* | Merge branch '3.x'Takeshi KOMIYA2020-11-221-0/+25
|\ \ | |/
| * refactor: Move _getannotations() to sphinx.util.inspectTakeshi KOMIYA2020-11-221-0/+12
| |
| * Merge pull request #8465 from tk0miya/8460_NewTypeTakeshi KOMIYA2020-11-221-0/+10
| |\ | | | | | | Fix #8460: autodoc: Support custom types defined by typing.NewType
| | * Fix #8460: autodoc: Support custom types defined by typing.NewTypeTakeshi KOMIYA2020-11-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A custom type defined by typing.NewType was rendered as a function because the generated type is a function having special attributes. This renders it as a variable. Note: The module name where the NewType object defined is lost on generating it. So it is hard to make cross-reference for these custom types.
| * | Handle AttributeError from getall() and getslots()Takeshi KOMIYA2020-11-211-0/+3
| |/
* | Merge branch '3.x'Takeshi KOMIYA2020-11-211-2/+43
|\ \ | |/
| * refactor autodoc: Add sphinx.util.inspect.getall()Takeshi KOMIYA2020-11-201-1/+17
| | | | | | | | | | Move a function that obtains __all__ attribute from a module to sphinx.util.inspect module as getall().
| * Add sphinx.util.inspect:getslots() to get __slots__ attributeTakeshi KOMIYA2020-11-151-0/+21
| |
| * Merge branch '3.3.x' into 3.xTakeshi KOMIYA2020-11-121-1/+5
| |\
| | * Fix #8350: autosummary_mock_imports causes slow down buildsTakeshi KOMIYA2020-11-121-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | The mock objects set up via `autosummary_mock_imports` causes slow down of autosummary stub generation because AttributeDocumenter falls into infinite recursion call to unwrap decorators of mocked objects. To avoid the trouble, this blocks unwrapping decorators of mocked objects.
* | | Merge branch '3.x'Takeshi KOMIYA2020-11-121-10/+3
|\ \ \ | |/ /
| * | Merge pull request #8408 from francoisfreitag/isortTakeshi KOMIYA2020-11-121-10/+3
| |\ \ | | | | | | | | Sort imports with isort
| | * | Sort imports with isortFrançois Freitag2020-11-111-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep imports alphabetically sorted and their order homogeneous across Python source files. The isort project has more feature and is more active than the flake8-import-order plugin. Most issues caught were simply import ordering from the same module. Where imports were purposefully placed out of order, tag with isort:skip.
* | | | Merge branch '3.x'Takeshi KOMIYA2020-11-101-2/+2
|\ \ \ \ | |/ / /
| * | | test: Adjust type annotataions in python 3.10Takeshi KOMIYA2020-11-101-1/+1
| | | |
| * | | autodoc: Add Optional[t] to annotation of function and methodTakeshi KOMIYA2020-11-101-2/+2
| |/ / | | | | | | | | | | | | | | | | | | As typing.get_type_hints() doing, this adds Optional[t] to type annotations if a default value equal to None is set. Note: this is default behavior of inspect.signature() since Python 3.10.