remove crappy non-ascii (hidden) characters

This commit is contained in:
mich 2020-06-16 16:59:50 +02:00
parent 2d61be3350
commit decc023abd
6 changed files with 29 additions and 20 deletions

View File

@ -932,7 +932,7 @@ Specific attribute:
else:
return {'base10Value': '%s' % (self._val[0]*(2**self._val[2]))}
else:
#self._val[1] == 10
#self._val[1] == 10
# TODO: some constraints on the mantissa / base / exponent should
# lead to an integer encoding instead of this scientific notation
return {'base10Value': '%ie%i' % (self._val[0], self._val[2])}

View File

@ -215,7 +215,7 @@ class Buf(Atom):
# BufAuto is used when a Buf requires to have its length automatically computed
# (i.e. in get_bl()) also when building the value (i.e. calling get_val())
# (i.e. in get_bl()) also when building the value (i.e. calling get_val())
# and not only at parsing (i.e. in _from_char())
class BufAuto(Buf):
@ -355,10 +355,10 @@ class String(Atom):
# format routines
#--------------------------------------------------------------------------#
# Warning: there is no specific processing against fixed bit / byte length
# because it is highly improbable to have such encoded string with fixed
# length.
# However, in case some fixed length is applied to such type, things could
# fail silently...
# because it is highly improbable to have such encoded string with fixed
# length.
# however, in case some fixed length is applied to such type, things could
# fail silently...
def _get_bl_from_val(self):
return 8 * len(self.get_val().encode(self.CODEC))

View File

@ -738,7 +738,7 @@ class Element(object):
try:
val = val[self._name]
except Exception:
raise(EltErr('{0} [_from_jval]: invalid value, {1!r}'.format(self._name, val)))
raise(EltErr('{0} [_from_jval]: invalid value, {1!r}'.format(self._name, val)))
else:
self._from_jval(val)
@ -4120,9 +4120,9 @@ class Alt(Element):
# Warning:
# When setting the selection callback as class attribute _sel, prototype is
# lambda a, b: ... both a & b being self when instantiated
# lambda a, b: ..., both a & b being self, when instantiated
# When setting the selection callback during / after initialization, prototype is
# lambda a: ... a being self
# lambda a: ..., a being self
__attrs__ = ('_env',
'_name',

View File

@ -3,7 +3,7 @@
# * Software Name : pycrate
# * Version : 0.4
# *
# * Copyright © 2013. Benoit Michau. ANSSI.
# * Copyright 2013. Benoit Michau. ANSSI.
# *
# * This library is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public

View File

@ -3,7 +3,7 @@
# * Software Name : pycrate
# * Version : 0.4
# *
# * Copyright © 2013. Benoit Michau. ANSSI.
# * Copyright 2013. Benoit Michau. ANSSI.
# *
# * This library is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public

View File

@ -325,14 +325,12 @@ class FGSIDType(Envelope):
# TS 24.501, 9.11.3.4
#------------------------------------------------------------------------------#
FGSIDType_dict = {
0 : 'No identity',
1 : 'SUCI',
2 : '5G-GUTI',
3 : 'IMEI',
4 : '5G-S-TMSI',
5 : 'IMEISV',
6 : 'MAC address'
FGSIDFMT_IMSI = 0
FGSIDFMT_NAI = 1
FGSIDFmt_dict = {
0 : 'IMSI',
1 : 'NAI'
}
FGSIDTYPE_NO = 0
@ -343,6 +341,15 @@ FGSIDTYPE_TMSI = 4
FGSIDTYPE_IMEISV = 5
FGSIDTYPE_MAC = 6
FGSIDType_dict = {
0 : 'No identity',
1 : 'SUCI',
2 : '5G-GUTI',
3 : 'IMEI',
4 : '5G-S-TMSI',
5 : 'IMEISV',
6 : 'MAC address'
}
_ProtSchemeID_dict = {
0 : 'Null scheme',
@ -424,12 +431,14 @@ class SUPI_IMSI(Envelope):
class SUPI_NAI(UTF8String):
pass
FGSIDFMT_IMSI = 0
FGSIDFMT_NAI = 1
class FGSIDSUPI(Envelope):
_name = '5GSIDSUPI'
_GEN = (
Uint('spare', bl=1),
Uint('Fmt', bl=3, dic={0:'IMSI', 1:'NAI'}),
Uint('Fmt', val=FGSIDFMT_IMSI, bl=3, dic=FGSIDFmt_dict),
Uint('spare', bl=1),
Uint('Type', val=FGSIDTYPE_SUPI, bl=3, dic=FGSIDType_dict),
Alt('Value', GEN={