Skip to content

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

Merged
merged 1 commit into from
Jan 21, 2018
Merged

No longer concatenating extensions #2381

merged 1 commit into from
Jan 21, 2018

Conversation

TheChymera
Copy link
Collaborator

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

Copy link
Member

@effigies effigies left a 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)
Copy link
Member

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

Copy link
Collaborator Author

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.

Copy link
Member

@effigies effigies left a 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)
Copy link
Member

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)

Copy link
Collaborator Author

@TheChymera TheChymera Jan 20, 2018

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]

Copy link
Member

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.

Copy link
Member

@effigies effigies left a 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.

@effigies effigies merged commit e125c95 into nipy:master Jan 21, 2018
@mgxd mgxd added this to the 1.0 milestone Jan 21, 2018
@TheChymera TheChymera deleted the png_ branch January 21, 2018 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants