commit: a90e8deaf125a0a92754b49ae6e08c22cc08f33d
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Sun Nov 23 16:21:43 2025 +0000
Commit: Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Sun Nov 23 16:21:43 2025 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=a90e8dea
chore: don't inject all Result classes into pkgcheck/__init__.py
Nothing uses this- I assume it's a historical hold over, but these
are accessible via object.KEYWORDS, so folks should use that registry.
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
src/pkgcheck/__init__.py | 21 ++-------------------
tests/test_api.py | 14 +-------------
2 files changed, 3 insertions(+), 32 deletions(-)
diff --git a/src/pkgcheck/__init__.py b/src/pkgcheck/__init__.py
index 7b1ba8dd..301838af 100644
--- a/src/pkgcheck/__init__.py
+++ b/src/pkgcheck/__init__.py
@@ -1,24 +1,7 @@
-from importlib import import_module as _import
-
-from .api import keywords, scan
+from .api import scan
from .base import PkgcheckException
from .results import Result
-__all__ = ("keywords", "scan", "PkgcheckException", "Result")
+__all__ = ("scan", "PkgcheckException", "Result")
__title__ = "pkgcheck"
__version__ = "0.10.38"
-
-
-def __getattr__(name):
- """Provide import access to keyword classes."""
- if name in keywords:
- return keywords[name]
-
- try:
- return _import("." + name, __name__)
- except ImportError:
- raise AttributeError(f"module {__name__} has no attribute {name}")
-
-
-def __dir__():
- return sorted(__all__ + tuple(keywords))
diff --git a/tests/test_api.py b/tests/test_api.py
index cf546ee5..3c3faa97 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -3,8 +3,8 @@ import os
import signal
import pytest
+
from pkgcheck import PkgcheckException, scan
-from pkgcheck import objects
class TestScanApi:
@@ -24,18 +24,6 @@ class TestScanApi:
def test_no_base_args(self, repo):
assert [] == list(scan(self.scan_args + ["-r", repo.location]))
- def test_keyword_import(self):
- """Keyword classes are importable from the top-level module."""
- from pkgcheck import NonsolvableDeps, Result
-
- assert issubclass(NonsolvableDeps, Result)
-
- def test_module_attributes(self):
- """All keyword class names are shown for the top-level module."""
- import pkgcheck
-
- assert set(objects.KEYWORDS) < set(dir(pkgcheck))
-
def test_sigint_handling(self, repo):
"""Verify SIGINT is properly handled by the parallelized pipeline."""