本文整理汇总了Python中symbol.import_as_name方法的典型用法代码示例。如果您正苦于以下问题:Python symbol.import_as_name方法的具体用法?Python symbol.import_as_name怎么用?Python symbol.import_as_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类symbol
的用法示例。
在下文中一共展示了symbol.import_as_name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: com_import_as_name
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import import_as_name [as 别名]
def com_import_as_name(self, node):
assert node[0] == symbol.import_as_name
node = node[1:]
assert node[0][0] == token.NAME
if len(node) == 1:
return node[0][1], None
assert node[1][1] == 'as', node
assert node[2][0] == token.NAME
return node[0][1], node[2][1]
示例2: Annotate
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import import_as_name [as 别名]
def Annotate(cls, symbol_type, children):
if (symbol_type != symbol.dotted_as_name and
symbol_type != symbol.import_as_name):
return None
return cls(symbol_type, children)
示例3: values
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import import_as_name [as 别名]
def values(self):
try:
import_as_names = self.FindChild(symbol.import_as_names)
except ValueError:
return (('*', None),)
return tuple((import_as_name.name, import_as_name.alias)
for import_as_name in import_as_names.children[::2])
示例4: module
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import import_as_name [as 别名]
def module(self):
import_as_name = self._import_as_name
if import_as_name:
return import_as_name.name
else:
return '*'
示例5: alias
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import import_as_name [as 别名]
def alias(self):
import_as_name = self._import_as_name
if import_as_name:
return import_as_name.alias
else:
return None
示例6: _get_forbidden_symbols
# 需要导入模块: import symbol [as 别名]
# 或者: from symbol import import_as_name [as 别名]
def _get_forbidden_symbols():
"""
Returns a list of symbol codes representing statements that are *not*
wanted in configuration files.
"""
try:
# Python 2.5:
symlst = [symbol.break_stmt, symbol.classdef, symbol.continue_stmt,
symbol.decorator, symbol.decorators, symbol.eval_input,
symbol.except_clause, symbol.exec_stmt, symbol.flow_stmt,
symbol.for_stmt, symbol.fpdef, symbol.fplist, symbol.funcdef,
symbol.global_stmt, symbol.import_as_name, symbol.import_as_names,
symbol.import_from, symbol.import_name, symbol.import_stmt,
symbol.lambdef, symbol.old_lambdef, symbol.print_stmt,
symbol.raise_stmt, symbol.try_stmt, symbol.while_stmt,
symbol.with_stmt, symbol.with_var, symbol.yield_stmt,
symbol.yield_expr]
except AttributeError:
# Python 2.4:
symlst = [symbol.break_stmt, symbol.classdef, symbol.continue_stmt,
symbol.decorator, symbol.decorators, symbol.eval_input,
symbol.except_clause, symbol.exec_stmt, symbol.flow_stmt,
symbol.for_stmt, symbol.fpdef, symbol.fplist, symbol.funcdef,
symbol.global_stmt, symbol.import_as_name, symbol.import_as_names,
symbol.import_from, symbol.import_name, symbol.import_stmt,
symbol.lambdef, symbol.print_stmt, symbol.raise_stmt,
symbol.try_stmt, symbol.while_stmt]
return symlst