You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* parser: remove unused get_port()
* Test repr for P_AttrList and DefaultStatement
* Parser: Add expand_attr_lists()
A helper function for `ParserElement`s that can accept `attr_list`
as part of their grammar. Assigning a results_name to the `attr_list`
component and passing it to this function will return either a
combined dict of all the attributes in all parsed attr_lists, or
an empty dict if none were found. This can then be included in
`pydot.core` class constructor calls via `**attrs`.
* Parser: Improve defaults node parsing
Rename `attr_stmt` to `default_stmt`, apply results names, and
rewrite `push_default_stmt` to make use of `expand_attr_lists()`
* Parser: Improve subgraph parsing
Again, add results names to grammar and use `expand_attr_lists()`
* Parser: Improve edge parsing
Slightly more complex than the previous parsing improvements, due
to the complexity present in `push_edge_stmt()`. It's now far _less_
complex, and drops a bunch of ugly hackery. Still, the meat of the
change is the same: add results names, use `expand_attr_lists()`.
* Parser: improve node parsing
This one's kind of a big deal. Yes, add results names and make use of
`apply_attr_lists()`. But beyond that, all parsing of `port` values
is eliminated — the `node_id` is now defined as a `DelimitedList`,
consisting of between 1 and 3 `ID` strings separated by colons. The
`DelimitedList` parser element will combine them into a single
string. We were always passing the node name strings in to the
`pydot.core.Node` constructor as a single string, anyway -- the
logic to parse out port values lives in _that_ code. So there's
no reason to duplicate it in the parser, other than to validate
that the string parsed has a _plausible_ format.
As a result, `do_node_ports()` is dropped as it's no longer ever
called.
* Parser: Clean up update_parent_graph_hierarchy
The function contained a ton of dead code, being far too complex
for its only REAL purpose: To ensure that subgraphs on complex
edges have the correct parent graph hierarchy.
(The obvious question here would be: "Wait, aren't those subgraphs
stored as `FrozenDict`s? How can they be "updated"? Well, it turns
out each `FrozenDict` representing a subgraph has a `parent_graph`
key in its dictionary that points to the _actual_ `Subgraph` object
it was created from (since the `Subgraph` had itself as its own
parent, when it was first initialized and then frozen).
Those `Subgraph` objects don't get garbage collected, because
they're still referenced by the `FrozenDict` they were created
from. That's probably a bad thing, and maybe we should focus on
_deleting_ them instead of reparenting them, but for now this
is the way the code's been doing it.
* Parser: Streamline add_elements()
Rewrite this crucial function to remove a _ton_ of dead code,
including all of the defaults-handling that never actually did
anything (and _shouldn't_ do anything, as it was based on a
misguided premise: That defaults should be copied directly into
the attributes of any individual graph elements they apply to.
We don't want that!)
As a result, also drop `add_defaults()` which is no longer used.
* Parser: Drop unused AttributeDict import
* Parser: Type adjustment
* Ruff fixes
0 commit comments