Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ESadek-MO committed Dec 12, 2024
1 parent c6510a5 commit af7d727
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
18 changes: 15 additions & 3 deletions lib/iris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ def callback(cube, field, filename):
class Future(threading.local):
"""Run-time configuration controller."""

def __init__(self, datum_support=False, pandas_ndim=False, save_split_attrs=False, dataless_cube=False):
def __init__(
self,
datum_support=False,
pandas_ndim=False,
save_split_attrs=False,
dataless_cube=False,
):
"""Container for run-time options controls.
To adjust the values simply update the relevant attribute from
Expand Down Expand Up @@ -190,7 +196,12 @@ def __repr__(self):
# msg = ('Future(example_future_flag={})')
# return msg.format(self.example_future_flag)
msg = "Future(datum_support={}, pandas_ndim={}, save_split_attrs={}, dataless_cubes={})"
return msg.format(self.datum_support, self.pandas_ndim, self.save_split_attrs, self.dataless_cube)
return msg.format(
self.datum_support,
self.pandas_ndim,
self.save_split_attrs,
self.dataless_cube,
)

# deprecated_options = {'example_future_flag': 'warning',}
deprecated_options: dict[str, Literal["error", "warning"]] = {}
Expand Down Expand Up @@ -834,4 +845,5 @@ def use_plugin(plugin_name):
"""
importlib.import_module(f"iris.plugins.{plugin_name}")

MAINTAIN_DATA = "MAINTAINDATA"

MAINTAIN_DATA = "MAINTAINDATA"
9 changes: 4 additions & 5 deletions lib/iris/_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,11 @@ def _deepcopy(self, memo, data=None):
"""
shape = None
try:
if (iris.FUTURE.dataless_cube and data is None):
if iris.FUTURE.dataless_cube and data is None:
shape = self.shape
elif (
(iris.FUTURE.dataless_cube and data == iris.MAINTAIN_DATA)
or (data is None)
):
elif (iris.FUTURE.dataless_cube and data == iris.MAINTAIN_DATA) or (
data is None
):
# Copy the managed data.
if self.has_lazy_data():
data = copy.deepcopy(self._lazy_array, memo)
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -4084,7 +4084,7 @@ def _deepcopy(self, memo, data=None):
aux_coords_and_dims=new_aux_coords_and_dims,
cell_measures_and_dims=new_cell_measures_and_dims,
ancillary_variables_and_dims=new_ancillary_variables_and_dims,
shape=(dm.shape if dm.core_data() is None else None)
shape=(dm.shape if dm.core_data() is None else None),
)

new_cube.metadata = deepcopy(self.metadata, memo)
Expand Down

0 comments on commit af7d727

Please sign in to comment.