commit: a28c4971887aa774f5f589662646da8f6dcb7c4e Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Sat Jul 15 08:18:03 2023 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Sat Jul 15 08:18:03 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=a28c4971
multiplex.tree: fix config name and type Resolves: https://github.com/pkgcore/pkgcheck/issues/602 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> src/pkgcore/pkgsets/live_rebuild_set.py | 2 +- src/pkgcore/repository/multiplex.py | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/pkgcore/pkgsets/live_rebuild_set.py b/src/pkgcore/pkgsets/live_rebuild_set.py index baa2d93fa..7a8647201 100644 --- a/src/pkgcore/pkgsets/live_rebuild_set.py +++ b/src/pkgcore/pkgsets/live_rebuild_set.py @@ -25,7 +25,7 @@ class EclassConsumerSet(VersionedInstalled): if not pkgs: # pkg is installed but no longer in any repo, just ignore it. continue - assert len(pkgs) == 1, "I do not know what I am doing: %r" % (pkgs,) + assert len(pkgs) == 1, f"I do not know what I am doing: {pkgs}" pkg = pkgs[0] if self.eclasses.isdisjoint(pkg.data.get("_eclasses_", ())): yield atom diff --git a/src/pkgcore/repository/multiplex.py b/src/pkgcore/repository/multiplex.py index e46799939..f56dfb0e3 100644 --- a/src/pkgcore/repository/multiplex.py +++ b/src/pkgcore/repository/multiplex.py @@ -81,8 +81,9 @@ class tree(prototype.tree): pkgcore_config_type = ConfigHint(types={"repos": "refs:repo"}, typename="repo") - def __init__(self, *trees): + def __init__(self, *trees, repos=()): super().__init__() + trees = trees + tuple(repos) for x in trees: if not hasattr(x, "itermatch"): raise errors.InitializationError( @@ -229,8 +230,7 @@ class tree(prototype.tree): elif isinstance(other, tree): return tree(*(self.trees + other.trees)) raise TypeError( - "cannot add '%s' and '%s' objects" - % (self.__class__.__name__, other.__class__.__name__) + f"cannot add {other.__class__.__name__!r} and {self.__class__.__name__!r} objects" ) def __radd__(self, other): @@ -241,17 +241,11 @@ class tree(prototype.tree): elif isinstance(other, tree): return tree(*(other.trees + self.trees)) raise TypeError( - "cannot add '%s' and '%s' objects" - % (other.__class__.__name__, self.__class__.__name__) + f"cannot add {other.__class__.__name__!r} and {self.__class__.__name__!r} objects" ) def __repr__(self): - return "<%s.%s trees=%r @%#8x>" % ( - self.__class__.__module__, - self.__class__.__name__, - getattr(self, "trees", "unset"), - id(self), - ) + return f"<{self.__class__.__module__}.{self.__class__.__name__} trees={getattr(self, 'trees', 'unset')!r} @{id(self):#8x}>" @property def pkg_masks(self):