fix: remove the use of map in the code base

closes #90
This commit is contained in:
Benoit Chevallier-Mames
2021-08-06 15:13:45 +02:00
committed by Benoit Chevallier
parent b79fd775d0
commit ee832079ba
5 changed files with 6 additions and 6 deletions

View File

@@ -16,8 +16,8 @@ def ir_nodes_has_integer_input_and_output(node: ir.IntermediateNode) -> bool:
Returns:
bool: True if all input and output values hold Integers
"""
return all(map(lambda x: isinstance(x.data_type, Integer), node.inputs)) and all(
map(lambda x: isinstance(x.data_type, Integer), node.outputs)
return all(isinstance(x.data_type, Integer) for x in node.inputs) and all(
isinstance(x.data_type, Integer) for x in node.outputs
)

View File

@@ -94,7 +94,7 @@ def make_integer_to_hold_ints(values: Iterable[int], force_signed: bool) -> Inte
Returns:
Integer: The Integer able to hold values
"""
assert all(map(lambda x: isinstance(x, int), values))
assert all(isinstance(x, int) for x in values)
min_value = min(values)
max_value = max(values)

View File

@@ -26,7 +26,7 @@ class IntermediateNode(ABC):
op_kwargs: Optional[Dict[str, Any]] = None,
) -> None:
self.inputs = list(inputs)
assert all(map(lambda x: isinstance(x, BaseValue), self.inputs))
assert all(isinstance(x, BaseValue) for x in self.inputs)
self.op_args = op_args
self.op_kwargs = op_kwargs

View File

@@ -55,7 +55,7 @@ class BaseTracer(ABC):
sanitized_inputs = [sanitize(inp) for inp in inputs]
traced_computation = computation_to_trace(
map(lambda x: x.output, sanitized_inputs),
(x.output for x in sanitized_inputs),
op_args=op_args,
op_kwargs=op_kwargs,
)

View File

@@ -213,7 +213,7 @@ def test_eval_op_graph_bounds_on_dataset_multiple_output(
yield (x_gen, y_gen)
node_bounds = eval_op_graph_bounds_on_dataset(
op_graph, data_gen(*tuple(map(lambda x: range(x[0], x[1] + 1), input_ranges)))
op_graph, data_gen(*tuple(range(x[0], x[1] + 1) for x in input_ranges))
)
for i, output_node in op_graph.output_nodes.items():