Convert ASTs into pydoctor.model.Documentable
instances.
Class |
|
Keeps tracks of the state of the AST build, creates documentable and adds objects to the system. |
Class |
|
No class docstring; 0/4 instance variable, 9/40 methods, 0/3 static method, 0/1 class method documented |
Class |
|
Responsible to read files and cache their parsed tree. |
Class |
|
This visitor implements the handling of type aliases and type variables. |
Exception |
|
A control flow exception meaning that the assignment should not be further proccessed. |
Function | extract |
Extract the "str" part from annotations like "Final[str]". |
Function | find |
Find module level Assign. Yields tuples containing the assigment name and the Assign node. |
Function | is |
Detect if the optional new_value expression override the one already stored in the Attribute.value attribute. |
Function | is |
Detect if the given assignment is a constant. |
Function | parse |
Find and attempt to parse into a list of names the __all__ variable of a module's AST and set Module.all accordingly. |
Function | parse |
Find __docformat__ variable of this module's AST and set Module.docformat accordingly. |
Function | parse |
Parse the contents of a Python source file. |
Function | setup |
Undocumented |
Constant | MODULE |
Undocumented |
Type Variable |
|
Undocumented |
Function | _handle |
If the given expression is a name assigned to a target that is not yet in use, create an alias. |
Function | _maybe |
Check whether a name is a potential attribute of the given class. This is used to prevent an assignment that wraps a method from creating an attribute that would overwrite or shadow that method. |
Variable | _CONTROL |
AST types that introduces a new control flow block, potentially conditionnal. |
Variable | _parse |
Undocumented |
Extract the "str" part from annotations like "Final[str]".
Raises | |
ValueError | If the "Final" annotation is not valid. |
Detect if the optional new_value expression override the one already stored in the Attribute.value
attribute.
model.Attribute
, annotation: ast.expr | None
, value: ast.expr | None
) -> bool
:
(source)
¶
Detect if the given assignment is a constant.
For an assignment to be detected as constant, it should:
- have all-caps variable name or using
typing.Final
annotation - not be overriden
- not be defined in a conditionnal block or any other kind of control flow blocks
Note | |
Must be called after setting obj.annotation to detect variables using Final. |
Find and attempt to parse into a list of names the __all__ variable of a module's AST and set Module.all
accordingly.
Find __docformat__ variable of this module's AST and set Module.docformat
accordingly.
This is all valid:
__docformat__ = "reStructuredText en" __docformat__ = "epytext" __docformat__ = "restructuredtext"
Mapping[ str, Callable[ [ ast.Assign, model.Module], None]]
=
(source)
¶
Undocumented
Value |
|
Check whether a name is a potential attribute of the given class. This is used to prevent an assignment that wraps a method from creating an attribute that would overwrite or shadow that method.
Returns | |
bool | True if the name does not exist or is an existing (possibly inherited) attribute, False if this name defines something else than an Attribute . |