From fa48be2fd6519a68178a246f92da10e473335e4e Mon Sep 17 00:00:00 2001 From: wistful Date: Fri, 8 May 2015 00:23:28 -0700 Subject: [PATCH] Automatically trip white spaces from values of 'select' and 'ignore' options. --- sublautopep8.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sublautopep8.py b/sublautopep8.py index 19ac8ad..b3ebb91 100644 --- a/sublautopep8.py +++ b/sublautopep8.py @@ -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 {} @@ -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)))