Skip to content

Commit

Permalink
Rename cache class
Browse files Browse the repository at this point in the history
  • Loading branch information
dhirving committed Dec 11, 2024
1 parent 163ae6e commit 8dfcee8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

from ...._dataset_type import DatasetType
from ....dimensions import DimensionGroup
from .tables import DynamicTables, DynamicTablesCache
from .tables import DynamicTables, TableCache


class DatasetTypeCache:
Expand All @@ -54,7 +54,7 @@ class DatasetTypeCache:
"""

def __init__(self) -> None:
self.tables = DynamicTablesCache()
self.tables = TableCache()
self._by_name_cache: dict[str, tuple[DatasetType, int]] = {}
self._by_dimensions_cache: dict[DimensionGroup, DynamicTables] = {}
self._full = False
Expand Down
12 changes: 5 additions & 7 deletions python/lsst/daf/butler/registry/datasets/byDimensions/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def makeCalibTableSpec(
return tableSpec


DynamicTablesCache: TypeAlias = ThreadSafeCache[str, sqlalchemy.Table]
TableCache: TypeAlias = ThreadSafeCache[str, sqlalchemy.Table]


@immutable
Expand Down Expand Up @@ -519,7 +519,7 @@ def from_dimensions_key(
calibs_name=makeCalibTableName(dimensions_key) if is_calibration else None,
)

def create(self, db: Database, collections: type[CollectionManager], cache: DynamicTablesCache) -> None:
def create(self, db: Database, collections: type[CollectionManager], cache: TableCache) -> None:
"""Create the tables if they don't already exist.
Parameters
Expand Down Expand Up @@ -551,7 +551,7 @@ def create(self, db: Database, collections: type[CollectionManager], cache: Dyna
)

def add_calibs(
self, db: Database, collections: type[CollectionManager], cache: DynamicTablesCache
self, db: Database, collections: type[CollectionManager], cache: TableCache
) -> DynamicTables:
"""Create a calibs table for a dataset type whose dimensions already
have a tags table.
Expand All @@ -577,9 +577,7 @@ def add_calibs(

return self.copy(calibs_name=calibs_name)

def tags(
self, db: Database, collections: type[CollectionManager], cache: DynamicTablesCache
) -> sqlalchemy.Table:
def tags(self, db: Database, collections: type[CollectionManager], cache: TableCache) -> sqlalchemy.Table:
"""Return the "tags" table that associates datasets with data IDs in
TAGGED and RUN collections.
Expand Down Expand Up @@ -612,7 +610,7 @@ def tags(
return cache.set_or_get(self.tags_name, table)

def calibs(
self, db: Database, collections: type[CollectionManager], cache: DynamicTablesCache
self, db: Database, collections: type[CollectionManager], cache: TableCache
) -> sqlalchemy.Table:
"""Return the "calibs" table that associates datasets with data IDs and
timespans in CALIBRATION collections.
Expand Down

0 comments on commit 8dfcee8

Please sign in to comment.