From 359502b13495d04d3f237085cd6ae9d2dcca2904 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 23 Apr 2019 11:56:32 +0200 Subject: [PATCH] kete: various flake8 fixes >$ flake8 --ignore=E501,W504 tools tools/kete.py:35:1: E302 expected 2 blank lines, found 1 tools/kete.py:553:12: E713 test for membership should be 'not in' tools/kete.py:599:42: E226 missing whitespace around arithmetic operator tools/kete.py:599:61: E226 missing whitespace around arithmetic operator tools/kete.py:615:25: E226 missing whitespace around arithmetic operator tools/kete.py:615:32: E226 missing whitespace around arithmetic operator tools/kete.py:624:49: E225 missing whitespace around operator tools/kete.py:871:9: F841 local variable 'e' is assigned to but never used --- tools/kete.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/kete.py b/tools/kete.py index 5fc63b2..8410b08 100755 --- a/tools/kete.py +++ b/tools/kete.py @@ -32,6 +32,7 @@ import configparser CONFIG_PATH = os.path.join(xdg.BaseDirectory.xdg_data_home, 'tuhi-kete') + class ColorFormatter(logging.Formatter): BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, LIGHT_GRAY = range(30, 38) DARK_GRAY, LIGHT_RED, LIGHT_GREEN, LIGHT_YELLOW, LIGHT_BLUE, LIGHT_MAGENTA, LIGHT_CYAN, WHITE = range(90, 98) @@ -550,7 +551,7 @@ class Fetcher(Worker): address = args.address index = args.index - if not address in config: + if address not in config: config[address] = {} self.orientation = config[address].get('Orientation', 'Landscape') @@ -596,7 +597,7 @@ class Fetcher(Worker): else: # Original diemnsions are too big for SVG Standard # so we nomalize them - width, height = dimensions[0]/100, dimensions[1]/100 + width, height = dimensions[0] / 100, dimensions[1] / 100 if self.orientation in ['Portrait', 'Reverse-Portrait']: svg = svgwrite.Drawing(filename=filename, size=(height, width)) @@ -612,7 +613,7 @@ class Fetcher(Worker): x, y = p['position'] # Normalize coordinates too - x, y = x/100, y/100 + x, y = x / 100, y / 100 if self.orientation == 'Reverse-Portrait': x, y = y, width - x @@ -621,7 +622,7 @@ class Fetcher(Worker): elif self.orientation == 'Reverse-Landscape': x, y = width - x, height - y - delta = (p['pressure'] - 1000.0)/ 1000.0 + delta = (p['pressure'] - 1000.0) / 1000.0 stoke_width = 0.4 + 0.20 * delta points_with_sk_width.append((x, y, stoke_width)) @@ -868,7 +869,7 @@ HandlePressure = true def run(self, init=None): try: self.cmdloop(init) - except KeyboardInterrupt as e: + except KeyboardInterrupt: print('^C') self.run('')