Skip to content

Commit

Permalink
isort everything
Browse files Browse the repository at this point in the history
  • Loading branch information
jackrosenthal committed Sep 23, 2023
1 parent 5e91e6c commit e21dbcd
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 67 deletions.
4 changes: 2 additions & 2 deletions algobowl/cli/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import dataclasses
import os
from pathlib import Path
import sys
from pathlib import Path

import click
import toml

from algobowl.cli import formatter
import algobowl.lib.problem as problemlib
from algobowl.cli import formatter


def get_default_config_path():
Expand Down
2 changes: 1 addition & 1 deletion algobowl/cli/group.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pathlib
import re
import sys
import pathlib

import click

Expand Down
4 changes: 2 additions & 2 deletions algobowl/cli/problem.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import concurrent.futures
import io
from pathlib import Path
import sys
from pathlib import Path

import click

from algobowl.cli import formatter
import algobowl.lib.problem as problemlib
from algobowl.cli import formatter


def _parse_input(cli, path: Path):
Expand Down
11 changes: 6 additions & 5 deletions algobowl/config/app_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
Configuration in this file is overridden by the paste config.
"""
import tg
import algobowl
from depot.manager import DepotManager
from markupsafe import Markup
from repoze.who.interfaces import IChallenger
from algobowl import model
from algobowl.config.auth import AuthMetadata, TokenAuth, MPAPIAuthenticator, GoogleAuth
from tg.configuration import AppConfig, milestones
from tg.support.converters import asbool
from tgext.admin.config import AdminConfig
from tgext.admin.layouts import BootstrapAdminLayout
from tgext.admin.widgets import BootstrapAdminTableFiller
from depot.manager import DepotManager
from markupsafe import Markup

import algobowl
from algobowl import model
from algobowl.config.auth import AuthMetadata, GoogleAuth, MPAPIAuthenticator, TokenAuth

base_config = AppConfig()
base_config.renderers = []
Expand Down
18 changes: 9 additions & 9 deletions algobowl/config/auth.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import os
from urllib.parse import urlencode

import tg
import requests
import transaction
import google_auth_oauthlib.flow as gflow
import googleapiclient.discovery as gdiscovery

from urllib.parse import urlencode
from webob import Request
import requests
import tg
import transaction
from repoze.who.interfaces import IAuthenticator, IChallenger, IIdentifier
from tg.configuration.auth import TGAuthMetadata
from tg.exceptions import HTTPFound
from webob import Request
from zope.interface import implementer
from repoze.who.interfaces import IIdentifier, IAuthenticator, IChallenger
from tg.configuration.auth import TGAuthMetadata
from algobowl.model import AuthToken, User, DBSession

from algobowl.model import AuthToken, DBSession, User


class BaseAuth:
Expand Down
3 changes: 2 additions & 1 deletion algobowl/config/middleware.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
"""WSGI middleware initialization for the algobowl application."""
from depot.manager import DepotManager

from algobowl.config.app_cfg import base_config
from algobowl.config.environment import load_environment
from depot.manager import DepotManager

__all__ = ["make_app"]

Expand Down
2 changes: 1 addition & 1 deletion algobowl/controllers/api/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import tg

from algobowl.lib import base
from algobowl import model
from algobowl.lib import base


@dataclasses.dataclass
Expand Down
22 changes: 12 additions & 10 deletions algobowl/controllers/competition.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import zipfile
import datetime
import algobowl.lib.problem as problemlib
from io import StringIO, BytesIO
from collections import namedtuple, defaultdict
import zipfile
from collections import defaultdict, namedtuple
from io import BytesIO, StringIO

from recordclass import recordclass
from tg import expose, abort, request, response, flash, redirect, require
from tg.predicates import has_permission
from sqlalchemy.sql.expression import case
from tg import abort, expose, flash, redirect, request, require, response
from tg.predicates import has_permission

import algobowl.lib.problem as problemlib
from algobowl.lib.base import BaseController
from algobowl.lib.logoutput import logoutput
from algobowl.model import (
DBSession,
Competition,
DBSession,
Evaluation,
Group,
Input,
Output,
Group,
VerificationStatus,
Protest,
Evaluation,
VerificationStatus,
)

__all__ = ["CompetitionsController", "CompetitionController"]
Expand Down
3 changes: 2 additions & 1 deletion algobowl/controllers/error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from tg import request, expose
from tg import expose, request

from algobowl.lib.base import BaseController

__all__ = ["ErrorController"]
Expand Down
13 changes: 7 additions & 6 deletions algobowl/controllers/group.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import datetime
import zipfile
import re
from io import StringIO, BytesIO
from tg import expose, redirect, url, request, response, abort, flash, require
from tg.predicates import not_anonymous, has_permission
import zipfile
from io import BytesIO, StringIO

from depot.io.utils import FileIntent
from tg import abort, expose, flash, redirect, request, require, response, url
from tg.predicates import has_permission, not_anonymous

import algobowl.lib.problem as problemlib
from algobowl.lib.helpers import ftime
from algobowl.lib.base import BaseController
from algobowl.lib.helpers import ftime
from algobowl.model import (
DBSession,
Evaluation,
Group,
Input,
Output,
Evaluation,
VerificationStatus,
)

Expand Down
22 changes: 10 additions & 12 deletions algobowl/controllers/root.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import tg
import algobowl.model
from algobowl.model import DBSession
from tg import expose, flash, require, url, lurl
from tg import redirect, tmpl_context
from tg import predicates
from tg.exceptions import HTTPFound
from repoze.who.api import get_api
from tg import expose, flash, lurl, predicates, redirect, require, tmpl_context, url
from tg.exceptions import HTTPFound
from tgext.admin.controller import AdminController

from algobowl.controllers import api
import algobowl.controllers.setup as setup_controller
import algobowl.controllers.pref as pref_controller
import algobowl.controllers.file_redirector as file_redirector
import algobowl.controllers.pref as pref_controller
import algobowl.controllers.setup as setup_controller
import algobowl.model
from algobowl.config.app_cfg import AdminConfig
from algobowl.lib.base import BaseController
from tgext.admin.controller import AdminController
from algobowl.controllers import api
from algobowl.controllers.competition import CompetitionsController
from algobowl.controllers.error import ErrorController
from algobowl.controllers.group import GroupsController
from algobowl.controllers.competition import CompetitionsController
from algobowl.lib.base import BaseController
from algobowl.model import DBSession

__all__ = ["RootController"]

Expand Down
4 changes: 1 addition & 3 deletions algobowl/lib/base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
"""The base Controller API."""

from tg import TGController, tmpl_context
from tg import request

from tg import TGController, request, tmpl_context

__all__ = ["BaseController"]

Expand Down
3 changes: 2 additions & 1 deletion algobowl/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
This module is exposed in all templates under the name ``h``.
"""
from datetime import datetime, date, time, timedelta
from datetime import date, datetime, time, timedelta

