mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-26 23:38:32 +03:00
pySim/utils: define 'Hexstr' using NewType
This means Hexstr is no longer an alias for 'str', but a distinct new type, a sub-class of 'str'. Change-Id: Ifb787670ed0e149ae6fcd0e6c0626ddc68880068
This commit is contained in:
@@ -7,7 +7,7 @@ import json
|
|||||||
import abc
|
import abc
|
||||||
import string
|
import string
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Optional, List, Dict, Any, Tuple
|
from typing import Optional, List, Dict, Any, Tuple, NewType
|
||||||
|
|
||||||
# Copyright (C) 2009-2010 Sylvain Munaut <tnt@246tNt.com>
|
# Copyright (C) 2009-2010 Sylvain Munaut <tnt@246tNt.com>
|
||||||
# Copyright (C) 2021 Harald Welte <laforge@osmocom.org>
|
# Copyright (C) 2021 Harald Welte <laforge@osmocom.org>
|
||||||
@@ -27,7 +27,7 @@ from typing import Optional, List, Dict, Any, Tuple
|
|||||||
#
|
#
|
||||||
|
|
||||||
# just to differentiate strings of hex nibbles from everything else
|
# just to differentiate strings of hex nibbles from everything else
|
||||||
Hexstr = str
|
Hexstr = NewType('Hexstr', str)
|
||||||
|
|
||||||
|
|
||||||
def h2b(s: Hexstr) -> bytearray:
|
def h2b(s: Hexstr) -> bytearray:
|
||||||
|
|||||||
Reference in New Issue
Block a user