From 52b21f404999ced1f3bd22b8f31f8e9159e0b928 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 13:05:22 +0000 Subject: [PATCH] style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf This commit fixes the style issues introduced in 9746187 according to the output from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf. Details: None --- api/endpoints.py | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/api/endpoints.py b/api/endpoints.py index 8deff8235..6bc4572c6 100644 --- a/api/endpoints.py +++ b/api/endpoints.py @@ -1,24 +1,28 @@ -from flask import Blueprint, request, jsonify +from flask import Blueprint, jsonify, request + from .authentication import jwt_required -from .serializers import UserSchema, TransactionSchema +from .serializers import TransactionSchema, UserSchema + +endpoints = Blueprint("endpoints", __name__) -endpoints = Blueprint('endpoints', __name__) -@endpoints.route('/users', methods=['POST']) +@endpoints.route("/users", methods=["POST"]) def create_user(): user_schema = UserSchema() user = user_schema.load(request.get_json()) # Create user in the database return user_schema.jsonify(user), 201 -@endpoints.route('/users/', methods=['GET']) + +@endpoints.route("/users/", methods=["GET"]) @jwt_required() def get_user(user_id): user = get_user_from_database(user_id) user_schema = UserSchema() return user_schema.jsonify(user) -@endpoints.route('/users/', methods=['PUT']) + +@endpoints.route("/users/", methods=["PUT"]) @jwt_required() def update_user(user_id): user = get_user_from_database(user_id) @@ -27,14 +31,16 @@ def update_user(user_id): # Update user in the database return user_schema.jsonify(user) -@endpoints.route('/users/', methods=['DELETE']) + +@endpoints.route("/users/", methods=["DELETE"]) @jwt_required() def delete_user(user_id): user = get_user_from_database(user_id) # Delete user from the database - return '', 204 + return "", 204 -@endpoints.route('/transactions', methods=['POST']) + +@endpoints.route("/transactions", methods=["POST"]) @jwt_required() def create_transaction(): transaction_schema = TransactionSchema() @@ -42,21 +48,24 @@ def create_transaction(): # Create transaction in the database return transaction_schema.jsonify(transaction), 201 -@endpoints.route('/transactions', methods=['GET']) + +@endpoints.route("/transactions", methods=["GET"]) @jwt_required() def get_transactions(): transactions = get_transactions_from_database() transaction_schema = TransactionSchema(many=True) return transaction_schema.jsonify(transactions) -@endpoints.route('/transactions/', methods=['GET']) + +@endpoints.route("/transactions/", methods=["GET"]) @jwt_required() def get_transaction(transaction_id): transaction = get_transaction_from_database(transaction_id) transaction_schema = TransactionSchema() return transaction_schema.jsonify(transaction) -@endpoints.route('/transactions/', methods=['PUT']) + +@endpoints.route("/transactions/", methods=["PUT"]) @jwt_required() def update_transaction(transaction_id): transaction = get_transaction_from_database(transaction_id) @@ -65,9 +74,10 @@ def update_transaction(transaction_id): # Update transaction in the database return transaction_schema.jsonify(transaction) -@endpoints.route('/transactions/', methods=['DELETE']) + +@endpoints.route("/transactions/", methods=["DELETE"]) @jwt_required() def delete_transaction(transaction_id): transaction = get_transaction_from_database(transaction_id) # Delete transaction from the database - return '', 204 + return "", 204