Skip to content

Commit e5da271

Browse files
authored
Merge pull request #3357 from SUSE/reduce_reduce
Remove unnecessary uses of reduce()
2 parents 6322b8c + d066750 commit e5da271

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/staging/bot.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from datetime import timedelta
1717
from enum import Enum
1818
from enum import unique
19-
from functools import reduce
2019
from io import BytesIO
2120
from pathlib import Path
2221
from typing import ClassVar
@@ -186,7 +185,7 @@ def __post_init__(self) -> None:
186185
self.branch_name = (
187186
self.deployment_branch_name
188187
+ "-"
189-
+ "".join(random.choice(string.ascii_letters) for _ in range(5))
188+
+ "".join(random.choices(string.ascii_letters, k=5))
190189
)
191190

192191
if not self.osc_username:
@@ -832,17 +831,7 @@ def _get_changed_packages_by_commit(self, commit: str | git.Commit) -> list[str]
832831
packages.append(b_path[0])
833832

834833
res = list(set(packages))
835-
836-
# it can happen that we only update a non-BCI package file,
837-
# e.g. .obs/workflows.yml, then we will have a commit, but the diff will
838-
# not touch any BCI and thus `res` will be an empty list
839-
# => give reduce an initial value (last parameter) as it will otherwise
840-
# fail
841-
assert reduce(
842-
lambda folder_a, folder_b: folder_a and folder_b,
843-
(pkg in bci_pkg_names for pkg in res),
844-
True,
845-
)
834+
assert all(pkg in bci_pkg_names for pkg in res)
846835
return res
847836

848837
async def _run_git_action_in_worktree(

0 commit comments

Comments
 (0)