diff --git a/ahriman-core/src/ahriman/application/handlers/status.py b/ahriman-core/src/ahriman/application/handlers/status.py
index d272c13e..dcd12380 100644
--- a/ahriman-core/src/ahriman/application/handlers/status.py
+++ b/ahriman-core/src/ahriman/application/handlers/status.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
import argparse
+import itertools
from collections.abc import Callable
@@ -56,9 +57,9 @@ class Status(Handler):
service_status = client.status_get()
StatusPrinter(service_status.status)(verbose=args.info)
if args.package:
- packages: list[tuple[Package, BuildStatus]] = sum(
- (client.package_get(base) for base in args.package),
- start=[])
+ packages: list[tuple[Package, BuildStatus]] = list(
+ itertools.chain.from_iterable(client.package_get(base) for base in args.package)
+ )
else:
packages = client.package_get(None)
diff --git a/ahriman-core/src/ahriman/application/handlers/validate.py b/ahriman-core/src/ahriman/application/handlers/validate.py
index a3789996..38a30af9 100644
--- a/ahriman-core/src/ahriman/application/handlers/validate.py
+++ b/ahriman-core/src/ahriman/application/handlers/validate.py
@@ -19,6 +19,7 @@
#
import argparse
import copy
+import itertools
from typing import Any
@@ -97,7 +98,7 @@ class Validate(Handler):
# create trigger loader instance
loader = TriggerLoader()
- triggers = loader.selected_triggers(configuration) + loader.known_triggers(configuration)
+ triggers = itertools.chain(loader.selected_triggers(configuration), loader.known_triggers(configuration))
for trigger in set(triggers):
try:
diff --git a/ahriman-core/src/ahriman/application/handlers/versions.py b/ahriman-core/src/ahriman/application/handlers/versions.py
index c9baf4b2..53d366cf 100644
--- a/ahriman-core/src/ahriman/application/handlers/versions.py
+++ b/ahriman-core/src/ahriman/application/handlers/versions.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
import argparse
+import itertools
import re
import sys
@@ -99,7 +100,7 @@ class Versions(Handler):
keys.extend(portion)
portion = {
key
- for key in sum((list(dependencies_by_key(key)) for key in portion), start=[])
+ for key in itertools.chain.from_iterable(dependencies_by_key(key) for key in portion)
if key not in keys
}
diff --git a/ahriman-core/src/ahriman/core/repository/update_handler.py b/ahriman-core/src/ahriman/core/repository/update_handler.py
index 19a79642..436b860d 100644
--- a/ahriman-core/src/ahriman/core/repository/update_handler.py
+++ b/ahriman-core/src/ahriman/core/repository/update_handler.py
@@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
+import itertools
+
from collections.abc import Iterable
from ahriman.core.build_tools.package_version import PackageVersion
@@ -126,7 +128,7 @@ class UpdateHandler(PackageInfo, Cleaner):
if not dependencies.paths:
continue # skip check if no package dependencies found
- required_packages = {dep for dep_packages in dependencies.paths.values() for dep in dep_packages}
+ required_packages = set(itertools.chain.from_iterable(dependencies.paths.values()))
filesystem = extract_files(required_packages)
for path, packages in dependencies.paths.items():
diff --git a/ahriman-core/src/ahriman/core/spawn.py b/ahriman-core/src/ahriman/core/spawn.py
index 93a6b42d..5b65f3f2 100644
--- a/ahriman-core/src/ahriman/core/spawn.py
+++ b/ahriman-core/src/ahriman/core/spawn.py
@@ -18,6 +18,7 @@
# along with this program. If not, see .
#
import argparse
+import itertools
import uuid
from collections.abc import Callable, Iterable
@@ -117,7 +118,7 @@ class Spawn(Thread, LazyLogging):
continue # skip null values
flag = f"--{argument}"
if isinstance(value, list):
- arguments.extend(list(sum(((flag, v) for v in value), ())))
+ arguments.extend(itertools.chain.from_iterable((flag, v) for v in value))
elif value:
arguments.extend([flag, value])
else:
diff --git a/ahriman-core/src/ahriman/models/result.py b/ahriman-core/src/ahriman/models/result.py
index 8697dbda..011680f1 100644
--- a/ahriman-core/src/ahriman/models/result.py
+++ b/ahriman-core/src/ahriman/models/result.py
@@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
+import itertools
+
from collections.abc import Callable, Iterable
from typing import Any, ClassVar, Self
@@ -100,7 +102,7 @@ class Result:
Returns:
list[Package]: list of packages with success result
"""
- return list(self._added.values()) + list(self._updated.values())
+ return list(itertools.chain(self._added.values(), self._updated.values()))
def add_added(self, package: Package) -> None:
"""
diff --git a/ahriman-triggers/src/ahriman/core/support/pkgbuild/keyring_generator.py b/ahriman-triggers/src/ahriman/core/support/pkgbuild/keyring_generator.py
index 2b807d96..0b65e984 100644
--- a/ahriman-triggers/src/ahriman/core/support/pkgbuild/keyring_generator.py
+++ b/ahriman-triggers/src/ahriman/core/support/pkgbuild/keyring_generator.py
@@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
+import itertools
+
from collections.abc import Callable
from pathlib import Path
@@ -117,7 +119,7 @@ class KeyringGenerator(PkgbuildGenerator):
source_path(Path): destination of the file content
"""
with source_path.open("w", encoding="utf8") as source_file:
- for key in sorted(set(self.trusted + self.packagers + self.revoked)):
+ for key in sorted(set(itertools.chain(self.trusted, self.packagers, self.revoked))):
public_key = self.sign.key_export(key)
source_file.write(public_key)
source_file.write("\n")