mirror of
https://gitea.tendokyu.moe/eamuse/eaapi.git
synced 2024-11-27 15:30:51 +01:00
Complex matching
This commit is contained in:
parent
0c5e00068d
commit
d2d8cd6b6f
@ -16,3 +16,7 @@ class DecodeError(CheckFailed):
|
||||
|
||||
class EncodeError(CheckFailed):
|
||||
pass
|
||||
|
||||
|
||||
class InvalidModel(EAAPIException):
|
||||
pass
|
||||
|
@ -1,7 +1,7 @@
|
||||
import inspect
|
||||
import re
|
||||
|
||||
from .exception import CheckFailed
|
||||
from .exception import CheckFailed, InvalidModel
|
||||
|
||||
|
||||
def assert_true(check, reason, exc=CheckFailed):
|
||||
@ -20,8 +20,11 @@ def py_encoding(name):
|
||||
|
||||
def parse_model(model):
|
||||
# e.g. KFC:J:A:A:2019020600
|
||||
gamecode, dest, spec, rev, version = re.match(r"([A-Z0-9]{3}):([A-Z]):([A-Z]):([A-Z])(?::(\d{8}))?", model).groups()
|
||||
return gamecode, dest, spec, rev, version
|
||||
match = re.match(r"^([A-Z0-9]{3}):([A-Z]):([A-Z]):([A-Z])(?::(\d{10}))?$", model)
|
||||
if match is None:
|
||||
raise InvalidModel
|
||||
gamecode, dest, spec, rev, datecode = match.groups()
|
||||
return gamecode, dest, spec, rev, datecode
|
||||
|
||||
|
||||
def pack(data, width):
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4b0e64341fa7c7aa2db4b57b53283308997fede7
|
||||
Subproject commit 9d190125536449fb01f963976ae6919c929e955d
|
Loading…
Reference in New Issue
Block a user