Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert len(closure_cells) == len(freevars), \
"Number of closure cells of a condition function ({}) == number of free vars ({})".format(
len(closure_cells), len(freevars))
for cell, freevar in zip(closure_cells, freevars):
closure_dict[freevar] = cell.cell_contents
variable_lookup.append(closure_dict)
# Add globals to the lookup
if condition.__globals__ is not None: # type: ignore
variable_lookup.append(condition.__globals__) # type: ignore
# pylint: disable=protected-access
recompute_visitor = icontract._recompute.Visitor(variable_lookup=variable_lookup)
recompute_visitor.visit(node=lambda_inspection.node.body)
recomputed_values = recompute_visitor.recomputed_values
repr_visitor = Visitor(
recomputed_values=recomputed_values, variable_lookup=variable_lookup, atok=lambda_inspection.atok)
repr_visitor.visit(node=lambda_inspection.node.body)
reprs = repr_visitor.reprs
else:
for key, val in condition_kwargs.items():
if _representable(value=val):
reprs[key] = val
parts = [] # type: List[str]
for key in sorted(reprs.keys()):