Skip to content

Commit

Permalink
Remove register_awkward()
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed Sep 22, 2024
1 parent 0152e61 commit be47a2f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 34 deletions.
3 changes: 1 addition & 2 deletions src/pylhe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from particle.exceptions import MatchingIDNotFound

from pylhe._version import version as __version__
from pylhe.awkward import register_awkward, to_awkward
from pylhe.awkward import to_awkward

__all__ = [
"__version__",
Expand All @@ -22,7 +22,6 @@
"read_lhe_init",
"read_lhe_with_attributes",
"read_num_events",
"register_awkward",
"to_awkward",
]

Expand Down
20 changes: 1 addition & 19 deletions src/pylhe/awkward.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
import awkward as ak
import vector

__all__ = ["register_awkward", "to_awkward"]
__all__ = ["to_awkward"]


def __dir__():
return __all__


def register_awkward():
"""
.. deprecated:: 0.6.0
Remove use of :func:`~pylhe.awkward.register_awkward` as registration
is automatic.
.. warning:: :func:`~pylhe.awkward.register_awkward` will be removed in
``pylhe`` ``v0.8.0``.
"""
import warnings

warnings.warn(
"pylhe.awkward.register_awkward is deprecated as of pylhe v0.6.0 and will be removed in pylhe v0.8.0."
+ " Please remove use of pylhe.awkward.register_awkward in favor of automatic registration.",
category=DeprecationWarning,
stacklevel=2, # Raise to user level
)


def to_awkward(event_iterable):
"""Convert iterable of LHEEvent instances to Awkward-Array."""

Expand Down
10 changes: 1 addition & 9 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pytest

import pylhe


Expand All @@ -17,18 +15,12 @@ def test_top_level_api():
"read_lhe_init",
"read_lhe_with_attributes",
"read_num_events",
"register_awkward",
"to_awkward",
]


def test_awkward_api():
assert dir(pylhe.awkward) == ["register_awkward", "to_awkward"]


def test_deprecated_api_warning():
with pytest.warns(DeprecationWarning):
pylhe.register_awkward()
assert dir(pylhe.awkward) == ["to_awkward"]


def test_load_version():
Expand Down
4 changes: 0 additions & 4 deletions tests/test_awkward.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
TEST_FILE = skhep_testdata.data_path("pylhe-testfile-pr29.lhe")


def test_register_awkward():
pylhe.register_awkward()


def test_to_awkward():
arr = pylhe.to_awkward(pylhe.read_lhe_with_attributes(TEST_FILE))
assert len(arr) == 791
Expand Down

0 comments on commit be47a2f

Please sign in to comment.