mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -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
|
@ -1,3 +1,4 @@
|
|||
# mypy: ignore-errors
|
||||
import railroad
|
||||
import pyparsing
|
||||
import typing
|
||||
|
@ -17,11 +18,13 @@ import inspect
|
|||
|
||||
|
||||
jinja2_template_source = """\
|
||||
{% if not embed %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
{% endif %}
|
||||
{% if not head %}
|
||||
<style type="text/css">
|
||||
<style>
|
||||
.railroad-heading {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
@ -29,8 +32,10 @@ jinja2_template_source = """\
|
|||
{% else %}
|
||||
{{ head | safe }}
|
||||
{% endif %}
|
||||
{% if not embed %}
|
||||
</head>
|
||||
<body>
|
||||
{% endif %}
|
||||
{{ body | safe }}
|
||||
{% for diagram in diagrams %}
|
||||
<div class="railroad-group">
|
||||
|
@ -41,8 +46,10 @@ jinja2_template_source = """\
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if not embed %}
|
||||
</body>
|
||||
</html>
|
||||
{% endif %}
|
||||
"""
|
||||
|
||||
template = Template(jinja2_template_source)
|
||||
|
@ -127,7 +134,7 @@ class EditablePartial(Generic[T]):
|
|||
return self.func(*args, **kwargs)
|
||||
|
||||
|
||||
def railroad_to_html(diagrams: List[NamedDiagram], **kwargs) -> str:
|
||||
def railroad_to_html(diagrams: List[NamedDiagram], embed=False, **kwargs) -> str:
|
||||
"""
|
||||
Given a list of NamedDiagram, produce a single HTML string that visualises those diagrams
|
||||
:params kwargs: kwargs to be passed in to the template
|
||||
|
@ -137,13 +144,17 @@ def railroad_to_html(diagrams: List[NamedDiagram], **kwargs) -> str:
|
|||
if diagram.diagram is None:
|
||||
continue
|
||||
io = StringIO()
|
||||
diagram.diagram.writeSvg(io.write)
|
||||
try:
|
||||
css = kwargs.get('css')
|
||||
diagram.diagram.writeStandalone(io.write, css=css)
|
||||
except AttributeError:
|
||||
diagram.diagram.writeSvg(io.write)
|
||||
title = diagram.name
|
||||
if diagram.index == 0:
|
||||
title += " (root)"
|
||||
data.append({"title": title, "text": "", "svg": io.getvalue()})
|
||||
|
||||
return template.render(diagrams=data, **kwargs)
|
||||
return template.render(diagrams=data, embed=embed, **kwargs)
|
||||
|
||||
|
||||
def resolve_partial(partial: "EditablePartial[T]") -> T:
|
||||
|
@ -398,7 +409,6 @@ def _apply_diagram_item_enhancements(fn):
|
|||
show_results_names: bool = False,
|
||||
show_groups: bool = False,
|
||||
) -> typing.Optional[EditablePartial]:
|
||||
|
||||
ret = fn(
|
||||
element,
|
||||
parent,
|
||||
|
@ -555,9 +565,11 @@ def _to_diagram_element(
|
|||
else:
|
||||
ret = EditablePartial.from_call(railroad.Group, label="", item="")
|
||||
elif isinstance(element, pyparsing.TokenConverter):
|
||||
ret = EditablePartial.from_call(
|
||||
AnnotatedItem, label=type(element).__name__.lower(), item=""
|
||||
)
|
||||
label = type(element).__name__.lower()
|
||||
if label == "tokenconverter":
|
||||
ret = EditablePartial.from_call(railroad.Sequence, items=[])
|
||||
else:
|
||||
ret = EditablePartial.from_call(AnnotatedItem, label=label, item="")
|
||||
elif isinstance(element, pyparsing.Opt):
|
||||
ret = EditablePartial.from_call(railroad.Optional, item="")
|
||||
elif isinstance(element, pyparsing.OneOrMore):
|
||||
|
@ -571,10 +583,12 @@ def _to_diagram_element(
|
|||
elif isinstance(element, pyparsing.Empty) and not element.customName:
|
||||
# Skip unnamed "Empty" elements
|
||||
ret = None
|
||||
elif len(exprs) > 1:
|
||||
elif isinstance(element, pyparsing.ParseElementEnhance):
|
||||
ret = EditablePartial.from_call(railroad.Sequence, items=[])
|
||||
elif len(exprs) > 0 and not element_results_name:
|
||||
ret = EditablePartial.from_call(railroad.Group, item="", label=name)
|
||||
elif len(exprs) > 0:
|
||||
ret = EditablePartial.from_call(railroad.Sequence, items=[])
|
||||
else:
|
||||
terminal = EditablePartial.from_call(railroad.Terminal, element.defaultName)
|
||||
ret = terminal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue