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

Enable pylint rules 2 #503

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ disable=missing-module-docstring,
too-few-public-methods,
too-many-ancestors,
duplicate-code,
consider-using-with,
arguments-differ

enable = useless-suppression
9 changes: 5 additions & 4 deletions lunes_cms/cms/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ def converted(self):
new_path = file_path[:-4] + "-conv.mp3"
mp3_converted_file.export(new_path, format="mp3", bitrate="44.1k")

converted_audiofile = File(file=open(new_path, "rb"), name=Path(new_path))
converted_audiofile.name = Path(new_path).name
converted_audiofile.content_type = "audio/mpeg"
converted_audiofile.size = os.path.getsize(new_path)
with open(new_path, "rb") as file:
converted_audiofile = File(file=file, name=Path(new_path))
converted_audiofile.name = Path(new_path).name
converted_audiofile.content_type = "audio/mpeg"
converted_audiofile.size = os.path.getsize(new_path)
os.remove(new_path)
return converted_audiofile
Comment on lines +84 to 90
Copy link
Member Author

Choose a reason for hiding this comment

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

@timobrembeck
This was what I've tried. I guess it's the cause of seek of closed file that converted_audiofile cannot reffer the file after with block is left.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok interesting, I had hoped that File() would already read the file contents.
I don't have time to have a closer look at this problem, but I'll revisit this later.


Expand Down