Skip to content

Commit f6545a0

Browse files
author
Angel Campoverde
committed
Remove getter functions, use loader
1 parent 08fb136 commit f6545a0

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/ap_utilities/decays/utilities.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,12 @@
22
Module containing utility functions
33
'''
44
from importlib.resources import files
5-
from functools import cache
65

76
import yaml
87

98
# ---------------------------------
10-
@cache
11-
def _get_evt_name() -> dict[str,str]:
12-
file_path = files('ap_utilities_data').joinpath('evt_name.yaml')
13-
file_path = str(file_path)
14-
with open(file_path, encoding='utf-8') as ifile:
15-
d_data = yaml.safe_load(ifile)
16-
17-
return d_data
18-
# ---------------------------------
19-
@cache
20-
def _get_name_evt(style : str) -> dict[str,str]:
21-
if style != 'safe_1':
22-
raise NotImplementedError(f'Style {style} not supported')
23-
24-
file_path = files('ap_utilities_data').joinpath('name_evt.yaml')
9+
def _load_data(file_name : str) -> dict:
10+
file_path = files('ap_utilities_data').joinpath(file_name)
2511
file_path = str(file_path)
2612
with open(file_path, encoding='utf-8') as ifile:
2713
d_data = yaml.safe_load(ifile)
@@ -71,7 +57,7 @@ def read_decay_name(event_type : str, style : str = 'safe_1') -> str:
7157
+ -> pl
7258
, -> _
7359
'''
74-
d_evt_name = _get_evt_name()
60+
d_evt_name = _load_data('evt_name.yaml')
7561

7662
if event_type not in d_evt_name:
7763
raise ValueError(f'Event type {event_type} not found')

0 commit comments

Comments
 (0)