style: autoformat src and tests

Repository-wide formatting pass over src/ and tests/: sorted imports and
__all__ entries, dropped redundant `# -*- coding: utf-8 -*-` headers,
unquoted forward-reference annotations (safe under
`from __future__ import annotations`), merged nested `with` statements,
moved `Iterable` and friends from `typing` to `collections.abc`, and
removed `# noqa: F401` markers that no longer suppress anything.

No behavioural changes. Unit and integration suites show the same four
pre-existing failures before and after the pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-Birkenbach
2026-07-27 15:17:35 +02:00
parent f1517963a5
commit 8294bce436
185 changed files with 378 additions and 445 deletions

View File

@@ -2,8 +2,8 @@ import unittest
from unittest.mock import patch
from pkgmgr.actions.branch.close_branch import close_branch
from pkgmgr.core.git.errors import GitRunError
from pkgmgr.core.git.commands import GitDeleteRemoteBranchError
from pkgmgr.core.git.errors import GitRunError
class TestCloseBranch(unittest.TestCase):

View File

@@ -2,8 +2,8 @@ import unittest
from unittest.mock import patch
from pkgmgr.actions.branch.drop_branch import drop_branch
from pkgmgr.core.git.errors import GitRunError
from pkgmgr.core.git.commands import GitDeleteRemoteBranchError
from pkgmgr.core.git.errors import GitRunError
class TestDropBranch(unittest.TestCase):

View File

@@ -3,7 +3,8 @@ from __future__ import annotations
import unittest
from pkgmgr.actions.install.installers.nix.conflicts import NixConflictResolver
from ._fakes import FakeRunResult, FakeRunner, FakeRetry
from ._fakes import FakeRetry, FakeRunner, FakeRunResult
class DummyCtx:

View File

@@ -4,7 +4,8 @@ import json
import unittest
from pkgmgr.actions.install.installers.nix.profile import NixProfileInspector
from ._fakes import FakeRunResult, FakeRunner
from ._fakes import FakeRunner, FakeRunResult
class TestNixProfileInspector(unittest.TestCase):

View File

@@ -4,6 +4,7 @@ import unittest
from unittest.mock import MagicMock
from pkgmgr.actions.install.installers.nix.installer import NixFlakeInstaller
from ._fakes import FakeRunResult

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Unit tests for NixFlakeInstaller using unittest (no pytest).

View File

@@ -2,11 +2,11 @@ from __future__ import annotations
import unittest
from pkgmgr.actions.install.installers.nix.profile.models import NixProfileEntry
from pkgmgr.actions.install.installers.nix.profile.matcher import (
entry_matches_output,
entry_matches_store_path,
)
from pkgmgr.actions.install.installers.nix.profile.models import NixProfileEntry
class TestMatcher(unittest.TestCase):

View File

@@ -3,7 +3,8 @@ from __future__ import annotations
import unittest
from pkgmgr.actions.install.installers.nix.profile_list import NixProfileListReader
from ._fakes import FakeRunResult, FakeRunner
from ._fakes import FakeRunner, FakeRunResult
class TestNixProfileListReader(unittest.TestCase):

View File

@@ -1,8 +1,9 @@
# tests/unit/pkgmgr/installers/test_base.py
import unittest
from pkgmgr.actions.install.installers.base import BaseInstaller
from pkgmgr.actions.install.context import RepoContext
from pkgmgr.actions.install.installers.base import BaseInstaller
class DummyInstaller(BaseInstaller):

View File

@@ -2,7 +2,7 @@
import os
import unittest
from unittest.mock import patch, mock_open
from unittest.mock import mock_open, patch
from pkgmgr.actions.install.context import RepoContext
from pkgmgr.actions.install.installers.makefile import MakefileInstaller

View File

@@ -1,16 +1,16 @@
# tests/unit/pkgmgr/test_capabilities.py
import unittest
from unittest.mock import patch, mock_open
from unittest.mock import mock_open, patch
from pkgmgr.actions.install.capabilities import (
PythonRuntimeCapability,
LAYER_ORDER,
CapabilityMatcher,
MakeInstallCapability,
NixFlakeCapability,
CapabilityMatcher,
PythonRuntimeCapability,
detect_capabilities,
resolve_effective_capabilities,
LAYER_ORDER,
)

