Skip to content

Conversation

cslzchen
Copy link
Contributor

@cslzchen cslzchen commented Mar 20, 2018

Ticket

https://openscience.atlassian.net/browse/SVCS-159

Purpose

#296 breaks files of which the extension names are not lower case. This PR fix the issue.

Changes

  • name -> name.lower()
  • Refactor get_renderer_name() and get_exporter_name()

Side effects

No

QA Notes

No

Deployment Notes

No

@coveralls
Copy link

coveralls commented Mar 20, 2018

Coverage Status

Coverage increased (+0.04%) to 72.405% when pulling a0c694e on cslzchen:fix/fix-renderer-and-exporter-names into 7150e66 on CenterForOpenScience:develop.

- get_renderer_name() and get_exporter_name() take self.metadata.ext as the ext name. Must convert it to lower case to find the renderer/exporter.
@cslzchen cslzchen force-pushed the fix/fix-renderer-and-exporter-names branch from f83ce64 to 39ebdca Compare March 20, 2018 21:04
- Improve code and comments - Fix tests
@cslzchen cslzchen force-pushed the fix/fix-renderer-and-exporter-names branch from 39ebdca to a0c694e Compare March 20, 2018 21:11
@cslzchen cslzchen requested a review from felliott March 20, 2018 21:15
Copy link
Contributor Author

@cslzchen cslzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for CR 🎆

  • If you prefer next for iterator, I can change it.
return list(entry_attrs)[0].attrs[0]
# `ep_iterator` is an iterable object. Must convert it to a `list` for access.
# `list()` can only be called once because the iterator moves to the end after conversion.
ep_iterator = pkg_resources.iter_entry_points(group='mfr.renderers', name=name.lower())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both exporter and renderer, the primary functional change is name=name.lower().


def get_exporter_name(name):
# If file type is supported, there must be only one element in the list.
assert len(ep_list) == 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both exporter and renderer, use assert for functionalities that are not expected to break.

@cslzchen cslzchen changed the title [No Ticket] Fix Extension Names in Renderer and Exporter [SVCS-159] Fix Extension Names in Renderer and Exporter Mar 21, 2018
@felliott felliott closed this in 227cae5 Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants