return Node(syms.atom, [LParen(), node, RParen()])
-consuming_calls = set(["sorted", "list", "set", "any", "all", "tuple", "sum",
- "min", "max", "enumerate"])
+consuming_calls = {"sorted", "list", "set", "any", "all", "tuple", "sum",
+ "min", "max", "enumerate"}
def attr_chain(obj, attr):
"""Follow an attribute chain.
root.insert_child(insert_pos, Node(syms.simple_stmt, children))
-_def_syms = set([syms.classdef, syms.funcdef])
+_def_syms = {syms.classdef, syms.funcdef}
def find_binding(name, node, package=None):
""" Returns the node which binds variable name, otherwise None.
If optional argument package is supplied, only imports will
return ret
return None
-_block_syms = set([syms.funcdef, syms.classdef, syms.trailer])
+_block_syms = {syms.funcdef, syms.classdef, syms.trailer}
def _find(name, node):
nodes = [node]
while nodes:
def tokenize_wrapper(input):
"""Tokenizes a string suppressing significant whitespace."""
- skip = set((token.NEWLINE, token.INDENT, token.DEDENT))
+ skip = {token.NEWLINE, token.INDENT, token.DEDENT}
tokens = tokenize.generate_tokens(io.StringIO(input).readline)
for quintuple in tokens:
type, value, start, end, line_text = quintuple
# Always return leafs
if pat.type is None:
raise _EveryNode
- return set([pat.type])
+ return {pat.type}
if isinstance(pat, pytree.NegatedPattern):
if pat.content:
def advance():
tok = next(gen)
return tok[0], tok[1]
- ignore = frozenset((token.NEWLINE, tokenize.NL, token.COMMENT))
+ ignore = frozenset({token.NEWLINE, tokenize.NL, token.COMMENT})
features = set()
try:
while True: