mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Bump pyparsing from 3.0.9 to 3.1.1 (#2131)
* Bump pyparsing from 3.0.9 to 3.1.1 Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 3.0.9 to 3.1.1. - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/master/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/pyparsing_3.0.9...3.1.1) --- updated-dependencies: - dependency-name: pyparsing dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update pyparsing==3.1.1 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
d0c7f25a3f
commit
3debeada2a
12 changed files with 1306 additions and 797 deletions
|
@ -4,7 +4,13 @@ import re
|
|||
import sys
|
||||
import typing
|
||||
|
||||
from .util import col, line, lineno, _collapse_string_to_ranges
|
||||
from .util import (
|
||||
col,
|
||||
line,
|
||||
lineno,
|
||||
_collapse_string_to_ranges,
|
||||
replaced_by_pep8,
|
||||
)
|
||||
from .unicode import pyparsing_unicode as ppu
|
||||
|
||||
|
||||
|
@ -19,6 +25,20 @@ _exception_word_extractor = re.compile("([" + _extract_alphanums + "]{1,16})|.")
|
|||
class ParseBaseException(Exception):
|
||||
"""base exception class for all parsing runtime exceptions"""
|
||||
|
||||
loc: int
|
||||
msg: str
|
||||
pstr: str
|
||||
parser_element: typing.Any # "ParserElement"
|
||||
args: typing.Tuple[str, int, typing.Optional[str]]
|
||||
|
||||
__slots__ = (
|
||||
"loc",
|
||||
"msg",
|
||||
"pstr",
|
||||
"parser_element",
|
||||
"args",
|
||||
)
|
||||
|
||||
# Performance tuning: we construct a *lot* of these, so keep this
|
||||
# constructor as small and fast as possible
|
||||
def __init__(
|
||||
|
@ -35,7 +55,7 @@ class ParseBaseException(Exception):
|
|||
else:
|
||||
self.msg = msg
|
||||
self.pstr = pstr
|
||||
self.parser_element = self.parserElement = elem
|
||||
self.parser_element = elem
|
||||
self.args = (pstr, loc, msg)
|
||||
|
||||
@staticmethod
|
||||
|
@ -64,7 +84,7 @@ class ParseBaseException(Exception):
|
|||
if isinstance(exc, ParseBaseException):
|
||||
ret.append(exc.line)
|
||||
ret.append(" " * (exc.column - 1) + "^")
|
||||
ret.append("{}: {}".format(type(exc).__name__, exc))
|
||||
ret.append(f"{type(exc).__name__}: {exc}")
|
||||
|
||||
if depth > 0:
|
||||
callers = inspect.getinnerframes(exc.__traceback__, context=depth)
|
||||
|
@ -74,7 +94,9 @@ class ParseBaseException(Exception):
|
|||
|
||||
f_self = frm.f_locals.get("self", None)
|
||||
if isinstance(f_self, ParserElement):
|
||||
if frm.f_code.co_name not in ("parseImpl", "_parseNoCache"):
|
||||
if not frm.f_code.co_name.startswith(
|
||||
("parseImpl", "_parseNoCache")
|
||||
):
|
||||
continue
|
||||
if id(f_self) in seen:
|
||||
continue
|
||||
|
@ -82,21 +104,19 @@ class ParseBaseException(Exception):
|
|||
|
||||
self_type = type(f_self)
|
||||
ret.append(
|
||||
"{}.{} - {}".format(
|
||||
self_type.__module__, self_type.__name__, f_self
|
||||
)
|
||||
f"{self_type.__module__}.{self_type.__name__} - {f_self}"
|
||||
)
|
||||
|
||||
elif f_self is not None:
|
||||
self_type = type(f_self)
|
||||
ret.append("{}.{}".format(self_type.__module__, self_type.__name__))
|
||||
ret.append(f"{self_type.__module__}.{self_type.__name__}")
|
||||
|
||||
else:
|
||||
code = frm.f_code
|
||||
if code.co_name in ("wrapper", "<module>"):
|
||||
continue
|
||||
|
||||
ret.append("{}".format(code.co_name))
|
||||
ret.append(code.co_name)
|
||||
|
||||
depth -= 1
|
||||
if not depth:
|
||||
|
@ -110,7 +130,7 @@ class ParseBaseException(Exception):
|
|||
internal factory method to simplify creating one type of ParseException
|
||||
from another - avoids having __init__ signature conflicts among subclasses
|
||||
"""
|
||||
return cls(pe.pstr, pe.loc, pe.msg, pe.parserElement)
|
||||
return cls(pe.pstr, pe.loc, pe.msg, pe.parser_element)
|
||||
|
||||
@property
|
||||
def line(self) -> str:
|
||||
|
@ -140,6 +160,15 @@ class ParseBaseException(Exception):
|
|||
"""
|
||||
return col(self.loc, self.pstr)
|
||||
|
||||
# pre-PEP8 compatibility
|
||||
@property
|
||||
def parserElement(self):
|
||||
return self.parser_element
|
||||
|
||||
@parserElement.setter
|
||||
def parserElement(self, elem):
|
||||
self.parser_element = elem
|
||||
|
||||
def __str__(self) -> str:
|
||||
if self.pstr:
|
||||
if self.loc >= len(self.pstr):
|
||||
|
@ -154,14 +183,14 @@ class ParseBaseException(Exception):
|
|||
foundstr = (", found %r" % found).replace(r"\\", "\\")
|
||||
else:
|
||||
foundstr = ""
|
||||
return "{}{} (at char {}), (line:{}, col:{})".format(
|
||||
self.msg, foundstr, self.loc, self.lineno, self.column
|
||||
)
|
||||
return f"{self.msg}{foundstr} (at char {self.loc}), (line:{self.lineno}, col:{self.column})"
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
|
||||
def mark_input_line(self, marker_string: str = None, *, markerString=">!<") -> str:
|
||||
def mark_input_line(
|
||||
self, marker_string: typing.Optional[str] = None, *, markerString: str = ">!<"
|
||||
) -> str:
|
||||
"""
|
||||
Extracts the exception line from the input string, and marks
|
||||
the location of the exception with a special symbol.
|
||||
|
@ -214,7 +243,10 @@ class ParseBaseException(Exception):
|
|||
"""
|
||||
return self.explain_exception(self, depth)
|
||||
|
||||
markInputline = mark_input_line
|
||||
# fmt: off
|
||||
@replaced_by_pep8(mark_input_line)
|
||||
def markInputline(self): ...
|
||||
# fmt: on
|
||||
|
||||
|
||||
class ParseException(ParseBaseException):
|
||||
|
@ -264,4 +296,4 @@ class RecursiveGrammarException(Exception):
|
|||
self.parseElementTrace = parseElementList
|
||||
|
||||
def __str__(self) -> str:
|
||||
return "RecursiveGrammarException: {}".format(self.parseElementTrace)
|
||||
return f"RecursiveGrammarException: {self.parseElementTrace}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue