我们从Python开源项目中,提取了以下34个代码示例,用于说明如何使用keyword.name()。
def completion_names(evaluator, stmt, pos, module): keyword_list = all_keywords(evaluator) if not isinstance(stmt, Leaf) or has_inappropriate_leaf_keyword(pos, module): keyword_list = filter( lambda keyword: not keyword.only_valid_as_leaf, keyword_list ) return [keyword.name for keyword in keyword_list]
def __init__(self, evaluator, name, pos): self.name = FakeName(name, self, pos) self.start_pos = pos self.parent = evaluator.BUILTINS
def only_valid_as_leaf(self): return self.name.value in keywords_only_valid_as_leaf
def names(self): """ For a `parsing.Name` like comparision """ return [self.name]
def docstr(self): return imitate_pydoc(self.name)
def __init__(self, evaluator, name): self.string_name = name self.parent_context = evaluator.BUILTINS
def __init__(self, evaluator, name, pos): self.name = KeywordName(evaluator, name) self.start_pos = pos self.parent = evaluator.BUILTINS
def __repr__(self): return '<%s: %s>' % (type(self).__name__, self.name)
def __init__(self, evaluator, name): self.evaluator = evaluator self.string_name = name self.parent_context = evaluator.BUILTINS