util.py: remove unused functions
This commit is contained in:
parent
af710a9c82
commit
8d1eff7eed
2 changed files with 1 additions and 24 deletions
|
|
@ -34,8 +34,6 @@ class InvalidPasswdFormat(Exception): mmcode = 1
|
|||
class CfgFileParseError(Exception): mmcode = 1
|
||||
class UserOptError(Exception): mmcode = 1
|
||||
class NoLEDSupport(Exception): mmcode = 1
|
||||
class NotAnInteger(Exception): mmcode = 1
|
||||
class IntegerOutOfRange(Exception): mmcode = 1
|
||||
|
||||
# 2: yellow hl, message only
|
||||
class InvalidTokenAddress(Exception): mmcode = 2
|
||||
|
|
|
|||
|
|
@ -362,7 +362,6 @@ def secs_to_hms(secs):
|
|||
def secs_to_ms(secs):
|
||||
return '{:02d}:{:02d}'.format(secs//60, secs % 60)
|
||||
|
||||
def is_digits(s): return set(list(s)) <= set(list(digits))
|
||||
def is_int(s):
|
||||
try:
|
||||
int(str(s))
|
||||
|
|
@ -372,32 +371,12 @@ def is_int(s):
|
|||
|
||||
def is_hex_str(s): return set(list(s.lower())) <= set(list(hexdigits.lower()))
|
||||
def is_hex_str_lc(s): return set(list(s)) <= set(list(hexdigits.lower()))
|
||||
def is_hex_str_uc(s): return set(list(s)) <= set(list(hexdigits.upper()))
|
||||
|
||||
def is_utf8(s):
|
||||
return is_ascii(s,enc='utf8')
|
||||
def is_ascii(s,enc='ascii'):
|
||||
try: s.decode(enc)
|
||||
try: s.decode('utf8')
|
||||
except: return False
|
||||
else: return True
|
||||
|
||||
def check_int_between(n,lo,hi,desc='value'):
|
||||
import re
|
||||
m = re.match(r'-{0,1}[0-9]+',str(n))
|
||||
if m == None:
|
||||
raise NotAnInteger(f'{n}: {desc} must be an integer')
|
||||
n = int(n)
|
||||
if n < lo or n > hi:
|
||||
raise IntegerOutOfRange(f'{n}: {desc} must be between {lo} and {hi}')
|
||||
return n
|
||||
|
||||
def match_ext(addr,ext):
|
||||
return addr.split('.')[-1] == ext
|
||||
|
||||
def get_from_brain_opt_params():
|
||||
l,p = opt.from_brain.split(',')
|
||||
return(int(l),p)
|
||||
|
||||
def remove_whitespace(s,ws='\t\r\n '):
|
||||
return s.translate(dict((ord(e),None) for e in ws))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue