Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _buildopcodes():
l = []
later_added = {"COMPLEX": 1}
for name, func in Unserializer.__dict__.items():
if name.startswith("load_"):
opname = name[5:].upper()
l.append((opname, func))
l.sort(key=lambda x: (later_added.get(x[0], 0), x[0]))
for i, (opname, func) in enumerate(l):
assert i < 26, "xxx"
i = bchr(64 + i)
Unserializer.num2func[i] = func
setattr(opcode, opname, i)
def __init__(self, io, id, _startcount=2):
self.execmodel = io.execmodel
self._io = io
self.id = id
self._strconfig = (Unserializer.py2str_as_py3str, Unserializer.py3str_as_py2str)
self._channelfactory = ChannelFactory(self, _startcount)
self._receivelock = self.execmodel.RLock()
# globals may be NONE at process-termination
self.__trace = trace
self._geterrortext = geterrortext
self._receivepool = self.execmodel.WorkerPool()
def loads(data):
return Unserializer(
BytesIO(data),
strconfig=(False, False)).load(versioned=False)