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

Fix mypy issues #476

Merged
merged 2 commits into from
Jul 24, 2023
Merged
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
8 changes: 4 additions & 4 deletions sentinelhub/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
letter_case=LetterCase.CAMEL,
)

geometry_config = dataclass_config(
geometry_config = dataclass_config( # type: ignore[misc]
encoder=Geometry.get_geojson,
decoder=lambda geojson: Geometry.from_geojson(geojson) if geojson else None,
exclude=lambda geojson: geojson is None, # type: ignore[misc, arg-type]
exclude=lambda geojson: geojson is None,
letter_case=LetterCase.CAMEL,
)


def enum_config(enum_class: Type[Enum]) -> Dict[str, dict]:
"""Given an Enum class it provide an object for serialization/deserialization"""
return dataclass_config(
return dataclass_config( # type: ignore[misc]
encoder=lambda enum_item: enum_item.value,
decoder=lambda item: enum_class(item) if item else None,
exclude=lambda item: item is None, # type: ignore[misc, arg-type]
exclude=lambda item: item is None,
letter_case=LetterCase.CAMEL,
)

Expand Down