Skip to content

Commit 9ba1999

Browse files
committed
fix types
1 parent 3b01a0c commit 9ba1999

File tree

6 files changed

+7
-19
lines changed

6 files changed

+7
-19
lines changed

services/web/server/src/simcore_service_webserver/garbage_collector/_core_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ async def replace_current_owner(
145145
)
146146
return
147147

148-
# the result might me none
148+
# the result might me none (really? that is not what the function is supposed to do)
149149
if new_project_owner_id is None:
150-
_logger.warning(
150+
_logger.warning( # type: ignore[unreachable]
151151
"Could not recover a new user id from gid %s", new_project_owner_gid
152152
)
153153
return

services/web/server/src/simcore_service_webserver/groups/_groups_repository.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ async def create_standard_group(
312312
user_id: UserID,
313313
create: StandardGroupCreate,
314314
) -> tuple[Group, AccessRightsDict]:
315-
316315
async with transaction_context(get_asyncpg_engine(app), connection) as conn:
317316
user = await conn.scalar(
318317
sa.select(
@@ -358,7 +357,6 @@ async def update_standard_group(
358357
group_id: GroupID,
359358
update: StandardGroupUpdate,
360359
) -> tuple[Group, AccessRightsDict]:
361-
362360
values = update.model_dump(mode="json", exclude_unset=True)
363361

364362
async with transaction_context(get_asyncpg_engine(app), connection) as conn:
@@ -560,12 +558,7 @@ async def update_user_in_group(
560558
the_user_id_in_group: UserID,
561559
access_rights: AccessRightsDict,
562560
) -> GroupMember:
563-
if not access_rights:
564-
msg = f"Cannot update empty {access_rights}"
565-
raise ValueError(msg)
566-
567561
async with transaction_context(get_asyncpg_engine(app), connection) as conn:
568-
569562
# first check if the group exists
570563
await _get_group_and_access_rights_or_raise(
571564
conn, caller_id=caller_id, group_id=group_id, permission="write"
@@ -715,7 +708,6 @@ async def auto_add_user_to_groups(
715708
*,
716709
user: dict,
717710
) -> None:
718-
719711
user_id: UserID = user["id"]
720712

721713
# auto add user to the groups with the right rules

services/web/server/src/simcore_service_webserver/projects/_projects_repository_legacy.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@
124124
class ProjectDBAPI(BaseProjectDB):
125125
def __init__(self, app: web.Application) -> None:
126126
self._app = app
127-
self._engine = cast(Engine, app.get(APP_AIOPG_ENGINE_KEY))
127+
self._engine = cast(Engine | None, app.get(APP_AIOPG_ENGINE_KEY))
128128

129129
def _init_engine(self) -> None:
130130
# Delays creation of engine because it setup_db does it on_startup
131-
self._engine = cast(Engine, self._app.get(APP_AIOPG_ENGINE_KEY))
131+
self._engine = cast(Engine | None, self._app.get(APP_AIOPG_ENGINE_KEY))
132132
if self._engine is None:
133133
msg = "Database subsystem was not initialized"
134134
raise ValueError(msg)
@@ -435,7 +435,6 @@ def _create_shared_workspace_query(
435435
is_search_by_multi_columns: bool,
436436
user_groups: list[GroupID],
437437
) -> sql.Select | None:
438-
439438
if workspace_query.workspace_scope is not WorkspaceScope.PRIVATE:
440439
assert workspace_query.workspace_scope in ( # nosec
441440
WorkspaceScope.SHARED,

services/web/server/src/simcore_service_webserver/resource_manager/registry.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ async def find_resources(
130130
return resources
131131

132132
async def find_keys(self, resource: tuple[str, str]) -> list[UserSessionDict]:
133-
if not resource:
134-
return []
135-
136133
field, value = resource
137134
return [
138135
self._decode_hash_key(hash_key)

services/web/server/src/simcore_service_webserver/resource_usage/_pricing_plans_admin_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _validate_pricing_unit(classification: PricingPlanClassification, unit_extra
135135
msg = "Expected UnitExtraInfoTier (CPU, RAM, VRAM) for TIER classification"
136136
raise ValueError(msg)
137137
else:
138-
msg = "Not known pricing plan classification"
138+
msg = "Not known pricing plan classification" # type: ignore[unreachable]
139139
raise ValueError(msg)
140140

141141

services/web/server/src/simcore_service_webserver/security/_authz_policy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ async def authorized_userid(self, identity: IdentityStr) -> int | None:
131131

132132
async def permits(
133133
self,
134-
identity: IdentityStr,
135-
permission: str,
134+
identity: IdentityStr | None,
135+
permission: str | None,
136136
context: OptionalContext = None,
137137
) -> bool:
138138
"""Implements Interface: Determines whether an identified user has permission

0 commit comments

Comments
 (0)