Skip to content

Commit 3562640

Browse files
committed
cleanup
1 parent 18a68ab commit 3562640

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

packages/postgres-database/src/simcore_postgres_database/utils_groups_extra_properties.py

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
_logger = logging.getLogger(__name__)
1818

1919
_WARNING_FMSG = (
20-
f"{__name__}.{{}} uses aiopg which has been deprecated in this repo. "
21-
"Use {{}} instead. "
20+
f"{__name__}.{{}} uses aiopg which has been deprecated in this repo. Use {{}} instead. "
2221
"SEE https://github.com/ITISFoundation/osparc-simcore/issues/4529"
2322
)
2423

@@ -44,7 +43,7 @@ class GroupExtraProperties(FromRowMixin):
4443
enable_efs: bool
4544

4645

47-
async def _list_table_entries_ordered_by_group_type_query(
46+
async def _list_table_entries_ordered_by_group_type_stmt(
4847
user_id: int, product_name: str
4948
):
5049
return (
@@ -78,23 +77,6 @@ async def _list_table_entries_ordered_by_group_type_query(
7877
)
7978

8079

81-
async def _list_table_entries_ordered_by_group_type(
82-
connection: SAConnection, user_id: int, product_name: str
83-
) -> list[RowProxy]:
84-
list_stmt = _list_table_entries_ordered_by_group_type_query(
85-
user_id=user_id, product_name=product_name
86-
)
87-
88-
result = await connection.execute(
89-
sa.select(list_stmt).order_by(list_stmt.c.type_order)
90-
)
91-
assert result # nosec
92-
93-
rows: list[RowProxy] | None = await result.fetchall()
94-
assert rows is not None # nosec
95-
return rows
96-
97-
9880
def _merge_extra_properties_booleans(
9981
instance1: GroupExtraProperties, instance2: GroupExtraProperties
10082
) -> GroupExtraProperties:
@@ -206,9 +188,18 @@ async def get_aggregated_properties_for_user(
206188
stacklevel=1,
207189
)
208190

209-
rows = await _list_table_entries_ordered_by_group_type(
210-
connection, user_id, product_name
191+
list_stmt = _list_table_entries_ordered_by_group_type_stmt(
192+
user_id=user_id, product_name=product_name
211193
)
194+
195+
result = await connection.execute(
196+
sa.select(list_stmt).order_by(list_stmt.c.type_order)
197+
)
198+
assert result # nosec
199+
200+
rows: list[RowProxy] | None = await result.fetchall()
201+
assert rows is not None # nosec
202+
212203
return GroupExtraPropertiesRepo._aggregate(rows, user_id, product_name)
213204

214205
@staticmethod
@@ -221,7 +212,7 @@ async def get_aggregated_properties_for_user_v2(
221212
) -> GroupExtraProperties:
222213
async with pass_or_acquire_connection(engine, connection) as conn:
223214

224-
list_stmt = _list_table_entries_ordered_by_group_type_query(
215+
list_stmt = _list_table_entries_ordered_by_group_type_stmt(
225216
user_id=user_id, product_name=product_name
226217
)
227218
result = await conn.stream(

0 commit comments

Comments
 (0)