Skip to content

Commit

Permalink
Mypy: removed type ignore at Annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Feb 8, 2024
1 parent 6e81ac1 commit 68ce756
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions openatlas/database/annotation.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Any, Optional
from typing import Any

from flask import g


class AnnotationImage:

@staticmethod
def get_by_id(id_: int) -> Optional[dict[str, Any]]:
def get_by_id(id_: int) -> dict[str, Any]:
g.cursor.execute(
"""
SELECT
Expand All @@ -21,7 +21,7 @@ def get_by_id(id_: int) -> Optional[dict[str, Any]]:
WHERE id = %(id)s;
""",
{'id': id_})
return dict(g.cursor.fetchone()) if g.cursor.rowcount else None
return dict(g.cursor.fetchone()) if g.cursor.rowcount else {}

@staticmethod
def get_by_file(image_id: int) -> list[dict[str, Any]]:
Expand Down
2 changes: 1 addition & 1 deletion openatlas/models/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def delete(self) -> None:

@staticmethod
def get_by_id(id_: int) -> Annotation:
return Annotation(Db.get_by_id(id_)) # type: ignore
return Annotation(Db.get_by_id(id_))

@staticmethod
def get_by_file(image_id: int) -> list[Annotation]:
Expand Down

0 comments on commit 68ce756

Please sign in to comment.