Skip to content

Commit

Permalink
warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Oct 16, 2024
1 parent 1bc7877 commit 24baf76
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/cachier/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from dataclasses import dataclass, replace
from typing import Optional, Union

from docutils.nodes import warning

from ._types import Backend, HashFunc, Mongetter


Expand Down Expand Up @@ -52,6 +54,19 @@ def _update_with_defaults(
return param


def set_default_params(**params: Mapping) -> None:
"""Configure default parameters applicable to all memoized functions."""
# This function is kept for backwards compatibility with desperation warning
import warnings

warnings.warn(
"set_default_params is deprecated and will be removed in a future version. "
"Please use `set_global_params` instead.",
DeprecationWarning,
)
set_global_params(**params)


def set_global_params(**params: Mapping) -> None:
"""Configure global parameters applicable to all memoized functions.
Expand All @@ -77,6 +92,19 @@ def set_global_params(**params: Mapping) -> None:
)


def get_default_params() -> Params:
"""Get current set of default parameters."""
# This function is kept for backwards compatibility with desperation warning
import warnings

warnings.warn(
"get_default_params is deprecated and will be removed in a future version. "
"Please use `get_global_params` instead.",
DeprecationWarning,
)
return get_global_params()


def get_global_params() -> Params:
"""Get current set of default parameters."""
import cachier
Expand Down

0 comments on commit 24baf76

Please sign in to comment.