diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..ec8841e5 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# isort +42023b25368d0de9caecbb607d8aa8333b6ddd7a diff --git a/backend/app.py b/backend/app.py index 66e8dd5d..6d658ab1 100644 --- a/backend/app.py +++ b/backend/app.py @@ -4,16 +4,16 @@ from flask_cors import CORS from werkzeug.utils import import_string -from backend.commands.populate_database import populate_database from backend.commands.import_attendance_list import import_attendance_list +from backend.commands.populate_database import populate_database from backend.commands.remove_expired_tokens import remove_expired_tokens -from backend.extensions import api, db, mail, migrate, jwt +from backend.extensions import api, db, jwt, mail, migrate from backend.models import JWTToken from backend.resources.auth import ( - UserLogin, - UserLogout, RefreshAccessToken, RefreshToken, + UserLogin, + UserLogout, ) from backend.resources.contact import SendMessage from backend.resources.hacknight import ( diff --git a/backend/commands/import_attendance_list.py b/backend/commands/import_attendance_list.py index 185c9d02..a7cf96ff 100644 --- a/backend/commands/import_attendance_list.py +++ b/backend/commands/import_attendance_list.py @@ -1,9 +1,10 @@ import csv -import click +import click from flask.cli import with_appcontext -from backend.models import Hacknight, Participant + from backend.extensions import db +from backend.models import Hacknight, Participant @click.command() diff --git a/backend/commands/populate_database.py b/backend/commands/populate_database.py index 84b216b5..e7c30dd2 100644 --- a/backend/commands/populate_database.py +++ b/backend/commands/populate_database.py @@ -1,5 +1,5 @@ -import random import itertools +import random import click from flask.cli import with_appcontext diff --git a/backend/factories.py b/backend/factories.py index 59d546a1..0609d3e2 100644 --- a/backend/factories.py +++ b/backend/factories.py @@ -1,6 +1,7 @@ +from random import randint + import factory from factory import fuzzy -from random import randint from sqlalchemy import or_ from backend.extensions import db diff --git a/backend/helpers.py b/backend/helpers.py index 8026af2f..cc98b844 100644 --- a/backend/helpers.py +++ b/backend/helpers.py @@ -1,6 +1,6 @@ import traceback +from contextlib import contextmanager, redirect_stderr, redirect_stdout from io import StringIO -from contextlib import redirect_stdout, redirect_stderr, contextmanager from typing import Optional import requests diff --git a/backend/migrations/env.py b/backend/migrations/env.py index 295ca9af..72f161ab 100644 --- a/backend/migrations/env.py +++ b/backend/migrations/env.py @@ -1,8 +1,10 @@ from __future__ import with_statement + +import logging +from logging.config import fileConfig + from alembic import context from sqlalchemy import engine_from_config, pool -from logging.config import fileConfig -import logging # this is the Alembic Config object, which provides # access to the values within the .ini file in use. diff --git a/backend/migrations/versions/22771e69d10c_.py b/backend/migrations/versions/22771e69d10c_.py index 35366eaa..3d49510e 100644 --- a/backend/migrations/versions/22771e69d10c_.py +++ b/backend/migrations/versions/22771e69d10c_.py @@ -5,9 +5,8 @@ Create Date: 2021-07-14 18:46:48.994109 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "22771e69d10c" diff --git a/backend/migrations/versions/4d81578a84d3_.py b/backend/migrations/versions/4d81578a84d3_.py index 5fb7a19a..3d5c0e80 100644 --- a/backend/migrations/versions/4d81578a84d3_.py +++ b/backend/migrations/versions/4d81578a84d3_.py @@ -5,9 +5,8 @@ Create Date: 2019-02-13 22:47:23.324102 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "4d81578a84d3" diff --git a/backend/migrations/versions/7408c872d6c0_.py b/backend/migrations/versions/7408c872d6c0_.py index 1c41d43c..c67415eb 100644 --- a/backend/migrations/versions/7408c872d6c0_.py +++ b/backend/migrations/versions/7408c872d6c0_.py @@ -5,9 +5,8 @@ Create Date: 2019-05-15 15:31:00.388640 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "7408c872d6c0" diff --git a/backend/migrations/versions/79060a1bab8e_.py b/backend/migrations/versions/79060a1bab8e_.py index 22f36b96..ad64ae39 100644 --- a/backend/migrations/versions/79060a1bab8e_.py +++ b/backend/migrations/versions/79060a1bab8e_.py @@ -5,9 +5,8 @@ Create Date: 2019-09-25 17:06:21.770398 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "79060a1bab8e" diff --git a/backend/migrations/versions/810e0afb57ea_.py b/backend/migrations/versions/810e0afb57ea_.py index d25d5af1..79f42868 100644 --- a/backend/migrations/versions/810e0afb57ea_.py +++ b/backend/migrations/versions/810e0afb57ea_.py @@ -5,9 +5,8 @@ Create Date: 2022-01-19 19:59:08.027108 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "810e0afb57ea" diff --git a/backend/migrations/versions/8c7cbf0f76c6_.py b/backend/migrations/versions/8c7cbf0f76c6_.py index 9434a4d5..708bf23a 100644 --- a/backend/migrations/versions/8c7cbf0f76c6_.py +++ b/backend/migrations/versions/8c7cbf0f76c6_.py @@ -5,9 +5,8 @@ Create Date: 2020-08-26 16:08:48.987798 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "8c7cbf0f76c6" diff --git a/backend/migrations/versions/b3338f2ae582_add_slack_to_participant.py b/backend/migrations/versions/b3338f2ae582_add_slack_to_participant.py index 8f84dd1c..05d44c6d 100644 --- a/backend/migrations/versions/b3338f2ae582_add_slack_to_participant.py +++ b/backend/migrations/versions/b3338f2ae582_add_slack_to_participant.py @@ -5,9 +5,8 @@ Create Date: 2020-04-05 17:19:46.056559 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "b3338f2ae582" diff --git a/backend/migrations/versions/d81187deab58_153_create_unique_constraints.py b/backend/migrations/versions/d81187deab58_153_create_unique_constraints.py index d2368d60..3a6e3e6c 100644 --- a/backend/migrations/versions/d81187deab58_153_create_unique_constraints.py +++ b/backend/migrations/versions/d81187deab58_153_create_unique_constraints.py @@ -5,9 +5,8 @@ Create Date: 2020-02-26 18:54:51.187603 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "d81187deab58" diff --git a/backend/migrations/versions/e77f6676bf8a_.py b/backend/migrations/versions/e77f6676bf8a_.py index 6c7a458c..2b18391d 100644 --- a/backend/migrations/versions/e77f6676bf8a_.py +++ b/backend/migrations/versions/e77f6676bf8a_.py @@ -5,9 +5,8 @@ Create Date: 2019-10-02 16:44:31.306623 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "e77f6676bf8a" diff --git a/backend/migrations/versions/ea7204474ffa_.py b/backend/migrations/versions/ea7204474ffa_.py index fdd69001..be352363 100644 --- a/backend/migrations/versions/ea7204474ffa_.py +++ b/backend/migrations/versions/ea7204474ffa_.py @@ -5,9 +5,8 @@ Create Date: 2018-11-25 18:45:30.629678 """ -from alembic import op import sqlalchemy as sa - +from alembic import op # revision identifiers, used by Alembic. revision = "ea7204474ffa" diff --git a/backend/models.py b/backend/models.py index e9f417e7..10cfda9d 100644 --- a/backend/models.py +++ b/backend/models.py @@ -4,7 +4,7 @@ from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.sql.schema import ForeignKey from sqlalchemy.types import Boolean, Date, DateTime, Integer, String, Text -from werkzeug.security import generate_password_hash, check_password_hash +from werkzeug.security import check_password_hash, generate_password_hash from backend.extensions import db diff --git a/backend/resources/auth.py b/backend/resources/auth.py index cb811934..8ec88dff 100644 --- a/backend/resources/auth.py +++ b/backend/resources/auth.py @@ -1,23 +1,24 @@ from datetime import datetime, timedelta from http import HTTPStatus -from backend.extensions import db -from backend.models import User, JWTToken -from backend.serializers.login_serializer import LoginSchema from flask import request from flask_jwt_extended import ( create_access_token, create_refresh_token, decode_token, get_jwt_identity, + get_raw_jwt, + jwt_optional, jwt_refresh_token_required, jwt_required, - jwt_optional, - get_raw_jwt, ) from flask_restful import Resource from marshmallow import ValidationError +from backend.extensions import db +from backend.models import JWTToken, User +from backend.serializers.login_serializer import LoginSchema + class UserLogin(Resource): @jwt_optional diff --git a/backend/resources/contact.py b/backend/resources/contact.py index 123fcb40..b6f5849a 100644 --- a/backend/resources/contact.py +++ b/backend/resources/contact.py @@ -1,17 +1,15 @@ import re import time -from textwrap import dedent - from http import HTTPStatus +from textwrap import dedent -from flask import request, current_app +from flask import current_app, request from flask_restful import Resource - from marshmallow import ValidationError -from backend.serializers.message_serializer import MessageSchema from backend.extensions import mail from backend.helpers import wrap_io +from backend.serializers.message_serializer import MessageSchema class MessageError(Exception): diff --git a/backend/resources/hacknight.py b/backend/resources/hacknight.py index c68f245d..57def5b6 100644 --- a/backend/resources/hacknight.py +++ b/backend/resources/hacknight.py @@ -1,11 +1,9 @@ from http import HTTPStatus from flask import request - from flask_jwt_extended import jwt_required from flask_restful import Resource - -from marshmallow import fields, Schema, ValidationError +from marshmallow import Schema, ValidationError, fields from backend.extensions import db from backend.models import Hacknight, Participant diff --git a/backend/resources/participant.py b/backend/resources/participant.py index 6a884de7..330976d7 100644 --- a/backend/resources/participant.py +++ b/backend/resources/participant.py @@ -1,10 +1,8 @@ from http import HTTPStatus from flask import request - from flask_jwt_extended import jwt_required from flask_restful import Resource - from marshmallow import ValidationError from backend.extensions import db diff --git a/backend/resources/team.py b/backend/resources/team.py index 81593d26..911dce6f 100644 --- a/backend/resources/team.py +++ b/backend/resources/team.py @@ -1,11 +1,9 @@ from http import HTTPStatus from flask import request - from flask_jwt_extended import jwt_required from flask_restful import Resource - -from marshmallow import fields, Schema, ValidationError +from marshmallow import Schema, ValidationError, fields from backend.extensions import db from backend.models import Participant, Team, TechStack diff --git a/backend/serializers/message_serializer.py b/backend/serializers/message_serializer.py index 93b76749..5ff5d08a 100644 --- a/backend/serializers/message_serializer.py +++ b/backend/serializers/message_serializer.py @@ -1,6 +1,6 @@ from http import HTTPStatus -from marshmallow import fields, Schema, validate +from marshmallow import Schema, fields, validate class MessageSchema(Schema): diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py index 39fe7cdf..e3b6ff6b 100644 --- a/backend/tests/conftest.py +++ b/backend/tests/conftest.py @@ -1,17 +1,17 @@ -import os import datetime +import os import tempfile -from flask.testing import FlaskClient import pytest +from flask.testing import FlaskClient from backend.app import create_app from backend.extensions import db from backend.factories import ( HacknightFactory, ParticipantFactory, - TechStackFactory, TeamFactory, + TechStackFactory, ) from backend.models import User diff --git a/backend/tests/test_commands.py b/backend/tests/test_commands.py index 3a39219c..1c694dfb 100644 --- a/backend/tests/test_commands.py +++ b/backend/tests/test_commands.py @@ -5,8 +5,8 @@ from flask.cli import ScriptInfo from flask_jwt_extended import create_access_token -from backend.commands.remove_expired_tokens import remove_expired_tokens from backend.commands.populate_database import populate_database +from backend.commands.remove_expired_tokens import remove_expired_tokens from backend.models import ( Hacknight, JWTToken, diff --git a/backend/tests/test_hacknight.py b/backend/tests/test_hacknight.py index 4aa23438..dd1ce8c6 100644 --- a/backend/tests/test_hacknight.py +++ b/backend/tests/test_hacknight.py @@ -1,5 +1,5 @@ -from http import HTTPStatus import json +from http import HTTPStatus from backend.models import Hacknight, Participant diff --git a/backend/tests/test_logout.py b/backend/tests/test_logout.py index 277b7de9..e4f06fd0 100644 --- a/backend/tests/test_logout.py +++ b/backend/tests/test_logout.py @@ -1,8 +1,8 @@ from http import HTTPStatus +import pytest from flask import jsonify from flask_jwt_extended import jwt_required -import pytest from backend.models import JWTToken diff --git a/backend/tests/test_team_details.py b/backend/tests/test_team_details.py index a810508b..a3cace92 100644 --- a/backend/tests/test_team_details.py +++ b/backend/tests/test_team_details.py @@ -1,5 +1,5 @@ -from http import HTTPStatus import json +from http import HTTPStatus import pytest diff --git a/backend/tests/test_teams_list.py b/backend/tests/test_teams_list.py index 85ed5cad..2f5ff87b 100644 --- a/backend/tests/test_teams_list.py +++ b/backend/tests/test_teams_list.py @@ -1,6 +1,5 @@ -from http import HTTPStatus - import json +from http import HTTPStatus from backend.models import Team from backend.serializers.team_serializer import TeamSchema diff --git a/backend/tests/test_tech_stack_details.py b/backend/tests/test_tech_stack_details.py index e0865df1..ca38e832 100644 --- a/backend/tests/test_tech_stack_details.py +++ b/backend/tests/test_tech_stack_details.py @@ -1,5 +1,5 @@ -from http import HTTPStatus import json +from http import HTTPStatus import pytest diff --git a/backend/tests/test_tech_stack_list.py b/backend/tests/test_tech_stack_list.py index 4cafdc58..a1c07be4 100644 --- a/backend/tests/test_tech_stack_list.py +++ b/backend/tests/test_tech_stack_list.py @@ -1,6 +1,5 @@ -from http import HTTPStatus - import json +from http import HTTPStatus from backend.models import TechStack from backend.serializers.techstack_serializer import TechStackSchema