diff options
author | Santo Cariotti <sancn@live.com> | 2017-09-04 11:24:56 +0200 |
---|---|---|
committer | Santo Cariotti <sancn@live.com> | 2017-09-04 11:24:56 +0200 |
commit | 0825f0e49be9c652ad6b8733271cab6ba975b848 (patch) | |
tree | 05bdb5be53e6c50d9e18c3a641427dd99575e08a /lib | |
parent | 03a094d09269abf16612ddfb498f600ee2a3dd25 (diff) |
fixed Codacy's stuff
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.py | 3 | ||||
-rw-r--r-- | lib/classes.py | 11 | ||||
-rw-r--r-- | lib/commands.py | 9 | ||||
-rw-r--r-- | lib/web.py | 2 |
4 files changed, 6 insertions, 19 deletions
@@ -1,4 +1,4 @@ -from classes import clear, YELLOW, BLACK, GREY +from classes import YELLOW, BLACK, GREY from commands import Commands from listcommands import ListCommands import os.path @@ -25,7 +25,6 @@ class Stout(Commands): try: with open(config['path'], 'rb') as fin: user = fin.readline().split() - if user[0] == '': return '' else: diff --git a/lib/classes.py b/lib/classes.py index 56a59d3..33cc0ea 100644 --- a/lib/classes.py +++ b/lib/classes.py @@ -1,20 +1,9 @@ -try: - from .config import config as co -except SystemError: - from config import config as co - RED = '\033[91m' YELLOW = '\033[93m' GREY = '\033[90m' BLACK = '\033[0m' BOLD = '\033[1m' -def clear(): - """ - clear the window - """ - print('\n' * 100) - class PersonalError(Exception): def __init__(self, value): diff --git a/lib/commands.py b/lib/commands.py index defdef6..663f231 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -1,4 +1,4 @@ -from classes import PersonalError, clear, RED, GREY +from classes import PersonalError, RED, GREY from listcommands import ListCommands from config import config as co @@ -42,7 +42,7 @@ class Commands(object): print(fin.readline().decode('utf-8')) else: print('nil') - elif cmd[2] not in ListCommands.commands['get'][1]: #check if the word after 'i' exists + elif cmd[2] not in ListCommands.commands['get'][1]: raise KeyError else: print(co[cmd[2]]) @@ -50,7 +50,7 @@ class Commands(object): with open(co['path'], 'rb') as fout: try: lines = fout.readlines() - except: + except Exception as e: lines = '' if lines is not None: @@ -93,7 +93,6 @@ class Commands(object): try: if len(cmd) > ListCommands.info['del'][1]: raise PersonalError(GREY + 'del ' + RED + 'accetta 1 parametro') - count = countID() if count == 0: #todo list is empty @@ -120,7 +119,7 @@ class Commands(object): def countID(): with open(co['path'], 'rb') as fout: - for i, val in enumerate(fout.readlines()): + for i, _ in enumerate(fout.readlines()): count = i return count @@ -8,7 +8,7 @@ def hello(): with open(config['path'], 'rb') as fout: try: lines = fout.readlines() - except: + except Exception as e: lines = '' if lines is not None: |