class InspectionEngine: (source)
Engine for locating and statically inspecting expressions.
Method | __init__ |
Undocumented |
Method | add |
Undocumented |
Method | collect |
Collect attributes from all union/typevar variants. |
Method | collect |
Collect nodes that can be referred to by an expression. |
Method | expr |
Format attributes that are valid for a given expression. |
Method | expr |
Format type for an expression using current options. |
Method | expression |
Find and format definition location for an expression. |
Method | find |
Find module by path, or return a suitable error message. |
Method | format |
Undocumented |
Method | get |
Get attributes of expression(s) at a location. |
Method | get |
Get symbol definitions of expression(s) at a location. |
Method | get |
Get types of expression(s) at a location. |
Method | missing |
Undocumented |
Method | missing |
Undocumented |
Method | modules |
Gather modules where given nodes where defined. |
Method | object |
Undocumented |
Method | parse |
Undocumented |
Method | reload |
Reload given module while temporary exporting types. |
Method | run |
Top-level logic to inspect expression(s) at a location. |
Method | run |
Get type of an expression matching a span. |
Method | run |
Get types of all expressions enclosing a position. |
Instance Variable | fg |
Undocumented |
Instance Variable | finder |
Undocumented |
Instance Variable | force |
Undocumented |
Instance Variable | include |
Undocumented |
Instance Variable | include |
Undocumented |
Instance Variable | include |
Undocumented |
Instance Variable | limit |
Undocumented |
Instance Variable | module |
Undocumented |
Instance Variable | union |
Undocumented |
Instance Variable | verbosity |
Undocumented |
Method | _fill |
Undocumented |
FineGrainedBuildManager
, *, verbosity: int
= 0, limit: int
= 0, include_span: bool
= False, include_kind: bool
= False, include_object_attrs: bool
= False, union_attrs: bool
= False, force_reload: bool
= False):
(source)
¶
Undocumented
Collect nodes that can be referred to by an expression. Note: it can be more than one for example in case of a union attribute.
Format attributes that are valid for a given expression. If expression type is not an Instance, try using fallback. Attributes are returned as a JSON (ordered by MRO) that maps base class name to list of attributes. Attributes may appear in multiple bases if overridden (we simply follow usual mypy logic for creating new Vars etc).
Format type for an expression using current options. If type is known, second item returned is True. If type is not known, an error message is returned instead, and second item returned is False.
Find and format definition location for an expression. If it is not a RefExpr, it is effectively skipped by returning an empty result.
Find module by path, or return a suitable error message. Note we don't use exceptions to simplify handling 1 vs 2 statuses.
list[ FuncBase|SymbolNode]
, expression: RefExpr
) -> tuple[ dict[ FuncBase|SymbolNode, State], bool]
:
(source)
¶
Gather modules where given nodes where defined. Also check if they need to be refreshed (cached nodes may have lines/columns missing).
str
, method: Callable[ [ Expression], tuple[ str, bool]]
) -> dict[ str, object]
:
(source)
¶
Top-level logic to inspect expression(s) at a location. This can be re-used by various simple inspections.
MypyFile
, line: int
, column: int
, end_line: int
, end_column: int
, method: Callable[ [ Expression], tuple[ str, bool]]
) -> dict[ str, object]
:
(source)
¶
Get type of an expression matching a span. Type or error is returned as a standard daemon response dict.