Skip to content

Commit e803533

Browse files
committed
Fix linting issue for add_element
1 parent d9c207d commit e803533

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

gvm/protocols/gmp/_gmpnext.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: GPL-3.0-or-later
44

5-
from typing import Any, Mapping, Optional, Sequence
5+
from typing import Mapping, Optional, Sequence
66

77
from gvm.protocols.gmp.requests import EntityID
88

@@ -114,7 +114,7 @@ def modify_agents(
114114
agent_ids: list[EntityID],
115115
*,
116116
authorized: Optional[bool] = None,
117-
config: Optional[Mapping[str, Any]] = None,
117+
config: Optional[Mapping[str, Optional[SupportsStr]]] = None,
118118
comment: Optional[str] = None,
119119
) -> T:
120120
"""
@@ -148,7 +148,7 @@ def delete_agents(self, agent_ids: list[EntityID]) -> T:
148148
def modify_agent_control_scan_config(
149149
self,
150150
agent_control_id: EntityID,
151-
config: Mapping[str, Any],
151+
config: Mapping[str, Optional[SupportsStr]],
152152
) -> T:
153153
"""
154154
Modify agent control scan config.

gvm/protocols/gmp/requests/next/_agents.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: GPL-3.0-or-later
44

5-
from typing import Any, Mapping, Optional
5+
from typing import Mapping, Optional
66

77
from gvm.errors import RequiredArgument
88
from gvm.protocols.core import Request
@@ -29,11 +29,11 @@ def _add_element(element, name: str, value: Optional[SupportsStr]) -> None:
2929

3030
@classmethod
3131
def _validate_agent_config(
32-
cls, config: Mapping[str, Any], *, caller: str
32+
cls, config: Mapping[str, Optional[SupportsStr]], *, caller: str
3333
) -> None:
3434
"""Ensure all required fields exist and are non-empty."""
3535

36-
def valid(d: Mapping[str, Any], key: str, path: str):
36+
def valid(d: Mapping[str, Optional[SupportsStr]], key: str, path: str):
3737
if (
3838
not isinstance(d, Mapping)
3939
or d.get(key) is None
@@ -79,7 +79,9 @@ def valid(d: Mapping[str, Any], key: str, path: str):
7979
valid(hb, "miss_until_inactive", "heartbeat.")
8080

8181
@classmethod
82-
def _append_agent_config(cls, parent, config: Mapping[str, Any]) -> None:
82+
def _append_agent_config(
83+
cls, parent, config: Mapping[str, Optional[SupportsStr]]
84+
) -> None:
8385
"""
8486
Append an agent configuration block to the given XML parent element.
8587
@@ -184,7 +186,7 @@ def modify_agents(
184186
agent_ids: list[EntityID],
185187
*,
186188
authorized: Optional[bool] = None,
187-
config: Optional[Mapping[str, Any]] = None,
189+
config: Optional[Mapping[str, Optional[SupportsStr]]] = None,
188190
comment: Optional[str] = None,
189191
) -> Request:
190192
"""
@@ -264,7 +266,7 @@ def delete_agents(cls, agent_ids: list[EntityID]) -> Request:
264266
def modify_agent_control_scan_config(
265267
cls,
266268
agent_control_id: EntityID,
267-
config: Mapping[str, Any],
269+
config: Mapping[str, Optional[SupportsStr]],
268270
) -> Request:
269271
"""
270272
Modify agent control scan config.

0 commit comments

Comments
 (0)