@@ -424,10 +424,12 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
424424 parens = [0 ] * nrows
425425 # relative indents of physical lines
426426 rel_indent = [0 ] * nrows
427+ # for each depth, collect a list of opening rows
427428 open_rows = [[0 ]]
428429 # visual indents
429430 indent_chances = {}
430431 last_indent = tokens [0 ][2 ]
432+ # for each depth, memorize the visual indent column
431433 indent = [last_indent [1 ]]
432434 if verbose >= 3 :
433435 print (">>> " + tokens [0 ][4 ].rstrip ())
@@ -458,6 +460,7 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
458460 if rel_indent [row ] == rel_indent [open_row ] + valid_hang :
459461 break
460462 hang = rel_indent [row ] - rel_indent [open_row ]
463+ # is there any chance of visual indent?
461464 visual_indent = (not close_bracket and hang > 0 and
462465 indent_chances .get (start [1 ]))
463466
@@ -1202,7 +1205,7 @@ def __init__(self, filename=None, lines=None,
12021205 try :
12031206 self .lines = readlines (filename )
12041207 except IOError :
1205- exc_type , exc = sys .exc_info ()[:2 ]
1208+ ( exc_type , exc ) = sys .exc_info ()[:2 ]
12061209 self ._io_error = '%s: %s' % (exc_type .__name__ , exc )
12071210 self .lines = []
12081211 else :
@@ -1218,7 +1221,7 @@ def __init__(self, filename=None, lines=None,
12181221 self .report_error = self .report .error
12191222
12201223 def report_invalid_syntax (self ):
1221- exc_type , exc = sys .exc_info ()[:2 ]
1224+ ( exc_type , exc ) = sys .exc_info ()[:2 ]
12221225 if len (exc .args ) > 1 :
12231226 offset = exc .args [1 ]
12241227 if len (offset ) > 2 :
@@ -1268,7 +1271,7 @@ def check_physical(self, line):
12681271 for name , check , argument_names in self ._physical_checks :
12691272 result = self .run_check (check , argument_names )
12701273 if result is not None :
1271- offset , text = result
1274+ ( offset , text ) = result
12721275 self .report_error (self .line_number , offset , text , check )
12731276
12741277 def build_tokens_line (self ):
@@ -1281,7 +1284,7 @@ def build_tokens_line(self):
12811284 length = 0
12821285 previous = None
12831286 for token in self .tokens :
1284- token_type , text = token [0 :2 ]
1287+ ( token_type , text ) = token [0 :2 ]
12851288 if token_type == tokenize .COMMENT :
12861289 comments .append (text )
12871290 continue
@@ -1290,8 +1293,8 @@ def build_tokens_line(self):
12901293 if token_type == tokenize .STRING :
12911294 text = mute_string (text )
12921295 if previous :
1293- end_row , end = previous [3 ]
1294- start_row , start = token [2 ]
1296+ ( end_row , end ) = previous [3 ]
1297+ ( start_row , start ) = token [2 ]
12951298 if end_row != start_row : # different row
12961299 prev_text = self .lines [end_row - 1 ][end - 1 ]
12971300 if prev_text == ',' or (prev_text not in '{[('
@@ -1343,7 +1346,7 @@ def check_ast(self):
13431346 tree = compile ('' .join (self .lines ), '' , 'exec' , PyCF_ONLY_AST )
13441347 except (SyntaxError , TypeError ):
13451348 return self .report_invalid_syntax ()
1346- for name , cls , _ in self ._ast_checks :
1349+ for name , cls , __ in self ._ast_checks :
13471350 checker = cls (tree , self .filename )
13481351 for lineno , offset , text , check in checker .run ():
13491352 if not self .lines or not noqa (self .lines [lineno - 1 ]):
@@ -1775,15 +1778,15 @@ def read_config(options, args, arglist, parser):
17751778 if options .verbose :
17761779 print ('local configuration: in %s' % parent )
17771780 break
1778- parent , tail = os .path .split (parent )
1781+ ( parent , tail ) = os .path .split (parent )
17791782
17801783 pep8_section = parser .prog
17811784 if config .has_section (pep8_section ):
17821785 option_list = dict ([(o .dest , o .type or o .action )
17831786 for o in parser .option_list ])
17841787
17851788 # First, read the default values
1786- new_options , _ = parser .parse_args ([])
1789+ ( new_options , __ ) = parser .parse_args ([])
17871790
17881791 # Second, parse the configuration
17891792 for opt in config .options (pep8_section ):
@@ -1805,7 +1808,7 @@ def read_config(options, args, arglist, parser):
18051808 setattr (new_options , normalized_opt , value )
18061809
18071810 # Third, overwrite with the command-line options
1808- options , _ = parser .parse_args (arglist , values = new_options )
1811+ ( options , __ ) = parser .parse_args (arglist , values = new_options )
18091812 options .doctest = options .testsuite = False
18101813 return options
18111814
@@ -1828,7 +1831,8 @@ def process_options(arglist=None, parse_argv=False, config_file=None,
18281831 (parser .prog , ', ' .join (parser .config_options ))))
18291832 group .add_option ('--config' , metavar = 'path' , default = config_file ,
18301833 help = "user config file location (default: %default)" )
1831- options , args = parser .parse_args (arglist )
1834+ # If parse_argv is None, the arguments are parsed from sys.argv
1835+ (options , args ) = parser .parse_args (arglist )
18321836 options .reporter = None
18331837
18341838 if options .ensure_value ('testsuite' , False ):
0 commit comments