forked from rpms/leapp-repository
88 lines
4.4 KiB
Diff
88 lines
4.4 KiB
Diff
From 1104e25977b728a7059fc1ef4613ef55d1e0a9d7 Mon Sep 17 00:00:00 2001
|
|
From: Tomas Fratrik <tfratrik@redhat.com>
|
|
Date: Wed, 13 Aug 2025 13:51:34 +0200
|
|
Subject: [PATCH 37/55] pylint: enable use-yield-from
|
|
|
|
Jira: RHELMISC-16038
|
|
---
|
|
.pylintrc | 3 +--
|
|
.../mount_units_generator/tests/test_mount_unit_generation.py | 3 +--
|
|
.../actors/storagescanner/tests/unit_test_storagescanner.py | 3 +--
|
|
.../tests/unit_test_targetuserspacecreator.py | 3 +--
|
|
repos/system_upgrade/common/libraries/config/version.py | 3 +--
|
|
5 files changed, 5 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/.pylintrc b/.pylintrc
|
|
index f7f4b25d..15a69461 100644
|
|
--- a/.pylintrc
|
|
+++ b/.pylintrc
|
|
@@ -52,8 +52,7 @@ disable=
|
|
raise-missing-from, # no 'raise from' in python 2
|
|
use-a-generator, # cannot be modified because of Python2 support
|
|
consider-using-f-string, # sorry, not gonna happen, still have to support py2
|
|
- logging-format-interpolation,
|
|
- use-yield-from # yield from cannot be used until we require python 3.3 or greater
|
|
+ logging-format-interpolation
|
|
|
|
[FORMAT]
|
|
# Maximum number of characters on a single line.
|
|
diff --git a/repos/system_upgrade/common/actors/initramfs/mount_units_generator/tests/test_mount_unit_generation.py b/repos/system_upgrade/common/actors/initramfs/mount_units_generator/tests/test_mount_unit_generation.py
|
|
index b814f6ce..9d75a31d 100644
|
|
--- a/repos/system_upgrade/common/actors/initramfs/mount_units_generator/tests/test_mount_unit_generation.py
|
|
+++ b/repos/system_upgrade/common/actors/initramfs/mount_units_generator/tests/test_mount_unit_generation.py
|
|
@@ -196,8 +196,7 @@ def test_copy_units_mixed_content(monkeypatch):
|
|
('/source/dir', ['local-fs.target.requires'], ['unit1.mount', 'unit2.mount']),
|
|
('/source/dir/local-fs.target.requires', [], ['unit1.mount', 'unit2.mount']),
|
|
]
|
|
- for i in tuples_to_yield:
|
|
- yield i
|
|
+ yield from tuples_to_yield
|
|
|
|
def mock_isdir(path):
|
|
return 'local-fs.target.requires' in path
|
|
diff --git a/repos/system_upgrade/common/actors/storagescanner/tests/unit_test_storagescanner.py b/repos/system_upgrade/common/actors/storagescanner/tests/unit_test_storagescanner.py
|
|
index 456e40ec..3c7fcbd6 100644
|
|
--- a/repos/system_upgrade/common/actors/storagescanner/tests/unit_test_storagescanner.py
|
|
+++ b/repos/system_upgrade/common/actors/storagescanner/tests/unit_test_storagescanner.py
|
|
@@ -268,8 +268,7 @@ def test_get_lsblk_info(monkeypatch):
|
|
'crypt', '', '/dev/nvme0n1p1'],
|
|
['/dev/nvme0n1p1', '259:1', '0', str(39 * bytes_per_gb), '0', 'part', '', '/dev/nvme0n1'],
|
|
]
|
|
- for output_line_parts in output_lines_split_on_whitespace:
|
|
- yield output_line_parts
|
|
+ yield from output_lines_split_on_whitespace
|
|
elif len(cmd) == 5 and cmd[:4] == ['lsblk', '-nr', '--output', 'NAME,KNAME,SIZE']:
|
|
# We cannot have the output in a list, since the command is called per device. Therefore, we have to map
|
|
# each device path to its output.
|
|
diff --git a/repos/system_upgrade/common/actors/targetuserspacecreator/tests/unit_test_targetuserspacecreator.py b/repos/system_upgrade/common/actors/targetuserspacecreator/tests/unit_test_targetuserspacecreator.py
|
|
index 2ae194d7..e78c3ac7 100644
|
|
--- a/repos/system_upgrade/common/actors/targetuserspacecreator/tests/unit_test_targetuserspacecreator.py
|
|
+++ b/repos/system_upgrade/common/actors/targetuserspacecreator/tests/unit_test_targetuserspacecreator.py
|
|
@@ -95,8 +95,7 @@ def traverse_structure(structure, root=Path('/')):
|
|
filepath = root / filename
|
|
|
|
if isinstance(links_to, dict):
|
|
- for pair in traverse_structure(links_to, filepath):
|
|
- yield pair
|
|
+ yield from traverse_structure(links_to, root=filepath)
|
|
else:
|
|
yield (filepath, links_to)
|
|
|
|
diff --git a/repos/system_upgrade/common/libraries/config/version.py b/repos/system_upgrade/common/libraries/config/version.py
|
|
index 00ce3ec8..5efa932d 100644
|
|
--- a/repos/system_upgrade/common/libraries/config/version.py
|
|
+++ b/repos/system_upgrade/common/libraries/config/version.py
|
|
@@ -106,8 +106,7 @@ class _SupportedVersionsDict(dict):
|
|
|
|
def __iter__(self):
|
|
self._feed_supported_versions()
|
|
- for d in self.data:
|
|
- yield d
|
|
+ yield from self.data
|
|
|
|
def __repr__(self):
|
|
self._feed_supported_versions()
|
|
--
|
|
2.51.1
|
|
|