Skip to content

Commit

Permalink
Fix stylistic problems noticed by flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
treyhunner committed Oct 26, 2014
1 parent 10a8040 commit 0d8ef26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions editorconfig/handler.py
Expand Up @@ -41,7 +41,7 @@ class EditorConfigHandler(object):
"""

def __init__(self, filepath, conf_filename='.editorconfig',
version=VERSION):
version=VERSION):
"""Create EditorConfigHandler for matching given filepath"""
self.filepath = filepath
self.conf_filename = conf_filename
Expand Down Expand Up @@ -94,7 +94,7 @@ def check_assertions(self):
# Raise ``VersionError`` if version specified is greater than current
if self.version is not None and self.version[:3] > VERSION[:3]:
raise VersionError(
"Required version is greater than the current version.")
"Required version is greater than the current version.")

def preprocess_values(self):

Expand All @@ -104,23 +104,24 @@ def preprocess_values(self):

# Lowercase option value for certain options
for name in ["end_of_line", "indent_style", "indent_size",
"insert_final_newline", "trim_trailing_whitespace", "charset"]:
"insert_final_newline", "trim_trailing_whitespace",
"charset"]:
if name in opts:
opts[name] = opts[name].lower()

# Set indent_size to "tab" if indent_size is unspecified and
# indent_style is set to "tab".
if (opts.get("indent_style") == "tab" and
not "indent_size" in opts and self.version >= (0, 10, 0)):
not "indent_size" in opts and self.version >= (0, 10, 0)):
opts["indent_size"] = "tab"

# Set tab_width to indent_size if indent_size is specified and
# tab_width is unspecified
if ("indent_size" in opts and "tab_width" not in opts and
opts["indent_size"] != "tab"):
opts["indent_size"] != "tab"):
opts["tab_width"] = opts["indent_size"]

# Set indent_size to tab_width if indent_size is "tab"
if ("indent_size" in opts and "tab_width" in opts and
opts["indent_size"] == "tab"):
opts["indent_size"] == "tab"):
opts["indent_size"] = opts["tab_width"]
4 changes: 2 additions & 2 deletions editorconfig/main.py
Expand Up @@ -25,9 +25,9 @@ def usage(command, error=False):
out = sys.stdout
out.write("%s [OPTIONS] FILENAME\n" % command)
out.write('-f '
'Specify conf filename other than ".editorconfig".\n')
'Specify conf filename other than ".editorconfig".\n')
out.write("-b "
"Specify version (used by devs to test compatibility).\n")
"Specify version (used by devs to test compatibility).\n")
out.write("-h OR --help Print this help message.\n")
out.write("-v OR --version Display version information.\n")

Expand Down

0 comments on commit 0d8ef26

Please sign in to comment.