diff options
author | 2024-01-15 17:22:58 -0800 | |
---|---|---|
committer | 2024-01-23 00:52:08 -0800 | |
commit | cc6a8d054363561890bb0552f1439a8ace92b367 (patch) | |
tree | 05d0f6f85a8a4193bad20cc813377921f92db1c2 | |
parent | fix filtered.tree.{categories,packages,versions} . (diff) | |
download | pkgcore-cc6a8d054363561890bb0552f1439a8ace92b367.tar.gz pkgcore-cc6a8d054363561890bb0552f1439a8ace92b367.tar.bz2 pkgcore-cc6a8d054363561890bb0552f1439a8ace92b367.zip |
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@gmail.com>
-rw-r--r-- | src/pkgcore/repository/prototype.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pkgcore/repository/prototype.py b/src/pkgcore/repository/prototype.py index 8830459e..e69af82f 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") |