1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

[PR #11346/61d794f1 backport][stable-12] incus conn plugin: improve readability (was ruff: set target-python 3.7) (#11353)

incus conn plugin: improve readability (was ruff: set target-python 3.7) (#11346)

* incus connection plugin: improve readability

* add changelog frag

* Update plugins/connection/incus.py



* Update plugins/connection/incus.py

* Update plugins/connection/incus.py



---------


(cherry picked from commit 61d794f171)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2025-12-31 08:40:42 +01:00 committed by GitHub
parent f49c5f79a7
commit 4514e271af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- incus connection plugin - improve code readability (https://github.com/ansible-collections/community.general/pull/11346).

View file

@ -142,10 +142,12 @@ class Connection(ConnectionBase):
]
if getattr(self._shell, "_IS_WINDOWS", False):
if (
(regex_match := self.powershell_regex_pattern.match(cmd))
and (regex_pattern := self.powershell_regex_pattern)
) or ((regex_match := self.cmd_regex_pattern.match(cmd)) and (regex_pattern := self.cmd_regex_pattern)):
if regex_match := self.powershell_regex_pattern.match(cmd):
regex_pattern = self.powershell_regex_pattern
elif regex_match := self.cmd_regex_pattern.match(cmd):
regex_pattern = self.cmd_regex_pattern
if regex_match:
self._display.vvvvvv(
f'Found keyword: "{regex_match.group("command")}" based on regex: {regex_pattern.pattern}',
host=self._instance(),