@@ -220,7 +220,7 @@ def first_lines(self, lines):
220
220
Returns a set of the first lines.
221
221
222
222
"""
223
- return set ( self .first_line (l ) for l in lines )
223
+ return { self .first_line (l ) for l in lines }
224
224
225
225
def translate_lines (self , lines ):
226
226
"""Implement `FileReporter.translate_lines`."""
@@ -520,7 +520,7 @@ class AstArcAnalyzer(object):
520
520
def __init__ (self , text , statements , multiline ):
521
521
self .root_node = ast .parse (neuter_encoding_declaration (text ))
522
522
# TODO: I think this is happening in too many places.
523
- self .statements = set ( multiline .get (l , l ) for l in statements )
523
+ self .statements = { multiline .get (l , l ) for l in statements }
524
524
self .multiline = multiline
525
525
526
526
if AST_DUMP : # pragma: debugging
@@ -626,10 +626,10 @@ def _line__Module(self, node):
626
626
return 1
627
627
628
628
# The node types that just flow to the next node with no complications.
629
- OK_TO_DEFAULT = set ([
629
+ OK_TO_DEFAULT = {
630
630
"Assign" , "Assert" , "AugAssign" , "Delete" , "Exec" , "Expr" , "Global" ,
631
631
"Import" , "ImportFrom" , "Nonlocal" , "Pass" , "Print" ,
632
- ])
632
+ }
633
633
634
634
@contract (returns = 'ArcStarts' )
635
635
def add_arcs (self , node ):
@@ -661,7 +661,7 @@ def add_arcs(self, node):
661
661
print ("*** Unhandled: {}" .format (node ))
662
662
663
663
# Default for simple statements: one exit from this node.
664
- return set ([ ArcStart (self .line_for_node (node ))])
664
+ return { ArcStart (self .line_for_node (node ))}
665
665
666
666
@one_of ("from_start, prev_starts" )
667
667
@contract (returns = 'ArcStarts' )
@@ -677,7 +677,7 @@ def add_body_arcs(self, body, from_start=None, prev_starts=None):
677
677
678
678
"""
679
679
if prev_starts is None :
680
- prev_starts = set ([ from_start ])
680
+ prev_starts = { from_start }
681
681
for body_node in body :
682
682
lineno = self .line_for_node (body_node )
683
683
first_line = self .multiline .get (lineno , lineno )
@@ -890,7 +890,7 @@ def _handle_decorated(self, node):
890
890
self .add_arc (last , lineno )
891
891
last = lineno
892
892
# The body is handled in collect_arcs.
893
- return set ([ ArcStart (last )])
893
+ return { ArcStart (last )}
894
894
895
895
_handle__ClassDef = _handle_decorated
896
896
@@ -984,7 +984,7 @@ def _handle__Try(self, node):
984
984
# If there are `except` clauses, then raises in the try body
985
985
# will already jump to them. Start this set over for raises in
986
986
# `except` and `else`.
987
- try_block .raise_from = set ([] )
987
+ try_block .raise_from = set ()
988
988
else :
989
989
self .block_stack .pop ()
990
990
@@ -1079,7 +1079,7 @@ def _combine_finally_starts(self, starts, exits):
1079
1079
if start .cause is not None :
1080
1080
causes .append (start .cause .format (lineno = start .lineno ))
1081
1081
cause = " or " .join (causes )
1082
- exits = set ( ArcStart (xit .lineno , cause ) for xit in exits )
1082
+ exits = { ArcStart (xit .lineno , cause ) for xit in exits }
1083
1083
return exits
1084
1084
1085
1085
@contract (returns = 'ArcStarts' )
0 commit comments