From 86315fc32b9cc50d003086bf424f8f5af8edd5e9 Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 27 Feb 2022 21:15:05 -0800 Subject: [PATCH] improve DeviceLibrary docstring --- masque/library/device_library.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/masque/library/device_library.py b/masque/library/device_library.py index cf06e72..6f4b0c9 100644 --- a/masque/library/device_library.py +++ b/masque/library/device_library.py @@ -7,7 +7,7 @@ from typing import Any, Tuple, Union, Iterator import logging from pprint import pformat -from ..error import LibraryError +from ..error import DeviceLibraryError if TYPE_CHECKING: from ..builder import Device @@ -21,10 +21,16 @@ L = TypeVar('L', bound='DeviceLibrary') class DeviceLibrary: """ - This class is usually used to create a device library by mapping names to - functions which generate or load the relevant `Device` object as-needed. + This class maps names to functions which generate or load the + relevant `Device` object. - The cache can be disabled by setting the `enable_cache` attribute to `False`. + This class largely functions the same way as `Library`, but + operates on `Device`s rather than `Patterns` and thus has no + need for distinctions between primary/secondary devices (as + there is no inter-`Device` hierarchy). + + Each device is cached the first time it is used. The cache can + be disabled by setting the `enable_cache` attribute to `False`. """ generators: Dict[str, Callable[[], 'Device']] cache: Dict[Union[str, Tuple[str, str]], 'Device']