switch Index to be a frozenset
MODIFY
.pre-commit-config.yaml
.pre-commit-config.yaml
@@ -28,7 +28,7 @@ repos:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: 'v0.910'
+ rev: 'v0.931'
hooks:
- id: mypy
exclude: tests

MODIFY
pangeo_forge_recipes/recipes/reference_hdf_zarr.py
pangeo_forge_recipes/recipes/reference_hdf_zarr.py
@@ -29,6 +29,8 @@ def scan_file(chunk_key: ChunkKey, config: HDFReferenceRecipe):
ref_fname = os.path.basename(fname + ".json")
with file_opener(fname, **config.netcdf_storage_options) as fp:
protocol = getattr(getattr(fp, "fs", None), "protocol", None) # make mypy happy
+ if protocol is None:
+ raise ValueError("Couldn't determine protocol")
target_url = unstrip_protocol(fname, protocol)
config.metadata_cache[ref_fname] = create_hdf5_reference(fp, target_url, fname)

MODIFY
pangeo_forge_recipes/recipes/xarray_zarr.py
pangeo_forge_recipes/recipes/xarray_zarr.py
@@ -49,12 +49,12 @@ SubsetSpec = Dict[str, int]
def _input_metadata_fname(input_key: InputKey) -> str:
- key_str = "-".join([f"{k.name}_{k.index}" for k in input_key])
+ key_str = "-".join([f"{k.name}_{k.index}" for k in sorted(input_key)])
return "input-meta-" + key_str + ".json"
def _input_reference_fname(input_key: InputKey) -> str:
- key_str = "-".join([f"{k.name}_{k.index}" for k in input_key])
+ key_str = "-".join([f"{k.name}_{k.index}" for k in sorted(input_key)])
return "input-reference-" + key_str + ".json"

switch Index to be a frozenset