From 8facbd5bab881e2fb35eb0129e0d60a474601c13 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 26 Sep 2024 13:06:18 +0200 Subject: [PATCH 1/3] add generate-run-shell: false to avoid error ENOENT: no such file or directory, lstat '/home/runner/work/_temp/setup-micromamba/micromamba-shell' --- .github/workflows/check_compatibility_ilastik.yaml | 1 + .github/workflows/test_call.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/check_compatibility_ilastik.yaml b/.github/workflows/check_compatibility_ilastik.yaml index c6099da9..4ee1d15d 100644 --- a/.github/workflows/check_compatibility_ilastik.yaml +++ b/.github/workflows/check_compatibility_ilastik.yaml @@ -55,6 +55,7 @@ jobs: - name: Setup ilastik env uses: mamba-org/setup-micromamba@v1 with: + generate-run-shell: false environment-file: env.yaml cache-downloads: true cache-environment: true diff --git a/.github/workflows/test_call.yaml b/.github/workflows/test_call.yaml index 119c75a0..62d87e30 100644 --- a/.github/workflows/test_call.yaml +++ b/.github/workflows/test_call.yaml @@ -93,6 +93,7 @@ jobs: id: create_env uses: mamba-org/setup-micromamba@v1 with: + generate-run-shell: false cache-downloads: true environment-name: ${{ matrix.weight_format }} environment-file: ${{inputs.environment_name}}_${{inputs.concept_id}}_${{inputs.version}}_conda_env_${{matrix.weight_format}}.yaml From ca6df803cc46df1b93cfce5a141fe267f1f803bb Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 26 Sep 2024 13:15:06 +0200 Subject: [PATCH 2/3] update typing --- .../remote_collection.py | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/bioimageio_collection_backoffice/remote_collection.py b/bioimageio_collection_backoffice/remote_collection.py index 558876da..2a7d6d2e 100644 --- a/bioimageio_collection_backoffice/remote_collection.py +++ b/bioimageio_collection_backoffice/remote_collection.py @@ -506,9 +506,7 @@ def generate_collection_json( def get_collection_json(self) -> CollectionJson: data = self.client.load_file("collection.json") assert data is not None - collection: Union[Any, Dict[str, Union[Any, List[Dict[str, Any]]]]] = ( - json.loads(data) - ) + collection: Dict[str, List[Dict[str, Any]]] = json.loads(data) assert isinstance( collection, dict ) # TODO: create typed dict for collection.json @@ -750,7 +748,7 @@ def unpack(self, package_url: str): file_names = set(zipobj.namelist()) bioimageio_yaml_file_name = identify_bioimageio_yaml_file_name(file_names) - rdf: Union[Any, Dict[Any, Any]] = yaml.load( + rdf: Dict[Any, Any] = yaml.load( zipobj.open(bioimageio_yaml_file_name).read().decode() ) if not isinstance(rdf, dict): @@ -919,7 +917,7 @@ def publish(self, reviewer: str) -> Record: if rdf_data is None: raise RuntimeError(f"Failed to load staged RDF from {self.rdf_path}") - rdf: Union[Any, Dict[Any, Any]] = yaml.load(rdf_data.decode()) + rdf: Dict[Any, Any] = yaml.load(rdf_data.decode()) assert isinstance(rdf, dict) version = rdf.get("version", "1") if not isinstance(version, (int, float, str)): @@ -1038,10 +1036,14 @@ def maybe_swap_with_thumbnail( src: Union[Any, Dict[Any, Any], List[Any]], thumbnails: Mapping[str, str] ) -> Any: if isinstance(src, dict): - return {k: maybe_swap_with_thumbnail(v, thumbnails) for k, v in src.items()} + src_dict: Dict[Any, Any] = src + return { + k: maybe_swap_with_thumbnail(v, thumbnails) for k, v in src_dict.items() + } if isinstance(src, list): - return [maybe_swap_with_thumbnail(s, thumbnails) for s in src] + src_list: List[Any] = src + return [maybe_swap_with_thumbnail(s, thumbnails) for s in src_list] if isinstance(src, str) and not src.startswith("https://"): clean_name = Path(src).name # remove any leading './' @@ -1057,10 +1059,12 @@ def resolve_relative_path( src: Union[Any, Dict[Any, Any], List[Any]], parsed_root: SplitResult ) -> Any: if isinstance(src, dict): - return {k: resolve_relative_path(v, parsed_root) for k, v in src.items()} + src_dict: Dict[Any, Any] = src + return {k: resolve_relative_path(v, parsed_root) for k, v in src_dict.items()} if isinstance(src, list): - return [resolve_relative_path(s, parsed_root) for s in src] + src_list: List[Any] = src + return [resolve_relative_path(s, parsed_root) for s in src_list] if isinstance(src, str): if src.startswith("http") or src.startswith("/") or "." not in src: From 081d34fac38edc0f6faf504f339f6b8737a93bd7 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 26 Sep 2024 13:20:57 +0200 Subject: [PATCH 3/3] update typing --- bioimageio_collection_backoffice/_thumbnails.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bioimageio_collection_backoffice/_thumbnails.py b/bioimageio_collection_backoffice/_thumbnails.py index e234b6c9..c5a32cef 100644 --- a/bioimageio_collection_backoffice/_thumbnails.py +++ b/bioimageio_collection_backoffice/_thumbnails.py @@ -16,11 +16,13 @@ def create_thumbnails( covers: Union[Any, List[Any]] = rdf.get("covers") plan: List[Tuple[Any, Tuple[int, int]]] = [] if isinstance(covers, list): - plan.extend((src, (600, 340)) for src in covers) + covers_list: List[Any] = covers + plan.extend((src, (600, 340)) for src in covers_list) badges: Union[Any, List[Any]] = rdf.get("badges") if isinstance(badges, list): - for badge in badges: + badges_list: List[Any] = badges + for badge in badges_list: if not isinstance(badge, dict): continue