summaryrefslogtreecommitdiff
path: root/fbin/file_storage/filesystem.py
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2021-06-09 19:19:56 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2021-06-09 19:21:34 +0200
commite96bedf7477d392b8821f76ca85038c198c84375 (patch)
treec56deba384f45da8958d848113b4da9fa73fe3f9 /fbin/file_storage/filesystem.py
parent7c13b1038482d68c2ab581dad16fa81c0a09034e (diff)
Fix linting errors
Style, unused imports, unused variables, etc. as reported by flake8. Configuration for flake8 has been added to setup.cfg.
Diffstat (limited to 'fbin/file_storage/filesystem.py')
-rw-r--r--fbin/file_storage/filesystem.py7
1 files changed, 4 insertions, 3 deletions
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)