-
Notifications
You must be signed in to change notification settings - Fork 532
No longer concatenating extensions #2381
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable.
cmd = 'dot -T%s -O \'%s\'' % (format, dotfilename) | ||
dot_base = os.path.splitext(dotfilename)[0] | ||
formatted_dot = '{}.{}'.format(dot_base, format) | ||
cmd = 'dot -T{} -o"{}" "{}"'.format(format, formatted_dot, dotfilename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be uppercase O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, -ofile
is what we should be using.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I guess I didn't review this thoroughly enough.
cmd = 'dot -T%s -O \'%s\'' % (format, dotfilename) | ||
dot_base = os.path.splitext(dotfilename)[0] | ||
formatted_dot = '{}.{}'.format(dot_base, format) | ||
cmd = 'dot -T{} -o"{}" "{}"'.format(format, formatted_dot, dotfilename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning formatted_dot
breaks if format == 'dot'
. One option is to revert the return line, and update these three lines to:
dot_base = os.path.splitext(dotfilename)[0]
orig_dot = dotfilename
dotfilename = '{}.{}'.format(dot_base, format)
cmd = 'dot -T{} -o"{}" "{}"'.format(format, dotfilename, orig_dot)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the advice, but I would recommend the current approach. Having dotfilename
mean both the original and the formatted filename is confusing, and I would rather not construct the formatted name implicitly inline with some other operation for the sake of clarity.
If the filename for some reason can't be split, I'd much rather like the traceback to serve me up this line directly:
dot_base = os.path.splitext(dotfilename)[0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that you're returning a value from an unassigned name in the case where format == 'dot'
. If you don't want to reassign a variable, you can return the formatted_dot
from within the if
block, or return dotfilename if format == 'dot' else formatted_dot
, or whatever, but the tests will need to pass before we can merge this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. If tests pass, I'm happy to merge. Thanks for your patience, Horea.
graph.png and graph.dot side by side is a lot better than graph.dot.png and graph.dot - for both tab completion, and software which has trouble intelligently parsing extensions (e.g. LaTeX's \includegraphics).
reiteration of #2268