Skip to content

Commit

Permalink
Remove deprecated method DecFileParser.load_grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardo-rodrigues committed Aug 9, 2024
1 parent 51d04de commit e3c9d82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 40 deletions.
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ ignore:
- "src/decaylanguage/modeling/*"
- "src/decaylanguage/utils/errors.py"
- "src/decaylanguage/utils/utilities.py"
- "src/decaylanguage/_compat/*"
43 changes: 3 additions & 40 deletions src/decaylanguage/dec/dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,46 +265,6 @@ def grammar_info(self) -> dict[str, Any]:

return self._grammar_info

def load_grammar(
self,
filename: str | None = None,
parser: str = "lalr",
lexer: str = "auto",
**options: Any,
) -> None:
"""
DEPRECATED, please use "``load_additional_decay_models``" instead.
Load a Lark grammar definition file, either the default one,
or a user-specified one, optionally setting Lark parsing options.
Parameters
----------
filename: str, optional, default=None
Input .dec decay file name. By default 'data/decfile.lark' is loaded.
parser: str, optional, default='lalr'
The Lark parser engine name.
lexer: str, optional, default='auto'
The Lark parser lexer mode to use.
options: keyword arguments, optional
Extra options to pass on to the parsing algorithm.
See Lark's Lark class for a description of available options
for parser, lexer and options.
"""

warnings.warn(
"This method is deprecated, please add unknown decay models by passing them to "
"``load_additional_decay_models`` instead before parsing the decayfile.",
DeprecationWarning,
stacklevel=2,
)

if filename is None:
filename = "decfile.lark"

self._load_grammar(filename, parser, lexer, **options)

def load_additional_decay_models(self, *models: str) -> None:
"""
Add one or more EvtGen decay models in addition to the ones already provided via
Expand Down Expand Up @@ -343,6 +303,9 @@ def _load_grammar(
The Lark parser lexer mode to use.
options: keyword arguments, optional
Extra options to pass on to the parsing algorithm.
See Lark's Lark class for a description of available options
for parser, lexer and options.
"""

with data.basepath.joinpath(filename).open() as f1:
Expand Down

0 comments on commit e3c9d82

Please sign in to comment.