import tg


Expand Down
2 changes: 1 addition & 1 deletion algobowl/lib/logoutput.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import io
import contextlib
import functools
import io

from tg import expose

Expand Down
10 changes: 5 additions & 5 deletions algobowl/model.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import enum
import datetime
import enum

import sqlalchemy as sa
import tg
from sqlalchemy.orm import relationship, relation
from zope.sqlalchemy import register
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from depot.fields.sqlalchemy import UploadedFileField
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relation, relationship, scoped_session, sessionmaker
from zope.sqlalchemy import register

maker = sessionmaker(autoflush=True, autocommit=False)
DBSession = scoped_session(maker)
Expand Down
3 changes: 2 additions & 1 deletion algobowl/websetup/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Setup the algobowl application"""
from algobowl.config.environment import load_environment
from .schema import setup_schema

from .bootstrap import bootstrap
from .schema import setup_schema


def setup_app(command, conf, vars):
Expand Down
3 changes: 1 addition & 2 deletions algobowl/websetup/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"""Setup the algobowl application"""
from __future__ import print_function

from tg import config
import transaction
from tg import config


def setup_schema(command, conf, vars):
Expand All @@ -14,7 +14,6 @@ def setup_schema(command, conf, vars):
from algobowl import model

# <websetup.websetup.schema.after.model.import>

# <websetup.websetup.schema.before.metadata.create_all>
print("Creating tables")
model.metadata.create_all(bind=config["tg.app_globals"].sa_engine)
Expand Down
1 change: 1 addition & 0 deletions migration/env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import with_statement

from alembic import context
from sqlalchemy import engine_from_config, pool

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""

import sqlalchemy as sa

from alembic import op
from depot.fields.sqlalchemy import UploadedFileField

Expand Down
2 changes: 1 addition & 1 deletion migration/versions/819923a3acd9_add_incognito_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"""

from alembic import op
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "819923a3acd9"
Expand Down
3 changes: 1 addition & 2 deletions migration/versions/8d2d82cd68f4_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"""

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "8d2d82cd68f4"
Expand Down

0 comments on commit e21dbcd

Please sign in to comment.