From cc6a8d054363561890bb0552f1439a8ace92b367 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Mon, 15 Jan 2024 17:22:58 -0800 Subject: 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 --- 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 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") -- cgit v1.2.3-65-gdbad