summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-12-13 19:50:49 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-12-13 19:50:49 (GMT)
commitdb9b65d9e5d9d39199714cfd15a26e46ab0eaae1 (patch)
treec8b2b598895c948a49ece65b52936f477eea89fd /Lib
parentbd62f0a6e4705ff6ae627df6afe9d871778f80eb (diff)
downloadcpython-db9b65d9e5d9d39199714cfd15a26e46ab0eaae1.zip
cpython-db9b65d9e5d9d39199714cfd15a26e46ab0eaae1.tar.gz
cpython-db9b65d9e5d9d39199714cfd15a26e46ab0eaae1.tar.bz2
Issue #22823: Use set literals in lib2to3.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lib2to3/fixer_util.py8
-rw-r--r--Lib/lib2to3/fixes/fix_dict.py2
-rw-r--r--Lib/lib2to3/patcomp.py2
-rw-r--r--Lib/lib2to3/refactor.py4
4 files changed, 8 insertions, 8 deletions
diff --git a/Lib/lib2to3/fixer_util.py b/Lib/lib2to3/fixer_util.py
index 6e259c5..44502bf 100644
--- a/Lib/lib2to3/fixer_util.py
+++ b/Lib/lib2to3/fixer_util.py
@@ -187,8 +187,8 @@ def parenthesize(node):
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.
@@ -359,7 +359,7 @@ def touch_import(package, name, node):
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
@@ -402,7 +402,7 @@ def find_binding(name, node, package=None):
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:
diff --git a/Lib/lib2to3/fixes/fix_dict.py b/Lib/lib2to3/fixes/fix_dict.py
index 4cc3717..963f952 100644
--- a/Lib/lib2to3/fixes/fix_dict.py
+++ b/Lib/lib2to3/fixes/fix_dict.py
@@ -36,7 +36,7 @@ from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot
from .. import fixer_util
-iter_exempt = fixer_util.consuming_calls | set(["iter"])
+iter_exempt = fixer_util.consuming_calls | {"iter"}
class FixDict(fixer_base.BaseFix):
diff --git a/Lib/lib2to3/patcomp.py b/Lib/lib2to3/patcomp.py
index 0a259e9..2012ec4 100644
--- a/Lib/lib2to3/patcomp.py
+++ b/Lib/lib2to3/patcomp.py
@@ -32,7 +32,7 @@ class PatternSyntaxError(Exception):
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
diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py
index 8100317..c24be14 100644
--- a/Lib/lib2to3/refactor.py
+++ b/Lib/lib2to3/refactor.py
@@ -57,7 +57,7 @@ def _get_head_types(pat):
# 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:
@@ -133,7 +133,7 @@ def _detect_future_features(source):
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: