Be more conservative in our imports

Try to avoid '*' from anything into various modules, polluting the
namespace.

Change-Id: Iba749d18e1863ded88ba2d2183e2e8d718b2d612
This commit is contained in:
Harald Welte
2024-02-04 16:56:46 +01:00
parent bc8e2e1664
commit e55fcf66bf
5 changed files with 8 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import logging import logging
from construct import GreedyRange, Struct
from pySim.construct import * from pySim.construct import *
from pySim.filesystem import * from pySim.filesystem import *
from pySim.runtime import RuntimeLchan from pySim.runtime import RuntimeLchan

View File

@@ -1,7 +1,9 @@
from construct.lib.containers import Container, ListContainer from construct.lib.containers import Container, ListContainer
from construct.core import EnumIntegerString from construct.core import EnumIntegerString
import typing 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, stream_write
from construct import SizeofError, IntegerError, swapbytes
from construct.core import evaluate, BitwisableString from construct.core import evaluate, BitwisableString
from construct.lib import integertypes from construct.lib import integertypes
from pySim.utils import b2h, h2b, swap_nibbles from pySim.utils import b2h, h2b, swap_nibbles

View File

@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. 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 Optional as COptional
from construct import * from construct import Struct, GreedyRange, FlagsEnum, Int16ub, Padding, Bit, Const
from typing import Optional, List, Dict, Tuple
from copy import deepcopy from copy import deepcopy
from bidict import bidict from bidict import bidict
from Cryptodome.Random import get_random_bytes from Cryptodome.Random import get_random_bytes
@@ -612,7 +612,7 @@ class ADF_SD(CardADF):
def set_status(self, scope:str, status:str, aid:Hexstr = ''): def set_status(self, scope:str, status:str, aid:Hexstr = ''):
SetStatus = Struct(Const(0x80, Byte), Const(0xF0, Byte), SetStatus = Struct(Const(0x80, Byte), Const(0xF0, Byte),
'scope'/SetStatusScope, 'status'/CLifeCycleState, '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}) apdu = build_construct(SetStatus, {'scope':scope, 'status':status, 'aid':aid})
data, sw = self._cmd.lchan.scc.send_apdu_checksw(b2h(apdu)) data, sw = self._cmd.lchan.scc.send_apdu_checksw(b2h(apdu))

View File

@@ -19,7 +19,6 @@
from typing import Optional, List, Dict, Any, Tuple from typing import Optional, List, Dict, Any, Tuple
from bidict import bidict 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 bertlv_encode_len, bertlv_parse_len, bertlv_encode_tag, bertlv_parse_tag
from pySim.utils import comprehensiontlv_encode_tag, comprehensiontlv_parse_tag from pySim.utils import comprehensiontlv_encode_tag, comprehensiontlv_parse_tag

View File

@@ -22,6 +22,7 @@ Various constants from 3GPP TS 31.103 V16.1.0
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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.filesystem import *
from pySim.utils import * from pySim.utils import *
from pySim.tlv import * from pySim.tlv import *