From e96bedf7477d392b8821f76ca85038c198c84375 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 9 Jun 2021 19:19:56 +0200 Subject: Fix linting errors Style, unused imports, unused variables, etc. as reported by flake8. Configuration for flake8 has been added to setup.cfg. --- fbin/file_storage/filesystem.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'fbin/file_storage/filesystem.py') diff --git a/fbin/file_storage/filesystem.py b/fbin/file_storage/filesystem.py index b132264..5b4f0a3 100644 --- a/fbin/file_storage/filesystem.py +++ b/fbin/file_storage/filesystem.py @@ -4,6 +4,7 @@ import tempfile from .base import BaseStorage + class Storage(BaseStorage): def __init__(self, app): super().__init__(app) @@ -49,7 +50,7 @@ class Storage(BaseStorage): file_path, size = self.upload_file(uploaded_file, file_hash, user) try: return self.add_file(file_hash, uploaded_file.filename, size, user, ip) - except: + except: # noqa: E722; we want to unlink and re-raise on all exceptions if os.path.exists(file_path): os.unlink(file_path) raise @@ -89,7 +90,7 @@ class Storage(BaseStorage): def store_thumbnail(self, f, stream): path = self.get_thumb_path(f) with open(path, 'wb') as f: - buf = stream.read(1024*10) + buf = stream.read(1024 * 10) while buf: f.write(buf) - buf = stream.read(1024*10) + buf = stream.read(1024 * 10) -- cgit v1.2.3