Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLovesDoggo committed Apr 6, 2024
1 parent 2cbccd4 commit 45e4152
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gameserver/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from adminsortable2.admin import SortableInlineAdminMixin, SortableAdminBase
from adminsortable2.admin import SortableAdminBase, SortableInlineAdminMixin
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.flatpages.admin import FlatPageAdmin
Expand Down
17 changes: 9 additions & 8 deletions gameserver/api/routes.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from django.db.models import F, OuterRef, Subquery, Case, When, Q
import datetime
from typing import Any, List

from django.db.models import Case, F, OuterRef, Q, Subquery, When
from django.shortcuts import get_object_or_404
from ninja import NinjaAPI, Schema

from gameserver.models.cache import ContestScore
from gameserver.models.contest import ContestProblem, ContestSubmission, Contest
from ninja import NinjaAPI, Schema
from typing import List, Any
from gameserver.models.contest import Contest, ContestProblem, ContestSubmission

import datetime

def unicode_safe(string):
return string.encode("unicode_escape").decode()
Expand Down Expand Up @@ -85,9 +86,9 @@ def ctftime_standings(request, contest_name: str):

return {"standings": standings, "tasks": task_names}


@api.get("/contests", response=List[ContestOutSchema])
def contests(request):
return (
Contest.objects.filter(is_public=True)
.values("name", "slug", "start_time", "end_time", "max_team_size", "description", "summary")
return Contest.objects.filter(is_public=True).values(
"name", "slug", "start_time", "end_time", "max_team_size", "description", "summary"
)
12 changes: 7 additions & 5 deletions gameserver/models/cache.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import TYPE_CHECKING, Optional, Self, Protocol, Callable
from django.http import HttpRequest
from typing import TYPE_CHECKING, Callable, Optional, Protocol, Self

from django.apps import apps
from django.db import models, transaction
from django.db.models import (
Expand All @@ -8,22 +8,24 @@
Count,
F,
OuterRef,
QuerySet,
Subquery,
Sum,
Value,
When,
QuerySet,
Window,
)
from django.db.models.functions import Coalesce, Rank, RowNumber
from django.http import HttpRequest

if TYPE_CHECKING:
from .profile import User
from .contest import Contest, ContestParticipation, ContestSubmission
from .profile import User


class ResetableCache(Protocol):
def can_reset(cls, request: HttpRequest) -> None: ...
def can_reset(cls, request: HttpRequest) -> None:
...


class CacheMeta(models.Model):
Expand Down
2 changes: 0 additions & 2 deletions gameserver/models/comment.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from typing import Iterable
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.urls import reverse
from django.utils import timezone

from .profile import User

Expand Down
2 changes: 1 addition & 1 deletion gameserver/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.urls import path, include
from django.urls import include, path

from . import views
from .api.routes import api
Expand Down
1 change: 1 addition & 0 deletions providers/CTFTimeOauth/provider.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider

from .views import CTFTimeOauth2Adapter


Expand Down
1 change: 0 additions & 1 deletion providers/CTFTimeOauth/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

from .provider import CTFTimeOauth2AProvider


urlpatterns = default_urlpatterns(CTFTimeOauth2AProvider)

0 comments on commit 45e4152

Please sign in to comment.