From ed77e389af974f660b73f7f65f71ff777ecde30c Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 7 Apr 2023 22:29:47 -0700 Subject: [PATCH] only mutable variant should have rename_top --- masque/library.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/masque/library.py b/masque/library.py index 17f8277..6940613 100644 --- a/masque/library.py +++ b/masque/library.py @@ -336,14 +336,6 @@ class ILibraryView(Mapping[str, 'Pattern'], metaclass=ABCMeta): """ return self[self.top()] - def rename_top(self, name: str) -> Self: - """ - Rename the (single) top pattern - """ - self.rename(self.top(), name, move_references=True) - return self - - def dfs( self, pattern: 'Pattern', @@ -497,6 +489,14 @@ class ILibrary(ILibraryView, MutableMapping[str, 'Pattern'], metaclass=ABCMeta): self.move_references(old_name, new_name) return self + def rename_top(self, name: str) -> Self: + """ + Rename the (single) top pattern + """ + self.rename(self.top(), name, move_references=True) + return self + + def move_references(self, old_target: str, new_target: str) -> Self: """ Change all references pointing at `old_target` into references pointing at `new_target`.