From e3c25a524127981ccf6ba32680f46c2cb06ed313 Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Fri, 21 Apr 2023 17:49:08 +0000 Subject: [PATCH] Pylinty --- onlylegs/api/account.py | 5 ++--- onlylegs/api/media.py | 1 - onlylegs/utils/generate_image.py | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/onlylegs/api/account.py b/onlylegs/api/account.py index 0ac8fb9..fb54c25 100644 --- a/onlylegs/api/account.py +++ b/onlylegs/api/account.py @@ -1,7 +1,6 @@ """ Onlylegs - API endpoints """ -from uuid import uuid4 import os import pathlib import re @@ -31,7 +30,7 @@ def account_picture(user_id): # If no image is uploaded, return 404 error if not file: return jsonify({"error": "No file uploaded"}), 400 - elif user.id != current_user.id: + if user.id != current_user.id: return jsonify({"error": "You are not allowed to do this, go away"}), 403 # Get file extension, generate random name and set file path @@ -84,7 +83,7 @@ def account_username(user_id): # Validate the form if not new_name or not username_regex.match(new_name): return jsonify({"error": "Username is invalid"}), 400 - elif user.id != current_user.id: + if user.id != current_user.id: return jsonify({"error": "You are not allowed to do this, go away"}), 403 # Save to database diff --git a/onlylegs/api/media.py b/onlylegs/api/media.py index 60b90ce..2ce774b 100644 --- a/onlylegs/api/media.py +++ b/onlylegs/api/media.py @@ -2,7 +2,6 @@ Onlylegs - API endpoints Media upload and retrieval """ -import os from uuid import uuid4 import os import pathlib diff --git a/onlylegs/utils/generate_image.py b/onlylegs/utils/generate_image.py index 7e36a31..fd86d28 100644 --- a/onlylegs/utils/generate_image.py +++ b/onlylegs/utils/generate_image.py @@ -1,11 +1,10 @@ """ Tools for generating images and thumbnails """ - import os from PIL import Image, ImageOps -from onlylegs.config import MEDIA_FOLDER, CACHE_FOLDER from werkzeug.utils import secure_filename +from onlylegs.config import MEDIA_FOLDER, CACHE_FOLDER def generate_thumbnail(file_path, resolution, ext=None):