From 337c7af90c6cfeafd08b85456f4f4be23a73b421 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Thu, 14 Sep 2017 15:02:38 +0200 Subject: [PATCH] code cleanup after running flake8 --- arduino_timetable/gui.py | 4 ++-- arduino_timetable/timetable.py | 6 ++---- setup.py | 8 ++------ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/arduino_timetable/gui.py b/arduino_timetable/gui.py index 4cc5abf..4f5399c 100644 --- a/arduino_timetable/gui.py +++ b/arduino_timetable/gui.py @@ -159,7 +159,7 @@ class ParsedCommandsPanel(tk.Frame): # assemble all lines lines = [ template.format(delta=delta, size=max_len_limes, cmd=cmd) - for delta,cmd + for delta, cmd in zip(times, commands) ] # return the text for the command list @@ -360,7 +360,7 @@ class Application(tk.Frame): # start the subprocess for the Arduino connection self.arduino_process = Process( target=arduino_subprocess, - args = ( + args=( self.arduino_lock, com_port, self.scheduled_commands diff --git a/arduino_timetable/timetable.py b/arduino_timetable/timetable.py index 276be74..5ba7644 100644 --- a/arduino_timetable/timetable.py +++ b/arduino_timetable/timetable.py @@ -60,7 +60,7 @@ def parse_time_table(timetable, available_commands=None): # remove empty lines lines = (line for line in content_lines if line) - timed_commands =[] + timed_commands = [] for line in lines: # split the lines into time and command try: @@ -175,6 +175,7 @@ def time_as_timedelta(time_object): microseconds=time_object.microsecond ) + def parse_command(command, available_commands=None): ''' parses a string and checks if it is a valid command @@ -306,7 +307,6 @@ class TimedCommands(object): port = port or find_arduino_port() self.serial = serial.Serial(port, baudrate, **serial_kwargs) - def _ensure_command_dict(self, iterable): ''' ensures, that the available commands are a dictionary @@ -333,12 +333,10 @@ class TimedCommands(object): msg = 'available commands should be a list or dict of strings' raise TypeError(msg) - def run(self): ''' run the scheduled commands ''' run(self.commands, self.serial) - def close(self): ''' closes an open serial connection ''' self.serial.close() diff --git a/setup.py b/setup.py index db19610..3334958 100644 --- a/setup.py +++ b/setup.py @@ -6,13 +6,8 @@ derived from https://github.com/pypa/sampleproject # Always prefer setuptools over distutils from setuptools import setup, find_packages -# To use a consistent encoding -import codecs import os - -# regular expressions for version string parsing from __init___.py import re -import io # the current directory of this file @@ -25,10 +20,11 @@ RE_VERSION = r"^__version__ = ['\"]([^'\"]*)['\"]" def read(*names, **kwargs): ''' helper function to read the content of a file ''' path = os.path.join(HERE, *names) - encoding=kwargs.get('encoding', 'utf-8') + encoding = kwargs.get('encoding', 'utf-8') with open(path, 'r', encoding=encoding) as file_handle: return file_handle.read() + def find_version(*file_paths): ''' # version string parsing from __init___.py