commit for publication
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
|
||||
def mac_addr(addr):
|
||||
WHITELIST_CHARS = ":0123456789ABCDEF"
|
||||
addr = addr.upper().strip()
|
||||
addr = "".join(char for char in addr if char in WHITELIST_CHARS)
|
||||
return addr
|
||||
|
||||
|
||||
def text_input(text, OVERWRITE_WHITELIST_CHARS=""):
|
||||
WHITELIST_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 _.-"
|
||||
|
||||
if OVERWRITE_WHITELIST_CHARS:
|
||||
WHITELIST_CHARS = OVERWRITE_WHITELIST_CHARS
|
||||
|
||||
if not isinstance(text, str):
|
||||
return ""
|
||||
|
||||
return "".join([char for char in text if char in WHITELIST_CHARS])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user