Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
break
else:
dictionary[key] = self._decode(unshared=True)
elif self._share_index is None:
# Optimization: pre-allocate structures from length. Note this
# cannot be done when sharing the structure as the resulting
# structure is not the one initially allocated
seq = [None] * length
for index in range(length):
key = self._decode(immutable=True, unshared=True)
seq[index] = (key, self._decode(unshared=True))
dictionary = dict(seq)
else:
dictionary = {}
self.set_shareable(dictionary)
for _ in range(length):
key = self._decode(immutable=True, unshared=True)
dictionary[key] = self._decode(unshared=True)
if self._object_hook:
dictionary = self._object_hook(self, dictionary)
self.set_shareable(dictionary)
elif self._immutable:
dictionary = FrozenDict(dictionary)
self.set_shareable(dictionary)
return dictionary
if length is None:
# Indefinite length
items = []
if not self._immutable:
self.set_shareable(items)
while True:
value = self._decode()
if value is break_marker:
break
else:
items.append(value)
else:
items = [None] * length
if not self._immutable:
self.set_shareable(items)
for index in range(length):
items[index] = self._decode()
if self._immutable:
items = tuple(items)
self.set_shareable(items)
return items
if length is None:
# Indefinite length
dictionary = {}
self.set_shareable(dictionary)
while True:
key = self._decode(immutable=True, unshared=True)
if key is break_marker:
break
else:
dictionary[key] = self._decode(unshared=True)
elif self._share_index is None:
# Optimization: pre-allocate structures from length. Note this
# cannot be done when sharing the structure as the resulting
# structure is not the one initially allocated
seq = [None] * length
for index in range(length):
key = self._decode(immutable=True, unshared=True)
seq[index] = (key, self._decode(unshared=True))
dictionary = dict(seq)
else:
dictionary = {}
self.set_shareable(dictionary)
for _ in range(length):
key = self._decode(immutable=True, unshared=True)
dictionary[key] = self._decode(unshared=True)
if self._object_hook:
dictionary = self._object_hook(self, dictionary)
self.set_shareable(dictionary)
elif self._immutable:
dictionary = FrozenDict(dictionary)
self.set_shareable(dictionary)