Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
Automatically trip white spaces from values of 'select' and 'ignore' …
Browse files Browse the repository at this point in the history
…options.
  • Loading branch information
wistful committed May 8, 2015
1 parent 49dc39b commit fa48be2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sublautopep8.py
Expand Up @@ -26,7 +26,7 @@ def _next(iter_obj):
return iter_obj.__next__()


def Settings(name, default):
def Settings(name, default): # flake8: noqa
"""Return value by name from user settings."""
view = sublime.active_window().active_view()
project_config = view.settings().get('sublimeautopep8', {}) if view else {}
Expand All @@ -40,7 +40,12 @@ def pep8_params():

# read settings
for opt in ("ignore", "select", "max-line-length", "indent-size"):
params.append("--{0}={1}".format(opt, Settings(opt, "")))
opt_value = Settings(opt, "")
# remove white spaces as autopep8 does not trim them
if opt in ("ignore", "select"):
opt_value = ','.join(param.strip()
for param in opt_value.split(','))
params.append("--{0}={1}".format(opt, opt_value))

if Settings("list-fixes", None):
params.append("--{0}={1}".format(opt, Settings(opt)))
Expand Down

0 comments on commit fa48be2

Please sign in to comment.