Skip to content

Commit

Permalink
Use slots flag with datastore records dataclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-slac committed Oct 17, 2023
1 parent 19ac7b3 commit d147228
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions python/lsst/daf/butler/datastore/stored_file_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
4 changes: 1 addition & 3 deletions python/lsst/daf/butler/datastores/inMemoryDatastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down

0 comments on commit d147228

Please sign in to comment.