From d147228d83e5eadf1901771a5fe26b927a5faad1 Mon Sep 17 00:00:00 2001 From: Andy Salnikov Date: Tue, 17 Oct 2023 11:55:34 -0700 Subject: [PATCH] Use slots flag with datastore records dataclasses --- python/lsst/daf/butler/datastore/stored_file_info.py | 4 +--- python/lsst/daf/butler/datastores/inMemoryDatastore.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/python/lsst/daf/butler/datastore/stored_file_info.py b/python/lsst/daf/butler/datastore/stored_file_info.py index 40ed1d663c..f00cbe4a87 100644 --- a/python/lsst/daf/butler/datastore/stored_file_info.py +++ b/python/lsst/daf/butler/datastore/stored_file_info.py @@ -170,12 +170,10 @@ def from_records( return [klass.from_record(record) for record in records] -@dataclass(frozen=True) +@dataclass(frozen=True, slots=True) class StoredFileInfo(StoredDatastoreItemInfo): """Datastore-private metadata associated with a Datastore file.""" - __slots__ = {"formatter", "path", "storageClass", "component", "checksum", "file_size"} - storageClassFactory = StorageClassFactory() def __init__( diff --git a/python/lsst/daf/butler/datastores/inMemoryDatastore.py b/python/lsst/daf/butler/datastores/inMemoryDatastore.py index 66ec3cf938..6aa9474e0d 100644 --- a/python/lsst/daf/butler/datastores/inMemoryDatastore.py +++ b/python/lsst/daf/butler/datastores/inMemoryDatastore.py @@ -54,14 +54,12 @@ log = logging.getLogger(__name__) -@dataclass(frozen=True) +@dataclass(frozen=True, slots=True) class StoredMemoryItemInfo(StoredDatastoreItemInfo): """Internal InMemoryDatastore Metadata associated with a stored DatasetRef. """ - __slots__ = {"timestamp", "storageClass", "parentID"} - timestamp: float """Unix timestamp indicating the time the dataset was stored."""