Skip to content

Commit 3a10792

Browse files
committed
Remove fixed "type: ignore"
1 parent 0c43f6c commit 3a10792

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

sqlalchemy_bind_manager/_repository/async_.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def save(self, instance: MODEL) -> MODEL:
4747
:param instance: A mapped object instance to be persisted
4848
:return: The model instance after being persisted (e.g. with primary key populated)
4949
"""
50-
async with self._get_session() as session: # type: ignore
50+
async with self._get_session() as session:
5151
session.add(instance)
5252
return instance
5353

@@ -61,7 +61,7 @@ async def save_many(
6161
:type instances: Iterable
6262
:return: The model instances after being persisted (e.g. with primary keys populated)
6363
"""
64-
async with self._get_session() as session: # type: ignore
64+
async with self._get_session() as session:
6565
session.add_all(instances)
6666
return instances
6767

@@ -74,7 +74,7 @@ async def get(self, identifier: PRIMARY_KEY) -> MODEL:
7474
"""
7575
# TODO: implement get_many()
7676
async with self._get_session(commit=False) as session:
77-
model = await session.get(self._model, identifier) # type: ignore
77+
model = await session.get(self._model, identifier)
7878
if model is None:
7979
raise ModelNotFound("No rows found for provided primary key.")
8080
return model
@@ -90,7 +90,7 @@ async def delete(
9090
"""
9191
# TODO: delete without loading the model
9292
obj = entity if self._is_mapped_object(entity) else await self.get(entity) # type: ignore
93-
async with self._get_session() as session: # type: ignore
93+
async with self._get_session() as session:
9494
await session.delete(obj)
9595

9696
async def find(
@@ -108,13 +108,13 @@ async def find(
108108
:return: A collection of models
109109
:rtype: List
110110
"""
111-
stmt = select(self._model) # type: ignore
111+
stmt = select(self._model)
112112
if search_params:
113113
stmt = self._filter_select(stmt, search_params)
114114

115115
if order_by is not None:
116116
stmt = self._filter_order_by(stmt, order_by)
117117

118-
async with self._get_session() as session: # type: ignore
118+
async with self._get_session() as session:
119119
result = await session.execute(stmt)
120120
return [x for x in result.scalars()]

sqlalchemy_bind_manager/_repository/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _validate_mapped_property(self, property_name: str) -> None:
4949
:raises UnmappedProperty: When the property is not mapped.
5050
"""
5151
m: Mapper = class_mapper(self._model)
52-
if property_name not in m.column_attrs: # type: ignore
52+
if property_name not in m.column_attrs:
5353
raise UnmappedProperty(
5454
f"Property `{property_name}` is not mapped in the ORM for model `{self._model}`"
5555
)

sqlalchemy_bind_manager/_repository/sync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def save(self, instance: MODEL) -> MODEL:
4747
:param instance: A mapped object instance to be persisted
4848
:return: The model instance after being persisted (e.g. with primary key populated)
4949
"""
50-
with self._get_session() as session: # type: ignore
50+
with self._get_session() as session:
5151
session.add(instance)
5252
return instance
5353

@@ -58,7 +58,7 @@ def save_many(self, instances: Iterable[MODEL]) -> Iterable[MODEL]:
5858
:type instances: Iterable
5959
:return: The model instances after being persisted (e.g. with primary keys populated)
6060
"""
61-
with self._get_session() as session: # type: ignore
61+
with self._get_session() as session:
6262
session.add_all(instances)
6363
return instances
6464

@@ -71,7 +71,7 @@ def get(self, identifier: PRIMARY_KEY) -> MODEL:
7171
"""
7272
# TODO: implement get_many()
7373
with self._get_session(commit=False) as session:
74-
model = session.get(self._model, identifier) # type: ignore
74+
model = session.get(self._model, identifier)
7575
if model is None:
7676
raise ModelNotFound("No rows found for provided primary key.")
7777
return model
@@ -102,7 +102,7 @@ def find(
102102
:return: A collection of models
103103
:rtype: List
104104
"""
105-
stmt = select(self._model) # type: ignore
105+
stmt = select(self._model)
106106
if search_params:
107107
stmt = self._filter_select(stmt, search_params)
108108

0 commit comments

Comments
 (0)