Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fixes, API changes, documentation #241

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

bug fixes, API changes, documentation #241

wants to merge 8 commits into from

Conversation

johnyf
Copy link
Contributor

@johnyf johnyf commented Oct 1, 2020

  • API:
    • require two positional arguments src and dst in get_edge
    • catch ImportError, instead of Exception
  • BUG:
    • return both aligned and reversed edges from get_edge
    • allow semicolon as attribute separator
  • DOC:
    • improve warning message about dot_parser
    • clarify the effect of calling the method set_node_defaults
  • REL:
    • update file LICENSE

The default `dst=None` could be interpreted as a search over
all edges with the argument `src_or_list` as source node.
However, the default corresponded to passing the pair of
source and destination nodes as the argument `src_or_list`.

Confusion can be avoided by requiring two arguments in all
cases. Using unpacking syntax at the call site addresses
use cases where the pair of nodes originates in an iterable.

Close #100.
Previously, the presence of both edges `a -> c` and `c -> a`
in an undirected graph resulted in the function `get_edge`
returning only one edge, namely `a -> c`.
The relevant grammar rule is `a_list:  ID '=' ID [(';' | ',')] [ a_list
]`.

[1] https://www.graphviz.org/doc/info/lang.html
@peternowee
Copy link
Member

Hi @johnyf, thanks for rebasing the dev-branch. These are the ones I would like to merge for the upcoming 1.4.2 release, with some remarks:

  • DOC: clarify the effect of calling set_node_defaults

    (c9a002b in this PR bug fixes, API changes, documentation #241, 71df273 + 56ea713 in the old dev branch.)

    Remarks:

    • How about "nodes added to the graph after ..." instead of "nodes created after ..." and "only to" instead of "to only"?
    • What docstring line length are we using? I see them sometimes get wrapped at 50 or 60 characters already, which seems a bit short to me. How about 72 characters?

    Alternative:

            """Define default node attributes.
    
            These attributes apply only to nodes added to the graph after
            calling this method.
            """
  • MAI: improve warning message about dot_parser

    (9dea3fc in this PR bug fixes, API changes, documentation #241, 8f9f7c6 in the old dev branch.)

    Without the related commit "API: catch ImportError instead of Exception".

Could you rebase them and maybe split them off to one or two separate PRs? I will contact you about the other commits again later.

@johnyf
Copy link
Contributor Author

johnyf commented Nov 24, 2020

Thank you for reviewing the changes. I will rebase the commits mentioned above and open another pull request.

The choice "created" was to emphasize that the nodes are added for the first time after setting node defaults. About the "only to", this phrasing has also a different meaning according to the Wiktionary (item 5 in the list at https://en.wiktionary.org/wiki/only#Adverb).

I use short lines to allow opening several tabs of code side by side in an editor. A line width of 72 characters for docstrings agrees with PEP 8 (https://www.python.org/dev/peps/pep-0008/#maximum-line-length).

@peternowee
Copy link
Member

Thank you for reviewing the changes. I will rebase the commits mentioned above and open another pull request.

Ok, thanks.

The choice "created" was to emphasize that the nodes are added for the first time after setting node defaults.

Ah ok, I see. But the problem is that "created" can also be understood as the nodes being instantiated and with that meaning the statement would not be true, because the node defaults will also apply to nodes instantiated before setting the defaults, but added to the graph after setting the defaults.

import pydot
g=pydot.Dot()
n1 = pydot.Node('n1')
n2 = pydot.Node('n2')
g.add_node(n2)
g.set_node_defaults(color='blue')
g.add_node(n1)
print(g)
g.write_png('test.png')
digraph G {
n2;
node [color=blue];
n1;
}

test

About the "only to", this phrasing has also a different meaning according to the Wiktionary (item 5 in the list at https://en.wiktionary.org/wiki/only#Adverb).

I do not see how "only to" could be understood to introduce such a construction here, because the rest of the sentence does not have an infinitive verb. See the examples in that item 5 ("to lose", "to betray") and on https://en.wiktionary.org/wiki/only_to ("to discover"). My feeling says "only to" would be better here, but if you feel the opposite I won't hold up merging this PR for it. The meaning is clear enough.

I use short lines to allow opening several tabs of code side by side in an editor. A line width of 72 characters for docstrings agrees with PEP 8 (https://www.python.org/dev/peps/pep-0008/#maximum-line-length).

Yep, thanks.

@peternowee
Copy link
Member

Hi @johnyf, hope you are ok. Do you still want to provide new commits for the two commits discussed above?

I sent you an email on 2020-12-22, btw.

@peternowee
Copy link
Member

@johnyf: I would like to move on with pydot 1.4.2. Do you still want to rebase and change these two commits yourself? Otherwise, I propose I just rebase and merge them as you provided them and then add my further changes in subsequent commits myself. Please let me know before 2021-01-22, also if you need more time.

@peternowee peternowee modified the milestones: Unplanned, 1.4.2 Jan 25, 2021
@peternowee
Copy link
Member

I cherry-picked the following two commits to master for inclusion in pydot 1.4.2:

I will look at the rest later. Thank you and hope you are ok. Sorry for my nitpicking.

Copy link

This pull request has conflicts, please resolve those so that the changes can be evaluated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants