class documentation

class EnumCallAnalyzer: (source)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method build​_enum​_call​_typeinfo Undocumented
Method check​_enum​_call Check if a call defines an Enum.
Method fail Undocumented
Method fail​_enum​_call​_arg Undocumented
Method parse​_enum​_call​_args Parse arguments of an Enum call.
Method process​_enum​_call Check if s defines an Enum; if yes, store the definition in symbol table.
Instance Variable api Undocumented
Instance Variable options Undocumented
def __init__(self, options, api): (source)

Undocumented

Parameters
options:OptionsUndocumented
api:SemanticAnalyzerInterfaceUndocumented
def build_enum_call_typeinfo(self, name, items, fullname, line): (source)

Undocumented

Parameters
name:strUndocumented
items:List[str]Undocumented
fullname:strUndocumented
line:intUndocumented
Returns
TypeInfoUndocumented
def check_enum_call(self, node, var_name, is_func_scope): (source)

Check if a call defines an Enum.

Example:

A = enum.Enum('A', 'foo bar')

is equivalent to:

class A(enum.Enum):
foo = 1 bar = 2
Parameters
node:ExpressionUndocumented
var​_name:strUndocumented
is​_func​_scope:boolUndocumented
Returns
Optional[TypeInfo]Undocumented
def fail(self, msg, ctx): (source)

Undocumented

Parameters
msg:strUndocumented
ctx:ContextUndocumented
def fail_enum_call_arg(self, message, context): (source)

Undocumented

Parameters
message:strUndocumented
context:ContextUndocumented
Returns
Tuple[List[str], List[Optional[Expression]], bool]Undocumented
def parse_enum_call_args(self, call, class_name): (source)

Parse arguments of an Enum call.

Return a tuple of fields, values, was there an error.

Parameters
call:CallExprUndocumented
class​_name:strUndocumented
Returns
Tuple[List[str], List[Optional[Expression]], bool]Undocumented
def process_enum_call(self, s, is_func_scope): (source)

Check if s defines an Enum; if yes, store the definition in symbol table.

Return True if this looks like an Enum definition (but maybe with errors), otherwise return False.

Parameters
s:AssignmentStmtUndocumented
is​_func​_scope:boolUndocumented
Returns
boolUndocumented

Undocumented

options = (source)

Undocumented