本文整理汇总了Python中mypy.nodes.Var._full_name方法的典型用法代码示例。如果您正苦于以下问题:Python Var._full_name方法的具体用法?Python Var._full_name怎么用?Python Var._full_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mypy.nodes.Var
的用法示例。
在下文中一共展示了Var._full_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: analyse_lvalue
# 需要导入模块: from mypy.nodes import Var [as 别名]
# 或者: from mypy.nodes.Var import _full_name [as 别名]
def analyse_lvalue(self, lval, nested=False, add_defs=False):
if isinstance(lval, NameExpr):
n = lval
nested_global = not self.locals and self.block_depth > 0 and not self.type
if (add_defs or nested_global) and n.name not in self.globals:
# Define new global name.
v = Var(n.name)
v._full_name = self.qualified_name(n.name)
v.is_ready = False # Type not inferred yet
n.node = v
n.is_def = True
n.kind = GDEF
n.full_name = v._full_name
self.globals[n.name] = SymbolTableNode(GDEF, v, self.cur_mod_id)
elif isinstance(n.node, Var) and n.is_def:
v = n.node
self.module_names[v.name()] = SymbolTableNode(GDEF, v, self.cur_mod_id)
elif self.locals and n.name not in self.locals[-1] and n.name not in self.global_decls[-1]:
# Define new local name.
v = Var(n.name)
n.node = v
n.is_def = True
n.kind = LDEF
self.add_local(v, n)
elif not self.locals and (self.type and n.name not in self.type.vars):
# Define a new attribute.
v = Var(n.name)
v.info = self.type
v.is_initialized_in_class = True
n.node = v
n.is_def = True
self.type.vars[n.name] = v
else:
# Bind to an existing name.
lval.accept(self)
elif isinstance(lval, MemberExpr):
if not add_defs:
self.analyse_member_lvalue(lval)
elif isinstance(lval, IndexExpr):
if not add_defs:
lval.accept(self)
elif isinstance(lval, ParenExpr):
self.analyse_lvalue((lval).expr, nested, add_defs)
elif (isinstance(lval, TupleExpr) or isinstance(lval, ListExpr)) and not nested:
items = (lval).items
for i in items:
self.analyse_lvalue(i, True, add_defs)
else:
self.fail("Invalid assignment target", lval)