Bump pyparsing from 3.1.2 to 3.1.4 (#2388)

* Bump pyparsing from 3.1.2 to 3.1.4

Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 3.1.2 to 3.1.4.
- [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.1.2...3.1.4)

---
updated-dependencies:
- dependency-name: pyparsing
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update pyparsing==3.1.4

---------

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:
dependabot[bot] 2024-11-16 14:47:48 -08:00 committed by GitHub
parent 2f3d24a0e7
commit d3f7eef84f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 323 additions and 223 deletions

View file

@ -120,8 +120,8 @@ class version_info(NamedTuple):
return f"{__name__}.{type(self).__name__}({', '.join('{}={!r}'.format(*nv) for nv in zip(self._fields, self))})"
__version_info__ = version_info(3, 1, 2, "final", 1)
__version_time__ = "06 Mar 2024 07:08 UTC"
__version_info__ = version_info(3, 1, 4, "final", 1)
__version_time__ = "25 Aug 2024 14:40 UTC"
__version__ = __version_info__.__version__
__versionTime__ = __version_time__
__author__ = "Paul McGuire <ptmcg.gm+pyparsing@gmail.com>"
@ -143,7 +143,7 @@ from .common import (
_builtin_exprs as common_builtin_exprs,
)
# define backward compat synonyms
# Compatibility synonyms
if "pyparsing_unicode" not in globals():
pyparsing_unicode = unicode # type: ignore[misc]
if "pyparsing_common" not in globals():

View file

@ -196,7 +196,7 @@ def with_class(classname, namespace=""):
return with_attribute(**{classattr: classname})
# pre-PEP8 compatibility symbols
# Compatibility synonyms
# fmt: off
replaceWith = replaced_by_pep8("replaceWith", replace_with)
removeQuotes = replaced_by_pep8("removeQuotes", remove_quotes)

View file

@ -418,20 +418,15 @@ class pyparsing_common:
# fmt: on
# pre-PEP8 compatibility names
convertToInteger = convert_to_integer
"""Deprecated - use :class:`convert_to_integer`"""
convertToFloat = convert_to_float
"""Deprecated - use :class:`convert_to_float`"""
convertToDate = convert_to_date
"""Deprecated - use :class:`convert_to_date`"""
convertToDatetime = convert_to_datetime
"""Deprecated - use :class:`convert_to_datetime`"""
stripHTMLTags = strip_html_tags
"""Deprecated - use :class:`strip_html_tags`"""
upcaseTokens = upcase_tokens
"""Deprecated - use :class:`upcase_tokens`"""
downcaseTokens = downcase_tokens
"""Deprecated - use :class:`downcase_tokens`"""
# fmt: off
convertToInteger = staticmethod(replaced_by_pep8("convertToInteger", convert_to_integer))
convertToFloat = staticmethod(replaced_by_pep8("convertToFloat", convert_to_float))
convertToDate = staticmethod(replaced_by_pep8("convertToDate", convert_to_date))
convertToDatetime = staticmethod(replaced_by_pep8("convertToDatetime", convert_to_datetime))
stripHTMLTags = staticmethod(replaced_by_pep8("stripHTMLTags", strip_html_tags))
upcaseTokens = staticmethod(replaced_by_pep8("upcaseTokens", upcase_tokens))
downcaseTokens = staticmethod(replaced_by_pep8("downcaseTokens", downcase_tokens))
# fmt: on
_builtin_exprs = [

File diff suppressed because it is too large Load diff

View file

@ -36,6 +36,7 @@ jinja2_template_source = """\
</head>
<body>
{% endif %}
<meta charset="UTF-8"/>
{{ body | safe }}
{% for diagram in diagrams %}
<div class="railroad-group">
@ -89,7 +90,7 @@ class AnnotatedItem(railroad.Group):
"""
def __init__(self, label: str, item):
super().__init__(item=item, label="[{}]".format(label) if label else label)
super().__init__(item=item, label=f"[{label}]")
class EditablePartial(Generic[T]):
@ -145,7 +146,7 @@ def railroad_to_html(diagrams: List[NamedDiagram], embed=False, **kwargs) -> str
continue
io = StringIO()
try:
css = kwargs.get('css')
css = kwargs.get("css")
diagram.diagram.writeStandalone(io.write, css=css)
except AttributeError:
diagram.diagram.writeSvg(io.write)
@ -425,9 +426,11 @@ def _apply_diagram_item_enhancements(fn):
element_results_name = element.resultsName
if element_results_name:
# add "*" to indicate if this is a "list all results" name
element_results_name += "" if element.modalResults else "*"
modal_tag = "" if element.modalResults else "*"
ret = EditablePartial.from_call(
railroad.Group, item=ret, label=element_results_name
railroad.Group,
item=ret,
label=f"{repr(element_results_name)}{modal_tag}",
)
return ret
@ -534,7 +537,7 @@ def _to_diagram_element(
# (all will have the same name, and resultsName)
if not exprs:
return None
if len(set((e.name, e.resultsName) for e in exprs)) == 1:
if len(set((e.name, e.resultsName) for e in exprs)) == 1 and len(exprs) > 2:
ret = EditablePartial.from_call(
railroad.OneOrMore, item="", repeat=str(len(exprs))
)
@ -563,7 +566,7 @@ def _to_diagram_element(
if show_groups:
ret = EditablePartial.from_call(AnnotatedItem, label="", item="")
else:
ret = EditablePartial.from_call(railroad.Group, label="", item="")
ret = EditablePartial.from_call(railroad.Sequence, items=[])
elif isinstance(element, pyparsing.TokenConverter):
label = type(element).__name__.lower()
if label == "tokenconverter":
@ -573,8 +576,36 @@ def _to_diagram_element(
elif isinstance(element, pyparsing.Opt):
ret = EditablePartial.from_call(railroad.Optional, item="")
elif isinstance(element, pyparsing.OneOrMore):
ret = EditablePartial.from_call(railroad.OneOrMore, item="")
if element.not_ender is not None:
args = [
parent,
lookup,
vertical,
index,
name_hint,
show_results_names,
show_groups,
]
return _to_diagram_element(
(~element.not_ender.expr + element.expr)[1, ...].set_name(element.name),
*args,
)
ret = EditablePartial.from_call(railroad.OneOrMore, item=None)
elif isinstance(element, pyparsing.ZeroOrMore):
if element.not_ender is not None:
args = [
parent,
lookup,
vertical,
index,
name_hint,
show_results_names,
show_groups,
]
return _to_diagram_element(
(~element.not_ender.expr + element.expr)[...].set_name(element.name),
*args,
)
ret = EditablePartial.from_call(railroad.ZeroOrMore, item="")
elif isinstance(element, pyparsing.Group):
ret = EditablePartial.from_call(

View file

@ -85,7 +85,7 @@ class ParseBaseException(Exception):
ret = []
if isinstance(exc, ParseBaseException):
ret.append(exc.line)
ret.append(" " * (exc.column - 1) + "^")
ret.append(f"{' ' * (exc.column - 1)}^")
ret.append(f"{type(exc).__name__}: {exc}")
if depth <= 0:
@ -245,6 +245,7 @@ class ParseBaseException(Exception):
"""
return self.explain_exception(self, depth)
# Compatibility synonyms
# fmt: off
markInputline = replaced_by_pep8("markInputline", mark_input_line)
# fmt: on

View file

@ -782,9 +782,12 @@ def infix_notation(
# if lpar and rpar are not suppressed, wrap in group
if not (isinstance(lpar, Suppress) and isinstance(rpar, Suppress)):
lastExpr = base_expr | Group(lpar + ret + rpar)
lastExpr = base_expr | Group(lpar + ret + rpar).set_name(
f"nested_{base_expr.name}"
)
else:
lastExpr = base_expr | (lpar + ret + rpar)
lastExpr = base_expr | (lpar + ret + rpar).set_name(f"nested_{base_expr.name}")
root_expr = lastExpr
arity: int
rightLeftAssoc: opAssoc
@ -855,6 +858,7 @@ def infix_notation(
thisExpr <<= (matchExpr | lastExpr).setName(term_name)
lastExpr = thisExpr
ret <<= lastExpr
root_expr.set_name("base_expr")
return ret
@ -1049,7 +1053,7 @@ def delimited_list(
)
# pre-PEP8 compatible names
# Compatibility synonyms
# fmt: off
opAssoc = OpAssoc
anyOpenTag = any_open_tag

View file

@ -4,12 +4,14 @@ from collections.abc import (
Mapping,
MutableSequence,
Iterator,
Sequence,
Container,
Iterable,
)
import pprint
from typing import Tuple, Any, Dict, Set, List
from .util import replaced_by_pep8
str_type: Tuple[type, ...] = (str, bytes)
_generator_type = type((_ for _ in ()))
@ -573,20 +575,20 @@ class ParseResults:
# replace values with copies if they are of known mutable types
for i, obj in enumerate(self._toklist):
if isinstance(obj, ParseResults):
self._toklist[i] = obj.deepcopy()
ret._toklist[i] = obj.deepcopy()
elif isinstance(obj, (str, bytes)):
pass
elif isinstance(obj, MutableMapping):
self._toklist[i] = dest = type(obj)()
ret._toklist[i] = dest = type(obj)()
for k, v in obj.items():
dest[k] = v.deepcopy() if isinstance(v, ParseResults) else v
elif isinstance(obj, Container):
self._toklist[i] = type(obj)(
elif isinstance(obj, Iterable):
ret._toklist[i] = type(obj)(
v.deepcopy() if isinstance(v, ParseResults) else v for v in obj
)
return ret
def get_name(self):
def get_name(self) -> str:
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.

View file

@ -53,51 +53,51 @@ class unicode_set:
_ranges: UnicodeRangeList = []
@_lazyclassproperty
def _chars_for_ranges(cls):
ret = []
def _chars_for_ranges(cls) -> List[str]:
ret: List[int] = []
for cc in cls.__mro__:
if cc is unicode_set:
break
for rr in getattr(cc, "_ranges", ()):
ret.extend(range(rr[0], rr[-1] + 1))
return [chr(c) for c in sorted(set(ret))]
return sorted(chr(c) for c in set(ret))
@_lazyclassproperty
def printables(cls):
def printables(cls) -> str:
"""all non-whitespace characters in this range"""
return "".join(filterfalse(str.isspace, cls._chars_for_ranges))
@_lazyclassproperty
def alphas(cls):
def alphas(cls) -> str:
"""all alphabetic characters in this range"""
return "".join(filter(str.isalpha, cls._chars_for_ranges))
@_lazyclassproperty
def nums(cls):
def nums(cls) -> str:
"""all numeric digit characters in this range"""
return "".join(filter(str.isdigit, cls._chars_for_ranges))
@_lazyclassproperty
def alphanums(cls):
def alphanums(cls) -> str:
"""all alphanumeric characters in this range"""
return cls.alphas + cls.nums
@_lazyclassproperty
def identchars(cls):
def identchars(cls) -> str:
"""all characters in this range that are valid identifier characters, plus underscore '_'"""
return "".join(
sorted(
set(
"".join(filter(str.isidentifier, cls._chars_for_ranges))
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµº"
+ "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ"
+ "_"
set(filter(str.isidentifier, cls._chars_for_ranges))
| set(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµº"
"ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ"
"_"
)
)
)
@_lazyclassproperty
def identbodychars(cls):
def identbodychars(cls) -> str:
"""
all characters in this range that are valid identifier body characters,
plus the digits 0-9, and · (Unicode MIDDLE DOT)
@ -105,7 +105,9 @@ class unicode_set:
identifier_chars = set(
c for c in cls._chars_for_ranges if ("_" + c).isidentifier()
)
return "".join(sorted(identifier_chars | set(cls.identchars + "0123456789·")))
return "".join(
sorted(identifier_chars | set(cls.identchars) | set("0123456789·"))
)
@_lazyclassproperty
def identifier(cls):

View file

@ -246,7 +246,7 @@ def replaced_by_pep8(compat_name: str, fn: C) -> C:
# (Presence of 'self' arg in signature is used by explain_exception() methods, so we take
# some extra steps to add it if present in decorated function.)
if "self" == list(inspect.signature(fn).parameters)[0]:
if ["self"] == list(inspect.signature(fn).parameters)[:1]:
@wraps(fn)
def _inner(self, *args, **kwargs):

View file

@ -30,7 +30,7 @@ plexapi==4.15.16
portend==3.2.0
profilehooks==1.12.0
PyJWT==2.9.0
pyparsing==3.1.2
pyparsing==3.1.4
python-dateutil==2.9.0.post0
python-twitter==3.5
pytz==2024.1