From 43c763692018b565ef43268914c34f7932b30d50 Mon Sep 17 00:00:00 2001 From: Darksider3 Date: Sun, 13 Oct 2019 21:12:17 +0200 Subject: [PATCH] Make PEP8 finally happy --- private/Backup.py | 2 +- private/lib/CFG.py | 2 +- private/lib/System.py | 5 +++-- private/lib/sqlitedb.py | 14 +++++++------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/private/Backup.py b/private/Backup.py index 2333c70..9a33128 100644 --- a/private/Backup.py +++ b/private/Backup.py @@ -23,4 +23,4 @@ if __name__ == "__main__": print(ret.getvalue(), file=f) exit(0) except KeyboardInterrupt as e: - pass \ No newline at end of file + pass diff --git a/private/lib/CFG.py b/private/lib/CFG.py index 270e0c5..13e2ec5 100644 --- a/private/lib/CFG.py +++ b/private/lib/CFG.py @@ -29,4 +29,4 @@ logging.basicConfig(format="%(asctime)s: %(message)s", level=int(config['LOG_LEVEL']['log_level']) ) del cwd -REG_FILE = config['DEFAULT']['applications_db'] \ No newline at end of file +REG_FILE = config['DEFAULT']['applications_db'] diff --git a/private/lib/System.py b/private/lib/System.py index a32f281..6e915de 100644 --- a/private/lib/System.py +++ b/private/lib/System.py @@ -146,7 +146,8 @@ class System: return False return True - def printTuple(self, tup: tuple) -> None: + @staticmethod + def printTuple(tup: tuple) -> None: """Prints a tuple with spaces as separators :param tup: Tuple you want to print @@ -190,7 +191,7 @@ if __name__ == "__main__": S.register("dar") S.lock_user_pw("dar") S.add_to_usergroup("dar") - #if not S.make_ssh_usable("dar", "SSHpub"): + # if not S.make_ssh_usable("dar", "SSHpub"): # print("Huh, error :shrug:") exit(0) except KeyboardInterrupt: diff --git a/private/lib/sqlitedb.py b/private/lib/sqlitedb.py index d457cf9..66bb9f9 100644 --- a/private/lib/sqlitedb.py +++ b/private/lib/sqlitedb.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import sqlite3 -from sys import stderr as STDERR +from sys import stderr as stderr # create dictionary out of sqlite results @@ -32,16 +32,16 @@ class SQLitedb: self.connection = sqlite3.connect(db) self.cursor = self.connection.cursor() except sqlite3.Error as e: - print("Connection error: %s" % e, file=STDERR) + print("Connection error: %s" % e, file=stderr) - self.cursor.row_factory = dict_factory # every result will be a dict now + self.cursor.row_factory = dict_factory # every result will be a dict now def __del__(self): try: self.connection.commit() self.connection.close() except sqlite3.Error as e: - print("Couldn't gracefully close db: %s" % e, file=STDERR) + print("Couldn't gracefully close db: %s" % e, file=stderr) def query(self, qq: str) -> list: """Do a query and automagically get the fetched results in a list @@ -55,7 +55,7 @@ class SQLitedb: self.cursor.execute(qq) self.last_result = self.cursor.fetchall() except sqlite3.Error as e: - print("Couldn't execute query %s, exception: %s" % (qq, e), file=STDERR) + print("Couldn't execute query %s, exception: %s" % (qq, e), file=stderr) self.last_result = [] return self.last_result @@ -81,10 +81,10 @@ class SQLitedb: self.cursor.execute(qq, deliver) self.last_result = self.cursor.fetchall() except sqlite3.Error as e: - print("Couldn't execute query %s, exception: %s" % (qq, e), file=STDERR) + print("Couldn't execute query %s, exception: %s" % (qq, e), file=stderr) self.last_result = [] except TypeError as e: - print("Types in given tuple doesnt match to execute query \"%s\": %s" % (qq, e), file=STDERR) + print("Types in given tuple doesnt match to execute query \"%s\": %s" % (qq, e), file=stderr) self.last_result = [] return self.last_result