module documentation

Defined python's object behaviour e.g. dunder method definition and action

Class StubTreeRewriter parse the stub file (.pyi) added related stub file syntax (e.g. @overload, @property, if sys.version etc.. Assumption: python version related stub must be declared as: if sys.version_info >= (3, ) with the operand must be a tuple constant...
Function get_caller_arg get the caller argument based on a str
Function get_custom_dunder_method return the custom dunder method for this operation, not include default dunder method Raise: DunderUnimplemented if no dunder method Raise: OperationIncompatible if : op is not comparison operator left is not Instance...
Function instance_attr Undocumented
Function instance_scope Undocumented
Function instance_starred Undocumented
Function py2_div Undocumented
Constant BIN_OP_DUNDER_METHOD Undocumented
Constant BIN_OP_METHOD Undocumented
Constant BOOL_METHOD Undocumented
Constant BUILTIN_DUNDER Undocumented
Constant COMP_METHOD Undocumented
Constant COMP_OP_DUNDER_METHOD Undocumented
Constant COMP_REFLECTED_OP Undocumented
Constant DUNDER_METHOD Undocumented
Constant REFLECTED_BIN_OP_DUNDER_METHOD Undocumented
Constant UNARY_METHOD Undocumented
Constant UNARY_OP_DUNDER_METHOD Undocumented
Function _and Undocumented
Function _or Undocumented
Function _reflected_name Undocumented
def get_caller_arg(self, arg_str, call_node): (source)

get the caller argument based on a str

Parameters
arg_str:strUndocumented
call_nodeUndocumented
def get_custom_dunder_method(left, op, context=None): (source)

return the custom dunder method for this operation, not include default dunder method Raise: DunderUnimplemented if no dunder method Raise: OperationIncompatible if : op is not comparison operator left is not Instance

Parameters
left:nodes.VariableUndocumented
op:strUndocumented
context:InferenceContextUndocumented
Returns
Iterable[nodes.Proxy]Undocumented
def instance_attr(self, context=None): (source)

Undocumented

def instance_scope(self, context=None): (source)

Undocumented

def instance_starred(self, context=None): (source)

Undocumented

def py2_div(a, b): (source)

Undocumented

BIN_OP_DUNDER_METHOD: dict[str, str] = (source)

Undocumented

Value
{'+': '__add__',
 '-': '__sub__',
 '/': '__truediv__',
 '//': '__floordiv__',
 '*': '__mul__',
 '**': '__pow__',
 '%': '__mod__',
...
BIN_OP_METHOD = (source)

Undocumented

Value
{'+': (lambda a, b: a + b),
 '-': (lambda a, b: a - b),
 '/': (lambda a, b: a / b),
 '%': (lambda a, b: a % b),
 '&': (lambda a, b: a & b),
 '|': (lambda a, b: a | b),
 '//': (lambda a, b: a // b),
...
BOOL_METHOD = (source)

Undocumented

Value
{'or': _or, 'and': _and}
BUILTIN_DUNDER: tuple[str, ...] = (source)

Undocumented

Value
('__abs__',
 '__int__',
 '__float__',
 '__str__',
 '__repr__',
 '__len__',
 '__round__',
...
COMP_METHOD = (source)

Undocumented

Value
{'>': (lambda a, b: a > b),
 '<': (lambda a, b: a < b),
 '>=': (lambda a, b: a >= b),
 '<=': (lambda a, b: a <= b),
 '==': (lambda a, b: a == b),
 '!=': (lambda a, b: a != b),
 'in': (lambda a, b: a in b),
...
COMP_OP_DUNDER_METHOD: dict = (source)

Undocumented

Value
{'>': '__gt__',
 '<': '__lt__',
 '>=': '__ge__',
 '<=': '__le__',
 '==': '__eq__',
 '!=': '__ne__',
 'in': '__contains__',
...
COMP_REFLECTED_OP: dict[str, str] = (source)

Undocumented

Value
{'>': '<', '<': '>', '==': '!=', '!=': '==', '>=': '<=', '<=': '>='}
DUNDER_METHOD = (source)
REFLECTED_BIN_OP_DUNDER_METHOD = (source)

Undocumented

Value
{key: _reflected_name(value) for key, value in BIN_OP_DUNDER_METHOD.items()}
UNARY_METHOD = (source)

Undocumented

Value
{'+': (lambda a: +a),
 '-': (lambda a: -a),
 'not': (lambda a: not a),
 '~': (lambda a: ~a)}
UNARY_OP_DUNDER_METHOD: dict = (source)

Undocumented

Value
{'-': '__neg__', '+': '__pos__', '~': '__invert__', 'not': None}
def _and(*val): (source)

Undocumented

def _or(*val): (source)

Undocumented

def _reflected_name(name): (source)

Undocumented