Undocumented
Function | ann_str_and_line |
Return the textual representation and line number of an object's type annotation. @param obj: Documentable object with a type annotation. |
Function | fromAST |
Undocumented |
Function | fromText |
Undocumented |
Function | test_aliasing |
Undocumented |
Function | test_aliasing_recursion |
Undocumented |
Function | test_all_allbad |
If no value in __all__ could be parsed, the result is an empty list. |
Function | test_all_bad_sequence |
Values other than lists and tuples assigned to __all__ have no effect and a warning is logged. |
Function | test_all_caps_variable_in_instance_is_not_a_constant |
Currently, it does not mark instance members as constants, never. |
Function | test_all_in_class_non_recognition |
A class variable named __all__ is just an ordinary variable and does not affect Module.all. |
Function | test_all_multiple |
If there are multiple assignments to __all__, a warning is logged and the last assignment takes effect. |
Function | test_all_nonliteral |
Non-literals in __all__ are ignored. |
Function | test_all_nonstring |
Non-string literals in __all__ are ignored. |
Function | test_all_recognition |
The value assigned to __all__ is parsed to Module.all. |
Function | test_annotated_variables |
Undocumented |
Function | test_assignment_to_method_in_class |
An assignment to a method in a class body does not change the type of the documentable. |
Function | test_assignment_to_method_in_init |
An assignment to a method inside __init__() does not change the type of the documentable. |
Function | test_attrs_args |
Non-existing arguments and invalid values to recognized arguments are rejected with a warning. |
Function | test_attrs_attrib_badargs |
. |
Function | test_attrs_attrib_instance |
An attr.ib attribute is classified as an instance variable. |
Function | test_attrs_attrib_type |
An attr.ib's "type" or "default" argument is used as an alternative type annotation. |
Function | test_attrs_auto_instance |
Attrs auto-attributes are classified as instance variables. |
Function | test_bad_string_annotation |
Invalid string annotations must be reported as syntax errors. |
Function | test_class |
Undocumented |
Function | test_class_with_base |
Undocumented |
Function | test_class_with_base_from_module |
Undocumented |
Function | test_classdecorator |
Undocumented |
Function | test_classdecorator_with_args |
Undocumented |
Function | test_classmethod |
Undocumented |
Function | test_constant_class |
Class variables with all-uppercase names are recognized as constants. |
Function | test_constant_module |
Module variables with all-uppercase names are recognized as constants. |
Function | test_constant_module_with_final |
Module variables annotated with typing.Final are recognized as constants. |
Function | test_constant_module_with_final_annotation_gets_infered |
It can recognize constants defined with typing.Final. It will infer the type of the constant if Final do not use subscripts. |
Function | test_constant_module_with_final_subscript1 |
It can recognize constants defined with typing.Final[something] |
Function | test_constant_module_with_final_subscript2 |
It can recognize constants defined with typing.Final[something]. And it automatically remove the Final part from the annotation. |
Function | test_constant_module_with_final_subscript_invalid_warns |
It warns if there is an invalid Final annotation. |
Function | test_constant_module_with_final_subscript_invalid_warns2 |
It warns if there is an invalid Final annotation. |
Function | test_constant_module_with_typing_extensions_final |
Module variables annotated with typing_extensions.Final are recognized as constants. |
Function | test_constant_override_do_not_warns_when_defined_in_class_docstring |
Constant can be documented as variables at docstring level without any warnings. |
Function | test_constant_override_do_not_warns_when_defined_in_module_docstring |
Undocumented |
Function | test_constant_override_in_instace_warns |
It warns when a constant is beeing re defined in instance. But it ignores it's value. |
Function | test_constant_override_in_instace_warns2 |
It warns when a constant is beeing re defined in instance. But it ignores it's value. Even if the actual constant definition is detected after the instance variable of the same name. |
Function | test_constant_override_in_module_warns |
Undocumented |
Function | test_detupling_assignment |
Undocumented |
Function | test_docformat_recognition |
The value assigned to __docformat__ is parsed to Module.docformat. |
Function | test_docformat_warn_empty |
Undocumented |
Function | test_docformat_warn_not_str |
Undocumented |
Function | test_docformat_warn_not_str2 |
Undocumented |
Function | test_docformat_warn_overrides |
Undocumented |
Function | test_docstring_assignment |
Undocumented |
Function | test_docstring_assignment_detuple |
We currently don't trace values for detupling assignments, so when assigning to __doc__ we get a warning about the unknown value. |
Function | test_documented_no_alias |
A variable that is documented should not be considered an alias. |
Function | test_follow_renaming |
Undocumented |
Function | test_function_async |
Undocumented |
Function | test_function_badsig |
When a function has an invalid signature, an error is logged and the empty signature is returned. |
Function | test_function_signature |
A round trip from source to inspect.Signature and back produces the original text. |
Function | test_function_signature_posonly |
Undocumented |
Function | test_function_simple |
Undocumented |
Function | test_ignore_function_contents |
Undocumented |
Function | test_import_func_from_package |
Importing a function from a package should look in the __init__ module. |
Function | test_import_module_from_package |
Importing a module from a package should not look in __init__ module. |
Function | test_import_star |
Undocumented |
Function | test_inferred_variable_types |
Undocumented |
Function | test_inherit_names |
Undocumented |
Function | test_inline_docstring_annotated_classvar |
Undocumented |
Function | test_inline_docstring_annotated_instancevar |
Undocumented |
Function | test_inline_docstring_classvar |
Undocumented |
Function | test_inline_docstring_instancevar |
Undocumented |
Function | test_inline_docstring_modulevar |
Undocumented |
Function | test_literal_string_annotation |
Strings inside Literal annotations must not be recursively parsed. |
Function | test_methoddecorator |
Undocumented |
Function | test_more_aliasing |
Undocumented |
Function | test_nested_class_inheriting_from_same_module |
Undocumented |
Function | test_no_docstring |
Undocumented |
Function | test_node2fullname |
The node2fullname() function finds the full (global) name for a name expression in the AST. |
Function | test_property_conflict |
Warn when a method is decorated as both property and class/staticmethod. These decoration combinations do not create class/static properties. |
Function | test_property_custom |
Any custom decorator with a name ending in 'property' makes a method into a property getter. |
Function | test_property_decorator |
A function decorated with '@property' is documented as an attribute. |
Function | test_property_setter |
Property setter and deleter methods are renamed, so they don't replace the property itself. |
Function | test_relative_import_in_package |
Relative imports in a package must be resolved by going up one level less, since we don't count "__init__.py" as a level. |
Function | test_relative_import_past_top |
A warning is logged when a relative import goes beyond the top-level package. |
Function | test_subclasses |
Undocumented |
Function | test_type_comment |
Undocumented |
Function | test_unstring_annotation |
Annotations or parts thereof that are strings are parsed and line number information is preserved. |
Function | test_variable_scopes |
Undocumented |
Function | test_variable_types |
Undocumented |
Function | to_html |
Undocumented |
Function | type2html |
Undocumented |
Function | type2str |
Undocumented |
Function | unwrap |
Undocumented |
Variable | systemcls_param |
Undocumented |
Parameters | |
obj:model.Documentable | Documentable object with a type annotation. |
Returns | |
Tuple[ | Undocumented |
Undocumented
Parameters | |
ast:ast.Module | Undocumented |
modname:str | Undocumented |
is_package:bool | Undocumented |
parent_name:Optional[ | Undocumented |
system:Optional[ | Undocumented |
buildercls:Optional[ | Undocumented |
systemcls:Type[ | Undocumented |
Returns | |
model.Module | Undocumented |
Undocumented
Parameters | |
text:str | Undocumented |
modname:str | Undocumented |
is_package:bool | Undocumented |
parent_name:Optional[ | Undocumented |
system:Optional[ | Undocumented |
buildercls:Optional[ | Undocumented |
systemcls:Type[ | Undocumented |
Returns | |
model.Module | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
An assignment to a method in a class body does not change the type of the documentable.
If the name we assign to exists and it does not belong to an Attribute (it's a Function instead, in this test case), the assignment will be ignored.
Parameters | |
systemcls:Type[ | Undocumented |
An assignment to a method inside __init__() does not change the type of the documentable.
If the name we assign to exists and it does not belong to an Attribute (it's a Function instead, in this test case), the assignment will be ignored.
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
annotation:str | Undocumented |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Undocumented
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
When a function has an invalid signature, an error is logged and the empty signature is returned.
Note that most bad signatures lead to a SyntaxError, which we cannot recover from. This test checks what happens if the AST can be produced but inspect.Signature() rejects the parsed parameters.
Parameters | |
signature:str | Undocumented |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
signature:str | Undocumented |
systemcls:Type[ | Undocumented |
Note | |
Our inspect.Signature Paramters objects are now tweaked such that they might produce HTML tags, handled by the PyvalColorizer . |
Undocumented
Parameters | |
signature:str | Undocumented |
systemcls:Type[ | Undocumented |
Importing a function from a package should look in the __init__ module.
In this test the following hierarchy is constructed:
package a module __init__ defines function 'f' module c imports function 'f' module b imports function 'f'
We verify that when module b and c import the name f from package a, they import the function f from the module a.__init__.
Parameters | |
systemcls:Type[ | Undocumented |
Importing a module from a package should not look in __init__ module.
In this test the following hierarchy is constructed:
package a module __init__ module b defines function 'f' module c imports module 'a.b'
We verify that when module c imports the name b from package a, it imports the module a.b which contains f.
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
annotation:str | Undocumented |
expected:str | Undocumented |
Parameters | |
decoration:str | Undocumented |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
capsys:CapSys | Undocumented |
Relative imports in a package must be resolved by going up one level less, since we don't count "__init__.py" as a level.
Hierarchy:
top: def f - pkg: imports f and g - mod: def g
Parameters | |
systemcls:Type[ | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
level:int | Undocumented |
capsys:CapSys | Undocumented |
Parameters | |
systemcls:Type[ | Undocumented |
Undocumented
Parameters | |
parsed_docstring:ParsedDocstring | Undocumented |
linker:DocstringLinker | Undocumented |
Returns | |
str | Undocumented |
Undocumented
Parameters | |
type_expr:Optional[ | Undocumented |
Returns | |
Optional[ | Undocumented |
Undocumented
Parameters | |
parsed_docstring:Optional[ | Undocumented |
Returns | |
str | Undocumented |