28 print(f"Error loading EzToggle data from {file_path}: {e}")
29
30
31def check_ez_toggle_event(toggle_list, mouse_x, mouse_y): 32 # Check if mouse is hovering over any toggle
33 for toggle in toggle_list:
34 if toggle.check_hover(mouse_x, mouse_y):
4from UI.Components.EzComponent import EzComponent
5
6
7def loader(file_path): 8 # Load EzToggle data from json file
9 try:
10 with open(file_path, "r", encoding="utf-8") as f:
5from UI.Components.EzComponent import EzComponent
6
7
8def loader(file_path): 9 # Load EzTextField data from json file
10 try:
11 with open(file_path, "r", encoding="utf-8") as f:
3from UI.Components.EzComponent import EzComponent
4
5
6def loader(file_path): 7 # Load EzText data from json file
8 try:
9 with open(file_path, "r", encoding="utf-8") as f:
10from UI.Components.EzComponent import EzComponent
11
12
13def loader(file_path: str): 14 # Load EzScrollView data from json file
15 try:
16 with open(file_path, "r", encoding="utf-8") as f:
According to PEP8, if any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None
, and an explicit return statement should be present at the end of the function (if reachable).
Good:
def foo(x):
if x >= 0:
return math.sqrt(x)
else:
return None
def bar(x):
if x < 0:
return None
return math.sqrt(x)
Bad:
def foo(x):
if x >= 0:
return math.sqrt(x)
def bar(x):
if x < 0:
return
return math.sqrt(x)