Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated items slated for removal in v0.4.0 #958

Merged
merged 6 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

-
- The `coreax.kernel` module, deprecated in v0.3.0, has been removed. The kernels have
been moved to submodules of `coreax.kernels` - see the "Deprecated" section of v0.3.0
for more information. (https://github.com/gchq/coreax/pull/958)
- `coreax.util.median_heuristic`, deprecated in v0.3.0 has been removed. This should be
replaced with `coreax.kernels.util.median_heuristic`.
for more information. (https://github.com/gchq/coreax/pull/958)

### Deprecated

Expand Down
60 changes: 40 additions & 20 deletions coreax/coreset.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def pre_coreset_data(self) -> _TOriginalData_co:

@property
@abstractmethod
@deprecated("Narrow to a subclass, then use `.indices` or `.points` instead.")
@deprecated(
"Narrow to a subclass, then use `.indices` or `.points` instead. "
+ "Deprecated since v0.4.0. "
+ "Will be removed in v0.5.0."
)
def nodes(self) -> Data:
"""Deprecated alias for `indices` or `points`, depending on subclass."""

Expand All @@ -98,7 +102,11 @@ def __check_init__(self) -> None:
)

@property
@deprecated("Use `.points` instead.")
@deprecated(
"Use `.points` instead. "
+ "Deprecated since v0.4.0. "
+ "Will be removed in v0.5.0."
)
def coreset(self) -> _TPointsData_co:
"""Deprecated alias for `.points`."""
return self.points
Expand Down Expand Up @@ -130,28 +138,28 @@ def __init__(self, nodes: Data, pre_coreset_data: _TOriginalData_co) -> None:
"""Initialise self."""
if isinstance(nodes, Array):
warnings.warn(
"Passing Arrays into PseudoCoreset() is deprecated. "
"Passing Arrays into PseudoCoreset() is deprecated since v0.4.0. "
"Use PseudoCoreset.build() instead. "
"In future, this will become a TypeError.",
"In v0.5.0, this will become a TypeError.",
DeprecationWarning,
stacklevel=2,
)
nodes = as_data(nodes) # pyright: ignore[reportAssignmentType]
if isinstance(pre_coreset_data, Array):
warnings.warn(
"Passing Arrays into PseudoCoreset() is deprecated. "
"Passing Arrays into PseudoCoreset() is deprecated since v0.4.0. "
"Use PseudoCoreset.build() instead. "
"In future, this will become a TypeError.",
"In v0.5.0, this will become a TypeError.",
DeprecationWarning,
stacklevel=2,
)
# pylint: disable-next=line-too-long
pre_coreset_data = as_data(pre_coreset_data) # pyright: ignore[reportAssignmentType]
if isinstance(pre_coreset_data, tuple):
warnings.warn(
"Passing Arrays into PseudoCoreset() is deprecated. "
"Passing Arrays into PseudoCoreset() is deprecated since v0.4.0. "
"Use PseudoCoreset.build() instead. "
"In future, this will become a TypeError.",
"In v0.5.0, this will become a TypeError.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -233,7 +241,11 @@ def pre_coreset_data(self):

@property
@override
@deprecated("Use `.points` instead.")
@deprecated(
"Use `.points` instead. "
+ "Deprecated since v0.4.0. "
+ "Will be removed in v0.5.0."
)
def nodes(self) -> Data:
"""Deprecated alias for `points`."""
return self.points
Expand All @@ -245,7 +257,11 @@ def solve_weights(self, solver: WeightsOptimiser[Data], **solver_kwargs) -> Self
return eqx.tree_at(lambda x: x.points.weights, self, weights)


@deprecated("Use AbstractCoreset, PseudoCoreset, or Coresubset instead.")
@deprecated(
"Use AbstractCoreset, PseudoCoreset, or Coresubset instead. "
+ "Deprecated since v0.4.0. "
+ "Will be removed in v0.5.0."
)
class Coreset(PseudoCoreset):
"""Deprecated - split into AbstractCoreset and PseudoCoreset."""

Expand Down Expand Up @@ -290,28 +306,28 @@ def __init__(self, indices: Data, pre_coreset_data: _TOriginalData_co) -> None:
"""Handle type conversion of ``indices`` and ``pre_coreset_data``."""
if isinstance(indices, Array):
warnings.warn(
"Passing Arrays into PseudoCoreset() is deprecated. "
"Use PseudoCoreset.build() instead. "
"In future, this will become a TypeError.",
"Passing Arrays into Coresubset() is deprecated since v0.4.0. "
"Use Coresubset.build() instead. "
"In v0.5.0, this will become a TypeError.",
DeprecationWarning,
stacklevel=2,
)
indices = as_data(indices) # pyright: ignore[reportAssignmentType]
if isinstance(pre_coreset_data, Array):
warnings.warn(
"Passing Arrays into PseudoCoreset() is deprecated. "
"Use PseudoCoreset.build() instead. "
"In future, this will become a TypeError.",
"Passing Arrays into Coresubset() is deprecated since v0.4.0. "
"Use Coresubset.build() instead. "
"In v0.5.0, this will become a TypeError.",
DeprecationWarning,
stacklevel=2,
)
# pylint: disable-next=line-too-long
pre_coreset_data = as_data(pre_coreset_data) # pyright: ignore[reportAssignmentType]
if isinstance(pre_coreset_data, tuple):
warnings.warn(
"Passing Arrays into PseudoCoreset() is deprecated. "
"Use PseudoCoreset.build() instead. "
"In future, this will become a TypeError.",
"Passing Arrays into Coresubset() is deprecated since v0.4.0. "
"Use Coresubset.build() instead. "
"In v0.5.0, this will become a TypeError.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -409,7 +425,11 @@ def indices(self) -> Data:

@property
@override
@deprecated("Use `.indices` instead.")
@deprecated(
"Use `.indices` instead. "
+ "Deprecated since v0.4.0. "
+ "Will be removed in v0.5.0."
)
def nodes(self) -> Data:
"""Deprecated alias for `indices`."""
return self.indices
Expand Down
Loading
Loading