laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/35802?usp=email )
Change subject: Be more conservative in our imports ......................................................................
Be more conservative in our imports
Try to avoid '*' from anything into various modules, polluting the namespace.
Change-Id: Iba749d18e1863ded88ba2d2183e2e8d718b2d612 --- M pySim/construct.py M pySim/global_platform/__init__.py M pySim/tlv.py M pySim/ts_31_103.py 4 files changed, 18 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/02/35802/1
diff --git a/pySim/construct.py b/pySim/construct.py index 0c82c41..f82fb5e 100644 --- a/pySim/construct.py +++ b/pySim/construct.py @@ -1,7 +1,8 @@ from construct.lib.containers import Container, ListContainer from construct.core import EnumIntegerString import typing -from construct import * +from construct import Adapter, Prefixed, Int8ub, GreedyBytes, Default, Flag, Byte, Construct, Enum +from construct import BitsInteger, BitStruct, Bytes, StreamError, stream_read_entire from construct.core import evaluate, BitwisableString from construct.lib import integertypes from pySim.utils import b2h, h2b, swap_nibbles diff --git a/pySim/global_platform/__init__.py b/pySim/global_platform/__init__.py index ba34db8..5ff9ad8 100644 --- a/pySim/global_platform/__init__.py +++ b/pySim/global_platform/__init__.py @@ -17,9 +17,9 @@ along with this program. If not, see http://www.gnu.org/licenses/. """
-from typing import Optional, List, Dict, Tuple from construct import Optional as COptional -from construct import * +from construct import Struct, GreedyRange, FlagsEnum, Int16ub, Padding, Bit +from typing import Optional, List, Dict, Tuple from copy import deepcopy from bidict import bidict from Cryptodome.Random import get_random_bytes @@ -612,7 +612,7 @@ def set_status(self, scope:str, status:str, aid:Hexstr = ''): SetStatus = Struct(Const(0x80, Byte), Const(0xF0, Byte), 'scope'/SetStatusScope, 'status'/CLifeCycleState, - 'aid'/HexAdapter(Prefixed(Int8ub, Optional(GreedyBytes)))) + 'aid'/HexAdapter(Prefixed(Int8ub, COptional(GreedyBytes)))) apdu = build_construct(SetStatus, {'scope':scope, 'status':status, 'aid':aid}) data, sw = self._cmd.lchan.scc.send_apdu_checksw(b2h(apdu))
diff --git a/pySim/tlv.py b/pySim/tlv.py index 31051aa..0dfb858 100644 --- a/pySim/tlv.py +++ b/pySim/tlv.py @@ -19,7 +19,6 @@
from typing import Optional, List, Dict, Any, Tuple from bidict import bidict -from construct import *
from pySim.utils import bertlv_encode_len, bertlv_parse_len, bertlv_encode_tag, bertlv_parse_tag from pySim.utils import comprehensiontlv_encode_tag, comprehensiontlv_parse_tag diff --git a/pySim/ts_31_103.py b/pySim/ts_31_103.py index a85e0ad..81de13c 100644 --- a/pySim/ts_31_103.py +++ b/pySim/ts_31_103.py @@ -22,6 +22,7 @@ # along with this program. If not, see http://www.gnu.org/licenses/. #
+from construct import Struct, Switch, this, Bytes, GreedyString from pySim.filesystem import * from pySim.utils import * from pySim.tlv import *