From 12ab40427ae2bc2ca90703ea95e2f9798705636f Mon Sep 17 00:00:00 2001 From: "deepsource-io[bot]" <42547082+deepsource-io[bot]@users.noreply.github.com> Date: Sat, 24 Jun 2023 20:12:12 +0000 Subject: [PATCH 1/2] ci: Add .deepsource.toml --- .deepsource.toml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .deepsource.toml diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 0000000..052e915 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,22 @@ +version = 1 + +[[analyzers]] +name = "javascript" + + [analyzers.meta] + environment = ["browser"] + +[[analyzers]] +name = "python" + + [analyzers.meta] + runtime_version = "3.x.x" + +[[analyzers]] +name = "docker" + + [analyzers.meta] + dockerfile_paths = ["/TFR/Dockerfile"] + +[[transformers]] +name = "black" \ No newline at end of file From 5018be373a06294db791dc65080a59d5f0efe106 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 24 Jun 2023 20:12:24 +0000 Subject: [PATCH 2/2] style: format code with black Format code with black This commit fixes the style issues introduced in 12ab404 according to the output from Black. Details: https://app.deepsource.com/gh/Fluffy-Bean/GameExpo23/transform/fe118739-de54-46aa-a7e7-995c32b67dc2/ --- TFR/server/account.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/TFR/server/account.py b/TFR/server/account.py index 4c647b4..f94bdfb 100644 --- a/TFR/server/account.py +++ b/TFR/server/account.py @@ -36,7 +36,7 @@ def settings(): flash("Password is incorrect!", "error") return redirect(url_for("account.settings")) - if "file" in request.files and request.files['file'].filename: + if "file" in request.files and request.files["file"].filename: picture = request.files["file"] file_ext = picture.filename.split(".")[-1].lower() file_name = f"{user.id}.{file_ext}" @@ -44,17 +44,18 @@ def settings(): if file_ext not in UPLOAD_EXTENSIONS: error.append("Picture is not a valid image!") if picture.content_length > UPLOAD_MAX_SIZE: - error.append(f"Picture must be less than {UPLOAD_EXTENSIONS / 1000000}MB!") + error.append( + f"Picture must be less than {UPLOAD_EXTENSIONS / 1000000}MB!" + ) image = Image.open(picture.stream) - + # Resizing gifs is more work than it's worth if file_ext != "gif": image_x, image_y = image.size - image.thumbnail(( - min(image_x, UPLOAD_RESOLUTION), - min(image_y, UPLOAD_RESOLUTION) - )) + image.thumbnail( + (min(image_x, UPLOAD_RESOLUTION), min(image_y, UPLOAD_RESOLUTION)) + ) if error: for err in error: @@ -65,7 +66,7 @@ def settings(): os.remove(os.path.join(UPLOAD_DIR, user.picture)) user.picture = file_name - + if file_ext == "gif": image.save(os.path.join(UPLOAD_DIR, file_name), save_all=True) else: