id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35,800 | 0133_add_problem_data_hints.py | DMOJ_online-judge/judge/migrations/0133_add_problem_data_hints.py | # Generated by Django 3.2.16 on 2022-12-20 10:02
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models
import judge.models.contest
import judge.models.problem
import judge.models.profile
class Migration(migrations.Migration):
dependencies = [
('judge', ... | 45,001 | Python | .py | 456 | 87.541667 | 18,559 | 0.637015 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,801 | 0139_user_index_refactor.py | DMOJ_online-judge/judge/migrations/0139_user_index_refactor.py | # Generated by Django 3.2.16 on 2023-02-12 01:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0138_dark_ace_theme'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='performance_poi... | 1,261 | Python | .py | 35 | 26.314286 | 117 | 0.580672 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,802 | 0137_profile_site_theme.py | DMOJ_online-judge/judge/migrations/0137_profile_site_theme.py | # Generated by Django 3.2.16 on 2023-01-29 23:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0136_remove_zombie_editorials'),
]
operations = [
migrations.AddField(
model_name='profile',
name='site_th... | 520 | Python | .py | 13 | 32.769231 | 176 | 0.621514 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,803 | 0100_contest_visiblity_permission.py | DMOJ_online-judge/judge/migrations/0100_contest_visiblity_permission.py | # Generated by Django 2.2.6 on 2019-11-08 02:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('judge', '0099_contest_problem_label'),
]
operations = [
migrations.AlterModelOptions(
name='contest',
options={'permissions'... | 874 | Python | .py | 12 | 66.083333 | 570 | 0.674446 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,804 | 0145_site_data_batch_prerequisites.py | DMOJ_online-judge/judge/migrations/0145_site_data_batch_prerequisites.py | # Generated by Django 3.2.21 on 2024-01-06 04:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0144_submission_index_cleanup'),
]
operations = [
migrations.AddField(
model_name='problemtestcase',
name=... | 512 | Python | .py | 13 | 32.153846 | 152 | 0.67004 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,805 | 0124_contest_show_short_display.py | DMOJ_online-judge/judge/migrations/0124_contest_show_short_display.py | # Generated by Django 2.2.24 on 2021-06-19 01:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0123_contest_rating_elo_mmr'),
]
operations = [
migrations.AddField(
model_name='contest',
name='show_shor... | 547 | Python | .py | 13 | 34.846154 | 197 | 0.671078 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,806 | 0121_per_problem_sub_access_control.py | DMOJ_online-judge/judge/migrations/0121_per_problem_sub_access_control.py | # Generated by Django 2.2.24 on 2021-06-17 01:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0120_totp_no_reuse'),
]
operations = [
migrations.AddField(
model_name='problem',
name='submission_source_... | 597 | Python | .py | 13 | 38.692308 | 241 | 0.639033 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,807 | 0138_dark_ace_theme.py | DMOJ_online-judge/judge/migrations/0138_dark_ace_theme.py | # Generated by Django 3.2.16 on 2023-02-08 01:11
from django.db import migrations, models
def github_to_auto(apps, schema_editor):
Profile = apps.get_model('judge', 'Profile')
Profile.objects.filter(ace_theme='github').update(ace_theme='auto')
def auto_to_github(apps, schema_editor):
Profile = apps.get... | 1,874 | Python | .py | 20 | 87.25 | 1,132 | 0.654743 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,808 | 0144_submission_index_cleanup.py | DMOJ_online-judge/judge/migrations/0144_submission_index_cleanup.py | import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0143_contest_problem_rank_index'),
]
operations = [
migrations.AlterField(
model_name='submission',
name='contest_object',
... | 1,795 | Python | .py | 39 | 32.128205 | 120 | 0.568739 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,809 | 0142_comment_revision_count.py | DMOJ_online-judge/judge/migrations/0142_comment_revision_count.py | from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations, models
def populate_revisions(apps, schema_editor):
db_alias = schema_editor.connection.alias
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
content_type = ContentType.objects.get(app_label='j... | 1,428 | Python | .py | 34 | 35.852941 | 105 | 0.676026 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,810 | 0113_contest_decimal_points.py | DMOJ_online-judge/judge/migrations/0113_contest_decimal_points.py | import django.core.validators
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0112_language_extensions'),
]
operations = [
migrations.AddField(
model_name='contest',
name=... | 794 | Python | .py | 19 | 33.842105 | 236 | 0.671855 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,811 | 0135_disable_judge.py | DMOJ_online-judge/judge/migrations/0135_disable_judge.py | # Generated by Django 2.2.28 on 2022-10-05 09:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0134_add_voting_functionality'),
]
operations = [
migrations.AddField(
model_name='judge',
name='is_disabl... | 496 | Python | .py | 13 | 30.923077 | 153 | 0.656904 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,812 | 0089_submission_to_contest.py | DMOJ_online-judge/judge/migrations/0089_submission_to_contest.py | # Generated by Django 2.1.12 on 2019-09-25 23:28
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0088_private_contests'),
]
operations = [
migrations.AddField(
model_name='submission... | 1,056 | Python | .py | 22 | 38.227273 | 167 | 0.637512 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,813 | 0141_submission_extra_index.py | DMOJ_online-judge/judge/migrations/0141_submission_extra_index.py | # Generated by Django 3.2.16 on 2023-02-19 20:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0140_submission_index_refactor'),
]
operations = [
migrations.AddIndex(
model_name='submission',
index=mod... | 1,145 | Python | .py | 28 | 31.714286 | 112 | 0.604317 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,814 | 0140_submission_index_refactor.py | DMOJ_online-judge/judge/migrations/0140_submission_index_refactor.py | # Generated by Django 3.2.16 on 2023-02-12 01:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0139_user_index_refactor'),
]
operations = [
migrations.AlterField(
model_name='submission',
name='points'... | 1,850 | Python | .py | 39 | 37.589744 | 412 | 0.588594 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,815 | 0129_see_scoreboard_subs.py | DMOJ_online-judge/judge/migrations/0129_see_scoreboard_subs.py | # Generated by Django 2.2.27 on 2022-02-26 05:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0128_limit_join_organizations'),
]
operations = [
migrations.AddField(
model_name='contest',
name='tester_... | 852 | Python | .py | 18 | 38.944444 | 227 | 0.667069 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,816 | 0123_contest_rating_elo_mmr.py | DMOJ_online-judge/judge/migrations/0123_contest_rating_elo_mmr.py | import math
from operator import attrgetter, itemgetter
from django.db import migrations, models
from django.db.models import Count, OuterRef, Subquery
from django.db.models.functions import Coalesce
from django.utils import timezone
def tie_ranker(iterable, key=attrgetter('points')):
rank = 0
delta = 1
... | 8,242 | Python | .py | 169 | 40.467456 | 117 | 0.616131 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,817 | 0109_scratch_codes.py | DMOJ_online-judge/judge/migrations/0109_scratch_codes.py | # Generated by Django 2.2.7 on 2020-05-27 05:50
import django.core.validators
import django.db.models.deletion
from django.db import migrations
import judge.models.profile
class Migration(migrations.Migration):
dependencies = [
('judge', '0108_bleach_problems'),
]
operations = [
migrat... | 814 | Python | .py | 16 | 44.75 | 393 | 0.686869 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,818 | 0101_submission_judged_date.py | DMOJ_online-judge/judge/migrations/0101_submission_judged_date.py | # Generated by Django 2.2.11 on 2020-03-26 00:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0100_contest_visiblity_permission'),
]
operations = [
migrations.AddField(
model_name='submission',
name='... | 454 | Python | .py | 13 | 27.692308 | 102 | 0.649083 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,819 | 0094_submissiontestcase_unique_together.py | DMOJ_online-judge/judge/migrations/0094_submissiontestcase_unique_together.py | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('judge', '0093_contest_moss'),
]
operations = [
migrations.AlterUniqueTogether(
name='submissiontestcase',
unique_together={('submission', 'case')},
),
]
| 311 | Python | .py | 11 | 21.181818 | 53 | 0.612795 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,820 | 0093_contest_moss.py | DMOJ_online-judge/judge/migrations/0093_contest_moss.py | # Generated by Django 2.1.12 on 2019-10-17 20:52
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0092_contest_clone'),
]
operations = [
migrations.CreateModel(
name='ContestMoss',
... | 2,026 | Python | .py | 40 | 40.025 | 446 | 0.606764 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,821 | 0128_limit_join_organizations.py | DMOJ_online-judge/judge/migrations/0128_limit_join_organizations.py | # Generated by Django 2.2.27 on 2022-02-23 19:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0127_tester_see_scoreboard'),
]
operations = [
migrations.AddField(
model_name='contest',
name='join_organ... | 793 | Python | .py | 18 | 35.666667 | 221 | 0.65974 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,822 | 0090_fix_contest_visibility.py | DMOJ_online-judge/judge/migrations/0090_fix_contest_visibility.py | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('judge', '0089_submission_to_contest'),
]
operations = [
migrations.RunSQL("""
UPDATE `judge_contest`
SET `judge_contest`.`is_private` = 0, `judge_contest`.`is_organization_p... | 544 | Python | .py | 15 | 27.8 | 95 | 0.582857 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,823 | 0130_blogpost_change_visibility.py | DMOJ_online-judge/judge/migrations/0130_blogpost_change_visibility.py | # Generated by Django 2.2.27 on 2022-02-25 22:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('judge', '0129_see_scoreboard_subs'),
]
operations = [
migrations.AlterModelOptions(
name='blogpost',
options={'permissions'... | 497 | Python | .py | 12 | 34.666667 | 193 | 0.639583 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,824 | 0136_remove_zombie_editorials.py | DMOJ_online-judge/judge/migrations/0136_remove_zombie_editorials.py | import django.db.models.deletion
from django.db import migrations, models
def delete_null_solutions(apps, scheme_editor):
model = apps.get_model('judge', 'Solution')
model.objects.filter(problem=None).delete()
class Migration(migrations.Migration):
dependencies = [
('judge', '0135_disable_judge... | 691 | Python | .py | 17 | 33.882353 | 176 | 0.685629 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,825 | 0120_totp_no_reuse.py | DMOJ_online-judge/judge/migrations/0120_totp_no_reuse.py | # Generated by Django 2.2.24 on 2021-06-06 23:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0119_hide_problem_authors'),
]
operations = [
migrations.AddField(
model_name='profile',
name='last_totp_t... | 432 | Python | .py | 13 | 26 | 84 | 0.635266 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,826 | 0126_infer_private_bools.py | DMOJ_online-judge/judge/migrations/0126_infer_private_bools.py | # Generated by hand on 2021-12-15
from django.db import migrations
def sync_private_booleans(apps, schema_editor):
Problem = apps.get_model('judge', 'Problem')
Contest = apps.get_model('judge', 'Contest')
db_alias = schema_editor.connection.alias
for problem in Problem.objects.using(db_alias).all():... | 1,243 | Python | .py | 30 | 33.2 | 79 | 0.667774 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,827 | 0127_tester_see_scoreboard.py | DMOJ_online-judge/judge/migrations/0127_tester_see_scoreboard.py | # Generated by Django 2.2.27 on 2022-02-26 04:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0126_infer_private_bools'),
]
operations = [
migrations.AddField(
model_name='contest',
name='tester_see_s... | 490 | Python | .py | 13 | 30.461538 | 140 | 0.654661 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,828 | 0114_remove_org_registrant.py | DMOJ_online-judge/judge/migrations/0114_remove_org_registrant.py | # Generated by Django 2.2.13 on 2021-04-09 19:37
from django.db import migrations
def make_admin_registrant(apps, schema_editor):
Organization = apps.get_model('judge', 'Organization')
db_alias = schema_editor.connection.alias
for org in Organization.objects.using(db_alias).all():
org.registrant ... | 698 | Python | .py | 19 | 30.105263 | 79 | 0.674107 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,829 | 0132_no_self_vote.py | DMOJ_online-judge/judge/migrations/0132_no_self_vote.py | from django.db import migrations
from django.db.models import F, OuterRef, Subquery, Sum
from django.db.models.functions import Coalesce
def delete_self_votes(apps, schema_editor):
Comment = apps.get_model('judge', 'Comment')
CommentVote = apps.get_model('judge', 'CommentVote')
CommentVote.objects.filter... | 805 | Python | .py | 17 | 42.588235 | 91 | 0.728205 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,830 | 0143_contest_problem_rank_index.py | DMOJ_online-judge/judge/migrations/0143_contest_problem_rank_index.py | # Generated by Django 3.2.16 on 2023-02-20 06:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0142_comment_revision_count'),
]
operations = [
migrations.AddIndex(
model_name='submission',
index=models... | 450 | Python | .py | 12 | 30.75 | 136 | 0.637413 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,831 | 0116_contest_curator_and_tester.py | DMOJ_online-judge/judge/migrations/0116_contest_curator_and_tester.py | # Generated by Django 2.2.13 on 2021-04-26 02:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0115_contest_scoreboard_visibility'),
]
operations = [
migrations.AlterField(
model_name='contest',
name='... | 1,244 | Python | .py | 28 | 34.964286 | 203 | 0.622626 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,832 | 0087_problem_resource_limits.py | DMOJ_online-judge/judge/migrations/0087_problem_resource_limits.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-09 14:44
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0086_rating_ceiling'),
]
operations = [
migrations.AlterField(
m... | 939 | Python | .py | 20 | 39.35 | 272 | 0.665574 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,833 | 0117_remove_private_messages.py | DMOJ_online-judge/judge/migrations/0117_remove_private_messages.py | # Generated by Django 2.2.13 on 2021-05-08 18:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('judge', '0116_contest_curator_and_tester'),
]
operations = [
migrations.RemoveField(
model_name='privatemessagethread',
nam... | 513 | Python | .py | 18 | 20.555556 | 53 | 0.604082 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,834 | 0107_submission_lock.py | DMOJ_online-judge/judge/migrations/0107_submission_lock.py | # Generated by Django 2.2.12 on 2020-05-13 20:58
from django.db import migrations, models
from django.utils import timezone
def updatecontestsubmissions(apps, schema_editor):
Contest = apps.get_model('judge', 'Contest')
Contest.objects.filter(end_time__lt=timezone.now()).update(is_locked=True)
Submissio... | 2,418 | Python | .py | 33 | 65 | 621 | 0.684476 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,835 | 0103_contest_participation_tiebreak_field.py | DMOJ_online-judge/judge/migrations/0103_contest_participation_tiebreak_field.py | # Generated by Django 2.2.6 on 2019-11-06 18:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0102_api_token'),
]
operations = [
migrations.AddField(
model_name='contestparticipation',
name='tiebreaker... | 425 | Python | .py | 13 | 25.461538 | 84 | 0.633907 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,836 | 0115_contest_scoreboard_visibility.py | DMOJ_online-judge/judge/migrations/0115_contest_scoreboard_visibility.py | # Generated by Django 2.2.19 on 2021-04-05 03:37
from django.db import migrations, models
def hide_scoreboard_eq_true(apps, schema_editor):
Contest = apps.get_model('judge', 'Contest')
Contest.objects.filter(hide_scoreboard=True).update(scoreboard_visibility='C')
def scoreboard_visibility_eq_contest(apps, ... | 1,242 | Python | .py | 24 | 44.541667 | 287 | 0.684036 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,837 | 0092_contest_clone.py | DMOJ_online-judge/judge/migrations/0092_contest_clone.py | # Generated by Django 2.1.12 on 2019-09-30 21:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('judge', '0091_compiler_message_ansi2html'),
]
operations = [
migrations.AlterModelOptions(
name='contest',
options={'permis... | 722 | Python | .py | 12 | 53.416667 | 412 | 0.66383 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,838 | 0086_rating_ceiling.py | DMOJ_online-judge/judge/migrations/0086_rating_ceiling.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-20 16:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0085_submission_source'),
]
operations = [
migrations.AddField(
model_name='contest',
... | 733 | Python | .py | 19 | 30.631579 | 132 | 0.628169 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,839 | 0102_api_token.py | DMOJ_online-judge/judge/migrations/0102_api_token.py | # Generated by Django 2.2.10 on 2020-03-30 07:10
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0101_submission_judged_date'),
]
operations = [
migrations.AddField(
model_name='profile... | 624 | Python | .py | 14 | 37.785714 | 253 | 0.672727 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,840 | 0091_compiler_message_ansi2html.py | DMOJ_online-judge/judge/migrations/0091_compiler_message_ansi2html.py | # -*- coding: utf-8 -*-
import lxml.html as lh
from django.db import migrations
from lxml.html.clean import clean_html
def strip_error_html(apps, schema_editor):
Submission = apps.get_model('judge', 'Submission')
for sub in Submission.objects.filter(error__isnull=False).iterator():
if sub.error:
... | 670 | Python | .py | 17 | 33.823529 | 87 | 0.68779 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,841 | 0085_submission_source.py | DMOJ_online-judge/judge/migrations/0085_submission_source.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-01-31 22:18
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0001_squashed_0084_contest_formats'),
]
operations = [
migrations.CreateM... | 1,595 | Python | .py | 35 | 35.428571 | 180 | 0.618252 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,842 | 0105_webauthn.py | DMOJ_online-judge/judge/migrations/0105_webauthn.py | # Generated by Django 2.2.12 on 2020-05-03 23:58
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0104_contestproblem_maxsubs'),
]
operations = [
migrations.AddField(
model_name='prof... | 1,298 | Python | .py | 25 | 41.76 | 167 | 0.637224 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,843 | 0131_spectate_contests.py | DMOJ_online-judge/judge/migrations/0131_spectate_contests.py | # Generated by Django 2.2.27 on 2022-02-25 07:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0130_blogpost_change_visibility'),
]
operations = [
migrations.AddField(
model_name='contest',
name='spect... | 1,408 | Python | .py | 28 | 40.821429 | 211 | 0.647273 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,844 | 0147_judge_add_tiers.py | DMOJ_online-judge/judge/migrations/0147_judge_add_tiers.py | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0146_comment_revision_count_v2'),
]
operations = [
migrations.AddField(
model_name='judge',
name='tier',
field=models.PositiveIntegerField(
... | 559 | Python | .py | 16 | 25.25 | 141 | 0.585185 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,845 | 0118_convert_to_dates.py | DMOJ_online-judge/judge/migrations/0118_convert_to_dates.py | # Generated by Django 2.2.17 on 2021-04-27 14:46
from django.db import migrations, models
from django.db.models import F
from django.utils import timezone
def convert_to_datetime(apps, schema_editor):
Contest = apps.get_model('judge', 'Contest')
Submission = apps.get_model('judge', 'Submission')
Submiss... | 2,236 | Python | .py | 51 | 35.705882 | 179 | 0.662678 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,846 | 0134_add_voting_functionality.py | DMOJ_online-judge/judge/migrations/0134_add_voting_functionality.py | import django.core.validators
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0133_add_problem_data_hints'),
]
operations = [
migrations.AddField(
model_name='profile',
na... | 2,332 | Python | .py | 40 | 37.65 | 120 | 0.512675 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,847 | 0146_comment_revision_count_v2.py | DMOJ_online-judge/judge/migrations/0146_comment_revision_count_v2.py | from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations, models
def populate_revisions(apps, schema_editor):
db_alias = schema_editor.connection.alias
ContentType = apps.get_model('contenttypes', 'ContentType')
try:
content_type = ContentType.objects.get(app_label='j... | 1,437 | Python | .py | 34 | 36.117647 | 105 | 0.677396 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,848 | error.py | DMOJ_online-judge/judge/views/error.py | import traceback
from django.shortcuts import render
from django.utils.translation import gettext as _
def error(request, context, status):
return render(request, 'error.html', context=context, status=status)
def error404(request, exception=None):
# TODO: "panic: go back"
return render(request, 'generi... | 882 | Python | .py | 24 | 31.041667 | 72 | 0.644287 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,849 | problem_manage.py | DMOJ_online-judge/judge/views/problem_manage.py | from operator import itemgetter
from celery.result import AsyncResult
from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
from django.urls import reverse
from django.utils.html imp... | 5,517 | Python | .py | 102 | 45.431373 | 113 | 0.694022 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,850 | license.py | DMOJ_online-judge/judge/views/license.py | from django.views.generic import DetailView
from judge.models import License
from judge.utils.views import TitleMixin
class LicenseDetail(TitleMixin, DetailView):
model = License
slug_field = slug_url_kwarg = 'key'
context_object_name = 'license'
template_name = 'license.html'
def get_title(self... | 355 | Python | .py | 10 | 31.3 | 44 | 0.753666 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,851 | ticket.py | DMOJ_online-judge/judge/views/ticket.py | import json
from django import forms
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import ImproperlyConfigured, PermissionDenied, ValidationError
from django.http import Http404, HttpResponse, HttpResponseBadRequest, HttpResponseRedirect, JsonResponse
from django.shortcuts impor... | 13,387 | Python | .py | 277 | 38.516245 | 118 | 0.634901 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,852 | user.py | DMOJ_online-judge/judge/views/user.py | import base64
import binascii
import itertools
import json
import os
from datetime import datetime
from operator import attrgetter, itemgetter
from django.conf import settings
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins... | 26,184 | Python | .py | 517 | 41.591876 | 120 | 0.661945 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,853 | problem_data.py | DMOJ_online-judge/judge/views/problem_data.py | import json
import mimetypes
import os
from itertools import chain
from typing import List
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 Vali... | 10,664 | Python | .py | 219 | 39.643836 | 119 | 0.650693 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,854 | blog.py | DMOJ_online-judge/judge/views/blog.py | from django.conf import settings
from django.db.models import Count, Max
from django.http import Http404
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import gettext as _
from django.views.generic import ListView
from judge.comments import CommentedDetailView
from judg... | 5,276 | Python | .py | 97 | 44.371134 | 120 | 0.649796 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,855 | language.py | DMOJ_online-judge/judge/views/language.py | from django.utils.translation import gettext_lazy
from django.views.generic import ListView
from judge.models import Language
from judge.utils.views import TitleMixin
class LanguageList(TitleMixin, ListView):
model = Language
context_object_name = 'languages'
template_name = 'status/language-list.html'
... | 643 | Python | .py | 14 | 40.642857 | 81 | 0.7488 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,856 | contests.py | DMOJ_online-judge/judge/views/contests.py | import json
from calendar import Calendar, SUNDAY
from collections import defaultdict, namedtuple
from datetime import date, datetime, time, timedelta
from functools import partial
from itertools import chain
from operator import attrgetter, itemgetter
from django import forms
from django.conf import settings
from dja... | 37,068 | Python | .py | 726 | 40.217631 | 120 | 0.633534 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,857 | problem.py | DMOJ_online-judge/judge/views/problem.py | import logging
import os
import re
from datetime import timedelta
from operator import itemgetter
from random import randrange
from statistics import mean, median
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.core.exceptions import Objec... | 35,881 | Python | .py | 675 | 41.862222 | 120 | 0.630264 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,858 | tasks.py | DMOJ_online-judge/judge/views/tasks.py | import json
from functools import partial
from uuid import UUID
from celery.result import AsyncResult
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponseBadRequest, HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from django.urls import reverse
from ... | 2,319 | Python | .py | 51 | 40.803922 | 106 | 0.717266 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,859 | ranked_submission.py | DMOJ_online-judge/judge/views/ranked_submission.py | from django.urls import reverse
from django.utils.html import escape, format_html
from django.utils.safestring import mark_safe
from django.utils.translation import gettext as _
from judge.models import Language, Submission
from judge.utils.problems import get_result_data
from judge.utils.raw_sql import join_sql_subqu... | 4,881 | Python | .py | 91 | 41.252747 | 108 | 0.590366 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,860 | comment.py | DMOJ_online-judge/judge/views/comment.py | from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.core.exceptions import PermissionDenied
from django.db import IntegrityError
from django.db.models import F
from django.forms.models import ModelForm
from django.http ... | 6,761 | Python | .py | 145 | 38.862069 | 117 | 0.689897 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,861 | status.py | DMOJ_online-judge/judge/views/status.py | from collections import defaultdict
from functools import partial
from django.shortcuts import render
from django.utils.translation import gettext as _
from packaging import version
from judge.models import Judge, Language, RuntimeVersion
__all__ = ['status_all', 'status_table']
def get_judges(request):
if req... | 3,540 | Python | .py | 88 | 31.818182 | 90 | 0.606768 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,862 | __init__.py | DMOJ_online-judge/judge/views/__init__.py | from django.views.generic import TemplateView
class TitledTemplateView(TemplateView):
title = None
def get_context_data(self, **kwargs):
if 'title' not in kwargs and self.title is not None:
kwargs['title'] = self.title
return super(TitledTemplateView, self).get_context_data(**kwar... | 324 | Python | .py | 7 | 39.714286 | 73 | 0.710191 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,863 | two_factor.py | DMOJ_online-judge/judge/views/two_factor.py | import base64
import json
import os
from io import BytesIO
import pyotp
import qrcode
import webauthn
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import SuccessURLAllowedHostsMixin
from django.http import Http404, HttpResponse, HttpResponseB... | 9,934 | Python | .py | 209 | 39.311005 | 118 | 0.679417 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,864 | select2.py | DMOJ_online-judge/judge/views/select2.py | 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_str
from django.views.generic.list import BaseListView
from judge.jinja2.gravatar import gravatar
from judge.models import Class, Comment, Contest, Orga... | 4,491 | Python | .py | 93 | 38.290323 | 117 | 0.643741 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,865 | widgets.py | DMOJ_online-judge/judge/views/widgets.py | import json
import os
import uuid
from urllib.parse import urljoin
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.files.storage import default_storage
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseRedirect
f... | 2,140 | Python | .py | 47 | 40.574468 | 109 | 0.738691 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,866 | organization.py | DMOJ_online-judge/judge/views/organization.py | from operator import attrgetter
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.cache import cache
from django.core.cache.utils import make_template_fragment_key
from django.core.exceptions import P... | 21,902 | Python | .py | 402 | 45.037313 | 120 | 0.666822 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,867 | stats.py | DMOJ_online-judge/judge/views/stats.py | from operator import itemgetter
from django.conf import settings
from django.db.models import Count, FloatField, Q, Value
from django.db.models.expressions import CombinedExpression
from django.http import JsonResponse
from django.shortcuts import render
from django.utils.translation import gettext as _
from judge.mo... | 2,415 | Python | .py | 47 | 44.851064 | 107 | 0.684099 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,868 | register.py | DMOJ_online-judge/judge/views/register.py | # coding=utf-8
from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.password_validation import get_default_password_validators
from django.forms import ChoiceField, ModelChoiceField
from django.shortcuts import render
from django.utils.translatio... | 5,147 | Python | .py | 87 | 48.252874 | 114 | 0.668121 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,869 | preview.py | DMOJ_online-judge/judge/views/preview.py | from django.http import HttpResponseBadRequest
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
class MarkdownPreviewView(TemplateResponseMixin, ContextMixin, View):
def post(self, request, *args, **kwargs):
try:
self.preview_data = data = request.POST['content']... | 1,627 | Python | .py | 33 | 44.030303 | 79 | 0.794774 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,870 | submission.py | DMOJ_online-judge/judge/views/submission.py | import json
from collections import namedtuple
from itertools import groupby
from operator import attrgetter
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist, Permis... | 29,241 | Python | .py | 547 | 43.511883 | 119 | 0.648111 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,871 | mailgun.py | DMOJ_online-judge/judge/views/mailgun.py | import hashlib
import hmac
import logging
from email.utils import parseaddr
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.utils... | 3,110 | Python | .py | 56 | 44.571429 | 119 | 0.647291 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,872 | __init__.py | DMOJ_online-judge/judge/views/api/__init__.py | from .api_v2 import (
APIContestDetail, APIContestList, APIContestParticipationList, APIOrganizationList, APIProblemDetail,
APIProblemList, APISubmissionDetail, APISubmissionList, APIUserDetail, APIUserList,
)
| 218 | Python | .py | 4 | 51.5 | 105 | 0.845794 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,873 | api_v2.py | DMOJ_online-judge/judge/views/api/api_v2.py | from operator import attrgetter
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied, ValidationError
from django.db.models import Count, F, OuterRef, Prefetch, Q, Subquery
from django.http import Http404, JsonResponse
from django.utils import timezone
from django.ut... | 26,458 | Python | .py | 650 | 29.14 | 119 | 0.569028 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,874 | base_handler.py | DMOJ_online-judge/judge/bridge/base_handler.py | import logging
import socket
import struct
import zlib
from itertools import chain
from netaddr import IPGlob, IPSet
from judge.utils.unicode import utf8text
logger = logging.getLogger('judge.bridge')
size_pack = struct.Struct('!I')
assert size_pack.size == 4
MAX_ALLOWED_PACKET_SIZE = 8 * 1024 * 1024
def proxy_l... | 6,587 | Python | .py | 163 | 29.815951 | 118 | 0.586439 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,875 | judge_list.py | DMOJ_online-judge/judge/bridge/judge_list.py | import logging
from collections import namedtuple
from random import random
from threading import RLock
from judge.judge_priority import REJUDGE_PRIORITY
try:
from llist import dllist
except ImportError:
from pyllist import dllist
logger = logging.getLogger('judge.bridge')
PriorityMarker = namedtuple('Prior... | 7,828 | Python | .py | 169 | 32.360947 | 120 | 0.556167 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,876 | daemon.py | DMOJ_online-judge/judge/bridge/daemon.py | import logging
import signal
import threading
from functools import partial
from django.conf import settings
from judge.bridge.django_handler import DjangoHandler
from judge.bridge.judge_handler import JudgeHandler
from judge.bridge.judge_list import JudgeList
from judge.bridge.server import Server
from judge.models ... | 1,413 | Python | .py | 34 | 37 | 98 | 0.758419 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,877 | judge_handler.py | DMOJ_online-judge/judge/bridge/judge_handler.py | import hmac
import json
import logging
import threading
import time
from collections import deque, namedtuple
from operator import itemgetter
from django import db
from django.conf import settings
from django.utils import timezone
from judge import event_poster as event
from judge.bridge.base_handler import ZlibPacke... | 27,510 | Python | .py | 544 | 38.985294 | 120 | 0.596948 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,878 | echo_test_client.py | DMOJ_online-judge/judge/bridge/echo_test_client.py | import os
import socket
import struct
import time
import zlib
size_pack = struct.Struct('!I')
def open_connection():
sock = socket.create_connection((host, port))
return sock
def zlibify(data):
data = zlib.compress(data.encode('utf-8'))
return size_pack.pack(len(data)) + data
def dezlibify(data, ... | 2,139 | Python | .py | 69 | 26.289855 | 67 | 0.637512 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,879 | echo_test_server.py | DMOJ_online-judge/judge/bridge/echo_test_server.py | from judge.bridge.base_handler import ZlibPacketHandler
class EchoPacketHandler(ZlibPacketHandler):
def on_connect(self):
print('New client:', self.client_address)
self.timeout = 5
def on_timeout(self):
print('Inactive client:', self.client_address)
def on_packet(self, data):
... | 1,083 | Python | .py | 27 | 34.074074 | 96 | 0.658046 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,880 | django_handler.py | DMOJ_online-judge/judge/bridge/django_handler.py | import json
import logging
import struct
from django import db
from judge.bridge.base_handler import Disconnect, ZlibPacketHandler
logger = logging.getLogger('judge.bridge')
size_pack = struct.Struct('!I')
class DjangoHandler(ZlibPacketHandler):
def __init__(self, request, client_address, server, judges):
... | 2,248 | Python | .py | 53 | 34.433962 | 105 | 0.636864 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,881 | server.py | DMOJ_online-judge/judge/bridge/server.py | import threading
from socketserver import TCPServer, ThreadingMixIn
class ThreadingTCPListener(ThreadingMixIn, TCPServer):
allow_reuse_address = True
class Server:
def __init__(self, addresses, handler):
self.servers = [ThreadingTCPListener(address, handler) for address in addresses]
self._s... | 873 | Python | .py | 24 | 27.791667 | 92 | 0.647687 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,882 | recaptcha.py | DMOJ_online-judge/judge/utils/recaptcha.py | try:
from snowpenguin.django.recaptcha2.fields import ReCaptchaField
from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget
except ImportError:
ReCaptchaField = None
ReCaptchaWidget = None
else:
from django.conf import settings
if not hasattr(settings, 'RECAPTCHA_PRIVATE_KEY'):
... | 375 | Python | .py | 11 | 29.454545 | 69 | 0.771978 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,883 | camo.py | DMOJ_online-judge/judge/utils/camo.py | import hmac
from hashlib import sha1
from django.conf import settings
from judge.utils.unicode import utf8bytes
class CamoClient(object):
"""Based on https://github.com/sionide21/camo-client"""
def __init__(self, server, key, excluded=(), https=False):
self.server = server.rstrip('/')
self.... | 1,617 | Python | .py | 38 | 32.184211 | 93 | 0.578713 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,884 | tickets.py | DMOJ_online-judge/judge/utils/tickets.py | from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from judge.models import Problem
def own_ticket_filter(profile_id):
return Q(assignees__id=profile_id) | Q(user_id=profile_id)
def filter_visible_tickets(queryset, user):
return queryset.filter(own_ticket_filter(user.... | 512 | Python | .py | 9 | 48.222222 | 91 | 0.710843 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,885 | unicode.py | DMOJ_online-judge/judge/utils/unicode.py | from typing import AnyStr, Optional, overload
@overload
def utf8bytes(maybe_text: AnyStr) -> bytes:
pass
@overload
def utf8bytes(maybe_text: None) -> None:
pass
def utf8bytes(maybe_text):
if maybe_text is None:
return None
if isinstance(maybe_text, bytes):
return maybe_text
ret... | 732 | Python | .py | 25 | 24.92 | 60 | 0.703597 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,886 | timedelta.py | DMOJ_online-judge/judge/utils/timedelta.py | import datetime
from django.utils.translation import ngettext, npgettext, pgettext
def nice_repr(timedelta, display='long', sep=', '):
"""
Turns a datetime.timedelta object into a nice string repr.
display can be 'minimal', 'short' or 'long' [default].
>>> from datetime import timedelta as td
>... | 3,485 | Python | .py | 78 | 35.730769 | 119 | 0.53137 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,887 | celery.py | DMOJ_online-judge/judge/utils/celery.py | from celery.result import AsyncResult
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.http import urlencode
class Progress:
def __init__(self, task, total, stage=None):
self.task = task
self._total = total
self._done = 0
self._stage = ... | 1,833 | Python | .py | 58 | 24.362069 | 75 | 0.612408 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,888 | problem_data.py | DMOJ_online-judge/judge/utils/problem_data.py | import json
import os
import re
import yaml
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.files.storage import FileSystemStorage
from django.urls import reverse
from django.utils.translation import gettext as _
if os.altsep:
def split_path_first(path, repath=re.c... | 9,118 | Python | .py | 210 | 29.119048 | 119 | 0.522136 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,889 | raw_sql.py | DMOJ_online-judge/judge/utils/raw_sql.py | from django.db import connections
from django.db.models.sql.constants import INNER, LOUTER
from django.db.models.sql.datastructures import Join
from judge.utils.cachedict import CacheDict
class RawSQLJoin(Join):
def __init__(self, subquery, subquery_params, parent_alias, table_alias, join_type, join_field, nulla... | 2,461 | Python | .py | 53 | 39.09434 | 114 | 0.68716 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,890 | lazy.py | DMOJ_online-judge/judge/utils/lazy.py | from django.utils.functional import lazy
class LazyMemoizedCallable:
sentinel = object()
def __init__(self, func):
self.value = self.sentinel
self.func = func
def __call__(self):
if self.value is self.sentinel:
self.value = self.func()
return self.value
def ... | 409 | Python | .py | 12 | 27.583333 | 58 | 0.662404 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,891 | strings.py | DMOJ_online-judge/judge/utils/strings.py | from math import isfinite
def safe_int_or_none(value):
try:
return int(value)
except (ValueError, TypeError):
return None
def safe_float_or_none(value, force_finite=True):
try:
num = float(value)
except (ValueError, TypeError):
return None
if force_finite and not... | 372 | Python | .py | 14 | 20.571429 | 49 | 0.661932 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,892 | pwned.py | DMOJ_online-judge/judge/utils/pwned.py | """
Based on https://github.com/ubernostrum/pwned-passwords-django.
Original license:
Copyright (c) 2018, James Bennett
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source ... | 4,061 | Python | .py | 91 | 38.956044 | 80 | 0.729552 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,893 | mathoid.py | DMOJ_online-judge/judge/utils/mathoid.py | import hashlib
import logging
import re
import requests
from django.conf import settings
from django.core.cache import caches
from django.utils.html import format_html
from mistune import escape
from judge.utils.file_cache import HashFileCache
from judge.utils.unicode import utf8bytes, utf8text
logger = logging.getL... | 5,489 | Python | .py | 132 | 31.643939 | 114 | 0.545233 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,894 | ranker.py | DMOJ_online-judge/judge/utils/ranker.py | from operator import attrgetter
def ranker(iterable, key=attrgetter('points'), rank=0):
delta = 1
last = None
for item in iterable:
new = key(item)
if new != last:
rank += delta
delta = 0
delta += 1
yield rank, item
last = key(item)
| 311 | Python | .py | 12 | 18.416667 | 55 | 0.552189 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,895 | safe_translations.py | DMOJ_online-judge/judge/utils/safe_translations.py | from django.utils.html import escape
def _init():
from functools import wraps
from django.utils import translation
def wrap(function):
@wraps(function)
def wrapper(*args, **kwargs):
return escape(function(*args, **kwargs))
return wrapper
for func in ['gettext', '... | 489 | Python | .py | 13 | 31.461538 | 118 | 0.663113 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,896 | caniuse.py | DMOJ_online-judge/judge/utils/caniuse.py | import json
import os
from ua_parser import user_agent_parser
with open(os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'caniuse.json')) as f:
_SUPPORT_DATA = json.loads(f.read())['data']
SUPPORT = 'y'
PARTIAL_SUPPORT = 'a'
UNSUPPORTED = 'n'
POLYFILL = 'p'
UNKNOWN = 'u'
PREFIX = 'x'
DISABLED = '... | 4,328 | Python | .py | 120 | 25.241667 | 100 | 0.525976 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,897 | pdfoid.py | DMOJ_online-judge/judge/utils/pdfoid.py | import base64
import logging
import requests
from django.conf import settings
from django.utils.translation import gettext
logger = logging.getLogger('judge.problem.pdf')
PDFOID_URL = settings.DMOJ_PDF_PDFOID_URL
PDF_RENDERING_ENABLED = PDFOID_URL is not None
def render_pdf(*, title: str, html: str, footer: bool ... | 1,151 | Python | .py | 33 | 27.848485 | 87 | 0.63234 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,898 | two_factor.py | DMOJ_online-judge/judge/utils/two_factor.py | import base64
import json
def webauthn_encode(binary):
return base64.urlsafe_b64encode(binary).decode('ascii').rstrip('=')
def webauthn_decode(text):
text += '=' * (-len(text) % 4)
return base64.urlsafe_b64decode(text)
class WebAuthnJSONEncoder(json.JSONEncoder):
def default(self, o):
if i... | 425 | Python | .py | 12 | 30.25 | 71 | 0.683047 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |
35,899 | subscription.py | DMOJ_online-judge/judge/utils/subscription.py | from django.conf import settings
if 'newsletter' in settings.INSTALLED_APPS:
from newsletter.models import Subscription
else:
Subscription = None
newsletter_id = None if Subscription is None else settings.DMOJ_NEWSLETTER_ID_ON_REGISTER
| 246 | Python | .py | 6 | 38.333333 | 89 | 0.819328 | DMOJ/online-judge | 918 | 355 | 202 | AGPL-3.0 | 9/5/2024, 5:15:11 PM (Europe/Amsterdam) |