From 566ba99f9c06e93d700fff51db3a2009e90c3508 Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 27 Feb 2022 21:15:58 -0800 Subject: [PATCH] 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 --- masque/library/device_library.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/masque/library/device_library.py b/masque/library/device_library.py index 6f4b0c9..f1a3b6f 100644 --- a/masque/library/device_library.py +++ b/masque/library/device_library.py @@ -78,16 +78,15 @@ class DeviceLibrary: def __repr__(self) -> str: return '' - 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: """