Skip to content
Snippets Groups Projects
Unverified Commit b0b1703f authored by karp's avatar karp
Browse files

Fix LSP error in UtcDateTime#process_bind_param

According to mypy the previous annotation violated the LSP.
We now use the types of the supertype method and return a
datetime object only if the argument was a datetime-object.
parent aa6c5152
No related branches found
No related tags found
1 merge request!22Make MyPy happy
......@@ -28,12 +28,12 @@ class UtcDateTime(types.TypeDecorator):
return types.String(32)
def process_bind_param(
self, value: datetime, dialect: Dialect
self, value: Any | None, dialect: Dialect
) -> Optional[str | datetime]:
if value is None:
return None
if isinstance(value, datetime):
return value.astimezone(timezone.utc).isoformat()
return value.astimezone(timezone.utc).isoformat()
return None
def process_result_value(
self, value: str | datetime, dialect: Dialect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment