Skip to content

Commit d941252

Browse files
committed
Merge branch 'too-many-args'
* too-many-args: Remove unused test pylint: deal with too-many-positional-arguments
2 parents 9926f7c + da67c26 commit d941252

5 files changed

+28
-40
lines changed

qrexec/policy/parser.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ class AskResolution(AbstractResolution):
723723
def __init__(self,
724724
rule: "Rule",
725725
request: "Request",
726+
*,
726727
# targets for the user to choose from
727728
targets_for_ask: Sequence[str],
728729
# default target, or None
@@ -913,7 +914,7 @@ def allow_no_autostart(target: str, system_info: FullSystemInfo) -> bool:
913914

914915
class Deny(ActionType):
915916
# pylint: disable=missing-docstring
916-
def __init__(self, rule: "Rule", notify: Optional[bool]=None):
917+
def __init__(self, rule: "Rule", *, notify: Optional[bool]=None):
917918
super().__init__(rule)
918919
self.notify = True if notify is None else notify
919920

@@ -950,6 +951,7 @@ class Allow(ActionType):
950951
def __init__(
951952
self,
952953
rule: "Rule",
954+
*,
953955
target: Optional[str]=None,
954956
user: Optional[str] = None,
955957
notify: bool = False,
@@ -1033,6 +1035,7 @@ class Ask(ActionType):
10331035
def __init__(
10341036
self,
10351037
rule: "Rule",
1038+
*,
10361039
target: Optional[str]=None,
10371040
default_target: Optional[str]=None,
10381041
user: Optional[str] = None,
@@ -1139,7 +1142,7 @@ class Rule:
11391142
:py:meth:`from_line_service()`.
11401143
"""
11411144

1142-
# pylint: disable=too-many-instance-attributes
1145+
# pylint: disable=too-many-instance-attributes,too-many-positional-arguments
11431146

11441147
action: Union[Allow, Deny, Ask]
11451148
def __init__(

qrexec/tests/qrexec_policy_daemon.py

+8-28
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,21 @@ async def qrexec_server(self, tmp_path, request):
8989
eval_server = await asyncio.start_unix_server(
9090
functools.partial(
9191
qrexec_policy_daemon.handle_qrexec_connection,
92-
log,
93-
mock_policy,
94-
False,
95-
b"policy.EvalSimple",
92+
log=log,
93+
policy_cache=mock_policy,
94+
check_gui=False,
95+
service_name=b"policy.EvalSimple",
9696
),
9797
path=str(tmp_path / "socket.Simple"),
9898
)
9999

100100
gui_server = await asyncio.start_unix_server(
101101
functools.partial(
102102
qrexec_policy_daemon.handle_qrexec_connection,
103-
log,
104-
mock_policy,
105-
True,
106-
b"policy.EvalGUI",
103+
log=log,
104+
policy_cache=mock_policy,
105+
check_gui=True,
106+
service_name=b"policy.EvalGUI",
107107
),
108108
path=str(tmp_path / "socket.GUI"),
109109
)
@@ -205,26 +205,6 @@ async def test_complex_request2(self, mock_request, async_server, tmp_path):
205205
policy_cache=unittest.mock.ANY,
206206
)
207207

208-
@pytest.mark.asyncio
209-
async def test_unfinished_request(
210-
self, mock_request, async_server, tmp_path
211-
):
212-
213-
data = b"unfinished"
214-
215-
task = self.send_data(async_server, tmp_path, data)
216-
217-
with pytest.raises(asyncio.TimeoutError):
218-
await asyncio.wait_for(task, timeout=2)
219-
220-
for task in asyncio.all_tasks():
221-
task.cancel()
222-
223-
with suppress(asyncio.CancelledError):
224-
await asyncio.sleep(1)
225-
226-
mock_request.assert_not_called()
227-
228208
@pytest.mark.asyncio
229209
async def test_too_short_request(
230210
self, mock_request, async_server, tmp_path

qrexec/tools/qrexec_policy_agent.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def _connect_events(self):
435435
def __init__(
436436
self, entries_info, source, service, argument, targets_list, target=None
437437
):
438-
# pylint: disable=too-many-arguments
438+
# pylint: disable=too-many-arguments,too-many-positional-arguments
439439
sanitize_domain_name(source, assert_sanitized=True)
440440
sanitize_service_name(service, assert_sanitized=True)
441441

@@ -521,7 +521,7 @@ async def confirm_rpc(self):
521521
async def confirm_rpc(
522522
entries_info, source, service, argument, targets_list, target=None
523523
):
524-
# pylint: disable=too-many-arguments
524+
# pylint: disable=too-many-arguments,too-many-positional-arguments
525525
window = RPCConfirmationWindow(
526526
entries_info, source, service, argument, targets_list, target
527527
)
@@ -597,7 +597,7 @@ async def handle_notify(self, params):
597597
return ""
598598

599599
def notify(self, resolution, service, argument, source, target):
600-
# pylint: disable=too-many-arguments
600+
# pylint: disable=too-many-arguments,too-many-positional-arguments
601601
if argument == "+":
602602
rpc = service
603603
else:

qrexec/tools/qrexec_policy_daemon.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ async def _extract_qrexec_parameters(reader):
165165
return invoked_service, service_argument, remote_domain
166166

167167

168-
# pylint: disable=too-many-return-statements,too-many-arguments
168+
# pylint: disable=too-many-return-statements,too-many-arguments,too-many-positional-arguments
169169
async def qrexec_policy_eval(
170170
log,
171171
policy_cache,
@@ -255,7 +255,7 @@ async def qrexec_policy_eval(
255255

256256
# pylint: disable=too-many-arguments
257257
async def handle_qrexec_connection(
258-
log, policy_cache, check_gui, service_name, reader, writer
258+
reader, writer, *, log, policy_cache, check_gui, service_name
259259
):
260260

261261
"""
@@ -314,17 +314,21 @@ async def start_serving(args=None):
314314
eval_server = await asyncio.start_unix_server(
315315
functools.partial(
316316
handle_qrexec_connection,
317-
log,
318-
policy_cache,
319-
False,
320-
b"policy.EvalSimple",
317+
log=log,
318+
policy_cache=policy_cache,
319+
check_gui=False,
320+
service_name=b"policy.EvalSimple",
321321
),
322322
path=args.eval_socket_path,
323323
)
324324

325325
gui_eval_server = await asyncio.start_unix_server(
326326
functools.partial(
327-
handle_qrexec_connection, log, policy_cache, True, b"policy.EvalGUI"
327+
handle_qrexec_connection,
328+
log=log,
329+
policy_cache=policy_cache,
330+
check_gui=True,
331+
service_name=b"policy.EvalGUI"
328332
),
329333
path=args.gui_socket_path,
330334
)

qrexec/tools/qrexec_policy_exec.py

+1
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ async def handle_request(
327327
intended_target: str,
328328
service_and_arg: str,
329329
log,
330+
*,
330331
just_evaluate: bool = False,
331332
assume_yes_for_ask: bool = False,
332333
allow_resolution_type: Optional[type]=None,

0 commit comments

Comments
 (0)