Skip to content

Commit

Permalink
Deprecate butler.collections as list of defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
dhirving committed Oct 11, 2024
1 parent 02f143d commit ef4ef27
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/lsst/daf/butler/_butler_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from collections.abc import Iterable, Mapping, Sequence, Set
from typing import TYPE_CHECKING, Any, overload

from deprecated.sphinx import deprecated
from pydantic import BaseModel

from ._collection_type import CollectionType
Expand Down Expand Up @@ -83,9 +84,21 @@ def __getitem__(self, index: int) -> str: ...
@overload
def __getitem__(self, index: slice) -> Sequence[str]: ...

@deprecated(
"'Butler.collections' will no longer directly contain the list of default collections"
" after v28. Use 'Butler.collections.defaults' instead.",
version="v28",
category=FutureWarning,
)
def __getitem__(self, index: int | slice) -> str | Sequence[str]:
return self.defaults[index]

@deprecated(
"'Butler.collections' will no longer directly contain the list of default collections"
" after v28. Use 'Butler.collections.defaults' instead.",
version="v28",
category=FutureWarning,
)
def __len__(self) -> int:
return len(self.defaults)

Expand Down

0 comments on commit ef4ef27

Please sign in to comment.