我们从Python开源项目中,提取了以下15个代码示例,用于说明如何使用symbol.dotted_name()。
def decorator(self, nodelist): # '@' dotted_name [ '(' [arglist] ')' ] assert len(nodelist) in (3, 5, 6) assert nodelist[0][0] == token.AT assert nodelist[-1][0] == token.NEWLINE assert nodelist[1][0] == symbol.dotted_name funcname = self.decorator_name(nodelist[1][1:]) if len(nodelist) > 3: assert nodelist[2][0] == token.LPAR expr = self.com_call_function(funcname, nodelist[3]) else: expr = funcname return expr
def import_from(self, nodelist): # import_from: 'from' ('.'* dotted_name | '.') 'import' ('*' | # '(' import_as_names ')' | import_as_names) assert nodelist[0][1] == 'from' idx = 1 while nodelist[idx][1] == '.': idx += 1 level = idx - 1 if nodelist[idx][0] == symbol.dotted_name: fromname = self.com_dotted_name(nodelist[idx]) idx += 1 else: fromname = "" assert nodelist[idx][1] == 'import' if nodelist[idx + 1][0] == token.STAR: return From(fromname, [('*', None)], level, lineno=nodelist[0][2]) else: node = nodelist[idx + 1 + (nodelist[idx + 1][0] == token.LPAR)] return From(fromname, self.com_import_as_names(node), level, lineno=nodelist[0][2])
def dotted_name(self, nodelist): raise WalkerError