refactor: fix new pylint warnings

This commit is contained in:
Umut
2021-09-29 11:43:30 +03:00
parent 36d732b0ae
commit bc80f0de10
2 changed files with 2 additions and 6 deletions

View File

@@ -123,11 +123,7 @@ def get_base_data_type_for_numpy_or_python_constant_data(constant_data: Any) ->
f"Unsupported constant data of type {type(constant_data)}",
)
if isinstance(constant_data, (numpy.ndarray, SUPPORTED_NUMPY_DTYPES_CLASS_TYPES)):
native_type = (
float
if constant_data.dtype == numpy.float32 or constant_data.dtype == numpy.float64
else int
)
native_type = float if (constant_data.dtype in (numpy.float32, numpy.float64)) else int
min_value = native_type(constant_data.min())
max_value = native_type(constant_data.max())

View File

@@ -23,7 +23,7 @@ def _is_equivalent_to_binary_commutative(lhs: IntermediateNode, rhs: object) ->
"""is_equivalent_to for a binary and commutative operation."""
return (
isinstance(rhs, lhs.__class__)
and (lhs.inputs == rhs.inputs or lhs.inputs == rhs.inputs[::-1])
and (lhs.inputs in (rhs.inputs, rhs.inputs[::-1]))
and lhs.outputs == rhs.outputs
)