fix whitespaces according to flake8

This commit is contained in:
Semjon Kerner 2021-05-09 11:09:26 +02:00
parent 3172b30d98
commit 1c5530dca4
16 changed files with 52 additions and 54 deletions

View File

@ -43,8 +43,8 @@ def initialize(window_to_hide):
try:
if helper.upgrade_avail() and not config.get("dont_ask_update", False):
cv,hv = helper.versions()
update_now, dont_ask_update = update_dialog.start(cv,hv)
cv, hv = helper.versions()
update_now, dont_ask_update = update_dialog.start(cv, hv)
if dont_ask_update:
config.set("dont_ask_update", dont_ask_update)
else:

View File

@ -114,4 +114,3 @@ class Calibrator:
def calibrate(self):
self._walk_calibrate()
self._rotate_calibrate()

View File

@ -68,4 +68,3 @@ class Recorder:
pickle.dump(data, file)
file.close()
FullAuto.state = State.NONE

View File

@ -92,4 +92,3 @@ if __name__ == '__main__':
# noinspection PyTypeChecker
fisher = SemiFisherEngine(None)
fisher.toggle_start()

View File

@ -34,11 +34,11 @@ class FishEvent:
sound = False
def _fishing_sleep(waittime, lower_limit_ms = 16, upper_limit_ms = 2500):
def _fishing_sleep(waittime, lower_limit_ms=16, upper_limit_ms=2500):
reaction = 0.0
if FishEvent.jitter and upper_limit_ms > lower_limit_ms:
reaction = float( random.randrange(lower_limit_ms, upper_limit_ms) )/1000.0
max_wait_t = waittime+reaction if waittime+reaction <= 2.5 else 2.5
reaction = float(random.randrange(lower_limit_ms, upper_limit_ms)) / 1000.0
max_wait_t = waittime + reaction if waittime + reaction <= 2.5 else 2.5
time.sleep(max_wait_t)

View File

