Skip to content

Commit

Permalink
Rewrite for code style without multiple returns
Browse files Browse the repository at this point in the history
  • Loading branch information
bouweandela committed Sep 2, 2024
1 parent f2edc16 commit d71c008
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/iris/_concatenate.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,16 @@ def __eq__(self, other: Any) -> bool:
def shape(chunks):
return tuple(sum(c) for c in chunks)

if shape(self.chunks) != shape(other.chunks):
return False

if self.chunks != other.chunks:
raise ValueError(
"Unable to compare arrays with different chunks: "
f"{self.chunks} != {other.chunks}"
)
return self.value == other.value
if shape(self.chunks) == shape(other.chunks):
if self.chunks != other.chunks:
raise ValueError(
"Unable to compare arrays with different chunks: "
f"{self.chunks} != {other.chunks}"
)
result = self.value == other.value
else:
result = False
return result


def _array_id(
Expand Down

0 comments on commit d71c008

Please sign in to comment.