Skip to content

Commit

Permalink
chore: fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjholland committed Feb 24, 2025
1 parent 6ae2df7 commit 6b1bf1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pyprobe/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def archive(self, path: str) -> None:
":func:`~Cell.import_from_cycler` method. To only process cycler files into the"
" PyProBE format, use the :func:`process_cycler_data` function.",
plain_reason="For integrated cycler file processing and data import, use the "
"import_from_cycler method`.To only process cycler files into the "
"import_from_cycler method. To only process cycler files into the "
"PyProBE format, use the pyprobe.process_cycler_data function.",
version="2.0.1",
)
Expand Down Expand Up @@ -516,7 +516,7 @@ def process_cycler_file(
"To only process cycler files into the "
"PyProBE format, use the :func:`process_cycler_data` function.",
plain_reason="For integrated cycler file processing and data import, use the "
"import_from_cycler method` using the 'generic' cycler. "
"import_from_cycler method using the 'generic' cycler. "
"To only process cycler files into the "
"PyProBE format, use the pyprobe.process_cycler_data function.",
version="2.0.1",
Expand Down
10 changes: 5 additions & 5 deletions pyprobe/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""A collection of utility functions for PyProBE."""

import functools
import warnings
import logging
from typing import Any, Protocol

from pydantic import ValidationError

logger = logging.getLogger(__name__)


def flatten_list(lst: int | list[Any]) -> list[int]:
"""Flatten a list of lists into a single list.
Expand Down Expand Up @@ -73,10 +75,8 @@ def deprecated(*, reason: str, version: str, plain_reason: str | None = None) ->
def decorator(func: Any) -> Any:
@functools.wraps(func)
def wrapper(*args: Any, **kwargs: Any) -> Any:
warnings.warn(
plain_reason if plain_reason else reason,
DeprecationWarning,
stacklevel=2,
logger.warning(
"Deprecation Warning: " + plain_reason if plain_reason else reason,
)
return func(*args, **kwargs)

Expand Down

0 comments on commit 6b1bf1f

Please sign in to comment.