From d36df2545676e8076cb68a5f56b4151123fb7411 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 17 Apr 2017 03:34:11 +0300 Subject: [PATCH] flake 8 --- pysollib/util.py | 27 +++++++++++++++------------ tests/style/py-flake8.t | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/pysollib/util.py b/pysollib/util.py index 6f92a854..589c8982 100644 --- a/pysollib/util.py +++ b/pysollib/util.py @@ -46,13 +46,14 @@ __all__ = ['SUITS', ] # imports -import sys, os +import sys +import os # PySol imports -from pysollib.settings import DATA_DIRS, TOOLKIT +from pysollib.settings import DATA_DIRS from pysollib.mfxutil import Image -from pysollib.mygettext import _, n_ +from pysollib.mygettext import _ # ************************************************************************ # * constants @@ -106,7 +107,7 @@ class DataLoader: if isinstance(filenames, str): filenames = (filenames,) assert isinstance(filenames, (tuple, list)) - #$ init path + # init path path = path[:] head, tail = os.path.split(argv0) if not head: @@ -123,7 +124,8 @@ class DataLoader: # check path for valid directories self.path = [] for p in path: - if not p: continue + if not p: + continue np = os.path.abspath(p) if np and (np not in self.path) and os.path.isdir(np): self.path.append(np) @@ -140,9 +142,9 @@ class DataLoader: self.dir = p break else: - raise OSError(str(argv0)+": DataLoader could not find "+str(filenames)) - ##print path, self.path, self.dir - + raise OSError(str(argv0)+": DataLoader could not find " + + str(filenames)) + # print path, self.path, self.dir def __findFile(self, func, filename, subdirs=None, do_raise=1): if subdirs is None: @@ -155,7 +157,8 @@ class DataLoader: if func(f): return f if do_raise: - raise OSError("DataLoader could not find "+filename+" in "+self.dir+" "+str(subdirs)) + raise OSError("DataLoader could not find "+filename+" in " + + self.dir+" "+str(subdirs)) return None def findFile(self, filename, subdirs=None): @@ -166,11 +169,12 @@ class DataLoader: f = self.__findFile(os.path.isfile, filename+ext, subdirs, 0) if f: return f - raise OSError("DataLoader could not find image "+filename+" in "+self.dir+" "+str(subdirs)) + raise OSError("DataLoader could not find image "+filename + + " in "+self.dir+" "+str(subdirs)) def findIcon(self, filename=None, subdirs=None): if not filename: - ##filename = PACKAGE.lower() + # filename = PACKAGE.lower() filename = 'pysol' root, ext = os.path.splitext(filename) if not ext: @@ -182,4 +186,3 @@ class DataLoader: def findDir(self, filename, subdirs=None): return self.__findFile(os.path.isdir, filename, subdirs) - diff --git a/tests/style/py-flake8.t b/tests/style/py-flake8.t index 26213a31..4e96b3c5 100644 --- a/tests/style/py-flake8.t +++ b/tests/style/py-flake8.t @@ -10,7 +10,7 @@ use String::ShellQuote qw/ shell_quote /; # my $cmd = shell_quote( 'flake8', '.' ); my $cmd = shell_quote( 'flake8', - grep { not($_ eq './pysollib/pysoltk.py') } glob('./pysollib/[a-s]*.py') ); + grep { not($_ eq './pysollib/pysoltk.py') } glob('./pysollib/[a-u]*.py') ); # TEST eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );