mirror of
https://github.com/DMOJ/online-judge.git
synced 2024-11-25 16:32:37 +08:00
Enforce import order
This commit is contained in:
parent
61daa227e2
commit
79fcd74937
2
.flake8
2
.flake8
@ -1,5 +1,7 @@
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
application-import-names = dmoj,judge,django_ace,event_socket_server
|
||||
import-order-style = pycharm
|
||||
ignore =
|
||||
W504, # line break occurred after a binary operator
|
||||
per-file-ignores =
|
||||
|
@ -1,6 +1,6 @@
|
||||
language: python
|
||||
python: 3.7
|
||||
install: pip install flake8
|
||||
install: pip install flake8 flake8-import-order
|
||||
script:
|
||||
- flake8 --version
|
||||
- flake8
|
||||
|
@ -10,7 +10,7 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dmoj.settings')
|
||||
|
||||
app = Celery('dmoj')
|
||||
|
||||
from django.conf import settings # noqa: E402, django must be imported here
|
||||
from django.conf import settings # noqa: E402, I202, django must be imported here
|
||||
app.config_from_object(settings, namespace='CELERY')
|
||||
|
||||
if hasattr(settings, 'CELERY_BROKER_URL_SECRET'):
|
||||
|
@ -1,8 +1,8 @@
|
||||
import traceback
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from django.utils.log import AdminEmailHandler
|
||||
from django.conf import settings
|
||||
|
||||
DEFAULT_THROTTLE = (10, 60)
|
||||
|
||||
|
21
dmoj/urls.py
21
dmoj/urls.py
@ -6,22 +6,23 @@ from django.contrib.sitemaps.views import sitemap
|
||||
from django.http import Http404, HttpResponsePermanentRedirect
|
||||
from django.templatetags.static import static
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.functional import lazystr
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.generic import RedirectView
|
||||
|
||||
from judge.feed import CommentFeed, AtomCommentFeed, BlogFeed, AtomBlogFeed, ProblemFeed, AtomProblemFeed
|
||||
from judge.feed import AtomBlogFeed, AtomCommentFeed, AtomProblemFeed, BlogFeed, CommentFeed, ProblemFeed
|
||||
from judge.forms import CustomAuthenticationForm
|
||||
from judge.sitemap import ProblemSitemap, UserSitemap, HomePageSitemap, UrlSitemap, ContestSitemap, \
|
||||
OrganizationSitemap, BlogPostSitemap, SolutionSitemap
|
||||
from judge.views import TitledTemplateView
|
||||
from judge.views import organization, language, status, blog, problem, mailgun, license, register, user, \
|
||||
submission, widgets, comment, contests, api, ranked_submission, stats, preview, ticket, totp, tasks, problem_manage
|
||||
from judge.sitemap import BlogPostSitemap, ContestSitemap, HomePageSitemap, OrganizationSitemap, ProblemSitemap, \
|
||||
SolutionSitemap, UrlSitemap, UserSitemap
|
||||
from judge.views import TitledTemplateView, api, blog, comment, contests, language, license, mailgun, organization, \
|
||||
preview, problem, problem_manage, ranked_submission, register, stats, status, submission, tasks, ticket, totp, \
|
||||
user, widgets
|
||||
from judge.views.problem_data import ProblemDataView, ProblemSubmissionDiff, \
|
||||
problem_data_file, problem_init_view
|
||||
from judge.views.register import RegistrationView, ActivationView
|
||||
from judge.views.select2 import UserSelect2View, OrganizationSelect2View, ProblemSelect2View, CommentSelect2View, \
|
||||
ContestSelect2View, UserSearchSelect2View, ContestUserSearchSelect2View, TicketUserSelect2View, AssigneeSelect2View
|
||||
from judge.views.register import ActivationView, RegistrationView
|
||||
from judge.views.select2 import AssigneeSelect2View, CommentSelect2View, ContestSelect2View, \
|
||||
ContestUserSearchSelect2View, OrganizationSelect2View, ProblemSelect2View, TicketUserSelect2View, \
|
||||
UserSearchSelect2View, UserSelect2View
|
||||
|
||||
admin.autodiscover()
|
||||
|
||||
|
@ -21,5 +21,5 @@ else:
|
||||
partial(MySQLdb.connect, waiter=gevent_waiter)
|
||||
)
|
||||
|
||||
from django.core.wsgi import get_wsgi_application # noqa: E402, django must be imported here
|
||||
from django.core.wsgi import get_wsgi_application # noqa: E402, I202, django must be imported here
|
||||
application = get_wsgi_application()
|
||||
|
@ -1,7 +1,7 @@
|
||||
from .base_server import BaseServer
|
||||
from .engines import *
|
||||
from .handler import Handler
|
||||
from .helpers import SizedPacketHandler, ZlibPacketHandler, ProxyProtocolMixin
|
||||
from .helpers import ProxyProtocolMixin, SizedPacketHandler, ZlibPacketHandler
|
||||
|
||||
|
||||
def get_preferred_engine(choices=('epoll', 'poll', 'select')):
|
||||
|
@ -2,10 +2,9 @@ import logging
|
||||
import socket
|
||||
import threading
|
||||
import time
|
||||
|
||||
from collections import defaultdict, deque
|
||||
from functools import total_ordering
|
||||
from heapq import heappush, heappop
|
||||
from heapq import heappop, heappush
|
||||
|
||||
logger = logging.getLogger('event_socket_server')
|
||||
|
||||
|
@ -2,7 +2,6 @@ import struct
|
||||
import zlib
|
||||
|
||||
from judge.utils.unicode import utf8text
|
||||
|
||||
from .handler import Handler
|
||||
|
||||
size_pack = struct.Struct('!I')
|
||||
|
@ -2,8 +2,8 @@ from django.contrib import admin
|
||||
from django.contrib.admin.models import LogEntry
|
||||
|
||||
from judge.admin.comments import CommentAdmin
|
||||
from judge.admin.contest import ContestTagAdmin, ContestAdmin, ContestParticipationAdmin
|
||||
from judge.admin.interface import NavigationBarAdmin, BlogPostAdmin, LicenseAdmin, LogEntryAdmin
|
||||
from judge.admin.contest import ContestAdmin, ContestParticipationAdmin, ContestTagAdmin
|
||||
from judge.admin.interface import BlogPostAdmin, LicenseAdmin, LogEntryAdmin, NavigationBarAdmin
|
||||
from judge.admin.organization import OrganizationAdmin, OrganizationRequestAdmin
|
||||
from judge.admin.problem import ProblemAdmin
|
||||
from judge.admin.profile import ProfileAdmin
|
||||
|
@ -1,7 +1,7 @@
|
||||
from django.forms import ModelForm
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import ungettext, gettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _, ungettext
|
||||
from reversion.admin import VersionAdmin
|
||||
|
||||
from judge.models import Comment
|
||||
|
@ -2,20 +2,20 @@ from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin, messages
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db import transaction, connection
|
||||
from django.db.models import TextField, Q
|
||||
from django.db import connection, transaction
|
||||
from django.db.models import Q, TextField
|
||||
from django.forms import ModelForm, ModelMultipleChoiceField
|
||||
from django.http import HttpResponseRedirect, Http404
|
||||
from django.http import Http404, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse_lazy, reverse
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext_lazy as _, ugettext, ungettext
|
||||
from reversion.admin import VersionAdmin
|
||||
|
||||
from judge.models import Contest, ContestProblem, ContestSubmission, Profile, Rating
|
||||
from judge.ratings import rate_contest
|
||||
from judge.widgets import HeavySelect2Widget, HeavySelect2MultipleWidget, AdminPagedownWidget, Select2MultipleWidget, \
|
||||
HeavyPreviewAdminPageDownWidget, Select2Widget
|
||||
from judge.widgets import AdminPagedownWidget, HeavyPreviewAdminPageDownWidget, HeavySelect2MultipleWidget, \
|
||||
HeavySelect2Widget, Select2MultipleWidget, Select2Widget
|
||||
|
||||
|
||||
class HeavySelect2Widget(HeavySelect2Widget):
|
||||
|
@ -1,7 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.models import User
|
||||
from django.forms import ModelForm
|
||||
from django.urls import reverse, reverse_lazy, NoReverseMatch
|
||||
from django.urls import NoReverseMatch, reverse, reverse_lazy
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from mptt.admin import DraggableMPTTAdmin
|
||||
@ -9,7 +9,7 @@ from reversion.admin import VersionAdmin
|
||||
|
||||
from judge.dblock import LockModel
|
||||
from judge.models import NavigationBar
|
||||
from judge.widgets import HeavySelect2MultipleWidget, HeavyPreviewAdminPageDownWidget, HeavySelect2Widget
|
||||
from judge.widgets import HeavyPreviewAdminPageDownWidget, HeavySelect2MultipleWidget, HeavySelect2Widget
|
||||
|
||||
|
||||
class NavigationBarAdmin(DraggableMPTTAdmin):
|
||||
|
@ -6,7 +6,7 @@ from django.utils.translation import gettext, gettext_lazy as _
|
||||
from reversion.admin import VersionAdmin
|
||||
|
||||
from judge.models import Organization
|
||||
from judge.widgets import HeavySelect2MultipleWidget, HeavySelect2Widget, HeavyPreviewAdminPageDownWidget
|
||||
from judge.widgets import HeavyPreviewAdminPageDownWidget, HeavySelect2MultipleWidget, HeavySelect2Widget
|
||||
|
||||
|
||||
class OrganizationForm(ModelForm):
|
||||
|
@ -7,13 +7,12 @@ from django.db.models import Q
|
||||
from django.forms import ModelForm
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext, ungettext, gettext_lazy as _
|
||||
from django.utils.translation import gettext, gettext_lazy as _, ungettext
|
||||
from reversion.admin import VersionAdmin
|
||||
|
||||
from judge.models import Profile, LanguageLimit, ProblemTranslation, Problem, ProblemClarification
|
||||
from judge.models import Solution
|
||||
from judge.widgets import HeavySelect2MultipleWidget, Select2MultipleWidget, Select2Widget, \
|
||||
HeavyPreviewAdminPageDownWidget, HeavyPreviewPageDownWidget, CheckboxSelectMultipleWithSelectAll
|
||||
from judge.models import LanguageLimit, Problem, ProblemClarification, ProblemTranslation, Profile, Solution
|
||||
from judge.widgets import CheckboxSelectMultipleWithSelectAll, HeavyPreviewAdminPageDownWidget, \
|
||||
HeavyPreviewPageDownWidget, HeavySelect2MultipleWidget, Select2MultipleWidget, Select2Widget
|
||||
|
||||
|
||||
class ProblemForm(ModelForm):
|
||||
|
@ -1,12 +1,12 @@
|
||||
from django.contrib import admin
|
||||
from django.forms import ModelForm
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext_lazy as _, gettext, ungettext
|
||||
from django.utils.translation import gettext, gettext_lazy as _, ungettext
|
||||
from reversion.admin import VersionAdmin
|
||||
|
||||
from django_ace import AceWidget
|
||||
from judge.models import Profile
|
||||
from judge.widgets import Select2Widget, AdminPagedownWidget
|
||||
from judge.widgets import AdminPagedownWidget, Select2Widget
|
||||
|
||||
|
||||
class ProfileForm(ModelForm):
|
||||
|
@ -1,6 +1,6 @@
|
||||
from django.conf.urls import url
|
||||
from django.db.models import TextField
|
||||
from django.forms import TextInput, ModelForm, ModelMultipleChoiceField
|
||||
from django.forms import ModelForm, ModelMultipleChoiceField, TextInput
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.urls import reverse
|
||||
|
@ -10,11 +10,11 @@ from django.db.models import Q
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext_lazy as _, pgettext, gettext, ungettext
|
||||
from django.utils.translation import gettext, gettext_lazy as _, pgettext, ungettext
|
||||
|
||||
from django_ace import AceWidget
|
||||
from judge.models import Submission, SubmissionTestCase, SubmissionSource, ContestSubmission, ContestParticipation, \
|
||||
ContestProblem, Profile
|
||||
from judge.models import ContestParticipation, ContestProblem, ContestSubmission, Profile, Submission, \
|
||||
SubmissionSource, SubmissionTestCase
|
||||
from judge.utils.raw_sql import use_straight_join
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ from django.forms import ModelForm
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from judge.models import TicketMessage
|
||||
from judge.widgets import HeavySelect2Widget, HeavySelect2MultipleWidget, HeavyPreviewAdminPageDownWidget
|
||||
from judge.widgets import HeavyPreviewAdminPageDownWidget, HeavySelect2MultipleWidget, HeavySelect2Widget
|
||||
|
||||
|
||||
class TicketMessageForm(ModelForm):
|
||||
|
@ -1,7 +1,6 @@
|
||||
from .judgelist import JudgeList
|
||||
from .judgehandler import JudgeHandler
|
||||
from .judgeserver import JudgeServer
|
||||
|
||||
from .djangohandler import DjangoHandler
|
||||
from .judgecallback import DjangoJudgeHandler
|
||||
from .djangoserver import DjangoServer
|
||||
from .judgecallback import DjangoJudgeHandler
|
||||
from .judgehandler import JudgeHandler
|
||||
from .judgelist import JudgeList
|
||||
from .judgeserver import JudgeServer
|
||||
|
@ -1,5 +1,5 @@
|
||||
import logging
|
||||
import json
|
||||
import logging
|
||||
import struct
|
||||
|
||||
from event_socket_server import ZlibPacketHandler
|
||||
|
@ -8,7 +8,7 @@ from django.utils import timezone
|
||||
|
||||
from judge import event_poster as event
|
||||
from judge.caching import finished_submission
|
||||
from judge.models import Submission, SubmissionTestCase, Problem, Judge, Language, LanguageLimit, RuntimeVersion
|
||||
from judge.models import Judge, Language, LanguageLimit, Problem, RuntimeVersion, Submission, SubmissionTestCase
|
||||
from .judgehandler import JudgeHandler, SubmissionData
|
||||
|
||||
logger = logging.getLogger('judge.bridge')
|
||||
|
@ -3,7 +3,7 @@ import logging
|
||||
import time
|
||||
from collections import deque, namedtuple
|
||||
|
||||
from event_socket_server import ZlibPacketHandler, ProxyProtocolMixin
|
||||
from event_socket_server import ProxyProtocolMixin, ZlibPacketHandler
|
||||
|
||||
logger = logging.getLogger('judge.bridge')
|
||||
|
||||
|
@ -4,7 +4,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db.models import Count
|
||||
from django.db.models.expressions import Value, F
|
||||
from django.db.models.expressions import F, Value
|
||||
from django.db.models.functions import Coalesce
|
||||
from django.forms import ModelForm
|
||||
from django.http import HttpResponseForbidden, HttpResponseNotFound, HttpResponseRedirect
|
||||
@ -19,7 +19,7 @@ from reversion.models import Revision, Version
|
||||
|
||||
from judge.dblock import LockModel
|
||||
from judge.models import Comment, CommentLock, CommentVote
|
||||
from judge.utils.raw_sql import unique_together_left_join, RawSQLColumn
|
||||
from judge.utils.raw_sql import RawSQLColumn, unique_together_left_join
|
||||
from judge.widgets import HeavyPreviewPageDownWidget
|
||||
|
||||
|
||||
|
@ -2,4 +2,4 @@ from judge.contest_format.atcoder import AtCoderContestFormat
|
||||
from judge.contest_format.default import DefaultContestFormat
|
||||
from judge.contest_format.ecoo import ECOOContestFormat
|
||||
from judge.contest_format.ioi import IOIContestFormat
|
||||
from judge.contest_format.registry import formats, choices
|
||||
from judge.contest_format.registry import choices, formats
|
||||
|
@ -1,4 +1,5 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db.models import Max
|
||||
from django.template.defaultfilters import floatformat
|
||||
|
@ -1,4 +1,5 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import connection
|
||||
from django.template.defaultfilters import floatformat
|
||||
|
@ -2,11 +2,10 @@ import json
|
||||
import threading
|
||||
from time import time
|
||||
|
||||
from django.conf import settings
|
||||
import pika
|
||||
from django.conf import settings
|
||||
from pika.exceptions import AMQPError
|
||||
|
||||
|
||||
__all__ = ['EventPoster', 'post', 'last']
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@ import socket
|
||||
import threading
|
||||
|
||||
from django.conf import settings
|
||||
from websocket import create_connection, WebSocketException
|
||||
from websocket import WebSocketException, create_connection
|
||||
|
||||
__all__ = ['EventPostingError', 'EventPoster', 'post', 'last']
|
||||
_local = threading.local()
|
||||
|
@ -6,7 +6,7 @@ from django.utils import timezone
|
||||
from django.utils.feedgenerator import Atom1Feed
|
||||
|
||||
from judge.jinja2.markdown import markdown
|
||||
from judge.models import Comment, BlogPost, Problem
|
||||
from judge.models import BlogPost, Comment, Problem
|
||||
|
||||
|
||||
class ProblemFeed(Feed):
|
||||
|
@ -7,15 +7,15 @@ from django.contrib.auth.forms import AuthenticationForm
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db.models import Q
|
||||
from django.forms import ModelForm, CharField, Form
|
||||
from django.forms import CharField, Form, ModelForm
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from django_ace import AceWidget
|
||||
from judge.models import Organization, Problem, Profile, Submission, PrivateMessage, Language
|
||||
from judge.models import Language, Organization, PrivateMessage, Problem, Profile, Submission
|
||||
from judge.utils.subscription import newsletter_id
|
||||
from judge.widgets import MathJaxPagedownWidget, HeavyPreviewPageDownWidget, PagedownWidget, \
|
||||
Select2Widget, Select2MultipleWidget
|
||||
from judge.widgets import HeavyPreviewPageDownWidget, MathJaxPagedownWidget, PagedownWidget, Select2MultipleWidget, \
|
||||
Select2Widget
|
||||
|
||||
|
||||
def fix_unicode(string, unsafe=tuple('\u202a\u202b\u202d\u202e')):
|
||||
|
@ -1,6 +1,6 @@
|
||||
# From: http://www.mercurytide.co.uk/news/article/django-full-text-search/
|
||||
|
||||
from django.db import models, connection
|
||||
from django.db import connection, models
|
||||
from django.db.models.query import QuerySet
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
from judge.utils.camo import client as camo_client
|
||||
|
||||
from . import registry
|
||||
|
||||
|
||||
|
@ -7,11 +7,11 @@ import mistune
|
||||
from django.conf import settings
|
||||
from jinja2 import Markup
|
||||
from lxml import html
|
||||
from lxml.etree import XMLSyntaxError, ParserError
|
||||
from lxml.etree import ParserError, XMLSyntaxError
|
||||
|
||||
from judge.highlight_code import highlight_code
|
||||
from judge.jinja2.markdown.lazy_load import lazy_load as lazy_load_processor
|
||||
from judge.jinja2.markdown.math import MathRenderer, MathInlineLexer, MathInlineGrammar
|
||||
from judge.jinja2.markdown.math import MathInlineGrammar, MathInlineLexer, MathRenderer
|
||||
from judge.utils.camo import client as camo_client
|
||||
from judge.utils.texoid import TEXOID_ENABLED, TexoidRenderer
|
||||
from .. import registry
|
||||
|
@ -1,5 +1,5 @@
|
||||
from django.template import (Template as DjangoTemplate, TemplateSyntaxError as DjangoTemplateSyntaxError,
|
||||
VariableDoesNotExist, Context)
|
||||
from django.template import (Context, Template as DjangoTemplate, TemplateSyntaxError as DjangoTemplateSyntaxError,
|
||||
VariableDoesNotExist)
|
||||
|
||||
from . import registry
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from django.template.loader import get_template
|
||||
from django.utils.safestring import mark_safe
|
||||
from django_social_share.templatetags.social_share import post_to_gplus_url, post_to_twitter_url, post_to_facebook_url
|
||||
from django_social_share.templatetags.social_share import post_to_facebook_url, post_to_gplus_url, post_to_twitter_url
|
||||
|
||||
from . import registry
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import re
|
||||
|
||||
from jinja2 import nodes, Markup
|
||||
from jinja2 import Markup, nodes
|
||||
from jinja2.ext import Extension
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import datetime
|
||||
|
||||
from judge.utils.timedelta import nice_repr
|
||||
|
||||
from . import registry
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import logging
|
||||
|
||||
from django.utils.safestring import mark_safe, SafeData
|
||||
from django.utils.safestring import SafeData, mark_safe
|
||||
from lxml import html
|
||||
from lxml.etree import ParserError, XMLSyntaxError
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from judge.models import Profile, Language
|
||||
from judge.models import Language, Profile
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
@ -8,7 +8,7 @@ from django.template.loader import get_template
|
||||
from django.utils import translation
|
||||
|
||||
from judge.models import Problem, ProblemTranslation
|
||||
from judge.pdf_problems import DefaultPdfMaker, PhantomJSPdfMaker, SlimerJSPdfMaker, PuppeteerPDFRender
|
||||
from judge.pdf_problems import DefaultPdfMaker, PhantomJSPdfMaker, PuppeteerPDFRender, SlimerJSPdfMaker
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
@ -1,6 +1,6 @@
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.urls import reverse, resolve, Resolver404
|
||||
from django.urls import Resolver404, resolve, reverse
|
||||
from django.utils.http import urlquote
|
||||
|
||||
|
||||
|
@ -2,18 +2,16 @@
|
||||
# Generated by Django 1.11.20 on 2019-04-18 02:06
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import jsonfield.fields
|
||||
import judge.models.interface
|
||||
import judge.models.problem_data
|
||||
import judge.models.profile
|
||||
import judge.utils.problem_data
|
||||
import mptt.fields
|
||||
import sortedm2m.fields
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
import judge.models.interface
|
||||
import judge.utils.problem_data
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Generated by Django 1.11.15 on 2019-01-31 22:18
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -1,16 +1,16 @@
|
||||
from reversion import revisions
|
||||
|
||||
from judge.models.choices import TIMEZONE, ACE_THEMES, MATH_ENGINES_CHOICES, EFFECTIVE_MATH_ENGINES
|
||||
from judge.models.choices import ACE_THEMES, EFFECTIVE_MATH_ENGINES, MATH_ENGINES_CHOICES, TIMEZONE
|
||||
from judge.models.comment import Comment, CommentLock, CommentVote
|
||||
from judge.models.contest import Contest, ContestTag, ContestParticipation, ContestProblem, ContestSubmission, Rating
|
||||
from judge.models.interface import MiscConfig, validate_regex, NavigationBar, BlogPost
|
||||
from judge.models.contest import Contest, ContestParticipation, ContestProblem, ContestSubmission, ContestTag, Rating
|
||||
from judge.models.interface import BlogPost, MiscConfig, NavigationBar, validate_regex
|
||||
from judge.models.message import PrivateMessage, PrivateMessageThread
|
||||
from judge.models.problem import ProblemGroup, ProblemType, Problem, ProblemClarification, ProblemTranslation, \
|
||||
TranslatedProblemQuerySet, TranslatedProblemForeignKeyQuerySet, License, LanguageLimit, Solution
|
||||
from judge.models.problem_data import problem_data_storage, problem_directory_file, ProblemData, ProblemTestCase, \
|
||||
CHECKERS
|
||||
from judge.models.profile import Profile, Organization, OrganizationRequest
|
||||
from judge.models.runtime import Language, RuntimeVersion, Judge
|
||||
from judge.models.problem import LanguageLimit, License, Problem, ProblemClarification, ProblemGroup, \
|
||||
ProblemTranslation, ProblemType, Solution, TranslatedProblemForeignKeyQuerySet, TranslatedProblemQuerySet
|
||||
from judge.models.problem_data import CHECKERS, ProblemData, ProblemTestCase, problem_data_storage, \
|
||||
problem_directory_file
|
||||
from judge.models.profile import Organization, OrganizationRequest, Profile
|
||||
from judge.models.runtime import Judge, Language, RuntimeVersion
|
||||
from judge.models.submission import SUBMISSION_RESULT, Submission, SubmissionSource, SubmissionTestCase
|
||||
from judge.models.ticket import Ticket, TicketMessage
|
||||
|
||||
|
@ -5,12 +5,12 @@ from django.db.models import CASCADE
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import gettext_lazy as _, gettext
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
from jsonfield import JSONField
|
||||
|
||||
from judge import contest_format
|
||||
from judge.models.problem import Problem
|
||||
from judge.models.profile import Profile, Organization
|
||||
from judge.models.profile import Organization, Profile
|
||||
from judge.models.submission import Submission
|
||||
|
||||
__all__ = ['Contest', 'ContestTag', 'ContestParticipation', 'ContestProblem', 'ContestSubmission', 'Rating']
|
||||
|
@ -5,7 +5,7 @@ from django.contrib.contenttypes.fields import GenericRelation
|
||||
from django.core.cache import cache
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator
|
||||
from django.db import models
|
||||
from django.db.models import F, QuerySet, CASCADE, SET_NULL
|
||||
from django.db.models import CASCADE, F, QuerySet, SET_NULL
|
||||
from django.db.models.expressions import RawSQL
|
||||
from django.db.models.functions import Coalesce
|
||||
from django.urls import reverse
|
||||
@ -13,10 +13,10 @@ from django.utils.functional import cached_property
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from judge.fulltext import SearchQuerySet
|
||||
from judge.models.profile import Profile, Organization
|
||||
from judge.models.profile import Organization, Profile
|
||||
from judge.models.runtime import Language
|
||||
from judge.user_translations import gettext as user_gettext
|
||||
from judge.utils.raw_sql import unique_together_left_join, RawSQLColumn
|
||||
from judge.utils.raw_sql import RawSQLColumn, unique_together_left_join
|
||||
|
||||
__all__ = ['ProblemGroup', 'ProblemType', 'Problem', 'ProblemTranslation', 'ProblemClarification',
|
||||
'License', 'Solution', 'TranslatedProblemQuerySet', 'TranslatedProblemForeignKeyQuerySet']
|
||||
|
@ -12,7 +12,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
from fernet_fields import EncryptedCharField
|
||||
from sortedm2m.fields import SortedManyToManyField
|
||||
|
||||
from judge.models.choices import TIMEZONE, ACE_THEMES, MATH_ENGINES_CHOICES
|
||||
from judge.models.choices import ACE_THEMES, MATH_ENGINES_CHOICES, TIMEZONE
|
||||
from judge.ratings import rating_class
|
||||
|
||||
__all__ = ['Organization', 'Profile', 'OrganizationRequest']
|
||||
|
@ -2,9 +2,9 @@ from collections import OrderedDict, defaultdict
|
||||
from operator import attrgetter
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.db import models
|
||||
from django.db.models import CASCADE
|
||||
from django.urls import reverse
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
@ -8,13 +8,12 @@ from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from judge.judgeapi import judge_submission, abort_submission
|
||||
from judge.judgeapi import abort_submission, judge_submission
|
||||
from judge.models.problem import Problem, TranslatedProblemForeignKeyQuerySet
|
||||
from judge.models.profile import Profile
|
||||
from judge.models.runtime import Language
|
||||
from judge.utils.unicode import utf8bytes
|
||||
|
||||
|
||||
__all__ = ['SUBMISSION_RESULT', 'Submission', 'SubmissionSource', 'SubmissionTestCase']
|
||||
|
||||
SUBMISSION_RESULT = (
|
||||
|
@ -1,8 +1,7 @@
|
||||
import errno
|
||||
import logging
|
||||
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
@ -5,12 +5,12 @@ from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
from django.core.cache import cache
|
||||
from django.core.cache.utils import make_template_fragment_key
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.db.models.signals import post_delete, post_save
|
||||
from django.dispatch import receiver
|
||||
|
||||
from .caching import finished_submission
|
||||
from .models import Problem, Contest, Submission, Organization, Profile, MiscConfig, Language, Judge, \
|
||||
BlogPost, ContestSubmission, Comment, License, EFFECTIVE_MATH_ENGINES
|
||||
from .models import BlogPost, Comment, Contest, ContestSubmission, EFFECTIVE_MATH_ENGINES, Judge, Language, License, \
|
||||
MiscConfig, Organization, Problem, Profile, Submission
|
||||
|
||||
|
||||
def get_pdf_path(basename):
|
||||
|
@ -3,7 +3,7 @@ from django.contrib.sitemaps import Sitemap
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from judge.models import Problem, Organization, Contest, BlogPost, Solution
|
||||
from judge.models import BlogPost, Contest, Organization, Problem, Solution
|
||||
|
||||
|
||||
class ProblemSitemap(Sitemap):
|
||||
|
@ -17,7 +17,7 @@ from social_core.pipeline.partial import partial
|
||||
from social_django.middleware import SocialAuthExceptionMiddleware as OldSocialAuthExceptionMiddleware
|
||||
|
||||
from judge.forms import ProfileForm
|
||||
from judge.models import Profile, Language
|
||||
from judge.models import Language, Profile
|
||||
|
||||
logger = logging.getLogger('judge.social_auth')
|
||||
|
||||
|
@ -2,7 +2,7 @@ from celery import shared_task
|
||||
from django.core.cache import cache
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from judge.models import Submission, Profile, Problem
|
||||
from judge.models import Problem, Profile, Submission
|
||||
from judge.utils.celery import Progress
|
||||
|
||||
__all__ = ('apply_submission_filter', 'rejudge_problem_filter', 'rescore_problem')
|
||||
|
@ -7,7 +7,7 @@ from django.core.cache import cache
|
||||
from django.utils.functional import SimpleLazyObject, new_method_proxy
|
||||
|
||||
from judge.utils.caniuse import CanIUse, SUPPORT
|
||||
from .models import Profile, MiscConfig, NavigationBar
|
||||
from .models import MiscConfig, NavigationBar, Profile
|
||||
|
||||
|
||||
class FixedSimpleLazyObject(SimpleLazyObject):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from operator import itemgetter, attrgetter
|
||||
from operator import attrgetter, itemgetter
|
||||
|
||||
from django import template
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
from judge.models import Profile
|
||||
from django.utils.timezone import now
|
||||
|
||||
from judge.models import Profile
|
||||
|
||||
|
||||
class LogUserAccessMiddleware(object):
|
||||
def __init__(self, get_response=None):
|
||||
|
@ -1,5 +1,4 @@
|
||||
import requests
|
||||
|
||||
from ua_parser import user_agent_parser
|
||||
|
||||
_SUPPORT_DATA = requests.get('https://raw.githubusercontent.com/Fyrd/caniuse/master/data.json').json()['data']
|
||||
|
@ -1,8 +1,7 @@
|
||||
import math
|
||||
|
||||
from functools import reduce
|
||||
|
||||
from django.core.paginator import Paginator, Page, InvalidPage
|
||||
from django.core.paginator import InvalidPage, Page, Paginator
|
||||
|
||||
__all__ = (
|
||||
'InvalidPage',
|
||||
|
@ -2,12 +2,12 @@ from collections import defaultdict
|
||||
from math import e
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.db.models import F, Count, Max, Q, ExpressionWrapper, Case, When
|
||||
from django.db.models import Case, Count, ExpressionWrapper, F, Max, Q, When
|
||||
from django.db.models.fields import FloatField
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext as _, gettext_noop
|
||||
|
||||
from judge.models import Submission, Problem
|
||||
from judge.models import Problem, Submission
|
||||
|
||||
__all__ = ['contest_completed_ids', 'get_result_data', 'user_completed_ids', 'user_authored_ids', 'user_editable_ids']
|
||||
|
||||
|
@ -3,7 +3,7 @@ from copy import copy
|
||||
from django.db import connections
|
||||
from django.db.models import Field
|
||||
from django.db.models.expressions import RawSQL
|
||||
from django.db.models.sql.constants import LOUTER, INNER
|
||||
from django.db.models.sql.constants import INNER, LOUTER
|
||||
from django.db.models.sql.datastructures import Join
|
||||
from django.utils import six
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
|
||||
from django.utils.translation import npgettext, pgettext, ungettext
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from operator import attrgetter
|
||||
|
||||
from django.db.models import Prefetch, F
|
||||
from django.http import JsonResponse, Http404
|
||||
from django.db.models import F, Prefetch
|
||||
from django.http import Http404, JsonResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from dmoj import settings
|
||||
|
@ -3,7 +3,7 @@ from operator import attrgetter
|
||||
from django.db.models import Max
|
||||
from django.http import JsonResponse
|
||||
|
||||
from judge.models import Problem, Profile, Submission, ContestParticipation
|
||||
from judge.models import ContestParticipation, Problem, Profile, Submission
|
||||
from judge.utils.ranker import ranker
|
||||
from judge.views.contests import contest_ranking_list
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from django.db.models import Q, Max, Count
|
||||
from django.db.models import Count, Max, Q
|
||||
from django.http import Http404
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
@ -7,8 +7,8 @@ from django.utils.translation import ugettext as _
|
||||
from django.views.generic import ListView
|
||||
|
||||
from judge.comments import CommentedDetailView
|
||||
from judge.models import BlogPost, Comment, Problem, Contest, Profile, Submission, Language, ProblemClarification
|
||||
from judge.models import Ticket
|
||||
from judge.models import BlogPost, Comment, Contest, Language, Problem, ProblemClarification, Profile, Submission, \
|
||||
Ticket
|
||||
from judge.utils.cachedict import CacheDict
|
||||
from judge.utils.diggpaginator import DiggPaginator
|
||||
from judge.utils.problems import user_completed_ids
|
||||
|
@ -4,7 +4,7 @@ from django.core.exceptions import PermissionDenied
|
||||
from django.db import IntegrityError, transaction
|
||||
from django.db.models import F
|
||||
from django.forms.models import ModelForm
|
||||
from django.http import HttpResponseForbidden, HttpResponseBadRequest, HttpResponse, Http404
|
||||
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseForbidden
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.decorators.http import require_POST
|
||||
|
@ -1,6 +1,6 @@
|
||||
from calendar import Calendar, SUNDAY
|
||||
from collections import namedtuple, defaultdict
|
||||
from datetime import timedelta, date, datetime, time
|
||||
from collections import defaultdict, namedtuple
|
||||
from datetime import date, datetime, time, timedelta
|
||||
from functools import partial
|
||||
from itertools import chain
|
||||
from operator import attrgetter
|
||||
@ -8,11 +8,11 @@ from operator import attrgetter
|
||||
from django import forms
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.core.cache import cache
|
||||
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
|
||||
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
|
||||
from django.db import IntegrityError
|
||||
from django.db.models import Q, Min, Max, Sum, Case, When, IntegerField
|
||||
from django.http import HttpResponseRedirect, HttpResponseBadRequest, Http404, HttpResponse
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.db.models import Case, IntegerField, Max, Min, Q, Sum, When
|
||||
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.template.defaultfilters import date as date_filter
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
@ -25,8 +25,7 @@ from django.views.generic.detail import BaseDetailView, DetailView
|
||||
|
||||
from judge import event_poster as event
|
||||
from judge.comments import CommentedDetailView
|
||||
from judge.models import Contest, ContestParticipation, ContestTag, Profile
|
||||
from judge.models import Problem
|
||||
from judge.models import Contest, ContestParticipation, ContestTag, Problem, Profile
|
||||
from judge.utils.opengraph import generate_opengraph
|
||||
from judge.utils.ranker import ranker
|
||||
from judge.utils.views import DiggPaginatorMixin, TitleMixin, generic_message
|
||||
|
@ -8,17 +8,17 @@ from django.core.exceptions import PermissionDenied
|
||||
from django.db import transaction
|
||||
from django.db.models import Count, Q
|
||||
from django.forms import Form, modelformset_factory
|
||||
from django.http import Http404, HttpResponseRedirect, HttpResponsePermanentRedirect
|
||||
from django.http import Http404, HttpResponsePermanentRedirect, HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext as _, gettext_lazy, ungettext
|
||||
from django.views.generic import DetailView, ListView, View, UpdateView, FormView
|
||||
from django.views.generic import DetailView, FormView, ListView, UpdateView, View
|
||||
from django.views.generic.detail import SingleObjectMixin, SingleObjectTemplateResponseMixin
|
||||
from reversion import revisions
|
||||
|
||||
from judge.forms import EditOrganizationForm
|
||||
from judge.models import Organization, OrganizationRequest, Profile
|
||||
from judge.utils.ranker import ranker
|
||||
from judge.utils.views import generic_message, TitleMixin
|
||||
from judge.utils.views import TitleMixin, generic_message
|
||||
|
||||
__all__ = ['OrganizationList', 'OrganizationHome', 'OrganizationUsers', 'OrganizationMembershipChange',
|
||||
'JoinOrganization', 'LeaveOrganization', 'EditOrganization', 'RequestJoinOrganization',
|
||||
|
@ -1,5 +1,5 @@
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
|
||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
|
||||
|
||||
|
||||
class MarkdownPreviewView(TemplateResponseMixin, ContextMixin, View):
|
||||
|
@ -10,15 +10,15 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
|
||||
from django.db import transaction
|
||||
from django.db.models import Count, Q, F, Prefetch
|
||||
from django.db.models import Count, F, Prefetch, Q
|
||||
from django.db.utils import ProgrammingError
|
||||
from django.http import Http404, HttpResponseRedirect, HttpResponse, HttpResponseForbidden
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import Http404, HttpResponse, HttpResponseForbidden, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.template.loader import get_template
|
||||
from django.urls import reverse
|
||||
from django.utils import translation, timezone
|
||||
from django.utils import timezone, translation
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.html import format_html, escape
|
||||
from django.utils.html import escape, format_html
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import gettext as _, gettext_lazy
|
||||
from django.views.generic import ListView, View
|
||||
@ -28,17 +28,17 @@ from django.views.generic.detail import SingleObjectMixin
|
||||
from django_ace.widgets import ACE_URL
|
||||
from judge.comments import CommentedDetailView
|
||||
from judge.forms import ProblemCloneForm, ProblemSubmitForm
|
||||
from judge.models import ContestSubmission, ContestProblem, Judge, Language, Problem, ProblemGroup, \
|
||||
from judge.models import ContestProblem, ContestSubmission, Judge, Language, Problem, ProblemGroup, \
|
||||
ProblemTranslation, ProblemType, RuntimeVersion, Solution, Submission, SubmissionSource, \
|
||||
TranslatedProblemForeignKeyQuerySet
|
||||
from judge.pdf_problems import HAS_PDF, DefaultPdfMaker
|
||||
from judge.pdf_problems import DefaultPdfMaker, HAS_PDF
|
||||
from judge.utils.diggpaginator import DiggPaginator
|
||||
from judge.utils.opengraph import generate_opengraph
|
||||
from judge.utils.problems import contest_completed_ids, user_completed_ids, contest_attempted_ids, user_attempted_ids, \
|
||||
hot_problems
|
||||
from judge.utils.strings import safe_int_or_none, safe_float_or_none
|
||||
from judge.utils.problems import contest_attempted_ids, contest_completed_ids, hot_problems, user_attempted_ids, \
|
||||
user_completed_ids
|
||||
from judge.utils.strings import safe_float_or_none, safe_int_or_none
|
||||
from judge.utils.tickets import own_ticket_filter
|
||||
from judge.utils.views import SingleObjectFormView, TitleMixin, generic_message, QueryStringSortMixin
|
||||
from judge.utils.views import QueryStringSortMixin, SingleObjectFormView, TitleMixin, generic_message
|
||||
|
||||
|
||||
def get_contest_problem(problem, profile):
|
||||
|
@ -2,14 +2,14 @@ import json
|
||||
import mimetypes
|
||||
import os
|
||||
from itertools import chain
|
||||
from zipfile import ZipFile, BadZipfile
|
||||
from zipfile import BadZipfile, ZipFile
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.forms import ModelForm, formset_factory, HiddenInput, NumberInput, Select, BaseModelFormSet
|
||||
from django.http import HttpResponseRedirect, HttpResponse, Http404
|
||||
from django.forms import BaseModelFormSet, HiddenInput, ModelForm, NumberInput, Select, formset_factory
|
||||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.urls import reverse
|
||||
from django.utils.html import escape, format_html
|
||||
@ -18,7 +18,7 @@ from django.utils.translation import gettext as _
|
||||
from django.views.generic import DetailView
|
||||
|
||||
from judge.highlight_code import highlight_code
|
||||
from judge.models import ProblemData, Problem, ProblemTestCase, problem_data_storage, Submission
|
||||
from judge.models import Problem, ProblemData, ProblemTestCase, Submission, problem_data_storage
|
||||
from judge.utils.problem_data import ProblemDataCompiler
|
||||
from judge.utils.unicode import utf8text
|
||||
from judge.utils.views import TitleMixin
|
||||
|
@ -2,7 +2,7 @@ from operator import itemgetter
|
||||
|
||||
from celery.result import AsyncResult
|
||||
from django.contrib import messages
|
||||
from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequest, HttpResponse
|
||||
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from django.utils.html import escape, format_html
|
||||
from django.utils.safestring import mark_safe
|
||||
@ -11,7 +11,7 @@ from django.views.generic import DetailView
|
||||
from django.views.generic.detail import BaseDetailView
|
||||
|
||||
from judge.models import Language, Submission
|
||||
from judge.tasks import rejudge_problem_filter, rescore_problem, apply_submission_filter
|
||||
from judge.tasks import apply_submission_filter, rejudge_problem_filter, rescore_problem
|
||||
from judge.utils.celery import redirect_to_task_status
|
||||
from judge.utils.views import TitleMixin
|
||||
from judge.views.problem import ProblemMixin
|
||||
|
@ -5,7 +5,7 @@ from django.utils.translation import gettext as _
|
||||
from judge.models import Submission
|
||||
from judge.utils.problems import get_result_data
|
||||
from judge.utils.raw_sql import join_sql_subquery
|
||||
from judge.views.submission import ProblemSubmissions, ForceContestMixin
|
||||
from judge.views.submission import ForceContestMixin, ProblemSubmissions
|
||||
|
||||
__all__ = ['RankedSubmissions', 'ContestRankedSubmission']
|
||||
|
||||
|
@ -8,15 +8,15 @@ from django.contrib.auth.password_validation import get_default_password_validat
|
||||
from django.forms import ChoiceField, ModelChoiceField
|
||||
from django.shortcuts import render
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
from registration.backends.default.views import (RegistrationView as OldRegistrationView,
|
||||
ActivationView as OldActivationView)
|
||||
from registration.backends.default.views import (ActivationView as OldActivationView,
|
||||
RegistrationView as OldRegistrationView)
|
||||
from registration.forms import RegistrationForm
|
||||
from sortedm2m.forms import SortedMultipleChoiceField
|
||||
|
||||
from judge.models import Profile, Language, Organization, TIMEZONE
|
||||
from judge.utils.recaptcha import ReCaptchaWidget, ReCaptchaField
|
||||
from judge.models import Language, Organization, Profile, TIMEZONE
|
||||
from judge.utils.recaptcha import ReCaptchaField, ReCaptchaWidget
|
||||
from judge.utils.subscription import Subscription, newsletter_id
|
||||
from judge.widgets import Select2Widget, Select2MultipleWidget
|
||||
from judge.widgets import Select2MultipleWidget, Select2Widget
|
||||
|
||||
valid_id = re.compile(r'^\w+$')
|
||||
bad_mail_regex = list(map(re.compile, getattr(settings, 'BAD_MAIL_PROVIDER_REGEX', ())))
|
||||
|
@ -1,11 +1,11 @@
|
||||
from django.db.models import Q, F
|
||||
from django.http import JsonResponse, Http404
|
||||
from django.db.models import F, Q
|
||||
from django.http import Http404, JsonResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.encoding import smart_text
|
||||
from django.views.generic.list import BaseListView
|
||||
|
||||
from judge.jinja2.gravatar import gravatar
|
||||
from judge.models import Profile, Organization, Problem, Comment, Contest
|
||||
from judge.models import Comment, Contest, Organization, Problem, Profile
|
||||
|
||||
|
||||
def _get_user_queryset(term):
|
||||
|
@ -1,8 +1,8 @@
|
||||
from itertools import repeat, chain
|
||||
from itertools import chain, repeat
|
||||
from operator import itemgetter
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.models import Count, Case, When, IntegerField, Value, FloatField
|
||||
from django.db.models import Case, Count, FloatField, IntegerField, Value, When
|
||||
from django.db.models.expressions import CombinedExpression
|
||||
from django.http import JsonResponse
|
||||
from django.shortcuts import render
|
||||
|
@ -1,12 +1,12 @@
|
||||
from collections import defaultdict
|
||||
from functools import partial
|
||||
from packaging import version
|
||||
|
||||
from django.shortcuts import render
|
||||
from django.utils import six
|
||||
from django.utils.translation import gettext as _
|
||||
from packaging import version
|
||||
|
||||
from judge.models import Judge, RuntimeVersion, Language
|
||||
from judge.models import Judge, Language, RuntimeVersion
|
||||
|
||||
__all__ = ['status_all', 'status_table']
|
||||
|
||||
|
@ -3,25 +3,25 @@ from operator import attrgetter
|
||||
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.core.cache import cache
|
||||
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied, ImproperlyConfigured
|
||||
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, PermissionDenied
|
||||
from django.db.models import Prefetch, Q
|
||||
from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseBadRequest, JsonResponse
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseRedirect, JsonResponse
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.html import format_html, escape
|
||||
from django.utils.html import escape, format_html
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import gettext as _, gettext_lazy
|
||||
from django.views.decorators.http import require_POST
|
||||
from django.views.generic import ListView, DetailView
|
||||
from django.views.generic import DetailView, ListView
|
||||
|
||||
from judge import event_poster as event
|
||||
from judge.highlight_code import highlight_code
|
||||
from judge.models import Problem, Submission, Profile, Contest, ProblemTranslation, Language
|
||||
from judge.utils.problems import get_result_data, user_completed_ids, user_authored_ids, user_editable_ids
|
||||
from judge.models import Contest, Language, Problem, ProblemTranslation, Profile, Submission
|
||||
from judge.utils.problems import get_result_data, user_authored_ids, user_completed_ids, user_editable_ids
|
||||
from judge.utils.raw_sql import use_straight_join
|
||||
from judge.utils.views import TitleMixin, DiggPaginatorMixin
|
||||
from judge.utils.views import DiggPaginatorMixin, TitleMixin
|
||||
|
||||
|
||||
def submission_related(queryset):
|
||||
|
@ -4,12 +4,12 @@ from uuid import UUID
|
||||
|
||||
from celery.result import AsyncResult
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.http import Http404, JsonResponse, HttpResponseBadRequest, HttpResponseRedirect
|
||||
from django.http import Http404, HttpResponseBadRequest, HttpResponseRedirect, JsonResponse
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse
|
||||
from django.utils.http import is_safe_url
|
||||
|
||||
from judge.tasks import success, failure, progress
|
||||
from judge.tasks import failure, progress, success
|
||||
from judge.utils.celery import redirect_to_task_status
|
||||
from judge.utils.views import short_circuit_middleware
|
||||
|
||||
|
@ -2,30 +2,24 @@ import json
|
||||
|
||||
from django import forms
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.core.exceptions import PermissionDenied, ImproperlyConfigured, ValidationError
|
||||
from django.http import Http404
|
||||
from django.http import HttpResponse
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.http import JsonResponse
|
||||
from django.core.exceptions import ImproperlyConfigured, PermissionDenied, ValidationError
|
||||
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseRedirect, JsonResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.template.defaultfilters import truncatechars
|
||||
from django.template.loader import get_template
|
||||
from django.urls import reverse
|
||||
from django.urls import reverse_lazy
|
||||
from django.urls import reverse, reverse_lazy
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.html import escape, format_html, linebreaks
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import gettext_lazy, gettext as _
|
||||
from django.utils.translation import gettext as _, gettext_lazy
|
||||
from django.views import View
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from judge import event_poster as event
|
||||
from judge.models import Profile
|
||||
from judge.models import Ticket, TicketMessage, Problem
|
||||
from judge.models import Problem, Profile, Ticket, TicketMessage
|
||||
from judge.utils.diggpaginator import DiggPaginator
|
||||
from judge.utils.tickets import own_ticket_filter, filter_visible_tickets
|
||||
from judge.utils.tickets import filter_visible_tickets, own_ticket_filter
|
||||
from judge.utils.views import SingleObjectFormView, TitleMixin, paginate_query_context
|
||||
from judge.views.problem import ProblemMixin
|
||||
from judge.widgets import HeavyPreviewPageDownWidget
|
||||
|
@ -1,4 +1,5 @@
|
||||
import base64
|
||||
from io import BytesIO
|
||||
|
||||
import pyotp
|
||||
import qrcode
|
||||
@ -10,7 +11,6 @@ from django.urls import reverse
|
||||
from django.utils.http import is_safe_url
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.generic import FormView
|
||||
from io import BytesIO
|
||||
|
||||
from judge.forms import TOTPForm
|
||||
from judge.utils.views import TitleMixin
|
||||
|
@ -10,9 +10,9 @@ from django.contrib.auth.models import Permission
|
||||
from django.contrib.auth.views import redirect_to_login
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import transaction
|
||||
from django.db.models import Max, Count, Min
|
||||
from django.db.models import Count, Max, Min
|
||||
from django.http import Http404, HttpResponseRedirect, JsonResponse
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.formats import date_format
|
||||
@ -23,14 +23,14 @@ from django.views.generic import DetailView, ListView, TemplateView
|
||||
from reversion import revisions
|
||||
|
||||
from judge.forms import ProfileForm, newsletter_id
|
||||
from judge.models import Profile, Submission, Rating
|
||||
from judge.performance_points import get_pp_breakdown, PP_ENTRIES
|
||||
from judge.models import Profile, Rating, Submission
|
||||
from judge.performance_points import PP_ENTRIES, get_pp_breakdown
|
||||
from judge.ratings import rating_class, rating_progress
|
||||
from judge.utils.problems import contest_completed_ids, user_completed_ids
|
||||
from judge.utils.ranker import ranker
|
||||
from judge.utils.subscription import Subscription
|
||||
from judge.utils.unicode import utf8text
|
||||
from judge.utils.views import TitleMixin, generic_message, DiggPaginatorMixin, QueryStringSortMixin
|
||||
from judge.utils.views import DiggPaginatorMixin, QueryStringSortMixin, TitleMixin, generic_message
|
||||
from .contests import ContestRanking
|
||||
|
||||
__all__ = ['UserPage', 'UserAboutPage', 'UserProblemsPage', 'users', 'edit_profile']
|
||||
|
@ -2,7 +2,7 @@ import requests
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.http import HttpResponseForbidden, HttpResponseBadRequest, HttpResponse, Http404, HttpResponseRedirect
|
||||
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseRedirect
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.generic import View
|
||||
|
||||
|
@ -2,7 +2,7 @@ from textwrap import dedent
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.template import Template, Context
|
||||
from django.template import Context, Template
|
||||
from lxml import html
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user