add Device.rename()
This commit is contained in:
parent
dbee0027b2
commit
4788fa3ca5
@ -724,6 +724,19 @@ class Device(Copyable, Mirrorable):
|
|||||||
self._dead = True
|
self._dead = True
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def rename(self: D, name: str) -> D:
|
||||||
|
"""
|
||||||
|
Renames the pattern and returns the device
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name: The new name
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
self
|
||||||
|
"""
|
||||||
|
self.name = name
|
||||||
|
return self
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
s = f'<Device {self.pattern} ['
|
s = f'<Device {self.pattern} ['
|
||||||
for name, port in self.ports.items():
|
for name, port in self.ports.items():
|
||||||
|
Loading…
Reference in New Issue
Block a user