type hint some files
This commit is contained in:
parent
0e74212c43
commit
a8a0255624
13 changed files with 643 additions and 62 deletions
|
@ -27,7 +27,7 @@ class InputValidation:
|
|||
self.rgb = self.master.register(self.check_rbg)
|
||||
self.hex = self.master.register(self.check_hex)
|
||||
|
||||
def ip_focus_out(self, event):
|
||||
def ip_focus_out(self, event: tk.Event):
|
||||
value = event.widget.get()
|
||||
try:
|
||||
IPNetwork(value)
|
||||
|
@ -35,12 +35,12 @@ class InputValidation:
|
|||
event.widget.delete(0, tk.END)
|
||||
event.widget.insert(tk.END, "invalid")
|
||||
|
||||
def focus_out(self, event, default):
|
||||
def focus_out(self, event: tk.Event, default: str):
|
||||
value = event.widget.get()
|
||||
if value == "":
|
||||
event.widget.insert(tk.END, default)
|
||||
|
||||
def check_positive_int(self, s):
|
||||
def check_positive_int(self, s: str):
|
||||
if len(s) == 0:
|
||||
return True
|
||||
try:
|
||||
|
@ -51,7 +51,7 @@ class InputValidation:
|
|||
except ValueError:
|
||||
return False
|
||||
|
||||
def check_positive_float(self, s):
|
||||
def check_positive_float(self, s: str):
|
||||
if len(s) == 0:
|
||||
return True
|
||||
try:
|
||||
|
@ -62,7 +62,7 @@ class InputValidation:
|
|||
except ValueError:
|
||||
return False
|
||||
|
||||
def check_node_name(self, s):
|
||||
def check_node_name(self, s: str):
|
||||
if len(s) < 0:
|
||||
return False
|
||||
if len(s) == 0:
|
||||
|
@ -72,7 +72,7 @@ class InputValidation:
|
|||
return False
|
||||
return True
|
||||
|
||||
def check_canvas_int(sefl, s):
|
||||
def check_canvas_int(self, s: str):
|
||||
if len(s) == 0:
|
||||
return True
|
||||
try:
|
||||
|
@ -83,7 +83,7 @@ class InputValidation:
|
|||
except ValueError:
|
||||
return False
|
||||
|
||||
def check_canvas_float(self, s):
|
||||
def check_canvas_float(self, s: str):
|
||||
if not s:
|
||||
return True
|
||||
try:
|
||||
|
@ -94,7 +94,7 @@ class InputValidation:
|
|||
except ValueError:
|
||||
return False
|
||||
|
||||
def check_ip4(self, s):
|
||||
def check_ip4(self, s: str):
|
||||
if not s:
|
||||
return True
|
||||
pat = re.compile("^([0-9]+[.])*[0-9]*$")
|
||||
|
@ -113,7 +113,7 @@ class InputValidation:
|
|||
else:
|
||||
return False
|
||||
|
||||
def check_rbg(self, s):
|
||||
def check_rbg(self, s: str):
|
||||
if not s:
|
||||
return True
|
||||
if s.startswith("0") and len(s) >= 2:
|
||||
|
@ -127,7 +127,7 @@ class InputValidation:
|
|||
except ValueError:
|
||||
return False
|
||||
|
||||
def check_hex(self, s):
|
||||
def check_hex(self, s: str):
|
||||
if not s:
|
||||
return True
|
||||
pat = re.compile("^([#]([0-9]|[a-f])+)$|^[#]$")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue