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:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -4,6 +4,7 @@ import unittest
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from pkgmgr.actions.install.installers.nix.installer import NixFlakeInstaller
|
||||
|
||||
from ._fakes import FakeRunResult
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Unit tests for NixFlakeInstaller using unittest (no pytest).
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import unittest
|
||||
|
||||
from pkgmgr.actions.install.context import RepoContext
|
||||
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import unittest
|
||||
|
||||
from pkgmgr.actions.publish.pypi_url import parse_pypi_project_url
|
||||
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user