"""
from array import array
-from codecs import getdecoder
-from codecs import getencoder
from collections import namedtuple
from collections import OrderedDict
from copy import copy
def colored(what, *args, **kwargs):
return what
-__version__ = "9.0"
+try:
+ from dateutil.tz import tzutc
+except ImportError: # pragma: no cover
+ tzutc = None
+
+
+__version__ = "9.1"
__all__ = (
"agg_octet_string",
# Basic coders
########################################################################
-_hexdecoder = getdecoder("hex")
-_hexencoder = getencoder("hex")
-
-
def hexdec(data):
"""Binary data to hexadecimal string convert
"""
- return _hexdecoder(data)[0]
+ return bytes.fromhex(data)
def hexenc(data):
"""Hexadecimal string to binary data convert
"""
- return _hexencoder(data)[0].decode("ascii")
+ return data.hex()
def int_bytes_len(num, byte_len=8):
def todatetime(self):
return self._value
+ def totzdatetime(self):
+ if tzutc is None:
+ raise NotImplementedError(
+ "Package python-dateutil is required to use this feature",
+ )
+ return self._value.replace(tzinfo=tzutc())
+
def __repr__(self):
return pp_console_row(next(self.pps()))