commit:     cc6a8d054363561890bb0552f1439a8ace92b367
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Tue Jan 16 01:22:58 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 23 08:52:08 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=cc6a8d05

refactor: leverage ABC protections for prototype.tree

This was always an abstract class, just typing/ABC didn't
exist when it was written.  Leverage modern protections.

Signed-off-by: Brian Harring <ferringb <AT> gmail.com>

 src/pkgcore/repository/prototype.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/pkgcore/repository/prototype.py 
b/src/pkgcore/repository/prototype.py
index 8830459e9..e69af82ff 100644
--- a/src/pkgcore/repository/prototype.py
+++ b/src/pkgcore/repository/prototype.py
@@ -15,6 +15,7 @@ from ..ebuild.atom import atom
 from ..operations import repo
 from ..restrictions import boolean, packages, restriction, values
 from ..restrictions.util import collect_package_restrictions
+import abc
 
 
 class CategoryLazyFrozenSet:
@@ -94,8 +95,8 @@ class VersionMapping(DictMixin):
             self._cache.pop(key, None)
 
 
-class tree:
-    """Template for all repository variants.
+class tree(abc.ABC):
+    """ABC for all repository variants.
 
     Args:
         frozen (bool): controls whether the repository is mutable or immutable
@@ -139,14 +140,17 @@ class tree:
         """Return a configured form of the repository."""
         raise NotImplementedError(self, "configure")
 
+    @abc.abstractmethod
     def _get_categories(self):
         """this must return a list, or sequence"""
         raise NotImplementedError(self, "_get_categories")
 
+    @abc.abstractmethod
     def _get_packages(self, category):
         """this must return a list, or sequence"""
         raise NotImplementedError(self, "_get_packages")
 
+    @abc.abstractmethod
     def _get_versions(self, package):
         """this must return a list, or sequence"""
         raise NotImplementedError(self, "_get_versions")

Reply via email to