Skip to content

Commit 920cdfa

Browse files
committed
mypy type
1 parent 90a7d36 commit 920cdfa

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/opengeodeweb_microservice/database/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def init_database(db_path: str = DATABASE_FILENAME) -> None:
2323
Base.metadata.create_all(engine)
2424

2525

26-
def get_session():
26+
def get_session() -> scoped_session:
2727
if scoped_session_registry is None:
2828
raise RuntimeError()
2929
return scoped_session_registry

src/opengeodeweb_microservice/database/data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from .connection import get_session
44
from .base import Base
55
import uuid
6+
from typing import cast
67

78

89
class Data(Base):
@@ -46,4 +47,4 @@ def create(
4647
@staticmethod
4748
def get(data_id: str) -> "Data | None":
4849
session = get_session()
49-
return session.get(Data, data_id)
50+
return cast("Data | None", session.get(Data, data_id))

0 commit comments

Comments
 (0)