mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-19 03:48:34 +03:00
add SAIP template handling + v3.1 definitions
This adds classes for describing profile templates as well as derived classes defining the profile templates of the "Profile Interoperability Technical Specification", specifically it's "ANNEX A (Normative): File Structure Templates Definition" We need a machine-readable definition of those templates, so we can fully interpret an unprotected profile package (UPP), as the UPP usually only contains the increment/difference to a given teplate. Change-Id: I79bc0a480450ca2de4b687ba6f11d0a4ea4f14c8
This commit is contained in:
@@ -22,6 +22,10 @@ class OID:
|
||||
def intlist_from_str(instr: str) -> List[int]:
|
||||
return [int(x) for x in instr.split('.')]
|
||||
|
||||
@staticmethod
|
||||
def str_from_intlist(intlist: List[int]) -> str:
|
||||
return '.'.join([str(x) for x in intlist])
|
||||
|
||||
def __init__(self, initializer: Union[List[int], str]):
|
||||
if type(initializer) == str:
|
||||
self.intlist = self.intlist_from_str(initializer)
|
||||
@@ -29,7 +33,7 @@ class OID:
|
||||
self.intlist = initializer
|
||||
|
||||
def __str__(self) -> str:
|
||||
return '.'.join([str(x) for x in self.intlist])
|
||||
return self.str_from_intlist(self.intlist)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return 'OID(%s)' % (str(self))
|
||||
|
||||
Reference in New Issue
Block a user