Skip to content

Commit

Permalink
manual flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Sep 1, 2020
1 parent 146c542 commit 852f886
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# 'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
Expand Down
4 changes: 3 additions & 1 deletion libmodernize/fixes/fix_dict_six.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Fixer for iterkeys() -> six.iterkeys(), and similarly for iteritems and itervalues."""
"""
Fixer for iterkeys() -> six.iterkeys(), and similarly for iteritems and itervalues.
"""

# Local imports
from fissix import fixer_util, pytree
Expand Down
1 change: 0 additions & 1 deletion libmodernize/fixes/fix_itertools_imports_six.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def transform(self, node, results):
children = imports.children
for child in children[::2]:
if child.type == token.NAME:
member = child.value
name_node = child
elif child.type == token.STAR:
# Just leave the import as is.
Expand Down
4 changes: 0 additions & 4 deletions libmodernize/fixes/fix_urllib_six.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

# Author: Nick Edds

from fissix import fixer_base
from fissix.fixer_util import (
Comma,
FromImport,
Expand Down Expand Up @@ -103,7 +102,6 @@


def build_pattern():
bare = set()
for old_module, changes in MAPPING.items():
for change in changes:
new_module, members = change
Expand Down Expand Up @@ -184,11 +182,9 @@ def transform_member(self, node, results):
for member in members:
# we only care about the actual members
if member.type == syms.import_as_name:
as_name = member.children[2].value
member_name = member.children[0].value
else:
member_name = member.value
as_name = None
if member_name != ",":
for change in MAPPING[mod_member.value]:
if member_name in change[1]:
Expand Down
10 changes: 6 additions & 4 deletions libmodernize/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def main(args=None):
"--fix",
action="append",
default=[],
help="Each FIX specifies a transformation; '-f default' includes default fixers.",
help="Each FIX specifies a transformation; "
"'-f default' includes default fixers.",
)
parser.add_option(
"--fixers-here",
Expand Down Expand Up @@ -137,7 +138,8 @@ def main(args=None):
parser.error("Can't use '-n' without '-w'.")
if options.list_fixes:
print(
"Standard transformations available for the -f/--fix and -x/--nofix options:"
"Standard transformations available for the "
"-f/--fix and -x/--nofix options:"
)
for fixname in sorted(avail_fixes):
print(" {} ({})".format(fixname, fixname.split(".fix_", 1)[1]))
Expand Down Expand Up @@ -263,8 +265,8 @@ def main(args=None):

# Return error status (0 if rt.errors is zero)
return_code = int(bool(rt.errors))
# If we are enforcing python 3 compatibility, return a non-zero exit code if we had to modify
# any files.
# If we are enforcing python 3 compatibility, return a non-zero exit code
# if we had to modify any files.
if options.enforce and rt.files:
return_code |= 2
return return_code
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ universal = 1
[flake8]
disable-noqa = True
max-line-length = 88
extend-ignore =
E203, # whitespace before : is not PEP8 compliant (& conflicts with black)

[isort]
profile = black
4 changes: 3 additions & 1 deletion tests/test_future_behaviour.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def _check_for_multiple_futures(file_name, source_content):
for future, how_many in counts.items():
if how_many > 1:
raise Exception(
f"The same future repeated more than once ({how_many} times):\n{future}\n\n* Input file:\n{source_content}\n\n* Output file:\n{result_content}\n"
f"The same future repeated more than once ({how_many} times):\n"
f"{future}\n\n* Input file:\n{source_content}\n\n"
f"* Output file:\n{result_content}\n"
)
return counts

Expand Down

0 comments on commit 852f886

Please sign in to comment.