From 8d1eff7eede8476f9f2eeb105201bb2b95b10f52 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 5 Sep 2021 18:40:43 +0000 Subject: [PATCH] util.py: remove unused functions --- mmgen/exception.py | 2 -- mmgen/util.py | 23 +---------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/mmgen/exception.py b/mmgen/exception.py index 5b5f082e..3548a28d 100755 --- a/mmgen/exception.py +++ b/mmgen/exception.py @@ -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 diff --git a/mmgen/util.py b/mmgen/util.py index 052099f8..af80a3e5 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -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))