laforge has uploaded this change for review.

View Change

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
---
M pySim/utils.py
1 file changed, 14 insertions(+), 2 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/56/33656/1
diff --git a/pySim/utils.py b/pySim/utils.py
index c6362fa..b534580 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -7,7 +7,7 @@
import abc
import string
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) 2021 Harald Welte <laforge@osmocom.org>
@@ -27,7 +27,7 @@
#

# just to differentiate strings of hex nibbles from everything else
-Hexstr = str
+Hexstr = NewType('Hexstr', str)


def h2b(s: Hexstr) -> bytearray:

To view, visit change 33656. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ifb787670ed0e149ae6fcd0e6c0626ddc68880068
Gerrit-Change-Number: 33656
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-MessageType: newchange