hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.59k stars 291 forks source link

w503 failure #415

Closed delandtj closed 6 years ago

delandtj commented 6 years ago
cat > x.py << EOF
def extractBlocks(self):
    addLine = (self.matchMultiple(linesIncludePatterns, line)
       and not self.matchMultiple(linesExcludePatterns, line)) or emptyLine
EOF
autopep8 -a -a -a -v --experimental x.py

fails with the following:

[file:x.py]
--->  Applying global fix for E265
--->  Applying global fix for E231
--->  Applying global fix for E721
--->  Applying global fix for W601
--->  Applying global fix for W603
--->  Applying global fix for W604
--->  Applying global fix for W690
--->  2 issue(s) to fix {'W503': {3}, 'E128': {3}}
--->  2 issue(s) to fix {'E501': {3}, 'W503': {3}}
Traceback (most recent call last):
  File "/usr/local/bin/autopep8", line 11, in <module>
    load_entry_point('autopep8', 'console_scripts', 'autopep8')()
  File "/home/src/autopep8/autopep8.py", line 3972, in main
    fix_multiple_files(args.files, args, sys.stdout)
  File "/home/src/autopep8/autopep8.py", line 3884, in fix_multiple_files
    _fix_file((name, options, output))
  File "/home/src/autopep8/autopep8.py", line 3865, in _fix_file
    fix_file(*parameters)
  File "/home/src/autopep8/autopep8.py", line 3254, in fix_file
    fixed_source = fix_lines(fixed_source, options, filename=filename)
  File "/home/src/autopep8/autopep8.py", line 3234, in fix_lines
    fixed_source = fix.fix()
  File "/home/src/autopep8/autopep8.py", line 572, in fix
    aggressive=self.options.aggressive))
  File "/home/src/autopep8/autopep8.py", line 514, in _fix_source
    modified_lines = fix(result)
  File "/home/src/autopep8/autopep8.py", line 1161, in fix_w503
    one_string_token = target.split()[0]
hhatto commented 6 years ago

fixed in latest master (e830499d6bdf967a0a795ce9d02b36bb13d55338) .

Thanks for your feedback!!