Skip to content

Commit 9efe96d

Browse files
ferdnycptmcg
authored andcommitted
Docs: Replace notes with real '.. deprecated' markup
1 parent 03e792f commit 9efe96d

File tree

5 files changed

+29
-9
lines changed

5 files changed

+29
-9
lines changed

pyparsing/core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,11 @@ def _checkRecursion(self, parseElementList):
19791979

19801980
def validate(self, validateTrace=None) -> None:
19811981
"""
1982+
.. deprecated:: 3.0.0
1983+
Do not use to check for left recursion.
1984+
19821985
Check defined expressions for valid structure, check for infinite recursive definitions.
1986+
19831987
"""
19841988
warnings.warn(
19851989
"ParserElement.validate() is deprecated, and should not be used to check for left recursion",

pyparsing/exceptions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,12 @@ class ParseSyntaxException(ParseFatalException):
299299

300300
class RecursiveGrammarException(Exception):
301301
"""
302+
.. deprecated:: 3.0.0
303+
Only used by the deprecated :meth:`ParserElement.validate`.
304+
302305
Exception thrown by :class:`ParserElement.validate` if the
303306
grammar could be left-recursive; parser may need to enable
304307
left recursion using :class:`ParserElement.enable_left_recursion<ParserElement.enable_left_recursion>`
305-
306-
Deprecated: only used by deprecated method ParserElement.validate.
307308
"""
308309

309310
def __init__(self, parseElementList) -> None:

pyparsing/helpers.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,9 @@ def ungroup(expr: ParserElement) -> ParserElement:
385385

386386
def locatedExpr(expr: ParserElement) -> ParserElement:
387387
"""
388-
(DEPRECATED - future code should use the :class:`Located` class)
388+
.. deprecated:: 3.0.0
389+
Use the :class:`Located` class instead.
390+
389391
Helper to decorate a returned token with its starting and ending
390392
locations in the input string.
391393
@@ -914,7 +916,9 @@ def parseImpl(self, instring, loc, doActions=True):
914916

915917
def indentedBlock(blockStatementExpr, indentStack, indent=True, backup_stacks=[]):
916918
"""
917-
(DEPRECATED - use :class:`IndentedBlock` class instead)
919+
.. deprecated:: 3.0.0
920+
Use the :class:`IndentedBlock` class instead.
921+
918922
Helper method for defining space-delimited indentation blocks,
919923
such as those used to define block statements in Python source code.
920924
@@ -1096,7 +1100,10 @@ def delimited_list(
10961100
*,
10971101
allow_trailing_delim: bool = False,
10981102
) -> ParserElement:
1099-
"""(DEPRECATED - use :class:`DelimitedList` class)"""
1103+
"""
1104+
.. deprecated:: 3.1.0
1105+
Use the :class:`DelimitedList` class instead.
1106+
"""
11001107
return DelimitedList(
11011108
expr, delim, combine, min, max, allow_trailing_delim=allow_trailing_delim
11021109
)

pyparsing/results.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -804,12 +804,17 @@ def is_iterable(obj):
804804
ret = cls([ret], name=name)
805805
return ret
806806

807+
# XXX: These docstrings don't show up in the documentation
808+
# (asList.__doc__ is the same as as_list.__doc__)
807809
asList = as_list
808-
"""Deprecated - use :class:`as_list`"""
810+
""".. deprecated:: 3.0.0
811+
use :class:`as_list`"""
809812
asDict = as_dict
810-
"""Deprecated - use :class:`as_dict`"""
813+
""".. deprecated:: 3.0.0
814+
use :class:`as_dict`"""
811815
getName = get_name
812-
"""Deprecated - use :class:`get_name`"""
816+
""".. deprecated:: 3.0.0
817+
use :class:`get_name`"""
813818

814819

815820
MutableMapping.register(ParseResults)

pyparsing/util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,10 @@ def _inner(*args, **kwargs):
425425
# )
426426
return fn(*args, **kwargs)
427427

428-
_inner.__doc__ = f"""Deprecated - use :class:`{fn.__name__}`"""
428+
_inner.__doc__ = f"""
429+
.. deprecated:: 3.0.0
430+
Use :class:`{fn.__name__}` instead
431+
"""
429432
_inner.__name__ = compat_name
430433
_inner.__annotations__ = fn.__annotations__
431434
if isinstance(fn, types.FunctionType):

0 commit comments

Comments
 (0)