Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump pyright and deepdiff #678

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions bioimageio/spec/model/v0_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,37 @@ def check_one_entry(self) -> Self:

return self

def __getitem__(
self,
key: Literal[
"keras_hdf5",
"onnx",
"pytorch_state_dict",
"tensorflow_js",
"tensorflow_saved_model_bundle",
"torchscript",
],
):
if key == "keras_hdf5":
ret = self.keras_hdf5
elif key == "onnx":
ret = self.onnx
elif key == "pytorch_state_dict":
ret = self.pytorch_state_dict
elif key == "tensorflow_js":
ret = self.tensorflow_js
elif key == "tensorflow_saved_model_bundle":
ret = self.tensorflow_saved_model_bundle
elif key == "torchscript":
ret = self.torchscript
else:
raise KeyError(key)

if ret is None:
raise KeyError(key)

return ret


class WeightsEntryDescrBase(FileDescr):
type: ClassVar[WeightsFormat]
Expand Down
31 changes: 31 additions & 0 deletions bioimageio/spec/model/v0_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,37 @@ def check_entries(self) -> Self:

return self

def __getitem__(
self,
key: Literal[
"keras_hdf5",
"onnx",
"pytorch_state_dict",
"tensorflow_js",
"tensorflow_saved_model_bundle",
"torchscript",
],
):
if key == "keras_hdf5":
ret = self.keras_hdf5
elif key == "onnx":
ret = self.onnx
elif key == "pytorch_state_dict":
ret = self.pytorch_state_dict
elif key == "tensorflow_js":
ret = self.tensorflow_js
elif key == "tensorflow_saved_model_bundle":
ret = self.tensorflow_saved_model_bundle
elif key == "torchscript":
ret = self.torchscript
else:
raise KeyError(key)

if ret is None:
raise KeyError(key)

return ret


class ModelId(ResourceId):
pass
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_json_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from argparse import ArgumentParser
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Dict, Literal, Final
from typing import Any, Dict, Final, Literal

from deepdiff import DeepDiff # pyright: ignore [reportMissingTypeStubs]
from deepdiff.diff import DeepDiff
from pydantic import ConfigDict, TypeAdapter
from typing_extensions import assert_never

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"jupyter",
"pdoc",
"pre-commit",
"pyright==1.1.390",
"pyright==1.1.391",
"ruff",
],
},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import shutil
from pathlib import Path

from deepdiff import DeepDiff
from deepdiff.diff import DeepDiff

from bioimageio.spec.model import v0_5

Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import jsonschema
import pytest
from deepdiff import DeepDiff # pyright: ignore [reportMissingTypeStubs]
from deepdiff.diff import DeepDiff
from pydantic import (
DirectoryPath,
RootModel,
Expand Down
Loading