only mutable variant should have rename_top
This commit is contained in:
parent
08291da167
commit
c5c31a5f0f
@ -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`.
|
||||
|
Loading…
Reference in New Issue
Block a user