Skip to content

Commit dd48b62

Browse files
committed
refactor: lint
1 parent fe6051d commit dd48b62

File tree

13 files changed

+25
-50
lines changed

13 files changed

+25
-50
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ analysis = [
3737
]
3838

3939
[tool.codespell]
40-
ignore-words-list = "selectin"
40+
ignore-words-list = "selectin,UE,ue"
4141
skip = 'pdm.lock,./assets/'
4242

4343
[tool.coverage.run]

src/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from src.model.base import Base
1616

17-
sqlalchemy_log._add_default_handler = lambda x: None # Patch to avoid duplicate logging
17+
sqlalchemy_log._add_default_handler = lambda x: None # type: ignore[assignment]
1818

1919
__all__ = ("create_db_config", "provide_transaction", "set_sqlite_pragma")
2020

src/model/event.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
import datetime
2-
from typing import TYPE_CHECKING, Optional
32
from uuid import UUID
43

5-
from litestar.dto import dto_field
64
from sqlalchemy import ForeignKey
7-
from sqlalchemy.orm import Mapped, mapped_column, relationship
5+
from sqlalchemy.orm import Mapped, mapped_column
86

97
from src.model import Base
108

119
__all__ = ("Event",)
1210

1311

14-
if TYPE_CHECKING:
15-
from src.model.observation_unit import ObservationUnit
16-
from src.model.vocabulary import Vocabulary
17-
18-
1912
class Event(Base):
2013
__tablename__ = "event_table" # type: ignore[assignment]
2114
event_date: Mapped[datetime.datetime | None]

src/model/facility.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
if TYPE_CHECKING:
1414
from src.model.experiment import Experiment
1515
from src.model.institution import Institution
16-
from src.model.observation_unit import ObservationUnit
1716
from src.model.vocabulary import Vocabulary
1817

1918

src/model/method.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212

1313
if TYPE_CHECKING:
14-
from src.model.biological_material import BiologicalMaterial
1514
from src.model.device import Device
1615
from src.model.observed_variable import ObservedVariable
1716
from src.model.vocabulary import Vocabulary

src/model/observation_unit.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
1-
from typing import TYPE_CHECKING, Optional
21
from uuid import UUID
32

4-
from litestar.dto import dto_field
53
from sqlalchemy import UUID as UUID_SQL
64
from sqlalchemy import Column, ForeignKey, Table
7-
from sqlalchemy.orm import Mapped, mapped_column, relationship
5+
from sqlalchemy.orm import Mapped, mapped_column
86

97
from src.model import Base
108

119
__all__ = ("ObservationUnit",)
1210

1311

14-
if TYPE_CHECKING:
15-
from src.model.event import Event
16-
from src.model.facility import Facility
17-
from src.model.sample import Sample
18-
from src.model.study import Study
19-
from src.model.variable import Variable
20-
from src.model.vocabulary import Vocabulary
21-
2212
ob_unit_to_ob_unit_table = Table(
2313
"ob_unit_to_ob_unit_table",
2414
Base.metadata,

src/model/sample.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
import datetime
2-
from typing import TYPE_CHECKING, Optional
32
from uuid import UUID
43

5-
from litestar.dto import dto_field
64
from sqlalchemy import ForeignKey
7-
from sqlalchemy.orm import Mapped, mapped_column, relationship
5+
from sqlalchemy.orm import Mapped, mapped_column
86

97
from src.model import Base
108

119
__all__ = ("Sample",)
1210

1311

14-
if TYPE_CHECKING:
15-
from src.model.observation_unit import ObservationUnit
16-
from src.model.vocabulary import Vocabulary
17-
18-
1912
class Sample(Base):
2013
__tablename__ = "sample_table" # type: ignore[assignment]
2114

src/model/variable.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
if TYPE_CHECKING:
1616
from src.model.device import Device
17-
from src.model.facility import Facility
1817
from src.model.study import Study
1918

2019
# from src.model.observation_unit import ObservationUnit
@@ -29,7 +28,7 @@
2928

3029

3130
class Variable(Base):
32-
__tablename__: str = "variable_table" # type: ignore[assignment]
31+
__tablename__: str = "variable_table"
3332
__mapper_args__ = {
3433
"polymorphic_identity": "variable",
3534
"polymorphic_on": "type",

src/model/vocabulary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
class Vocabulary(Base):
28-
__tablename__: str = "vocabulary_table" # type: ignore[assignment]
28+
__tablename__: str = "vocabulary_table"
2929
title: Mapped[str]
3030
# Todo: use the same terminologies as PHIS - extract, widening, narrowing?
3131
relationship_type: Mapped[str | None]

src/router/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ async def get_items(
107107
title: str | None,
108108
id: UUID | list[UUID] | None = None,
109109
**kwargs: Any,
110-
) -> Sequence[T.__name__]:
110+
) -> Sequence[T.__name__]: # type: ignore[name-defined]
111111
return cast(
112112
Sequence[T],
113113
await read_items_by_attrs(transaction, table, title=title, id=id, **kwargs),
@@ -119,7 +119,7 @@ async def get_item_by_id(
119119
table: Any,
120120
transaction: "AsyncSession",
121121
id: UUID,
122-
) -> T.__name__:
122+
) -> T.__name__: # type: ignore[name-defined]
123123
return cast(
124124
T,
125125
await read_item_by_id(session=transaction, table=table, id=id),
@@ -171,7 +171,7 @@ async def get_items(
171171
title: str | None,
172172
id: UUID | list[UUID] | None = None,
173173
**kwargs: Any,
174-
) -> Sequence[V.__name__]:
174+
) -> Sequence[V.__name__]: # type: ignore[name-defined]
175175
return cast(
176176
Sequence[V],
177177
await read_items_by_attrs(
@@ -180,7 +180,7 @@ async def get_items(
180180
)
181181

182182
@get("/{id:uuid}")
183-
async def get_item_by_id(self, table: Any, transaction: AsyncSession, id: UUID) -> V.__name__:
183+
async def get_item_by_id(self, table: Any, transaction: AsyncSession, id: UUID) -> V.__name__: # type: ignore[name-defined]
184184
data = await read_item_by_id(transaction, table, id, self.selectinload_attrs)
185185
return cast(V, self.dataclass.from_orm(data))
186186

@@ -193,7 +193,7 @@ async def create_item(self, table: Any, transaction: AsyncSession, data: V.__nam
193193
return cast(V, self.dataclass.from_orm(table_data))
194194

195195
@put("{id:uuid}")
196-
async def update_item(self, table: Any, transaction: AsyncSession, data: V.__name__, id: UUID) -> V.__name__:
196+
async def update_item(self, table: Any, transaction: AsyncSession, data: V.__name__, id: UUID) -> V.__name__: # type: ignore[name-defined]
197197
# Fetch item
198198
item = cast(
199199
T,

0 commit comments

Comments
 (0)