Skip to content

Bring back filename parameter to compression_wrapper #497

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 5 commits into from
May 13, 2020

Conversation

piskvorky
Copy link
Owner

@piskvorky piskvorky commented May 12, 2020

Smart_open 1.8.4 used to have a nifty _compression_wrapper function. It was internal (_ prefix) but generally useful.

That function doesn't exist any more in smart_open 2.0.0. It was promoted to a public compression.compression_wrapper which is almost identical, but not quite. The new function doesn't accept a filename, and is instead hard-wired to extract the filename from file_obj.name.

This is undesirable in our system, where hacking file_obj to add the .name attribute is complicated (and unnecessary).

This PR brings back the option of supplying own filename. It's fully backward compatible: with no filename specified, it will fall back to file_obj.name like before.

Checklist

Before you create the PR, please make sure you have:

  • Picked a concise, informative and complete title
  • Clearly explained the motivation behind the PR
  • Linked to any existing issues that your PR will be solving
  • Included tests for any new functionality
  • Checked that all unit tests pass

@piskvorky
Copy link
Owner Author

piskvorky commented May 12, 2020

Also had to fix some unrelated code because CI was failing flake8 with E741 ambiguous variable name 'l'.

@piskvorky piskvorky requested a review from mpenkov May 12, 2020 20:58
Copy link
Collaborator

@mpenkov mpenkov 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, minor nitpicks.

Co-authored-by: Michael Penkov <m@penkov.dev>
@mpenkov mpenkov merged commit cc247c5 into develop May 13, 2020
@mpenkov
Copy link
Collaborator

mpenkov commented May 13, 2020

Do we want this in the change log? It seems relatively minor, so we can leave it out, in my opinion.

@mpenkov mpenkov deleted the compression_wrapper branch May 13, 2020 07:33
@piskvorky
Copy link
Owner Author

piskvorky commented May 13, 2020

Definitely, very minor (a user base of one, most likely). Thanks for the review!

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.

2 participants