diff --git a/.readthedocs.yml b/.readthedocs.yml
index 5ab5f829..b9f560bd 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
- python: "3.11"
+ python: "3.12"
python:
install:
diff --git a/pyproject.toml b/pyproject.toml
index 2513bb1e..b5c13e73 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -81,6 +81,7 @@ web = [
"aiohttp_security",
"cryptography",
"requests-unixsocket", # required by unix socket support
+ "setuptools", # required by aiohttp-apispec
]
[tool.flit.sdist]
diff --git a/src/ahriman/core/auth/oauth.py b/src/ahriman/core/auth/oauth.py
index 763a5344..4dcef521 100644
--- a/src/ahriman/core/auth/oauth.py
+++ b/src/ahriman/core/auth/oauth.py
@@ -69,7 +69,8 @@ class OAuth(Mapping):
Returns:
str: login control as html code to insert
"""
- return f""" login"""
+ return f""" login"""
@staticmethod
def get_provider(name: str) -> type[aioauth_client.OAuth2Client]:
diff --git a/src/ahriman/core/exceptions.py b/src/ahriman/core/exceptions.py
index 412a58d8..98a69d4b 100644
--- a/src/ahriman/core/exceptions.py
+++ b/src/ahriman/core/exceptions.py
@@ -330,5 +330,5 @@ class UnsafeRunError(RuntimeError):
root_uid(int): ID of the owner of root directory
"""
RuntimeError.__init__(self, f"Current UID {current_uid} differs from root owner {root_uid}. "
- f"Note that for the most actions it is unsafe to run application as different user."
- f" If you are 100% sure that it must be there try --unsafe option")
+ f"Note that for the most actions it is unsafe to run application as different user."
+ f" If you are 100% sure that it must be there try --unsafe option")
diff --git a/src/ahriman/core/report/remote_call.py b/src/ahriman/core/report/remote_call.py
index debe358e..6294f65b 100644
--- a/src/ahriman/core/report/remote_call.py
+++ b/src/ahriman/core/report/remote_call.py
@@ -106,7 +106,7 @@ class RemoteCall(Report):
"aur": self.update_aur,
"local": self.update_local,
"manual": self.update_manual,
- })
+ })
response_json = response.json()
process_id: str = response_json["process_id"]
diff --git a/src/ahriman/core/support/pkgbuild/keyring_generator.py b/src/ahriman/core/support/pkgbuild/keyring_generator.py
index 02554a7a..b013488a 100644
--- a/src/ahriman/core/support/pkgbuild/keyring_generator.py
+++ b/src/ahriman/core/support/pkgbuild/keyring_generator.py
@@ -183,11 +183,12 @@ post_install() {{
Returns:
str: package() function for PKGBUILD
"""
+ # somehow autopep thinks that construction inside contains valid python code and reformats it
return f"""{{
install -Dm644 "{Path("$srcdir") / f"{self.name}.gpg"}" "{Path("$pkgdir") / "usr" / "share" / "pacman" / "keyrings" / f"{self.name}.gpg"}"
install -Dm644 "{Path("$srcdir") / f"{self.name}-revoked"}" "{Path("$pkgdir") / "usr" / "share" / "pacman" / "keyrings" / f"{self.name}-revoked"}"
install -Dm644 "{Path("$srcdir") / f"{self.name}-trusted"}" "{Path("$pkgdir") / "usr" / "share" / "pacman" / "keyrings" / f"{self.name}-trusted"}"
-}}"""
+}}""" # nopep8
def sources(self) -> dict[str, Callable[[Path], None]]:
"""
diff --git a/src/ahriman/core/upload/github.py b/src/ahriman/core/upload/github.py
index e996ea3e..e10cbb6d 100644
--- a/src/ahriman/core/upload/github.py
+++ b/src/ahriman/core/upload/github.py
@@ -162,7 +162,8 @@ class GitHub(Upload, HttpUpload):
Returns:
dict[str, Any] | None: GitHub API release object if release found and None otherwise
"""
- url = f"https://api.github.com/repos/{self.github_owner}/{self.github_repository}/releases/tags/{self.github_release_tag}"
+ url = f"https://api.github.com/repos/{self.github_owner}/{
+ self.github_repository}/releases/tags/{self.github_release_tag}"
try:
response = self.make_request("GET", url)
release: dict[str, Any] = response.json()
diff --git a/src/ahriman/core/util.py b/src/ahriman/core/util.py
index feda5a3a..6df666be 100644
--- a/src/ahriman/core/util.py
+++ b/src/ahriman/core/util.py
@@ -349,7 +349,7 @@ def pretty_datetime(timestamp: datetime.datetime | float | int | None) -> str:
if timestamp is None:
return ""
if isinstance(timestamp, (int, float)):
- timestamp = datetime.datetime.utcfromtimestamp(timestamp)
+ timestamp = datetime.datetime.fromtimestamp(timestamp, datetime.UTC)
return timestamp.strftime("%Y-%m-%d %H:%M:%S")
@@ -505,7 +505,7 @@ def utcnow() -> datetime.datetime:
Returns:
datetime.datetime: current time in UTC
"""
- return datetime.datetime.utcnow()
+ return datetime.datetime.now(datetime.UTC)
def walk(directory_path: Path) -> Generator[Path, None, None]:
diff --git a/src/ahriman/models/aur_package.py b/src/ahriman/models/aur_package.py
index 4ec2888e..cd73fab5 100644
--- a/src/ahriman/models/aur_package.py
+++ b/src/ahriman/models/aur_package.py
@@ -137,8 +137,8 @@ class AURPackage:
description=package.desc,
num_votes=0,
popularity=0.0,
- first_submitted=datetime.datetime.utcfromtimestamp(0),
- last_modified=datetime.datetime.utcfromtimestamp(package.builddate),
+ first_submitted=datetime.datetime.fromtimestamp(0, datetime.UTC),
+ last_modified=datetime.datetime.fromtimestamp(package.builddate, datetime.UTC),
url_path="",
url=package.url,
out_of_date=None,
@@ -175,13 +175,11 @@ class AURPackage:
description=dump["pkgdesc"],
num_votes=0,
popularity=0.0,
- first_submitted=datetime.datetime.utcfromtimestamp(0),
- last_modified=datetime.datetime.strptime(dump["last_update"], "%Y-%m-%dT%H:%M:%S.%fZ"),
+ first_submitted=datetime.datetime.fromtimestamp(0, datetime.UTC),
+ last_modified=datetime.datetime.fromisoformat(dump["last_update"]),
url_path="",
url=dump["url"],
- out_of_date=datetime.datetime.strptime(
- dump["flag_date"],
- "%Y-%m-%dT%H:%M:%S.%fZ") if dump["flag_date"] is not None else None,
+ out_of_date=datetime.datetime.fromisoformat(dump["flag_date"]) if dump.get("flag_date") else None,
maintainer=next(iter(dump["maintainers"]), None),
submitter=None,
repository=dump["repo"],
@@ -208,9 +206,9 @@ class AURPackage:
"""
identity_mapper: Callable[[Any], Any] = lambda value: value
value_mapper: dict[str, Callable[[Any], Any]] = {
- "out_of_date": lambda value: datetime.datetime.utcfromtimestamp(value) if value is not None else None,
- "first_submitted": datetime.datetime.utcfromtimestamp,
- "last_modified": datetime.datetime.utcfromtimestamp,
+ "out_of_date": lambda value: datetime.datetime.fromtimestamp(value, datetime.UTC) if value is not None else None,
+ "first_submitted": lambda value: datetime.datetime.fromtimestamp(value, datetime.UTC),
+ "last_modified": lambda value: datetime.datetime.fromtimestamp(value, datetime.UTC),
}
result: dict[str, Any] = {}
diff --git a/tests/ahriman/conftest.py b/tests/ahriman/conftest.py
index 07cbc14f..f8e77228 100644
--- a/tests/ahriman/conftest.py
+++ b/tests/ahriman/conftest.py
@@ -133,8 +133,8 @@ def aur_package_ahriman() -> AURPackage:
description="ArcH linux ReposItory MANager",
num_votes=0,
popularity=0,
- first_submitted=datetime.datetime.utcfromtimestamp(1618008285),
- last_modified=datetime.datetime.utcfromtimestamp(1673826351),
+ first_submitted=datetime.datetime.fromtimestamp(1618008285, datetime.UTC),
+ last_modified=datetime.datetime.fromtimestamp(1673826351, datetime.UTC),
url_path="/cgit/aur.git/snapshot/ahriman.tar.gz",
url="https://github.com/arcan1s/ahriman",
out_of_date=None,
@@ -200,8 +200,8 @@ def aur_package_akonadi() -> AURPackage:
description="PIM layer, which provides an asynchronous API to access all kind of PIM data",
num_votes=0,
popularity=0.0,
- first_submitted=datetime.datetime.utcfromtimestamp(0),
- last_modified=datetime.datetime.utcfromtimestamp(1646555990.610),
+ first_submitted=datetime.datetime.fromtimestamp(0, datetime.UTC),
+ last_modified=datetime.datetime.fromtimestamp(1646555990.610, datetime.UTC),
url_path="",
url="https://kontact.kde.org",
out_of_date=None,
diff --git a/tests/ahriman/core/report/test_remote_call.py b/tests/ahriman/core/report/test_remote_call.py
index a6b34ccd..d4ed263d 100644
--- a/tests/ahriman/core/report/test_remote_call.py
+++ b/tests/ahriman/core/report/test_remote_call.py
@@ -85,7 +85,7 @@ def test_remote_update(remote_call: RemoteCall, mocker: MockerFixture) -> None:
"aur": False,
"local": False,
"manual": True,
- })
+ })
def test_remote_wait(remote_call: RemoteCall, mocker: MockerFixture) -> None:
diff --git a/tests/ahriman/core/support/pkgbuild/test_pkgbuild_generator.py b/tests/ahriman/core/support/pkgbuild/test_pkgbuild_generator.py
index d4857c71..e612727f 100644
--- a/tests/ahriman/core/support/pkgbuild/test_pkgbuild_generator.py
+++ b/tests/ahriman/core/support/pkgbuild/test_pkgbuild_generator.py
@@ -6,7 +6,6 @@ from pytest_mock import MockerFixture
from unittest.mock import MagicMock, call as MockCall
from ahriman.core.support.pkgbuild.pkgbuild_generator import PkgbuildGenerator
-from ahriman.core.util import utcnow
from ahriman.models.pkgbuild_patch import PkgbuildPatch
@@ -38,7 +37,7 @@ def test_pkgver(pkgbuild_generator: PkgbuildGenerator, mocker: MockerFixture) ->
must implement default version as current date
"""
mocker.patch("ahriman.core.support.pkgbuild.pkgbuild_generator.utcnow", return_value=datetime.datetime(2002, 3, 11))
- assert pkgbuild_generator.pkgver == utcnow().strftime("20020311")
+ assert pkgbuild_generator.pkgver == "20020311"
def test_url(pkgbuild_generator: PkgbuildGenerator) -> None: