Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _fill_map(self, needed):
"""Fill up mapping array to required length."""
logger.info("Filling up fixed-length mapping array")
while len(self.map) < needed:
# Generate a dummy mapping for an invalid object with zero length.
obj = objectdictionary.Variable('Dummy', 0, 0)
var = Variable(obj)
var.length = 0
self.map.append(var)
def _get_variable(self, index, subindex):
obj = self.pdo_node.node.object_dictionary[index]
if isinstance(obj, (objectdictionary.Record, objectdictionary.Array)):
obj = obj[subindex]
var = Variable(obj)
var.pdo_parent = self
return var