Undocumented
Class |
|
This class is dynamically added to the bases of each AST node class. |
Class |
|
Undocumented |
Class |
|
This class is selectively added to the bases of the following ast nodes: Constant , List , Tuple , Dict , Set . |
Class |
|
Optionnaly holds type information. |
Class |
|
Special object which is returned when inference fails. |
Function | are |
return true if the two given statements are mutually exclusive |
Function | fix |
Fix a newly created AST tree to be compatible with astuce. |
Function | get |
Wraps the context ast context classes into a more friendly enumeration. |
Function | get |
Get the full path of a name from a from .x import y or import y alias. |
Function | get |
Return the first parent node that is an If node (or None) |
Function | get |
Returns the parent package of this module or None if not found. |
Function | get |
Get the origin module fullname from an ast.alias. This string can be used to retreive the ast.Module instance from the Parser.modules dict. |
Function | is |
Whether this node is the target of an assigment. |
Function | is |
Whether this node is the target of a del statment. |
Function | is |
Whether this node is a frame. |
Function | is |
Is this If node is part of the the C{else} branch of a parent If node. |
Function | is |
Whether this node is a scope. |
Function | literal |
Transform a literal object into it's AST counterpart. |
Function | nodes |
Get the nodes (including this one or below) of the given types. |
Function | qname |
Transform a dotted name (i.e twisted.internet.reactor) into it's AST couterparts. |
Function | relative |
Convert a relative import path to an absolute one. |
Function | _get |
Get the full path of a name from a from .x import y alias. |
Constant | _CONTEXT |
Undocumented |
Constant | _END |
Undocumented |
return true if the two given statements are mutually exclusive
algorithm : 1) index stmt1's parents 2) climb among stmt2's parents until we find a common parent 3) if the common parent is a If or Try statement, look if nodes are
in exclusive branches
Parameters | |
stmt1:ASTNode | Undocumented |
stmt2:ASTNode | Undocumented |
Returns | |
bool | Undocumented |
Fix a newly created AST tree to be compatible with astuce.
Parameters | |
node:_typing.ASTNode | Undocumented |
parent:Optional[ | Undocumented |
Returns | |
_typing.ASTNode | Undocumented |
Wraps the context ast context classes into a more friendly enumeration.
Dynamically created nodes do not have the ctx field, in this case fall back to Load context.
Parameters | |
node:Union[ | Undocumented |
Returns | |
Context | Undocumented |
Returns the parent package of this module or None
if not found.
Some code rely on the fact that Module.parent
property is always None.
So we should not overide this behaviour.
Parameters | |
node:_typing.Module | Undocumented |
Returns | |
Optional[ | Undocumented |
Get the origin module fullname from an ast.alias.
This string can be used to retreive the ast.Module
instance from the Parser.modules
dict.
Note that for static analysis, we don't currently need the submodule information. So imports like:
import c.abc
Will result in 'c' beeing returned.
But:
import c.abc as cabc
Will result in 'c.abc' beeing returned.
Import from like:
# in pack/__init__.py from .x import y # in pack/x.py pass # if the file is not in the system, it will fail to resolve.
Will result in 'pack.x' beeing returned.
Parameters | |
alias:ast.alias | Undocumented |
Returns | |
str | Undocumented |
Whether this node is the target of an assigment.
Parameters | |
node:Union[ | Undocumented |
Returns | |
bool | Undocumented |
Whether this node is the target of a del statment.
Parameters | |
node:Union[ | Undocumented |
Returns | |
bool | Undocumented |
Transform a literal object into it's AST counterpart.
The object provided may only consist of the following Python builtin types: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None.
Normally, AST and literal_to_ast(ast.literal_eval(AST)) are equivalent.
Parameters | |
ob:Any | Undocumented |
Returns | |
ast.expr | Undocumented |
Get the nodes (including this one or below) of the given types.
Parameters | |
klass:Union[ | The types of node to search for. |
predicate:Optional[ | Callable that returns False value to ignore more objects. |
Returns | |
Iterator[ | The node of the given types. |
Transform a dotted name (i.e twisted.internet.reactor) into it's AST couterparts.
Parameters | |
name:str | Undocumented |
Returns | |
Union[ | Undocumented |
Convert a relative import path to an absolute one.
Parameters | |
node:ast.ImportFrom | The "from ... import ..." AST node. |
name | The imported name. |
Returns | |
str | The absolute import path of the module this nodes imports from. |
Raises | |
InferenceError | if the import is relative and the module could not be found in the system. |
Get the full path of a name from a from .x import y alias.
Parameters | |
importast.ImportFrom | The node to resolve the name of. |
alias | The alias node |
Returns | |
str | The full import path of the name. |
Undocumented
Value |
|