From e3c9d827984794ddba7837268de38ede7bc17ac6 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Fri, 9 Aug 2024 18:18:43 +0200 Subject: [PATCH] Remove deprecated method DecFileParser.load_grammar --- codecov.yml | 1 + src/decaylanguage/dec/dec.py | 43 +++--------------------------------- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/codecov.yml b/codecov.yml index ae28abca..3b766cf4 100644 --- a/codecov.yml +++ b/codecov.yml @@ -9,3 +9,4 @@ ignore: - "src/decaylanguage/modeling/*" - "src/decaylanguage/utils/errors.py" - "src/decaylanguage/utils/utilities.py" + - "src/decaylanguage/_compat/*" diff --git a/src/decaylanguage/dec/dec.py b/src/decaylanguage/dec/dec.py index 02059558..07af2ce2 100644 --- a/src/decaylanguage/dec/dec.py +++ b/src/decaylanguage/dec/dec.py @@ -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 @@ -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: