From f5e26ae95430a04db4749b6b2fb63d8e555aa6ba Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 9 Jul 2023 16:11:46 +0200 Subject: [PATCH] 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 --- pySim/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pySim/utils.py b/pySim/utils.py index c6362fab..b5345802 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -7,7 +7,7 @@ import json 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 # Copyright (C) 2021 Harald Welte @@ -27,7 +27,7 @@ from typing import Optional, List, Dict, Any, Tuple # # just to differentiate strings of hex nibbles from everything else -Hexstr = str +Hexstr = NewType('Hexstr', str) def h2b(s: Hexstr) -> bytearray: