Remove unused imports and fix whitespace issues

This commit is contained in:
Evan 2019-04-19 21:54:43 -04:00 committed by Roger Fu
parent fbabc7d7a5
commit 2287a95185
15 changed files with 15 additions and 18 deletions

View File

@ -1 +1 @@
default_app_config = 'judge.apps.JudgeAppConfig'
default_app_config = 'judge.apps.JudgeAppConfig'

View File

@ -106,7 +106,7 @@ class ContestAdmin(VersionAdmin):
(None, {'fields': ('key', 'name', 'organizers', 'is_public', 'use_clarifications',
'hide_problem_tags', 'hide_scoreboard', 'run_pretests_only')}),
(_('Scheduling'), {'fields': ('start_time', 'end_time', 'time_limit')}),
(_('Details'), {'fields': ('description', 'og_image', 'logo_override_image','tags', 'summary')}),
(_('Details'), {'fields': ('description', 'og_image', 'logo_override_image', 'tags', 'summary')}),
(_('Format'), {'fields': ('format_name', 'format_config')}),
(_('Rating'), {'fields': ('is_rated', 'rate_all', 'rate_exclude')}),
(_('Organization'), {'fields': ('is_private', 'organizations', 'access_code')}),

View File

@ -9,7 +9,6 @@ from django.core.exceptions import PermissionDenied
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_ace import AceWidget

View File

@ -4,4 +4,4 @@ from .judgeserver import JudgeServer
from .djangohandler import DjangoHandler
from .judgecallback import DjangoJudgeHandler
from .djangoserver import DjangoServer
from .djangoserver import DjangoServer

View File

@ -18,7 +18,7 @@ from reversion import revisions
from reversion.models import Revision, Version
from judge.dblock import LockModel
from judge.models import Comment, CommentLock, CommentVote, Problem, Profile, Submission
from judge.models import Comment, CommentLock, CommentVote
from judge.utils.raw_sql import unique_together_left_join, RawSQLColumn
from judge.widgets import HeavyPreviewPageDownWidget
@ -59,7 +59,7 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
if self.comment_page is None:
raise NotImplementedError()
return self.comment_page
def is_comment_locked(self):
return (CommentLock.objects.filter(page=self.get_comment_page()).exists() and
not self.request.user.has_perm('judge.override_comment_lock'))

View File

@ -79,4 +79,4 @@ def last():
del _local.poster
except AttributeError:
pass
return 0
return 0

View File

@ -7,7 +7,7 @@ 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, TextInput, Form
from django.forms import ModelForm, CharField, Form
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _

View File

@ -5,4 +5,4 @@ from . import registry
@registry.filter
def camo(url):
return camo_client.image_url(url)
return camo_client.image_url(url)

View File

@ -21,4 +21,4 @@ class Command(BaseCommand):
except Language.DoesNotExist:
raise CommandError('Invalid target language: %s' % options['target'])
target.problem_set = source.problem_set.all()
target.problem_set = source.problem_set.all()

View File

@ -1,9 +1,7 @@
from operator import itemgetter
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator, RegexValidator
from django.db import models
from django.db.models import Max, CASCADE
from django.db.models import CASCADE
from django.urls import reverse
from django.utils import timezone
from django.utils.functional import cached_property

View File

@ -10,7 +10,7 @@ from mptt.models import MPTTModel
from judge.models.profile import Profile
__all__ = ['MiscConfig', 'validate_regex', 'NavigationBar', 'BlogPost', 'Solution']
__all__ = ['MiscConfig', 'validate_regex', 'NavigationBar', 'BlogPost']
class MiscConfig(models.Model):

View File

@ -19,7 +19,7 @@ from judge.user_translations import gettext as user_gettext
from judge.utils.raw_sql import unique_together_left_join, RawSQLColumn
__all__ = ['ProblemGroup', 'ProblemType', 'Problem', 'ProblemTranslation', 'ProblemClarification',
'TranslatedProblemQuerySet', 'TranslatedProblemForeignKeyQuerySet', 'License']
'License', 'Solution', 'TranslatedProblemQuerySet', 'TranslatedProblemForeignKeyQuerySet']
class ProblemType(models.Model):

View File

@ -15,4 +15,4 @@ def cutoff(value, length):
@register.filter(name='roundfloat')
def roundfloat(value, at):
return str(round(value, int(at)))
return str(round(value, int(at)))

View File

@ -118,7 +118,7 @@ class ContestUserSearchSelect2View(UserSearchSelect2View):
contest = get_object_or_404(Contest, key=self.kwargs['contest'])
if not contest.can_see_scoreboard(self.request) or contest.hide_scoreboard and contest.is_in_contest(self.request):
raise Http404()
return Profile.objects.filter(contest_history__contest=contest,
user__username__icontains=self.term).distinct()

View File

@ -45,4 +45,4 @@ class CompressorWidgetMixin(object):
js=[result.find('.//script').get('src')] if self.compress_js else media._js
)
media = property(_media)
media = property(_media)