Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CFP-506] Isort everything #510

Merged
merged 2 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# isort
42023b25368d0de9caecbb607d8aa8333b6ddd7a
8 changes: 4 additions & 4 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
5 changes: 3 additions & 2 deletions backend/commands/import_attendance_list.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
2 changes: 1 addition & 1 deletion backend/commands/populate_database.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import random
import itertools
import random

import click
from flask.cli import with_appcontext
Expand Down
3 changes: 2 additions & 1 deletion backend/factories.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion backend/helpers.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions backend/migrations/env.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
3 changes: 1 addition & 2 deletions backend/migrations/versions/22771e69d10c_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions backend/migrations/versions/4d81578a84d3_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions backend/migrations/versions/7408c872d6c0_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions backend/migrations/versions/79060a1bab8e_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions backend/migrations/versions/810e0afb57ea_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions backend/migrations/versions/8c7cbf0f76c6_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions backend/migrations/versions/e77f6676bf8a_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions backend/migrations/versions/ea7204474ffa_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions backend/resources/auth.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 3 additions & 5 deletions backend/resources/contact.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
4 changes: 1 addition & 3 deletions backend/resources/hacknight.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions backend/resources/participant.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 1 addition & 3 deletions backend/resources/team.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion backend/serializers/message_serializer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from http import HTTPStatus

from marshmallow import fields, Schema, validate
from marshmallow import Schema, fields, validate


class MessageSchema(Schema):
Expand Down
6 changes: 3 additions & 3 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_hacknight.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
import json
from http import HTTPStatus

from backend.models import Hacknight, Participant

Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_logout.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_team_details.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
import json
from http import HTTPStatus

import pytest

Expand Down
3 changes: 1 addition & 2 deletions backend/tests/test_teams_list.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_tech_stack_details.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
import json
from http import HTTPStatus

import pytest

Expand Down
3 changes: 1 addition & 2 deletions backend/tests/test_tech_stack_list.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down