@ -16,6 +16,7 @@ class State(Enum):
FIGHT = 14
DEAD = 15
Colors = {
State.IDLE : [255, 255, 255],
State.LOOKAWAY : [ 76, 0, 76],

View File

@ -62,7 +62,7 @@ def start_semifisher_config(gui: 'GUI'):
gui._notify.set(1)
def del_entry_key(event):
event.widget.delete(0,"end")
event.widget.delete(0, "end")
event.widget.insert(0, str(event.char))
top = PopUp(save, gui._root, background=gui._root["background"])

View File

@ -9,7 +9,7 @@ from fishy.helper.config import config
def show(win_loc):
dim=(300,200)
dim = (300, 200)
top = tk.Tk()
top.overrideredirect(True)
@ -27,9 +27,9 @@ def show(win_loc):
# Position splash at the center of the main window
default_loc = (str(top.winfo_reqwidth())+"+"+str(top.winfo_reqheight())+"+"+"0"+"0")
default_loc = (str(top.winfo_reqwidth()) + "+" + str(top.winfo_reqheight()) + "+" + "0" + "0")
loc = (win_loc or default_loc).split("+")[1:]
top.geometry("{}x{}+{}+{}".format(dim[0], dim[1], int(loc[0])+int(dim[0]/2), int(loc[1])+int(dim[1]/2)))
top.geometry("{}x{}+{}+{}".format(dim[0], dim[1], int(loc[0]) + int(dim[0] / 2), int(loc[1]) + int(dim[1] / 2)))
top.update()
time.sleep(3)

View File

@ -9,21 +9,21 @@ def show(currentversion, newversion, returns):
top.title("A wild fishy update appeared!")
top.iconbitmap(helper.manifest_file('icon.ico'))
dialogLabel = tk.Label(top, text="There is a new fishy update available ("+currentversion+"->"+newversion+"). Do you want to update now?")
dialogLabel = tk.Label(top, text="There is a new fishy update available (" + currentversion + "->" + newversion + "). Do you want to update now?")
dialogLabel.grid(row=0, columnspan=2, padx=5, pady=5)
cbVar = tk.IntVar()
dialogCheckbutton = tk.Checkbutton(top, text="don't ask again", variable=cbVar)
dialogCheckbutton.grid(row=1, columnspan=2, padx=5, pady=0)
top.update()
buttonWidth = int(dialogLabel.winfo_width()/2)-20
buttonWidth = int(dialogLabel.winfo_width() / 2) - 20
def _clickYes():
returns[0],returns[1]=True, False
returns[0], returns[1] = True, False
top.destroy()
def _clickNo():
returns[0],returns[1]=False, bool(cbVar.get())
returns[0], returns[1] = False, bool(cbVar.get())
top.destroy()
pixelVirtual = tk.PhotoImage(width=1, height=1) # trick to use buttonWidth as pixels, not #symbols

View File

@ -76,6 +76,7 @@ def _get_current_version():
index = "https://pypi.python.org/simple"
pkg = "fishy"
def versions():
return _hr_version(_get_current_version()), _hr_version(_get_highest_version(index, pkg))

View File

@ -28,7 +28,7 @@ def playsound_multiple(path, count=2):
return
def _ps_m():
for i in range(count-1):
for i in range(count - 1):
playsound(path, True)
playsound(path, False)
@ -194,21 +194,21 @@ def install_addon(name, url, v=None):
r = requests.get(url, stream=True)
z = ZipFile(BytesIO(r.content))
z.extractall(path=get_addondir())
logging.info("Add-On "+name+" installed successfully!\nPlease make sure to enable \"Allow outdated addons\" in ESO")
logging.info("Add-On " + name + " installed successfully!\nPlease make sure to enable \"Allow outdated addons\" in ESO")
return 0
except Exception as ex:
logging.error("Could not install Add-On "+name+", try doing it manually")
logging.error("Could not install Add-On " + name + ", try doing it manually")
return 1
def remove_addon(name, url=None, v=None):
try:
shutil.rmtree(os.path.join(get_addondir(), name))
logging.info("Add-On "+name+" removed!")
logging.info("Add-On " + name + " removed!")
except FileNotFoundError:
pass
except PermissionError as ex:
logging.error("Fishy has no permission to remove "+name+" Add-On")
logging.error("Fishy has no permission to remove " + name + " Add-On")
return 1
return 0

View File

@ -18,7 +18,7 @@ def _sv_parser(path):
- remove empty expressions
EXPRESSIONS: A) List-Start "name=", B) Variable assignment "name=val", C) List End "}"
"""
for old, new in ((",","\n"), ("{","{\n"), ("}","}\n"), ("{",""), (",", ""), ("[", ""), ("]", ""), ('"', ""), (" ", "")):
for old, new in ((",", "\n"), ("{", "{\n"), ("}", "}\n"), ("{", ""), (",", ""), ("[", ""), ("]", ""), ('"', ""), (" ", "")):
lua = lua.replace(old, new)
lua = lua.lower().split("\n")
lua = [expression for expression in lua if expression]
@ -29,7 +29,7 @@ def _sv_parser(path):
the last symbol of each line decides the type of the node (branch vertex or leaf)
"""
stack = []
root = (dict(),"root")
root = (dict(), "root")
stack.append(root)
for line in lua:
if line == "":
@ -37,14 +37,14 @@ def _sv_parser(path):
if line[-1] == '=': #subtree start
t = dict()
tname = line.split("=")[0]
stack.append((t,tname))
stack.append((t, tname))
elif line[-1] == '}': #subtree end
t = stack.pop()
tp = stack.pop()
tp[0][t[1]] = t[0]
stack.append(tp)
else: #new element in tree
name,val = line.split("=")
name, val = line.split("=")
t = stack.pop()
t[0][name] = val
stack.append(t)
@ -68,13 +68,12 @@ def sv_color_extract(Colors):
ingame representation of colors range from 0 to 1 in float
these values are scaled by 255
"""
rgb=[
floor(float(root["colors"][i]["r"])*255),
floor(float(root["colors"][i]["g"])*255),
floor(float(root["colors"][i]["b"])*255)
rgb = [
floor(float(root["colors"][i]["r"]) * 255),
floor(float(root["colors"][i]["g"]) * 255),
floor(float(root["colors"][i]["b"]) * 255)
]
colors.append(rgb)
for i,c in enumerate(Colors):
for i, c in enumerate(Colors):
Colors[c] = colors[i]
return Colors

View File

@ -17,7 +17,7 @@ def is_logged_in():
if config.get("uid") is None:
return -1
body = {"uid": config.get("uid"), "apiversion":apiversion}
body = {"uid": config.get("uid"), "apiversion": apiversion}
response = requests.get(urls.discord, params=body)
logged_in = response.json()["discord_login"]
return 1 if logged_in else 0
@ -25,7 +25,7 @@ def is_logged_in():
@fallback(False)
def login(uid, login_code):
body = {"uid": uid, "login_code": login_code, "apiversion":apiversion}
body = {"uid": uid, "login_code": login_code, "apiversion": apiversion}
reponse = requests.post(urls.discord, json=body)
result = reponse.json()
@ -37,7 +37,7 @@ def login(uid, login_code):
@fallback(False)
def logout():
body = {"uid": config.get("uid"), "apiversion":apiversion}
body = {"uid": config.get("uid"), "apiversion": apiversion}
reponse = requests.delete(urls.discord, json=body)
result = reponse.json()
return result["success"]
@ -57,7 +57,7 @@ def send_notification(message):
if not is_subbed()[0]:
return False
body = {"uid": config.get("uid"), "message": message, "apiversion":apiversion}
body = {"uid": config.get("uid"), "message": message, "apiversion": apiversion}
requests.post(urls.notify, json=body)
@ -71,13 +71,13 @@ def send_fish_caught(fish_caught, hole_time, fish_times):
"session": get_session()
}
body = {"uid": config.get("uid"), "hole_data": hole_data, "apiversion":apiversion}
body = {"uid": config.get("uid"), "hole_data": hole_data, "apiversion": apiversion}
requests.post(urls.hole_depleted, json=body)
@fallback(False)
def sub():
body = {"uid": config.get("uid"), "apiversion":apiversion}
body = {"uid": config.get("uid"), "apiversion": apiversion}
response = requests.post(urls.subscription, json=body)
result = response.json()
return result["success"]
@ -94,7 +94,7 @@ def is_subbed():
if config.get("uid") is None:
return False, False
body = {"uid": config.get("uid"), "apiversion":apiversion}
body = {"uid": config.get("uid"), "apiversion": apiversion}
response = requests.get(urls.subscription, params=body)
if response.status_code != 200:
@ -106,7 +106,7 @@ def is_subbed():
@fallback(None)
def unsub():
body = {"uid": config.get("uid"), "apiversion":apiversion}
body = {"uid": config.get("uid"), "apiversion": apiversion}
response = requests.delete(urls.subscription, json=body)
result = response.json()
return result["success"]
@ -119,7 +119,7 @@ def get_session(lazy=True):
if lazy and _session_id is not None:
return _session_id
body = {"uid": config.get("uid"), "apiversion":apiversion}
body = {"uid": config.get("uid"), "apiversion": apiversion}
response = requests.post(urls.session, params=body)
if response.status_code == 405:
@ -133,7 +133,7 @@ def get_session(lazy=True):
@fallback(False)
def has_beta():
body = {"uid": config.get("uid"), "apiversion":apiversion}
body = {"uid": config.get("uid"), "apiversion": apiversion}
response = requests.get(urls.beta, params=body)
result = response.json()