View File

@@ -1,4 +1,5 @@
import unittest
from pkgmgr.actions.install.context import RepoContext

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import unittest
@@ -8,7 +7,6 @@ from unittest.mock import MagicMock, patch
from pkgmgr.actions.install import install_repos
Repository = Dict[str, Any]

View File

@@ -1,12 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import unittest
from pkgmgr.actions.install.layers import (
CliLayer,
CLI_LAYERS,
CliLayer,
classify_command_layer,
layer_priority,
)

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from unittest.mock import MagicMock, patch

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations

View File

@@ -22,25 +22,24 @@ class TestGitRemotePrimaryPush(unittest.TestCase):
},
)
with patch("os.path.isdir", return_value=True):
with (
patch(
"pkgmgr.actions.mirror.git_remote.has_origin_remote",
return_value=False,
),
patch("pkgmgr.actions.mirror.git_remote.add_remote") as m_add_remote,
patch(
"pkgmgr.actions.mirror.git_remote.set_remote_url"
) as m_set_remote_url,
patch(
"pkgmgr.actions.mirror.git_remote.get_remote_push_urls",
return_value=set(),
),
patch(
"pkgmgr.actions.mirror.git_remote.add_remote_push_url"
) as m_add_push,
):
ensure_origin_remote(repo, ctx, preview=False)
with (
patch("os.path.isdir", return_value=True), patch(
"pkgmgr.actions.mirror.git_remote.has_origin_remote",
return_value=False,
),
patch("pkgmgr.actions.mirror.git_remote.add_remote") as m_add_remote,
patch(
"pkgmgr.actions.mirror.git_remote.set_remote_url"
) as m_set_remote_url,
patch(
"pkgmgr.actions.mirror.git_remote.get_remote_push_urls",
return_value=set(),
),
patch(
"pkgmgr.actions.mirror.git_remote.add_remote_push_url"
) as m_add_push,
):
ensure_origin_remote(repo, ctx, preview=False)
# determine_primary_remote_url falls back to file order (primary first)
m_add_remote.assert_called_once_with(

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations

View File

@@ -4,7 +4,7 @@ from __future__ import annotations
import io
import unittest
from contextlib import redirect_stdout
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch
from pkgmgr.actions.mirror.visibility_cmd import set_mirror_visibility

View File

@@ -1,4 +1,5 @@
import unittest
from pkgmgr.actions.publish.pypi_url import parse_pypi_project_url

View File

@@ -5,7 +5,7 @@ import unittest
class TestReleasePackageInit(unittest.TestCase):
def test_release_is_reexported(self) -> None:
from pkgmgr.actions.release import release # noqa: F401
from pkgmgr.actions.release import release
self.assertTrue(callable(release))

View File

@@ -3,11 +3,11 @@ from __future__ import annotations
import unittest
from unittest.mock import patch
from pkgmgr.core.version.semver import SemVer
from pkgmgr.actions.release.versioning import (
determine_current_version,
bump_semver,
determine_current_version,
)
from pkgmgr.core.version.semver import SemVer
class TestDetermineCurrentVersion(unittest.TestCase):

View File

@@ -4,10 +4,10 @@ import unittest
from pkgmgr.actions.repository.create.model import RepoParts
from pkgmgr.actions.repository.create.parser import (
parse_identifier,
_parse_git_url,
_strip_git_suffix,
_split_host_port,
_strip_git_suffix,
parse_identifier,
)

View File

@@ -4,8 +4,8 @@ import unittest
from unittest.mock import patch
from pkgmgr.actions.changelog import generate_changelog
from pkgmgr.core.git.queries import GitChangelogQueryError
from pkgmgr.cli.commands.changelog import _find_previous_and_current_tag
from pkgmgr.core.git.queries import GitChangelogQueryError
class TestGenerateChangelog(unittest.TestCase):