Simplify blob design
This commit is contained in:
parent
844c5100ef
commit
9f116547d0
1 changed files with 5 additions and 14 deletions
|
|
@ -1,14 +1,4 @@
|
|||
from enum import Enum, auto
|
||||
|
||||
|
||||
class Blobs(Enum):
|
||||
init_hardcoded = auto()
|
||||
init_hardcoded_clean_slate = auto()
|
||||
reset_blob = auto()
|
||||
db_write_enable = auto()
|
||||
|
||||
|
||||
def __load_blob(blob):
|
||||
def __load_blob(blob: str) -> bytes:
|
||||
from .usb import usb
|
||||
|
||||
if usb.usb_dev().idVendor == 0x138a:
|
||||
|
|
@ -24,6 +14,7 @@ def __load_blob(blob):
|
|||
return globals()[blob]
|
||||
|
||||
|
||||
for p in dir(Blobs):
|
||||
if isinstance(getattr(Blobs, p), Blobs):
|
||||
globals()[p] = lambda bname=p: __load_blob(bname)
|
||||
init_hardcoded = lambda: __load_blob('init_hardcoded')
|
||||
init_hardcoded_clean_slate = lambda: __load_blob('init_hardcoded_clean_slate')
|
||||
reset_blob = lambda: __load_blob('reset_blob')
|
||||
db_write_enable = lambda: __load_blob('db_write_enable')
|
||||
|
|
|
|||
Loading…
Reference in a new issue