Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed Oct 9, 2024
1 parent 78c650c commit 618ad26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
9 changes: 3 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@

html_static_path = ["_static"]

on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if not on_rtd:
# Import and set the theme if we're building docs locally
import sphinx_rtd_theme
# Import and set the theme if we're building docs locally
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme = "sphinx_rtd_theme"

# Autodoc options
autodoc_member_order = "groupwise"
Expand Down
9 changes: 3 additions & 6 deletions src/pyhepmc/_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ def __init__(self, reason: str, removal: str = ""):
self.removal = Version(removal) if removal else None

def __call__(self, func: Callable[..., Any]) -> Callable[..., Any]:
category: Any = FutureWarning
category: Any = DeprecationWarning
extra = ""
if self.removal:
vstring = ".".join(str(x) for x in self.removal)
extra = f" and will be removed in version {vstring}"
if CURRENT_VERSION >= self.removal:
category = DeprecationWarning
if self.removal and CURRENT_VERSION < self.removal:
extra = f" and will be removed in version {self.removal}"
msg = f"{func.__name__} is deprecated{extra}: {self.reason}"

def decorated_func(*args: Any, **kwargs: Any) -> Any:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def bad(self):
foo.bar()

with pytest.warns(
FutureWarning,
match="bar is deprecated and will be removed in version 1000.0.0: use baz",
DeprecationWarning,
match="foo is deprecated and will be removed in version 1000.0.0: use baz",
):
foo.foo()

0 comments on commit 618ad26

Please sign in to comment.