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,900
cachedict.py
DMOJ_online-judge/judge/utils/cachedict.py
class CacheDict(dict): def __init__(self, func): super(CacheDict, self).__init__() self.func = func def __missing__(self, key): self[key] = value = self.func(key) return value
217
Python
.py
7
24.142857
42
0.564593
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,901
stats.py
DMOJ_online-judge/judge/utils/stats.py
from operator import itemgetter __all__ = ('chart_colors', 'highlight_colors', 'get_pie_chart', 'get_bar_chart') BASE_COLORS = [0x3366CC, 0xDC3912, 0xFF9900, 0x109618, 0x990099, 0x3B3EAC, 0x0099C6, 0xDD4477, 0x66AA00, 0xB82E2E, 0x316395, 0x994499, 0x22AA99, 0xAAAA11, 0x6633CC, 0xE67300, 0x8B0707, 0x32...
1,599
Python
.py
34
37.5
114
0.576577
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,902
problems.py
DMOJ_online-judge/judge/utils/problems.py
from collections import defaultdict from math import e from django.core.cache import cache from django.db.models import Case, Count, ExpressionWrapper, F, When from django.db.models.fields import FloatField from django.utils import timezone from django.utils.translation import gettext_noop from judge.models import Pr...
4,996
Python
.py
99
42.555556
120
0.6367
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,903
infinite_paginator.py
DMOJ_online-judge/judge/utils/infinite_paginator.py
import collections.abc import inspect from math import ceil from django.core.paginator import EmptyPage, InvalidPage from django.http import Http404 from django.utils.functional import cached_property from django.utils.inspect import method_has_no_args class InfinitePage(collections.abc.Sequence): def __init__(s...
4,432
Python
.py
108
33.009259
100
0.640345
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,904
opengraph.py
DMOJ_online-judge/judge/utils/opengraph.py
from django.core.cache import cache from django.template.defaultfilters import truncatewords from judge.jinja2.markdown import markdown from judge.jinja2.reference import reference def generate_opengraph(cache_key, data, style): metadata = cache.get(cache_key) if metadata is None: description = None ...
865
Python
.py
21
32.809524
85
0.626635
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,905
texoid.py
DMOJ_online-judge/judge/utils/texoid.py
import hashlib import json import logging from base64 import b64decode import requests from django.conf import settings from django.core.cache import caches from judge.utils.file_cache import HashFileCache from judge.utils.unicode import utf8bytes logger = logging.getLogger('judge.texoid') TEXOID_ENABLED = hasattr(...
2,871
Python
.py
68
32.176471
95
0.603374
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,906
file_cache.py
DMOJ_online-judge/judge/utils/file_cache.py
import errno import os from gzip import open as gzip_open from urllib.parse import urljoin class HashFileCache(object): def __init__(self, root, url, gzip=False): self.root = root self.url = url self.gzip = gzip def create(self, hash): try: os.makedirs(os.path.join...
1,254
Python
.py
34
28.5
73
0.587262
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,907
views.py
DMOJ_online-judge/judge/utils/views.py
from django.shortcuts import render from django.views.generic import FormView from django.views.generic.detail import SingleObjectMixin from judge.utils.diggpaginator import DiggPaginator def generic_message(request, title, message, status=None): return render(request, 'generic-message.html', { 'message'...
4,114
Python
.py
89
38.292135
112
0.64005
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,908
mail.py
DMOJ_online-judge/judge/utils/mail.py
import re from typing import Any, Dict, List, Optional, Pattern from django.conf import settings from django.core.mail import EmailMultiAlternatives from django.forms import ValidationError from django.template import loader from django.utils.translation import gettext bad_mail_regex: List[Pattern[str]] = list(map(r...
1,608
Python
.py
33
43.030303
105
0.717752
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,909
iterator.py
DMOJ_online-judge/judge/utils/iterator.py
from itertools import zip_longest def chunk(iterable, size): fill = object() for group in zip_longest(*[iter(iterable)] * size, fillvalue=fill): yield [item for item in group if item is not fill]
214
Python
.py
5
38.2
71
0.705314
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,910
diggpaginator.py
DMOJ_online-judge/judge/utils/diggpaginator.py
import math from functools import reduce from django.core.paginator import InvalidPage, Page, Paginator __all__ = ( 'InvalidPage', 'ExPaginator', 'DiggPaginator', 'QuerySetDiggPaginator', ) class ExPaginator(Paginator): """Adds a ``softlimit`` option to ``page()``. If True, querying a page n...
11,385
Python
.py
246
38.479675
109
0.604129
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,911
test_iterator.py
DMOJ_online-judge/judge/utils/tests/test_iterator.py
import unittest from itertools import chain from judge.utils.iterator import chunk class ChunkTestCase(unittest.TestCase): def test_empty(self): self.assertEqual(list(chunk([], 5)), []) def test_normal(self): for size in [10, 13, 100, 200]: with self.subTest(f'chunk size {size}')...
605
Python
.py
14
33.357143
72
0.60477
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,912
test_infinite_paginator.py
DMOJ_online-judge/judge/utils/tests/test_infinite_paginator.py
from django.test import SimpleTestCase from judge.utils.infinite_paginator import infinite_paginate class InfinitePaginatorTestCase(SimpleTestCase): def test_first_page(self): self.assertEqual(infinite_paginate(range(1, 101), 1, 10, 2).object_list, list(range(1, 11))) self.assertEqual(infinite_p...
2,211
Python
.py
26
77.192308
116
0.640661
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,913
test_lazy.py
DMOJ_online-judge/judge/utils/tests/test_lazy.py
import unittest from judge.utils.lazy import memo_lazy class MemoLazyTestCase(unittest.TestCase): def test_works(self): called_times = 0 def work(): nonlocal called_times called_times += 1 return 123 result = memo_lazy(work, int) self.assertEq...
423
Python
.py
13
24.384615
43
0.634568
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,914
camo.py
DMOJ_online-judge/judge/management/commands/camo.py
from django.core.management.base import BaseCommand, CommandError from judge.utils.camo import client as camo_client class Command(BaseCommand): help = 'obtains the camo url for the specified url' def add_arguments(self, parser): parser.add_argument('url', help='url to use camo on') def handle(...
484
Python
.py
10
42
65
0.709402
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,915
addjudge.py
DMOJ_online-judge/judge/management/commands/addjudge.py
from django.core.management.base import BaseCommand from judge.models import Judge class Command(BaseCommand): help = 'create a judge' def add_arguments(self, parser): parser.add_argument('name', help='the name of the judge') parser.add_argument('auth_key', help='authentication key for the j...
495
Python
.py
12
34.833333
80
0.67364
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,916
move_user_content.py
DMOJ_online-judge/judge/management/commands/move_user_content.py
from django.core.management.base import BaseCommand, CommandError from django.db import transaction from judge.models import Comment, CommentVote, ContestParticipation, Profile, Submission class Command(BaseCommand): help = 'moves comments and submissions from <source> to <target>' def add_arguments(self, p...
1,333
Python
.py
23
49.130435
110
0.700461
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,917
makedmojmessages.py
DMOJ_online-judge/judge/management/commands/makedmojmessages.py
import glob import io import os import sys from django.conf import settings from django.core.management import CommandError from django.core.management.commands.makemessages import Command as MakeMessagesCommand, check_programs from judge.models import NavigationBar, ProblemType class Command(MakeMessagesCommand): ...
5,921
Python
.py
110
41.8
112
0.595061
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,918
generate_sitemap.py
DMOJ_online-judge/judge/management/commands/generate_sitemap.py
import sys from pathlib import Path from urllib.parse import urljoin from django.contrib.sites.models import Site from django.core.management import BaseCommand from django.template.loader import get_template from judge.sitemap import sitemaps class Command(BaseCommand): requires_system_checks = False def ...
2,784
Python
.py
53
42.09434
106
0.616575
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,919
copy_language.py
DMOJ_online-judge/judge/management/commands/copy_language.py
from django.core.management.base import BaseCommand, CommandError from judge.models import Language, LanguageLimit class Command(BaseCommand): help = 'allows the problems that allow <source> to be submitted in <target>' def add_arguments(self, parser): parser.add_argument('source', help='language to...
1,199
Python
.py
20
47.5
118
0.648464
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,920
generate_api_token.py
DMOJ_online-judge/judge/management/commands/generate_api_token.py
from django.contrib.auth.models import User from django.core.management.base import BaseCommand from judge.models import Profile class Command(BaseCommand): help = """Generates or regenerates an API token for user. The output is a 48 character, urlsafe base64 encoded token. This allows the user to acc...
900
Python
.py
15
52.466667
118
0.7125
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,921
runbridged.py
DMOJ_online-judge/judge/management/commands/runbridged.py
from django.core.management.base import BaseCommand from judge.bridge.daemon import judge_daemon class Command(BaseCommand): def handle(self, *args, **options): judge_daemon()
191
Python
.py
5
34.2
51
0.770492
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,922
adduser.py
DMOJ_online-judge/judge/management/commands/adduser.py
from django.conf import settings from django.contrib.auth.models import User from django.core.management.base import BaseCommand from judge.models import Language, Profile class Command(BaseCommand): help = 'creates a user' def add_arguments(self, parser): parser.add_argument('name', help='username'...
1,372
Python
.py
25
45.28
90
0.660448
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,923
render_pdf.py
DMOJ_online-judge/judge/management/commands/render_pdf.py
from django.conf import settings from django.core.management.base import BaseCommand from django.template.loader import get_template from django.utils import translation from judge.models import Problem, ProblemTranslation from judge.utils.pdfoid import render_pdf class Command(BaseCommand): help = 'renders a PD...
1,574
Python
.py
33
36.787879
95
0.614081
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,924
runmoss.py
DMOJ_online-judge/judge/management/commands/runmoss.py
from django.conf import settings from django.core.management.base import BaseCommand from moss import * from judge.models import Contest, ContestParticipation, Submission class Command(BaseCommand): help = 'Checks for duplicate code using MOSS' LANG_MAPPING = { ('C++', MOSS_LANG_CC), ('C', M...
2,055
Python
.py
42
35.642857
115
0.554446
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,925
create_problem.py
DMOJ_online-judge/judge/management/commands/create_problem.py
from django.core.management.base import BaseCommand from judge.models import Problem, ProblemGroup, ProblemType class Command(BaseCommand): help = 'create an empty problem' def add_arguments(self, parser): parser.add_argument('code', help='problem code') parser.add_argument('name', help='pro...
873
Python
.py
18
41.222222
71
0.68
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,926
camo.py
DMOJ_online-judge/judge/jinja2/camo.py
from judge.utils.camo import client as camo_client from . import registry @registry.filter def camo(url): if camo_client is None: return url return camo_client.rewrite_url(url)
195
Python
.py
7
24.285714
50
0.752688
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,927
timedelta.py
DMOJ_online-judge/judge/jinja2/timedelta.py
import datetime from judge.utils.timedelta import nice_repr from . import registry @registry.filter def timedelta(value, display='long'): if value is None: return value return nice_repr(value, display) @registry.filter def timestampdelta(value, display='long'): value = datetime.timedelta(second...
586
Python
.py
19
27.684211
53
0.77957
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,928
datetime.py
DMOJ_online-judge/judge/jinja2/datetime.py
import functools from django.template.defaultfilters import date, time from django.templatetags.tz import localtime from django.utils.html import escape from django.utils.safestring import mark_safe from django.utils.timezone import utc from django.utils.translation import gettext as _ from . import registry def lo...
1,103
Python
.py
23
42.652174
107
0.696545
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,929
language.py
DMOJ_online-judge/judge/jinja2/language.py
from django.utils import translation from . import registry @registry.function('language_info') def get_language_info(language): # ``language`` is either a language code string or a sequence # with the language code as its first item if len(language[0]) > 1: return translation.get_language_info(l...
535
Python
.py
13
37
65
0.742747
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,930
rating.py
DMOJ_online-judge/judge/jinja2/rating.py
from django.utils.translation import gettext_lazy as _ from judge.ratings import rating_class, rating_name, rating_progress from . import registry def _get_rating_value(func, obj): if obj is None: return None if isinstance(obj, int): return func(obj) else: return func(obj.rating)...
811
Python
.py
23
31.478261
68
0.731959
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,931
format.py
DMOJ_online-judge/judge/jinja2/format.py
import html from django.utils.html import escapejs, format_html from . import registry @registry.function def bold(text): return format_html('<b>{0}</b>', text) @registry.filter def htmltojs(text): return format_html("'{0}'", escapejs(html.unescape(text)))
271
Python
.py
9
27.555556
62
0.746094
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,932
__init__.py
DMOJ_online-judge/judge/jinja2/__init__.py
import itertools import json from urllib.parse import quote from jinja2.ext import Extension from mptt.utils import get_cached_trees from statici18n.templatetags.statici18n import inlinei18n from judge.highlight_code import highlight_code from judge.user_translations import gettext from . import (camo, datetime, file...
1,146
Python
.py
29
36.37931
113
0.777477
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,933
filesize.py
DMOJ_online-judge/judge/jinja2/filesize.py
from django.utils.html import avoid_wrapping from . import registry def _format_size(bytes, callback): bytes = float(bytes) KB = 1 << 10 MB = 1 << 20 GB = 1 << 30 TB = 1 << 40 PB = 1 << 50 if bytes < KB: return callback('', bytes) elif bytes < MB: return callback('K'...
843
Python
.py
27
26.037037
108
0.5886
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,934
reference.py
DMOJ_online-judge/judge/jinja2/reference.py
import re from collections import defaultdict from urllib.parse import urljoin from ansi2html import Ansi2HTMLConverter from django.contrib.auth.models import AbstractUser from django.urls import reverse from django.utils.html import escape from django.utils.safestring import mark_safe from lxml.html import Element f...
5,576
Python
.py
152
30.039474
98
0.646742
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,935
render.py
DMOJ_online-judge/judge/jinja2/render.py
from django.template import (Context, Template as DjangoTemplate, TemplateSyntaxError as DjangoTemplateSyntaxError, VariableDoesNotExist) from . import registry MAX_CACHE = 100 django_cache = {} def compile_template(code): if code in django_cache: return django_cache[code] ...
755
Python
.py
19
33.631579
115
0.714286
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,936
gravatar.py
DMOJ_online-judge/judge/jinja2/gravatar.py
import hashlib from django.contrib.auth.models import AbstractUser from django.utils.http import urlencode from judge.models import Profile from judge.utils.unicode import utf8bytes from . import registry @registry.function def gravatar(email, size=80, default=None): if isinstance(email, Profile): if de...
738
Python
.py
20
32.05
119
0.701262
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,937
spaceless.py
DMOJ_online-judge/judge/jinja2/spaceless.py
import re from jinja2 import nodes from jinja2.ext import Extension from markupsafe import Markup class SpacelessExtension(Extension): """ Removes whitespace between HTML tags at compile time, including tab and newline characters. It does not remove whitespace between jinja2 tags or variables. Neither do...
1,039
Python
.py
24
37.041667
114
0.690783
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,938
registry.py
DMOJ_online-judge/judge/jinja2/registry.py
from django_jinja.library import render_with globals = {} tests = {} filters = {} extensions = [] __all__ = ['render_with', 'function', 'filter', 'test', 'extension'] def _store_function(store, func, name=None): if name is None: name = func.__name__ store[name] = func def _register_function(store,...
1,180
Python
.py
37
25.054054
68
0.630878
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,939
social.py
DMOJ_online-judge/judge/jinja2/social.py
from django.template.loader import get_template from django.utils.safestring import mark_safe from django_social_share.templatetags.social_share import post_to_facebook_url, post_to_twitter_url from . import registry SHARES = [ ('post_to_twitter', 'django_social_share/templatetags/post_to_twitter.html', post_to_t...
1,513
Python
.py
28
49.428571
107
0.73103
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,940
submission.py
DMOJ_online-judge/judge/jinja2/submission.py
from operator import attrgetter from judge.models import SubmissionSourceAccess from . import registry # TODO: maybe refactor this? def get_editor_ids(contest): return set(map(attrgetter('id'), contest.authors.all())) | set(map(attrgetter('id'), contest.curators.all())) @registry.function def submission_layout...
1,567
Python
.py
31
44.16129
117
0.720078
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,941
__init__.py
DMOJ_online-judge/judge/jinja2/markdown/__init__.py
import logging import re from html import unescape from urllib.parse import urlparse import mistune from bleach.css_sanitizer import CSSSanitizer from bleach.sanitizer import Cleaner from django.conf import settings from lxml import html from lxml.etree import ParserError, XMLSyntaxError from markupsafe import Markup ...
7,520
Python
.py
159
38.327044
111
0.614775
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,942
bleach_whitelist.py
DMOJ_online-judge/judge/jinja2/markdown/bleach_whitelist.py
# Based on https://github.com/yourcelf/bleach-whitelist/blob/master/bleach_whitelist/bleach_whitelist.py standard_styles = [ # Taken from https://developer.mozilla.org/en-US/docs/Web/CSS/Reference # This includes pseudo-classes, pseudo-elements, @-rules, units, and # selectors in addition to properties, bu...
37,019
Python
.py
522
65.806513
120
0.631947
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,943
test_markdown.py
DMOJ_online-judge/judge/jinja2/markdown/test_markdown.py
from django.test import SimpleTestCase from lxml import html from . import fragment_tree_to_str, fragments_to_tree, get_cleaner, markdown MATHML_N = """\ <math xmlns="http://www.w3.org/1998/Math/MathML"> <semantics> <mi>N</mi> <annotation encoding="application/x-tex">N</annotation> </semantics> </math> """ MATHML_CH...
5,497
Python
.py
140
27.435714
202
0.493899
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,944
math.py
DMOJ_online-judge/judge/jinja2/markdown/math.py
import re import mistune from judge.utils.mathoid import MathoidMathParser mistune._pre_tags.append('latex') class MathInlineGrammar(mistune.InlineGrammar): block_math = re.compile(r'^\$\$(.*?)\$\$|^\\\[(.*?)\\\]', re.DOTALL) math = re.compile(r'^~(.*?)~|^\\\((.*?)\\\)', re.DOTALL) text = re.compile(r'...
2,241
Python
.py
50
36.16
94
0.584099
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,945
lazy_load.py
DMOJ_online-judge/judge/jinja2/markdown/lazy_load.py
from copy import deepcopy from django.templatetags.static import static from lxml import html def lazy_load(tree): blank = static('blank.gif') for img in tree.xpath('.//img'): src = img.get('src', '') if src.startswith('data') or '-math' in img.get('class', ''): continue n...
623
Python
.py
17
29.588235
88
0.60199
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,946
ioi.py
DMOJ_online-judge/judge/contest_format/ioi.py
from django.db import connection from django.utils.translation import gettext as _, gettext_lazy from judge.contest_format.legacy_ioi import LegacyIOIContestFormat from judge.contest_format.registry import register_contest_format from judge.timezone import from_database_time @register_contest_format('ioi16') class I...
4,705
Python
.py
91
32.131868
115
0.479904
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,947
ecoo.py
DMOJ_online-judge/judge/contest_format/ecoo.py
from datetime import timedelta from django.core.exceptions import ValidationError from django.db.models import Count, Max, OuterRef, Subquery from django.template.defaultfilters import floatformat from django.urls import reverse from django.utils.html import format_html from django.utils.safestring import mark_safe fr...
6,729
Python
.py
125
42.248
120
0.606535
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,948
default.py
DMOJ_online-judge/judge/contest_format/default.py
from datetime import timedelta from django.core.exceptions import ValidationError from django.db.models import Max from django.template.defaultfilters import floatformat from django.urls import reverse from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation...
3,684
Python
.py
66
46.439394
119
0.667314
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,949
icpc.py
DMOJ_online-judge/judge/contest_format/icpc.py
from datetime import timedelta from django.core.exceptions import ValidationError from django.db import connection from django.template.defaultfilters import floatformat from django.urls import reverse from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation...
6,294
Python
.py
118
40
120
0.587882
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,950
legacy_ioi.py
DMOJ_online-judge/judge/contest_format/legacy_ioi.py
from datetime import timedelta from django.core.exceptions import ValidationError from django.db.models import Min, OuterRef, Subquery from django.template.defaultfilters import floatformat from django.urls import reverse from django.utils.html import format_html from django.utils.safestring import mark_safe from djan...
4,672
Python
.py
86
41.72093
117
0.609761
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,951
__init__.py
DMOJ_online-judge/judge/contest_format/__init__.py
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.icpc import ICPCContestFormat from judge.contest_format.ioi import IOIContestFormat from judge.contest_format.lega...
416
Python
.py
7
58.428571
66
0.889976
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,952
base.py
DMOJ_online-judge/judge/contest_format/base.py
from abc import ABCMeta, abstractmethod class abstractclassmethod(classmethod): __isabstractmethod__ = True def __init__(self, callable): callable.__isabstractmethod__ = True super(abstractclassmethod, self).__init__(callable) class BaseContestFormat(metaclass=ABCMeta): @abstractmethod ...
3,705
Python
.py
87
34.574713
116
0.683815
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,953
atcoder.py
DMOJ_online-judge/judge/contest_format/atcoder.py
from datetime import timedelta from django.core.exceptions import ValidationError from django.db import connection from django.template.defaultfilters import floatformat from django.urls import reverse from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation...
5,872
Python
.py
108
40.861111
119
0.59356
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,954
registry.py
DMOJ_online-judge/judge/contest_format/registry.py
formats = {} def register_contest_format(name): def register_class(contest_format_class): assert name not in formats formats[name] = contest_format_class return contest_format_class return register_class def choices(): return [(key, value.name) for key, value in sorted(formats.i...
329
Python
.py
9
31
72
0.704762
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,955
profile.py
DMOJ_online-judge/judge/admin/profile.py
from django.contrib import admin from django.contrib.auth.admin import UserAdmin as OldUserAdmin from django.forms import ModelForm from django.urls import reverse_lazy from django.utils.html import format_html from django.utils.translation import gettext, gettext_lazy as _, ngettext from reversion.admin import Version...
6,092
Python
.py
120
42.216667
113
0.655172
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,956
runtime.py
DMOJ_online-judge/judge/admin/runtime.py
from django.core.exceptions import PermissionDenied from django.db.models import TextField from django.forms import ModelForm, TextInput from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.urls import path, reverse from django.utils.decorators import method_decorator ...
4,789
Python
.py
102
40.009804
112
0.660454
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,957
ticket.py
DMOJ_online-judge/judge/admin/ticket.py
from django.contrib.admin import ModelAdmin from django.contrib.admin.options import StackedInline from django.forms import ModelForm from django.urls import reverse_lazy from judge.models import TicketMessage from judge.widgets import AdminHeavySelect2MultipleWidget, AdminHeavySelect2Widget, AdminMartorWidget class...
1,337
Python
.py
29
40.517241
118
0.707467
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,958
interface.py
DMOJ_online-judge/judge/admin/interface.py
from django.contrib import admin from django.contrib.auth.models import User from django.contrib.flatpages.admin import FlatPageAdmin as OldFlatPageAdmin from django.contrib.flatpages.forms import FlatpageForm as OldFlatpageForm from django.forms import ModelForm from django.urls import NoReverseMatch, reverse, reverse...
6,591
Python
.py
131
42.931298
116
0.664798
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,959
problem.py
DMOJ_online-judge/judge/admin/problem.py
from operator import attrgetter from django import forms from django.contrib import admin from django.db import transaction from django.forms import ModelForm from django.urls import reverse, reverse_lazy from django.utils import timezone from django.utils.html import format_html from django.utils.translation import g...
11,833
Python
.py
215
45.753488
120
0.652482
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,960
comments.py
DMOJ_online-judge/judge/admin/comments.py
from django.contrib import admin from django.db.models import F from django.forms import ModelForm from django.urls import reverse_lazy from django.utils.html import format_html from django.utils.translation import gettext_lazy as _, ngettext from reversion.admin import VersionAdmin from judge.models import Comment fr...
2,619
Python
.py
56
37.589286
102
0.625539
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,961
__init__.py
DMOJ_online-judge/judge/admin/__init__.py
from django.contrib import admin from django.contrib.admin.models import LogEntry from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from judge.admin.comments import CommentAdmin from judge.admin.contest import ContestAdmin, ContestParticipationAdmin, ContestTagAdmin from ...
2,339
Python
.py
43
53.162791
111
0.870096
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,962
contest.py
DMOJ_online-judge/judge/admin/contest.py
from adminsortable2.admin import SortableInlineAdminMixin from django.contrib import admin from django.core.exceptions import PermissionDenied from django.db import connection, transaction from django.db.models import Q, TextField from django.forms import ModelForm, ModelMultipleChoiceField from django.http import Http...
18,696
Python
.py
323
46.517028
120
0.637262
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,963
organization.py
DMOJ_online-judge/judge/admin/organization.py
from django.contrib import admin 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, gettext_lazy as _ from reversion.admin import VersionAdmin from judge.models import Organizatio...
4,464
Python
.py
91
40.868132
114
0.662684
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,964
submission.py
DMOJ_online-judge/judge/admin/submission.py
from functools import partial from operator import itemgetter from django.conf import settings from django.contrib import admin, messages from django.core.cache import cache from django.core.exceptions import PermissionDenied from django.db.models import Q from django.http import HttpResponseRedirect from django.short...
12,304
Python
.py
222
44.878378
120
0.635133
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,965
taxon.py
DMOJ_online-judge/judge/admin/taxon.py
from django.contrib import admin from django.forms import ModelForm, ModelMultipleChoiceField from django.utils.translation import gettext_lazy as _ from judge.models import Problem from judge.widgets import AdminHeavySelect2MultipleWidget class ProblemGroupForm(ModelForm): problems = ModelMultipleChoiceField( ...
2,045
Python
.py
39
45.974359
104
0.712494
DMOJ/online-judge
918
355
202
AGPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,966
manage.py
turicas_brasil_io/manage.py
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") try: from django.core.management import execute_from_command_line except Impo...
663
Python
.py
18
30.944444
73
0.677067
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,967
rocketchat.py
turicas_brasil_io/utils/rocketchat.py
#!/usr/bin/env python from urllib.parse import urljoin import requests ####### # INFO: esta é uma cópia de https://github.com/turicas/covid19-br/blob/master/bot/rocketchat.py HTTP_METHODS = "GET HEAD POST PUT DELETE CONNECT OPTIONS TRACE PATCH".lower().split() class RocketChat: def __init__(self, base_url): ...
2,334
Python
.py
58
29.758621
103
0.562334
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,968
sqlprint.py
turicas_brasil_io/utils/sqlprint.py
# Based on: <https://djangosnippets.org/snippets/290/> import sqlparse from django.conf import settings from django.db import connection class SqlPrintingMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): response = self.get_response(re...
931
Python
.py
19
39.526316
107
0.62624
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,969
file_info.py
turicas_brasil_io/utils/file_info.py
def human_readable_size(size, divider=1024): """ >>> human_readable_size(100) '100B' >>> human_readable_size(1023) '1023B' >>> human_readable_size(1024) '1kB' >>> human_readable_size(1.5 * 1024) '1.50kB' >>> human_readable_size(1024 * 1024) '1MB' >>> human_readable_size(1...
966
Python
.py
32
24.78125
75
0.583065
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,970
tests.py
turicas_brasil_io/utils/tests.py
from django.conf import settings class DjangoAssertionsMixin: """ This class is a base test class to beter usage of custom assert methods """ def assertTemplateUsed(self, response, template_name, *args, **kwargs): invalid_string = "Invalid: '%s'" settings.TEMPLATES[0]["OPTIONS"]["stri...
494
Python
.py
10
43.2
78
0.70625
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,971
classes.py
turicas_brasil_io/utils/classes.py
def subclasses(cls): children = set(cls.__subclasses__()) return children | set(grandchildren for child in children for grandchildren in subclasses(child))
164
Python
.py
3
51
101
0.751553
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,972
conversion.py
turicas_brasil_io/utils/conversion.py
import csv import gzip import io import lzma import sqlite3 import rows def open_compressed(filename, encoding, mode="r"): if filename.endswith(".xz"): return io.TextIOWrapper( lzma.open(filename, mode=mode), encoding=encoding, ) elif filename.endswith(".gz"): ...
2,152
Python
.py
64
27.53125
114
0.673578
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,973
forms.py
turicas_brasil_io/utils/forms.py
from django.conf import settings from django_recaptcha.fields import ReCaptchaField class FlagedReCaptchaField(ReCaptchaField): def validate(self, *args, **kwargs): if settings.DISABLE_RECAPTCHA: self.validators = [] self.required = False else: super().validate(...
337
Python
.py
9
30
50
0.677914
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,974
api_urls.py
turicas_brasil_io/project/api_urls.py
from django.urls import include, path urlpatterns = [ path("", include("api.urls_v0", namespace="v0")), path("v1/", include("api.urls", namespace="v1")), ] handler403 = "traffic_control.handlers.handler_403" handler404 = "traffic_control.handlers.handler_404" handler500 = "traffic_control.handlers.handler_500...
322
Python
.py
8
38
53
0.737179
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,975
settings.py
turicas_brasil_io/project/settings.py
""" Django settings for the project. Generated by 'django-admin startproject' using Django 4.2.13. For more information on this file, see https://docs.djangoproject.com/en/4.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.2/ref/settings/ """ from pathlib imp...
12,711
Python
.py
300
38.7
118
0.725182
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,976
worker.py
turicas_brasil_io/project/worker.py
from raven import Client from raven.transport import HTTPTransport from rq import Worker from rq.contrib.sentry import register_sentry class SentryAwareWorker(Worker): def __init__(self, *args, **kwargs): from django.conf import settings super().__init__(*args, **kwargs) client = Client(s...
403
Python
.py
10
35.4
69
0.733333
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,977
asgi.py
turicas_brasil_io/project/asgi.py
""" ASGI config for the project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.setdefault("DJANGO_SETTINGS_...
387
Python
.py
10
37.1
78
0.800539
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,978
urls.py
turicas_brasil_io/project/urls.py
from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path urlpatterns = [ path("admin/", admin.site.urls), path("api/", include("project.api_urls")), path("auth/", include("brasilio_auth.urls", namespace="brasilio_auth...
772
Python
.py
16
45.375
76
0.734748
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,979
storage.py
turicas_brasil_io/project/storage.py
import json from urllib.parse import urljoin import boto3 from django.conf import settings class S3FileStorage: def __init__(self): self.session = boto3.session.Session() self.client = self.session.client( "s3", endpoint_url=settings.AWS_S3_ENDPOINT_URL, aws_ac...
2,455
Python
.py
56
33.375
105
0.597321
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,980
middlewares.py
turicas_brasil_io/project/middlewares.py
from django.conf import settings from django.urls.base import set_urlconf def host_based_url_conf(get_response): def middleware(request): if request.get_host() == settings.BRASILIO_API_HOST: set_urlconf(settings.API_ROOT_URLCONF) setattr(request, "urlconf", settings.API_ROOT_URLCON...
428
Python
.py
11
31.363636
66
0.687651
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,981
test_settings.py
turicas_brasil_io/project/test_settings.py
from pathlib import Path from .settings import * # noqa for queue in RQ_QUEUES.values(): # noqa queue["ASYNC"] = False SAMPLE_SPREADSHEETS_DATA_DIR = Path(BASE_DIR).joinpath("covid19", "tests", "data") # noqa CACHES = { "default": { "BACKEND": "django.core.cache.backends.dummy.DummyCache", } }...
586
Python
.py
16
34.125
90
0.699647
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,982
wsgi.py
turicas_brasil_io/project/wsgi.py
""" WSGI config for the project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_...
826
Python
.py
20
38.35
78
0.778616
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,983
urls_v0.py
turicas_brasil_io/api/urls_v0.py
from django.urls import path from traffic_control.decorators import enable_ratelimit from . import views app_name = "v0" urlpatterns = [ # Dataset-related endpoints path("", views.api_root, name="api-root"), path("datasets/", views.dataset_list, name="dataset-list"), path("dataset/<slug>/", views.d...
503
Python
.py
15
29
73
0.68323
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,984
models.py
turicas_brasil_io/api/models.py
import binascii import os from django.conf import settings from django.db import models class NumMaxTokensExceeded(Exception): """ User already has the max number of allowed tokens """ class Token(models.Model): """ Same as DRF Token model, but allowing more than one token per user """ ...
1,352
Python
.py
39
28.307692
107
0.660769
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,985
serializers.py
turicas_brasil_io/api/serializers.py
from rest_framework import serializers from rest_framework.reverse import reverse from core.models import Dataset, Field, Link, Table class LinkSerializer(serializers.ModelSerializer): class Meta: model = Link fields = ("title", "url") class FieldSerializer(serializers.ModelSerializer): cla...
2,595
Python
.py
75
25.746667
103
0.60104
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,986
authentication.py
turicas_brasil_io/api/authentication.py
from rest_framework.authentication import TokenAuthentication as BaseTokenAuth from api.models import Token class TokenAuthentication(BaseTokenAuth): model = Token
171
Python
.py
4
40
78
0.865854
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,987
urls.py
turicas_brasil_io/api/urls.py
from django.urls import path from traffic_control.decorators import enable_ratelimit from . import views app_name = "v1" urlpatterns = [ # Dataset-related endpoints path("", views.api_root, name="api-root"), path("datasets/", views.dataset_list, name="dataset-list"), path("dataset/<slug>/", views.d...
503
Python
.py
15
29
73
0.68323
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,988
versioning.py
turicas_brasil_io/api/versioning.py
from decorator import decorator from django.shortcuts import redirect from api.exceptions import ApiEndpointFromOldVersionException @decorator def check_api_version_redirect(func, self, request, *args, **kwargs): if request.version == "v0": raise ApiEndpointFromOldVersionException(request) return fu...
535
Python
.py
12
40.333333
69
0.78876
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,989
admin.py
turicas_brasil_io/api/admin.py
from django.contrib import admin from api.models import Token class TokenAdmin(admin.ModelAdmin): list_display = ("key", "user", "created") fields = ("user",) ordering = ("-created",) actions = None # Actions not compatible with mapped IDs. admin.site.register(Token, TokenAdmin)
302
Python
.py
8
34.125
61
0.719723
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,990
exceptions.py
turicas_brasil_io/api/exceptions.py
from urllib.parse import urlencode from django.urls import resolve, reverse class ApiEndpointFromOldVersionException(Exception): def __init__(self, request): self.request = request @property def should_redirect_to(self): match = resolve(self.request.path) url = reverse(f"v1:{matc...
486
Python
.py
13
30.384615
83
0.670236
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,991
paginators.py
turicas_brasil_io/api/paginators.py
from rest_framework import pagination class LargeTablePageNumberPagination(pagination.PageNumberPagination): max_page_size = 10000 page_size = 1000 page_size_query_param = "page_size"
199
Python
.py
5
35.8
70
0.795812
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,992
permissions.py
turicas_brasil_io/api/permissions.py
from django.conf import settings from rest_framework.authentication import get_authorization_header from rest_framework.permissions import IsAuthenticated class ApiIsAuthenticated(IsAuthenticated): def has_permission(self, request, *args, **kwargs): if settings.ENABLE_API_AUTH: return super()....
492
Python
.py
10
42.8
85
0.752083
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,993
views.py
turicas_brasil_io/api/views.py
from collections.abc import Sequence from django.conf import settings from django.shortcuts import get_object_or_404 from django.urls import reverse from rest_framework import viewsets from rest_framework.generics import ListAPIView from rest_framework.response import Response from rest_framework.views import APIView ...
5,138
Python
.py
107
40.850467
110
0.703756
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,994
0002_auto_20201002_2046.py
turicas_brasil_io/api/migrations/0002_auto_20201002_2046.py
# Generated by Django 3.1.1 on 2020-10-02 23:46 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("api", "0001_initial"), ...
689
Python
.py
21
23.952381
66
0.606335
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,995
0001_initial.py
turicas_brasil_io/api/migrations/0001_initial.py
# Generated by Django 3.1.1 on 2020-10-02 23:39 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
1,084
Python
.py
28
26.357143
112
0.544762
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,996
test_views.py
turicas_brasil_io/api/tests/test_views.py
from django.conf import settings from django.contrib.auth import get_user_model from django.test import TestCase, override_settings from django.urls import reverse, reverse_lazy from model_bakery import baker from core.tests.utils import BaseTestCaseWithSampleDataset from traffic_control.tests.util import TrafficContr...
8,520
Python
.py
169
41.491124
222
0.648772
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,997
test_models.py
turicas_brasil_io/api/tests/test_models.py
from django.conf import settings from django.test import TestCase from model_bakery import baker from api.models import Token class TokenTests(TestCase): def test_same_user_can_have_multiple_token(self): user = baker.make(settings.AUTH_USER_MODEL) token_1, token_2 = baker.make(Token, user=user, ...
376
Python
.py
9
37.111111
68
0.743094
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,998
generate_list.py
turicas_brasil_io/data-server/generate_list.py
import argparse import hashlib import os from pathlib import Path from jinja2 import Template from tqdm import tqdm def sha512sum(filename, buffer_size=1 * 1024 * 1024): obj = hashlib.sha512() with open(filename, mode="rb") as fobj: finished = False while not finished: data = fobj...
3,387
Python
.py
95
29.178947
76
0.62149
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)
35,999
filters.py
turicas_brasil_io/core/filters.py
def clean_value(key, value): if value == "false": return key, False if value == "true": return key, True if value == "None": return f"{key}__isnull", True return key, value def parse_querystring(querystring): query = querystring.copy() order_by = query.pop("order-by", [...
981
Python
.py
26
31
91
0.627368
turicas/brasil.io
915
145
143
GPL-3.0
9/5/2024, 5:15:11 PM (Europe/Amsterdam)