Skip to content

Commit f62dfe5

Browse files
authored
[CLN] Refactor grid selection logic by using active state checks (#1062)
# Description Refactored the `regular_grid` method to use the previously defined boolean variables `dense_grid_exists_and_active` and `octree_grid_exists_and_active` for consistency and improved readability, instead of directly checking if the grid objects are not None. Relates to #grid-refactoring # Checklist - [ ] My code uses type hinting for function and method arguments and return values. - [ ] I have created tests which cover my code. - [ ] The test code either 1. demonstrates at least one valuable use case (e.g. integration tests) or 2. verifies that outputs are as expected for given inputs (e.g. unit tests). - [ ] New tests pass locally with my changes.
2 parents 4a76201 + ed18b1f commit f62dfe5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gempy/core/data/grid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ def regular_grid(self):
275275

276276
if dense_grid_exists_and_active and octree_grid_exists_and_active:
277277
raise AttributeError('Both dense_grid and octree_grid are active. This is not possible.')
278-
elif self.dense_grid is not None:
278+
elif dense_grid_exists_and_active:
279279
return self.dense_grid
280-
elif self.octree_grid is not None:
280+
elif octree_grid_exists_and_active:
281281
return self.octree_grid
282282
else:
283283
return None

0 commit comments

Comments
 (0)