laforge submitted this change.
tlv/cosmetic: improve import of osmocom functions
We can import osmocom and then reference build/parse_construct
using osmocom.construct.build/parse_construct.
Change-Id: I6ce3cffbce9b276de7b223d88268d35cf2706d6a
---
M src/osmocom/tlv.py
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/osmocom/tlv.py b/src/osmocom/tlv.py
index d24f2aa..93e4e87 100644
--- a/src/osmocom/tlv.py
+++ b/src/osmocom/tlv.py
@@ -21,7 +21,7 @@
import re
from typing import List, Tuple, Optional
-from osmocom.construct import build_construct, parse_construct
+import osmocom
#########################################################################
# poor man's COMPREHENSION-TLV decoder.
@@ -383,9 +383,9 @@
if self.decoded is None:
do = b''
elif self._construct:
- do = build_construct(self._construct, self.decoded, context)
+ do = osmocom.construct.build_construct(self._construct, self.decoded, context)
elif self.__class__._construct:
- do = build_construct(self.__class__._construct, self.decoded, context)
+ do = osmocom.construct.build_construct(self.__class__._construct, self.decoded, context)
else:
do = self._to_bytes()
self.encoded = do
@@ -402,9 +402,9 @@
if self.encoded == b'':
self.decoded = None
elif self._construct:
- self.decoded = parse_construct(self._construct, do, context=context)
+ self.decoded = osmocom.construct.parse_construct(self._construct, do, context=context)
elif self.__class__._construct:
- self.decoded = parse_construct(self.__class__._construct, do, context=context)
+ self.decoded = osmocom.construct.parse_construct(self.__class__._construct, do, context=context)
else:
self.decoded = self._from_bytes(do)
return self.decoded
To view, visit change 38288. To unsubscribe, or for help writing mail filters, visit settings.