set_const doesn't need to take in a separate key, can just use the pattern's name

might as well make the convenience function convenient
nolock
jan 2 years ago
parent 86315fc32b
commit 566ba99f9c

@ -78,16 +78,15 @@ class DeviceLibrary:
def __repr__(self) -> str:
return '<DeviceLibrary with keys ' + repr(list(self.generators.keys())) + '>'
def set_const(self, key: str, const: 'Device') -> None:
def set_const(self, const: 'Device') -> None:
"""
Convenience function to avoid having to manually wrap
constant values into callables.
already-generated Device objects into callables.
Args:
key: Lookup key, usually the device name
const: Device object to return
const: Pre-generated device object
"""
self.generators[key] = lambda: const
self.generators[const.pattern.name] = lambda: const
def add(self: L, other: L) -> L:
"""

Loading…
Cancel
Save