run upgraded black
MODIFY
pangeo_forge_recipes/patterns.py
pangeo_forge_recipes/patterns.py
@@ -22,8 +22,7 @@ from typing import (
class CombineOp(Enum):
- """Used to uniquely identify different combine operations across Pangeo Forge Recipes.
- """
+ """Used to uniquely identify different combine operations across Pangeo Forge Recipes."""
MERGE = 1
CONCAT = 2

MODIFY
pangeo_forge_recipes/recipes/xarray_zarr.py
pangeo_forge_recipes/recipes/xarray_zarr.py
@@ -430,7 +430,10 @@ def open_chunk(chunk_key: ChunkKey, *, config: XarrayZarrRecipe) -> xr.Dataset:
yield ds
-def get_input_meta(metadata_cache: Optional[MetadataTarget], file_pattern: FilePattern,) -> Dict:
+def get_input_meta(
+ metadata_cache: Optional[MetadataTarget],
+ file_pattern: FilePattern,
+) -> Dict:
# getitems should be async; much faster than serial calls
if metadata_cache is None:
raise ValueError("metadata_cache is not set.")
@@ -558,7 +561,9 @@ def prepare_target(*, config: XarrayZarrRecipe) -> None:
# Regardless of whether there is an existing dataset or we are creating a new one,
# we need to expand the concat_dim to hold the entire expected size of the data
input_sequence_lens = calculate_sequence_lens(
- config.nitems_per_input, config.file_pattern, config.storage_config.metadata,
+ config.nitems_per_input,
+ config.file_pattern,
+ config.storage_config.metadata,
)
n_sequence = sum(input_sequence_lens)
logger.info(f"Expanding target concat dim '{config.concat_dim}' to size {n_sequence}")

MODIFY
tests/conftest.py
tests/conftest.py
@@ -46,7 +46,9 @@ from pangeo_forge_recipes.storage import CacheFSSpecTarget, FSSpecTarget, Metada
# $ pytest --redirect-dask-worker-logs-to-stdout=DEBUG
def pytest_addoption(parser):
parser.addoption(
- "--redirect-dask-worker-logs-to-stdout", action="store", default="NOTSET",
+ "--redirect-dask-worker-logs-to-stdout",
+ action="store",
+ default="NOTSET",
)
@@ -226,7 +228,10 @@ def netcdf_local_paths_sequential_1d(daily_xarray_dataset, tmpdir_factory):
@pytest.fixture(scope="session")
def netcdf_local_paths_sequential_2d(daily_xarray_dataset, tmpdir_factory):
return make_netcdf_local_paths(
- daily_xarray_dataset, tmpdir_factory, "2D", split_up_files_by_day,
+ daily_xarray_dataset,
+ tmpdir_factory,
+ "2D",
+ split_up_files_by_day,
)
@@ -244,14 +249,20 @@ def netcdf_local_paths_sequential(request):
@pytest.fixture(scope="session")
def netcdf_local_paths_sequential_multivariable_1d(daily_xarray_dataset, tmpdir_factory):
return make_netcdf_local_paths(
- daily_xarray_dataset, tmpdir_factory, "D", split_up_files_by_variable_and_day,
+ daily_xarray_dataset,
+ tmpdir_factory,
+ "D",
+ split_up_files_by_variable_and_day,
)
@pytest.fixture(scope="session")
def netcdf_local_paths_sequential_multivariable_2d(daily_xarray_dataset, tmpdir_factory):
return make_netcdf_local_paths(
- daily_xarray_dataset, tmpdir_factory, "2D", split_up_files_by_variable_and_day,
+ daily_xarray_dataset,
+ tmpdir_factory,
+ "2D",
+ split_up_files_by_variable_and_day,
)
@@ -266,7 +277,9 @@ def netcdf_local_paths_sequential_multivariable(request):
return request.param
-@pytest.fixture(scope="session",)
+@pytest.fixture(
+ scope="session",
+)
def netcdf_local_paths_sequential_multivariable_with_coordinateless_dimension(
daily_xarray_dataset_with_coordinateless_dimension, tmpdir_factory
):

MODIFY
tests/recipe_tests/test_HDFReferenceRecipe.py
tests/recipe_tests/test_HDFReferenceRecipe.py
@@ -15,7 +15,11 @@ HDFReferenceRecipe = reference_hdf_zarr.HDFReferenceRecipe
@pytest.mark.parametrize("default_storage", [True, False])
@pytest.mark.parametrize("with_intake", [False, True])
def test_single(
- netcdf_local_file_pattern_sequential, tmpdir, with_intake, default_storage, execute_recipe,
+ netcdf_local_file_pattern_sequential,
+ tmpdir,
+ with_intake,
+ default_storage,
+ execute_recipe,
):
file_pattern = netcdf_local_file_pattern_sequential
path = list(file_pattern.items())[0][1]

MODIFY
tests/recipe_tests/test_XarrayZarrRecipe.py
tests/recipe_tests/test_XarrayZarrRecipe.py
@@ -467,7 +467,11 @@ def test_calculate_sequence_length(calc_sequence_length_fixture):
# Cache metadata, if necessary.
if not nitems_per_input:
- recipe = XarrayZarrRecipe(file_pattern, target_chunks={"time": 1}, cache_inputs=False,)
+ recipe = XarrayZarrRecipe(
+ file_pattern,
+ target_chunks={"time": 1},
+ cache_inputs=False,
+ )
recipe.storage_config.metadata = metadata_cache
for input_key in recipe.iter_inputs():
recipe.cache_input(input_key)

MODIFY
tests/recipe_tests/test_graph_memory.py
tests/recipe_tests/test_graph_memory.py
@@ -40,10 +40,15 @@ def test_memory_usage():
dates = pd.date_range("2020-05-31T00:00:00", "2021-05-31T23:59:59", freq="30min")
time_concat_dim = ConcatDim("time", dates, nitems_per_file=1)
- pattern = FilePattern(_make_filename_for_memory_usage_test, time_concat_dim,)
+ pattern = FilePattern(
+ _make_filename_for_memory_usage_test,
+ time_concat_dim,
+ )
recipe = XarrayZarrRecipe(
- pattern, xarray_open_kwargs={"group": "Grid", "decode_coords": "all"}, inputs_per_chunk=1,
+ pattern,
+ xarray_open_kwargs={"group": "Grid", "decode_coords": "all"},
+ inputs_per_chunk=1,
)
delayed = recipe.to_dask()

MODIFY
tests/test_patterns.py
tests/test_patterns.py
@@ -109,7 +109,10 @@ def test_file_pattern_concat_merge(runtime_secrets, pickle, concat_merge_pattern
fp = loads(dumps(fp))
assert fp.dims == {"variable": 2, "time": 3}
- assert fp.shape == (2, 3,)
+ assert fp.shape == (
+ 2,
+ 3,
+ )
assert fp.merge_dims == ["variable"]
assert fp.concat_dims == ["time"]
assert fp.nitems_per_input == {"time": None}
@@ -191,5 +194,5 @@ def test_setting_file_types(file_type_value):
fp = make_concat_merge_pattern(**file_type_kwargs)[0]
assert fp.file_type == FileType(file_type_value)
else:
- with pytest.raises(ValueError, match=fr"'{file_type_value}' is not a valid FileType"):
+ with pytest.raises(ValueError, match=rf"'{file_type_value}' is not a valid FileType"):
fp = make_concat_merge_pattern(**file_type_kwargs)[0]

run upgraded black