Skip to content

Commit 25bbf42

Browse files
committed
Fix mypy complains
SDESK-7460
1 parent 4fc2f1a commit 25bbf42

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

superdesk/core/auth/user_auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def authorize(self, request: Request) -> Any | None:
2929
endpoint_rules = cast(list[AuthRule], endpoint_rules.get(request.method) or [])
3030

3131
auth_rules = self.get_default_auth_rules()
32-
auth_rules.append(endpoint_rules or [])
32+
auth_rules.append(endpoint_rules or []) # type: ignore[arg-type]
3333

3434
for rule in flatten(auth_rules):
3535
response = await rule(request)

superdesk/core/mongo/mongo_manager.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
# AUTHORS and LICENSE files distributed with this source code, or
99
# at https://www.sourcefabric.org/superdesk/license
1010

11-
from typing import Dict, List, Tuple
12-
from dataclasses import asdict
13-
from copy import deepcopy
1411
import logging
12+
from copy import deepcopy
13+
from dataclasses import asdict
14+
from typing import Dict, List, Tuple
1515

1616
from pymongo import MongoClient
1717
from pymongo.database import Database, Collection
@@ -250,7 +250,7 @@ def get_client_async(
250250

251251
if not self._mongo_clients_async.get(mongo_config.prefix):
252252
client_config, dbname = get_mongo_client_config(self.app.wsgi.config, mongo_config.prefix)
253-
client = AsyncIOMotorClient(**client_config)
253+
client: AsyncIOMotorClient = AsyncIOMotorClient(**client_config)
254254
db = client.get_database(dbname if not versioning else f"{dbname}_versions")
255255
self._mongo_clients_async[mongo_config.prefix] = (client, db)
256256

superdesk/privilege.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
def privilege(
2626
name,
27-
label: Optional[LazyString] = None,
28-
description: Optional[LazyString] = None,
29-
category: Optional[LazyString] = None,
27+
label: LazyString | str | None = None,
28+
description: LazyString | str | None = None,
29+
category: LazyString | str | None = None,
3030
**kwargs,
3131
):
3232
"""Register privilege.

tests/core/modules/module_with_privileges.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from quart_babel import lazy_gettext
22

3-
from superdesk.core.auth.privilege_rules import http_method_privilege_based_rules
43
from superdesk.core.module import Module
54
from superdesk.core.privileges import Privilege
5+
from superdesk.core.auth.privilege_rules import http_method_privilege_based_rules
66
from superdesk.core.resources import ResourceConfig, ResourceModel, RestEndpointConfig
77

88
test_privileges = ["can_read", "can_create"]

0 commit comments

Comments
 (0)