code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
from django.middleware.csrf import CsrfViewMiddleware
from django.utils.decorators import decorator_from_middleware, available_attrs
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
csrf_protect = decorator_from_middleware(CsrfViewMiddlewar... | ajibawa-2023/Python-Code-Large/train/row_84590 | 30 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84590:ImportFrom_L1_C0", "label": "from django.middleware.csrf import CsrfViewMiddleware", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 0, 0.66, 0.0, 574, 0, 1, 0, 0, 574, 0, 0], "semantic": {"name": "django.middleware.cs... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84590:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84590:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84590:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84590:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cach... | ajibawa-2023/Python-Code-Large/train/row_84591 | 34 | 81 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84591:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0309, 0.0494, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "sni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84591:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84591:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84591:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84591:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
import mimetypes
import os
import posixpath
import re
import stat
import urllib
from email.Utils import parsedate_tz, mktime_tz
from django.template import loader
from dj... | ajibawa-2023/Python-Code-Large/train/row_84592 | 67 | 143 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84592:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0175, 0.028, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84592:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84592:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84592:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84592:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.http import HttpResponseForbidden
from django.template import Context, Template
from django.conf import settings
# We include the template inline since we need to be able to reliably display
# this error message, especially for the sake of developers, and there isn't any
# other way of making it available ... | ajibawa-2023/Python-Code-Large/train/row_84593 | 10 | 102 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84593:ImportFrom_L1_C0", "label": "from django.http import HttpResponseForbidden", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0098, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84593:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84593:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84593:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84593:ImportFrom_L96_C4"}, {"f": "ajibawa-2023/Python-... |
from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
"""
Render a given template with any extra URL parameters in the... | ajibawa-2023/Python-Code-Large/train/row_84594 | 20 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84594:ImportFrom_L1_C0", "label": "from django.template import loader, RequestContext", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84594:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84594:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84594:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84594:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.forms.models import ModelFormMetaclass, ModelForm
from django.template import RequestContext, loader
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.core.xheaders import populate_xheaders
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.... | ajibawa-2023/Python-Code-Large/train/row_84595 | 106 | 215 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84595:ImportFrom_L1_C0", "label": "from django.forms.models import ModelFormMetaclass, ModelForm", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0047, 0.0047, 0, 0.66, 0.0, 625, 0, 2, 0, 0, 625, 0, 0], "semantic": {"name": "django.forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84595:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84595:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84595:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84595:For_L17_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.template import loader, RequestContext
from django.http import Http404, HttpResponse
from django.core.xheaders import populate_xheaders
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ObjectDoesNotExist
def object_list(request, queryset, paginate_by=None, page=No... | ajibawa-2023/Python-Code-Large/train/row_84596 | 57 | 145 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84596:ImportFrom_L1_C0", "label": "from django.template import loader, RequestContext", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0069, 0, 0.66, 0.0, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84596:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84596:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84596:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84596:If_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import datetime
import time
from django.template import loader, RequestContext
from django.core.exceptions import ObjectDoesNotExist
from django.core.xheaders import populate_xheaders
from django.db.models.fields import DateTimeField
from django.http import Http404, HttpResponse
def archive_index(request, queryset, d... | ajibawa-2023/Python-Code-Large/train/row_84597 | 181 | 368 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84597:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0027, 0.0027, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84597:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84597:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84597:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84597:If_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
class GenericViewError(Exception):
"""A problem in a generic view."""
pass
| ajibawa-2023/Python-Code-Large/train/row_84598 | 2 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84598:ClassDef_L1_C0", "label": "GenericViewError", "type": "class", "loc": [1, 3], "level": 0, "parent": null, "vector": [3, 0, 0.6667, 1.0, 0, 0.66, 0.0, 943, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "GenericViewError", "arg_names": [], "import_names": [], "rhs_ca... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84598:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84598:Expr_L2_C4"}] |
from django import http
from django.views.decorators.csrf import requires_csrf_token
from django.template import Context, RequestContext, loader
# This can be called when CsrfViewMiddleware.process_view has not run, therefore
# need @requires_csrf_token in case the template needs {% csrf_token %}.
@requires_csrf_toke... | ajibawa-2023/Python-Code-Large/train/row_84599 | 14 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84599:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84599:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84599:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84599:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84599:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import os
import gettext as gettext_module
from django import http
from django.conf import settings
from django.utils import importlib
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
from django.utils.encoding import smart_unicod... | ajibawa-2023/Python-Code-Large/train/row_84600 | 128 | 261 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84600:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0038, 0.0038, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84600:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84600:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84600:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84600:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
from django.template import loader
from django.http import HttpResponse, Http404
from django.http import HttpResponseRedirect, Http... | ajibawa-2023/Python-Code-Large/train/row_84601 | 42 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84601:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0288, 0.0481, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84601:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84601:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84601:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84601:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""Multi-consumer multi-producer dispatching mechanism
Originally based on pydispatch (BSD) http://pypi.python.org/pypi/PyDispatcher/2.0.1
See license.txt for original license.
Heavily modified for Django's purposes.
"""
from django.dispatch.dispatcher import Signal | ajibawa-2023/Python-Code-Large/train/row_84602 | 2 | 9 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84602:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.4444, 0.7778, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
Common checksum routines (used in multiple localflavor/ cases, for example).
"""
__all__ = ['luhn',]
LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) # sum_of_digits(index * 2)
def luhn(candidate):
"""
Checks a candidate number for validity according to the Luhn
algorithm (used in validation of, for ... | ajibawa-2023/Python-Code-Large/train/row_84605 | 12 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84605:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0909, 0.1364, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84605:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84605:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84605:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84605:If_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"Commonly-used date structures"
from django.utils.translation import ugettext_lazy as _
WEEKDAYS = {
0:_('Monday'), 1:_('Tuesday'), 2:_('Wednesday'), 3:_('Thursday'), 4:_('Friday'),
5:_('Saturday'), 6:_('Sunday')
}
WEEKDAYS_ABBR = {
0:_('Mon'), 1:_('Tue'), 2:_('Wed'), 3:_('Thu'), 4:_('Fri'),
5:_('Sat'... | ajibawa-2023/Python-Code-Large/train/row_84606 | 9 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84606:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import imp
import os
import sys
def module_has_submodule(package, module_name):
"""See if 'module' is in 'package'."""
name = ".".join([package.__name__, module_name])
try:
# None indicates a cached miss; see mark_miss() in Python/import.c.
return sys.modules[name] is not None
except K... | ajibawa-2023/Python-Code-Large/train/row_84607 | 34 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84607:Import_L1_C0", "label": "imp import imp", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "imp", "arg_names": [], "import_names": ["imp"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84607:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84607:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84607:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84607:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
termcolors.py
"""
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
RESET = '0'
opt_dict = {'bold': '1', 'underscore': '4', 'blink': '5', 'rever... | ajibawa-2023/Python-Code-Large/train/row_84608 | 60 | 198 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84608:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0101, 0.0152, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84608:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84608:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84608:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84608:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""Thread-local objects
(Note that this module provides a Python version of thread
threading.local class. Depending on the version of Python you're
using, there may be a faster one available. You should always import
the local class from threading.)
Thread-local objects support the management of thread-local dat... | ajibawa-2023/Python-Code-Large/train/row_84610 | 65 | 240 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84610:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 134], "level": 0, "parent": null, "vector": [8, 0, 0.2812, 0.5583, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annot... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84610:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84610:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84610:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84610:FunctionDef_L141_C4"}, {"f": "ajibawa-2023/Python... |
"""
Code used in a couple of places to work with the current thread's environment.
Current users include i18n and request prefix handling.
"""
try:
import threading
currentThread = threading.currentThread
except ImportError:
def currentThread():
return "no threading"
| ajibawa-2023/Python-Code-Large/train/row_84611 | 6 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84611:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.2083, 0.3333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84611:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84611:Import_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84611:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84611:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print df.format('jS F Y H:i')
7th October 2003 11:39
>>>
"""
import re
import time
import calendar
from django.utils.dates import MONTHS, MONTHS_3, ... | ajibawa-2023/Python-Code-Large/train/row_84612 | 199 | 286 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84612:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0227, 0.042, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84612:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84612:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84612:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84612:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-... |
import datetime
import time
from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, e.g. "10 minutes". If d occurs after now,
... | ajibawa-2023/Python-Code-Large/train/row_84613 | 35 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84613:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84613:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84613:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84613:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84613:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | ajibawa-2023/Python-Code-Large/train/row_84614 | 60 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84614:Import_L31_C0", "label": "os import os, sys, time", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.2605, 0.0084, 0, 0.66, 0.0, 688, 0, 3, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "sys",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84614:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84614:Import_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84614:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84614:Import_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
import re
import sys
import urllib
from email.Utils import formatdate
from django.utils.encoding import smart_str, force_unicode
from django.utils.functional import allow_lazy
ETAG_MATCH = re.compile(r'(?:W/)?"((?:\\.|[^"])*)"')
def urlquote(url, safe='/'):
"""
A version of Python's urllib.quote() function t... | ajibawa-2023/Python-Code-Large/train/row_84615 | 56 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84615:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0077, 0.0077, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84615:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84615:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84615:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84615:Return_L18_C4"}, {"f": "ajibawa-2023/Python-Code... |
# License for code in this file that was taken from Python 2.5.
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# --------------------------------------------
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF"), and the Individual or Organization ("Licensee") accessing and
# otherwise usin... | ajibawa-2023/Python-Code-Large/train/row_84616 | 163 | 367 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84616:FunctionDef_L53_C0", "label": "curry", "type": "function", "loc": [53, 56], "level": 0, "parent": null, "vector": [2, 0, 0.1485, 0.0109, 0, 0.66, 0.0, 553, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "curry", "arg_names": ["_curried_func", "args", "kwargs"], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84616:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84616:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84616:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84616:Return_L55_C8"}, {"f": "ajibawa-2023/Pyth... |
"""
Utilities for XML generation/parsing.
"""
from xml.sax.saxutils import XMLGenerator
class SimplerXMLGenerator(XMLGenerator):
def addQuickElement(self, name, contents=None, attrs=None):
"Convenience method for adding an element with no children"
if attrs is None: attrs = {}
self.startEl... | ajibawa-2023/Python-Code-Large/train/row_84617 | 11 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84617:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2143, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84617:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84617:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84617:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84617:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
# Performance note: I benchmarked this code using a set instead of
# a list for the stopwords and was surprised to find that the list
# performed /better/ than the set - maybe because it's only a small
# list.
stopwords = '''
i
a
an
are
as
at
be
by
for
from
how
in
is
it
of
on
or
that
the
this
to
was
what
when
where
''... | ajibawa-2023/Python-Code-Large/train/row_84618 | 9 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84618:Assign_L6_C0", "label": "stopwords = split()", "type": "assigned_variable", "loc": [6, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4524, 0.6429, 0, 0.66, 0.0, 557, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "stopwords", "arg_names": [], "import_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84618:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84618:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84618:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84618:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Functions for working with "safe strings": strings that can be displayed safely
without further escaping in HTML. Marking something as a "safe string" means
that the producer of the string has already turned characters that should not
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
"""
f... | ajibawa-2023/Python-Code-Large/train/row_84620 | 60 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84620:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0294, 0.0504, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84620:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84620:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84620:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84620:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Synchronization primitives:
- reader-writer lock (preference to writers)
(Contributed to Django by eugene@lazutkin.com)
"""
try:
import threading
except ImportError:
import dummy_threading as threading
class RWLock:
"""
Classic implementation of reader-writer lock with preference to writers.... | ajibawa-2023/Python-Code-Large/train/row_84621 | 45 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84621:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.046, 0.0805, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84621:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84621:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84621:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84621:Import_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"Implementation of tzinfo classes for use with datetime.datetime."
import time
from datetime import timedelta, tzinfo
from django.utils.encoding import smart_unicode, smart_str, DEFAULT_LOCALE_ENCODING
class FixedOffset(tzinfo):
"Fixed offset in minutes east from UTC."
def __init__(self, offset):
if i... | ajibawa-2023/Python-Code-Large/train/row_84622 | 48 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84622:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.013, 0.013, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84622:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84622:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84622:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84622:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
import decimal
import datetime
from django.conf import settings
from django.utils.translation import get_language, to_locale, check_for_language
from django.utils.importlib import import_module
from django.utils.encoding import smart_str
from django.utils import dateformat, numberformat, datetime_safe
from django.util... | ajibawa-2023/Python-Code-Large/train/row_84623 | 102 | 159 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84623:Import_L1_C0", "label": "decimal import decimal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 0, 0.66, 0.0, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["decimal"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84623:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84623:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84623:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84623:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Functions for reversing a regular expression (used in reverse URL resolving).
Used internally by Django and not intended for external use.
This is not, and is not intended to be, a complete reg-exp decompiler. It
should be good enough for a large class of URLS, however.
"""
# Mapping of an escape character to a r... | ajibawa-2023/Python-Code-Large/train/row_84624 | 169 | 328 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84624:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0122, 0.0213, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84624:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84624:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84624:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84624:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import re
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.translation import ugettext_lazy
from htmlentitydefs import name2codepoint
# Capitalizes the first letter of a string.
capfirst = lambda x: x and force_unicode(x)[0].upper() + force_unicode(x)[1:]... | ajibawa-2023/Python-Code-Large/train/row_84625 | 158 | 282 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84625:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84625:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84625:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84625:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84625:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code... |
import os
from os.path import join, normcase, normpath, abspath, isabs, sep
from django.utils.encoding import force_unicode
# Define our own abspath function that can handle joining
# unicode paths to a current working directory that has non-ASCII
# characters in it. This isn't necessary on Windows since the
# Wind... | ajibawa-2023/Python-Code-Large/train/row_84626 | 19 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84626:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0217, 0.0217, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84626:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84626:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84626:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84626:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
"""Implementation of JSONEncoder
"""
import re
c_encode_basestring_ascii = None
c_make_encoder = None
ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {
'\\': '\\\\',
'"': '\\"',
'\b': '\\b',
'\f': '\\f',
... | ajibawa-2023/Python-Code-Large/train/row_84627 | 226 | 428 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84627:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0035, 0.0047, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84627:For_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84627:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84627:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84627:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | ajibawa-2023/Python-Code-Large/train/row_84629 | 53 | 349 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84629:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 99], "level": 0, "parent": null, "vector": [8, 0, 0.1433, 0.2837, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84629:Try_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84629:Import_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84629:Try_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84629:If_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | ajibawa-2023/Python-Code-Large/train/row_84631 | 48 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84631:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0308, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84631:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84631:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84631:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84631:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
from django.utils.copycompat import deepcopy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
... | ajibawa-2023/Python-Code-Large/train/row_84632 | 74 | 153 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84632:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0163, 0.0261, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84632:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84632:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84632:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84632:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
Providing iterator functions that are not in all version of Python we support.
Where possible, we try to use the system-native version and only fall back to
these implementations if necessary.
"""
import itertools
# Fallback for Python 2.4, Python 2.5
def product(*args, **kwds):
"""
Taken from http://docs... | ajibawa-2023/Python-Code-Large/train/row_84633 | 28 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84633:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.1111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84633:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84633:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84633:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84633:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code... |
import django
import os.path
import re
def get_svn_revision(path=None):
"""
Returns the SVN revision in the form SVN-XXXX,
where XXXX is the revision number.
Returns SVN-unknown if anything goes wrong, such as an unexpected
format of internal SVN files.
If path is provided, it should be a dir... | ajibawa-2023/Python-Code-Large/train/row_84634 | 21 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84634:Import_L1_C0", "label": "django import django", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["django"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84634:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84634:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84634:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84634:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.conf import settings
from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):
"""
Gets a number (as a number or string), and returns it as a string,
using formats definied as arguments:
* decimal_sep: Decimal separator symbol... | ajibawa-2023/Python-Code-Large/train/row_84636 | 28 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84636:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84636:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84636:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84636:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84636:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""HTML utilities suitable for global use."""
import re
import string
from django.utils.safestring import SafeData, mark_safe
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.http import urlquote
# Configuration for urlize() function.
LEADING_PUNCTUATIO... | ajibawa-2023/Python-Code-Large/train/row_84637 | 115 | 192 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84637:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0052, 0.0052, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84637:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84637:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84637:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84637:Return_L34_C4"}, {"f": "ajibawa-2023/Python-Code... |
# Taken from Python 2.7 with permission from/by the original author.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex'):
raise ValueError("'package' not set to a string")
dot = len(package)
for x in ... | ajibawa-2023/Python-Code-Large/train/row_84638 | 19 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84638:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0278, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84638:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84638:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84638:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84638:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Fixes Python 2.4's failure to deepcopy unbound functions.
"""
import copy
import types
# Monkeypatch copy's deepcopy registry to handle functions correctly.
if (hasattr(copy, '_deepcopy_dispatch') and types.FunctionType not in copy._deepcopy_dispatch):
copy._deepcopy_dispatch[types.FunctionType] = copy._deepc... | ajibawa-2023/Python-Code-Large/train/row_84639 | 6 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84639:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2143, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84639:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84639:Assign_L10_C4"}] |
"""
The md5 and sha modules are deprecated since Python 2.5, replaced by the
hashlib module containing both hash algorithms. Here, we provide a common
interface to the md5 and sha constructors, depending on system version.
"""
import sys
if sys.version_info >= (2, 5):
import hashlib
md5_constructor = hashlib.m... | ajibawa-2023/Python-Code-Large/train/row_84640 | 14 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84640:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.15, 0.25, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84640:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84640:Import_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84640:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84640:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84... |
from types import GeneratorType
from django.utils.copycompat import deepcopy
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of the given diction... | ajibawa-2023/Python-Code-Large/train/row_84641 | 283 | 473 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84641:ImportFrom_L1_C0", "label": "from types import GeneratorType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0021, 0.0021, 0, 0.66, 0.0, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "types", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84641:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84641:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84641:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84641:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Syndication feed generation library -- used for generating RSS, etc.
Sample usage:
>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
... title=u"Poynter E-Media Tidbits",
... link=u"http://www.poynter.org/column.asp?id=31",
... description=u"A group Weblog by the shar... | ajibawa-2023/Python-Code-Large/train/row_84642 | 217 | 373 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84642:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 24], "level": 0, "parent": null, "vector": [8, 0, 0.0335, 0.0643, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84642:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84642:If_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84642:If_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84642:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
# Python's datetime strftime doesn't handle dates before 1900.
# These classes override date and datetime to support the formatting of a date
# through its full "proleptic Gregorian" date range.
#
# Based on code submitted to comp.lang.python by Andrew Dalke
#
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was... | ajibawa-2023/Python-Code-Large/train/row_84643 | 56 | 89 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84643:ImportFrom_L10_C0", "label": "from datetime import real_date, real_datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1124, 0.0112, 0, 0.66, 0.0, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84643:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84643:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84643:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84643:Return_L16_C8"}, {"f": "ajibawa-2023/Python-... |
# These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
import warnings
from django.conf import settings
from django.utils.encoding import force_uni... | ajibawa-2023/Python-Code-Large/train/row_84645 | 38 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84645:Import_L5_C0", "label": "warnings import warnings", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0694, 0.0139, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84645:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84645:If_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84645:If_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84645:Return_L11_C20"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
Internationalization support.
"""
from django.utils.encoding import force_unicode
from django.utils.functional import lazy, curry
__all__ = ['gettext', 'gettext_noop', 'gettext_lazy', 'ngettext',
'ngettext_lazy', 'string_concat', 'activate', 'deactivate',
'get_language', 'get_language_bidi', 'get_... | ajibawa-2023/Python-Code-Large/train/row_84646 | 55 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84646:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0192, 0.0288, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84646:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84646:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84646:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84646:ImportFrom_L29_C4"}, {"f": "ajibawa-2023/Python-... |
"""
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see:
http... | ajibawa-2023/Python-Code-Large/train/row_84647 | 117 | 228 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84647:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 18], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0789, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84647:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84647:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84647:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84647:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python... |
from django.contrib.syndication import views
from django.core.exceptions import ObjectDoesNotExist
import warnings
# This is part of the deprecated API
from django.contrib.syndication.views import FeedDoesNotExist, add_domain
class Feed(views.Feed):
"""Provided for backwards compatibility."""
def __init__(sel... | ajibawa-2023/Python-Code-Large/train/row_84648 | 23 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84648:ImportFrom_L1_C0", "label": "from django.contrib.syndication import views", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0263, 0, 0.66, 0.0, 61, 0, 1, 0, 0, 61, 0, 0], "semantic": {"name": "django.contrib.syndication", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84648:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84648:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84648:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84648:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import datetime
from django.conf import settings
from django.contrib.sites.models import get_current_site
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import HttpResponse, Http404
from django.template import loader, Template, TemplateDoesNotExist, RequestContext
from djan... | ajibawa-2023/Python-Code-Large/train/row_84649 | 114 | 230 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84649:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0043, 0.0043, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84649:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84649:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84649:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84649:If_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/ro... |
"""
Czech-specific form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Select, RegexField, Field
from django.utils.translation import ugettext_lazy as _
import re
birth_number = re.compile(r'^(?P<birth>\d{6})/?(?P<id>\d{3,4})$')
ic_... | ajibawa-2023/Python-Code-Large/train/row_84650 | 63 | 140 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84650:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0143, 0.0214, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84650:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84650:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84650:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84650:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Czech regions, translations get from http://www.crwflags.com/fotw/Flags/cz-re.html
"""
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('PR', _('Prague')),
('CE', _('Central Bohemian Region')),
('SO', _('South Bohemian Region')),
('PI', _('Pilsen Region')),
('CA', _(... | ajibawa-2023/Python-Code-Large/train/row_84651 | 3 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84651:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0909, 0.1364, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
India-specific Form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import gettext
import re
class INZipCodeField(RegexFiel... | ajibawa-2023/Python-Code-Large/train/row_84652 | 28 | 56 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84652:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0357, 0.0536, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84652:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84652:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84652:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84652:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Cod... |
"""
A mapping of state misspellings/abbreviations to normalized abbreviations, and
an alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('KA', 'Karnataka'),
('AP', 'Andhra Pr... | ajibawa-2023/Python-Code-Large/train/row_84653 | 3 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84653:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0476, 0.0833, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
NL-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
pc_re = re.compile('^\d{4}[A-Z]{2}$... | ajibawa-2023/Python-Code-Large/train/row_84654 | 51 | 101 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84654:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0198, 0.0297, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84654:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84654:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84654:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84654:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import ugettext_lazy as _
PROVINCE_CHOICES = (
('DR', _('Drenthe')),
('FL', _('Flevoland')),
('FR', _('Friesland')),
('GL', _('Gelderland')),
('GR', _('Groningen')),
('LB', _('Limburg')),
('NB', _('Noord-Brabant')),
('NH', _('Noord-Holland')),
('OV', _(... | ajibawa-2023/Python-Code-Large/train/row_84655 | 2 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84655:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Iceland specific form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField
from django.forms.widgets import Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
cla... | ajibawa-2023/Python-Code-Large/train/row_84656 | 45 | 83 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84656:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0241, 0.0361, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84656:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84656:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84656:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84656:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
IS_POSTALCODES = (
('101', u'101 Reykjavík'),
('103', u'103 Reykjavík'),
('104', u'104 Reykjavík'),
('105', u'105 Reykjavík'),
('107', u'107 Reykjavík'),
('108', u'108 Reykjavík'),
('109', u'109 Reykjavík'),
('110', u'110 Reykjavík'),
('111', u'111 Reykjavík'... | ajibawa-2023/Python-Code-Large/train/row_84657 | 1 | 151 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84657:Assign_L3_C0", "label": "IS_POSTALCODES =", "type": "assigned_variable", "loc": [3, 151], "level": 0, "parent": null, "vector": [14, 0, 0.5099, 0.9868, 0, 0.66, 0.0, 247, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "IS_POSTALCODES", "arg_names": [], "import_names":... | [] |
# -*- coding: utf-8 -*-
"""
Swedish specific Form helpers
"""
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.validators import EMPTY_VALUES
from django.contrib.localflavor.se.utils import (id_number_checksum,
validate_id_birthday, format_personal_id_numbe... | ajibawa-2023/Python-Code-Large/train/row_84658 | 55 | 157 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84658:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0191, 0.0191, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84658:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84658:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84658:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84658:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Swedish counties, sorted by codes.
http://en.wikipedia.org/wiki/Counties_of_Sweden
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from django.utils.translation import ugettext_lazy as _
COUNTY_CHOICES = (
... | ajibawa-2023/Python-Code-Large/train/row_84659 | 3 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84659:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 10], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.25, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
import re
import datetime
def id_number_checksum(gd):
"""
Calculates a Swedish ID number checksum, using the
"Luhn"-algoritm
"""
n = s = 0
for c in (gd['year'] + gd['month'] + gd['day'] + gd['serial']):
tmp = ((n % 2) and 1 or 2) * int(c)
if tmp > 9:
tmp = sum([int(... | ajibawa-2023/Python-Code-Large/train/row_84660 | 36 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84660:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0119, 0.0119, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84660:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84660:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84660:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84660:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
IT-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.contrib.localflavor.it.... | ajibawa-2023/Python-Code-Large/train/row_84661 | 49 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84661:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0238, 0.0357, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84661:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84661:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84661:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84661:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*
REGION_CHOICES = (
('ABR', 'Abruzzo'),
('BAS', 'Basilicata'),
('CAL', 'Calabria'),
('CAM', 'Campania'),
('EMR', 'Emilia-Romagna'),
('FVG', 'Friuli-Venezia Giulia'),
('LAZ', 'Lazio'),
('LIG', 'Liguria'),
('LOM', 'Lombardia'),
('MAR', 'Marche'),
('MOL', ... | ajibawa-2023/Python-Code-Large/train/row_84662 | 1 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84662:Assign_L3_C0", "label": "REGION_CHOICES =", "type": "assigned_variable", "loc": [3, 24], "level": 0, "parent": null, "vector": [14, 0, 0.5625, 0.9167, 0, 0.66, 0.0, 868, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "REGION_CHOICES", "arg_names": [], "import_names": ... | [] |
from django.utils.encoding import smart_str, smart_unicode
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': ... | ajibawa-2023/Python-Code-Large/train/row_84663 | 21 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84663:ImportFrom_L1_C0", "label": "from django.utils.encoding import smart_str, smart_unicode", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 96, 0, 2, 0, 0, 96, 0, 0], "semantic": {"name": "django.utils.enco... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84663:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84663:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84663:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84663:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*
PROVINCE_CHOICES = (
('AG', 'Agrigento'),
('AL', 'Alessandria'),
('AN', 'Ancona'),
('AO', 'Aosta'),
('AR', 'Arezzo'),
('AP', 'Ascoli Piceno'),
('AT', 'Asti'),
('AV', 'Avellino'),
('BA', 'Bari'),
('BT', 'Barletta-Andria-Trani'), # active starting from 2009
... | ajibawa-2023/Python-Code-Large/train/row_84664 | 1 | 114 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84664:Assign_L3_C0", "label": "PROVINCE_CHOICES =", "type": "assigned_variable", "loc": [3, 114], "level": 0, "parent": null, "vector": [14, 0, 0.5132, 0.9825, 0, 0.66, 0.0, 540, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "PROVINCE_CHOICES", "arg_names": [], "import_nam... | [] |
"""
JP-specific Form helpers
"""
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import RegexField, Select
class JPPostalCodeField(RegexField):
"""
A form field that validates its input is a Japanese postcode.
Accepts 7 digits, wit... | ajibawa-2023/Python-Code-Large/train/row_84665 | 18 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84665:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0541, 0.0811, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84665:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84665:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84665:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84665:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.utils.translation import ugettext_lazy
JP_PREFECTURES = (
('hokkaido', ugettext_lazy('Hokkaido'),),
('aomori', ugettext_lazy('Aomori'),),
('iwate', ugettext_lazy('Iwate'),),
('miyagi', ugettext_lazy('Miyagi'),),
('akita', ugettext_lazy('Akita'),),
('yamagata', ugettext_lazy('Yamagat... | ajibawa-2023/Python-Code-Large/train/row_84666 | 2 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84666:ImportFrom_L1_C0", "label": "from django.utils.translation import ugettext_lazy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translatio... | [] |
"""
Chile specific form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
class CLRegionSelect(Select):
""... | ajibawa-2023/Python-Code-Large/train/row_84667 | 50 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84667:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0316, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84667:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84667:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84667:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84667:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Chilean regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
REGION_CHOICES = (
('RM', u'Región Metropolitana de Santiago'),
('I', u'Región de Tarapacá'),
('II', u'Región de Ant... | ajibawa-2023/Python-Code-Large/train/row_84668 | 2 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84668:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.18, 0.24, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [] |
"""
AT-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
re_ssn = re.compile(r'^\d{4} \d{6}')
class ATZipCodeField(RegexField)... | ajibawa-2023/Python-Code-Large/train/row_84669 | 32 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84669:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.029, 0.0435, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84669:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84669:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84669:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84669:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('BL', _('Burgenland')),
('KA', _('Carinthia')),
('NO', _('Lower Austria')),
('OO', _('Upper Austria')),
('SA', _('Salzburg')),
('ST', _('Styria')),
('TI', _('Tyrol')),
('VO', _('Vorarlberg'... | ajibawa-2023/Python-Code-Large/train/row_84670 | 2 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84670:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
DE-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
import re
id_re = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})[-\ ]?(?P<... | ajibawa-2023/Python-Code-Large/train/row_84671 | 47 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84671:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0238, 0.0357, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84671:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84671:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84671:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84671:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('BW', _('Baden-Wuerttemberg')),
('BY', _('Bavaria')),
('BE', _('Berlin')),
('BB', _('Brandenburg')),
('HB', _('Bremen')),
('HH', _('Hamburg')),
('HE', _('Hessen')),
('MV', _('Mecklenburg-We... | ajibawa-2023/Python-Code-Large/train/row_84672 | 2 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84672:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0476, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Australian-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
PHONE_DIGITS_RE ... | ajibawa-2023/Python-Code-Large/train/row_84673 | 30 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84673:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.06, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84673:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84673:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84673:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84673:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
An alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('ACT', 'Australian Capital Territory'),
('NSW', 'New South Wales'),
('NT', 'Northern Territory'),
('QLD', 'Q... | ajibawa-2023/Python-Code-Large/train/row_84674 | 2 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84674:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.2059, 0.3529, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
PT-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re.com... | ajibawa-2023/Python-Code-Large/train/row_84675 | 28 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84675:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0625, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84675:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84675:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84675:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84675:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
AR-specific Form helpers.
"""
from django.forms import ValidationError
from django.core.validators import EMPTY_VALUES
from django.forms.fields import RegexField, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
class... | ajibawa-2023/Python-Code-Large/train/row_84676 | 64 | 115 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84676:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0261, 0.0261, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84676:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84676:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84676:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84676:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Argentinean provinces and autonomous cities as `choices` in a
formfield. From
http://www.argentina.gov.ar/argentina/portal/paginas.dhtml?pagina=425
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
PROVINCE_CHOICES = (
('B'... | ajibawa-2023/Python-Code-Large/train/row_84677 | 2 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84677:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 9], "level": 0, "parent": null, "vector": [8, 0, 0.1528, 0.2222, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
# -*- coding: utf-8 -*-
"""
BR-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
... | ajibawa-2023/Python-Code-Large/train/row_84678 | 96 | 163 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84678:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0184, 0.0184, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84678:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84678:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84678:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84678:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Brazilian states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('AC', 'Acre'),
('AL', 'Alagoas'),
('AP', u'Amapá'),
('AM', 'Amazonas'),
... | ajibawa-2023/Python-Code-Large/train/row_84679 | 2 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84679:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1216, 0.1622, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
Slovak-specific form helpers
"""
from django.forms.fields import Select, RegexField
from django.utils.translation import ugettext_lazy as _
class SKRegionSelect(Select):
"""
A select widget widget with list of Slovak regions as choices.
"""
def __init__(self, attrs=None):
from sk_regions i... | ajibawa-2023/Python-Code-Large/train/row_84680 | 22 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84680:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0465, 0.0698, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84680:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84680:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84680:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84680:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Slovak districts according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
DISTRICT_CHOICES = (
('BB', _('Banska Bystrica')),
('BS', _('Banska Stiavnica')),
('BJ', _('Bardejov')),
('BN', _('Banovce nad Bebravo... | ajibawa-2023/Python-Code-Large/train/row_84681 | 3 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84681:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.023, 0.0345, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
"""
Slovak regions according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('BB', _('Banska Bystrica region')),
('BA', _('Bratislava region')),
('KE', _('Kosice region')),
('NR', _('Nitra regi... | ajibawa-2023/Python-Code-Large/train/row_84682 | 3 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84682:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.125, 0.1875, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
"""
Mexican-specific form helpers.
"""
from django.forms.fields import Select
class MXStateSelect(Select):
"""
A Select widget that uses a list of Mexican states as its choices.
"""
def __init__(self, attrs=None):
from mx_states import STATE_CHOICES
super(MXStateSelect, self).__init__(... | ajibawa-2023/Python-Code-Large/train/row_84683 | 7 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84683:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2143, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84683:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84683:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84683:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84683:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*-
"""
A list of Mexican states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('AGU', _(u'Aguascalientes')),
('BCN', _(u... | ajibawa-2023/Python-Code-Large/train/row_84684 | 3 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84684:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.1333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [] |
# -*- coding: utf-8 -*-
"""
Spanish-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
import re
class ESPostalCodeField(RegexField):
"""
A... | ajibawa-2023/Python-Code-Large/train/row_84685 | 76 | 185 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84685:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0162, 0.0162, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84685:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84685:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84685:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84685:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('AN', _('Andalusia')),
('AR', _('Aragon')),
('O', _('Principality of Asturias')),
('IB', _('Balearic Islands')),
('PV', _('Basque Country')),
('CN', _('Canary Islands')),
('S', _('Cantabria')... | ajibawa-2023/Python-Code-Large/train/row_84686 | 2 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84686:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0435, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_name... | [] |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
PROVINCE_CHOICES = (
('01', _('Arava')),
('02', _('Albacete')),
('03', _('Alacant')),
('04', _('Almeria')),
('05', _('Avila')),
('06', _('Badajoz')),
('07', _('Illes Balears')),
('08', _('Barcelona')),
(... | ajibawa-2023/Python-Code-Large/train/row_84687 | 2 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84687:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0172, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
FR-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re.com... | ajibawa-2023/Python-Code-Large/train/row_84688 | 28 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84688:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0392, 0.0588, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84688:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84688:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84688:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84688:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
DEPARTMENT_ASCII_CHOICES = (
('01', '01 - Ain'),
('02', '02 - Aisne'),
('03', '03 - Allier'),
('04', '04 - Alpes-de-Haute-Provence'),
('05', '05 - Hautes-Alpes'),
('06', '06 - Alpes-Maritimes'),
('07', '07 - Ardeche'),
('08', '08 - Ardennes'),
('09', '09 - Ar... | ajibawa-2023/Python-Code-Large/train/row_84689 | 1 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84689:Assign_L3_C0", "label": "DEPARTMENT_ASCII_CHOICES =", "type": "assigned_variable", "loc": [3, 110], "level": 0, "parent": null, "vector": [14, 0, 0.5136, 0.9818, 0, 0.66, 0.0, 807, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "DEPARTMENT_ASCII_CHOICES", "arg_names":... | [] |
"""
South Africa-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.checksums import luhn
from django.utils.translation import gettext as _
import re
from datetime import date
id_re = re... | ajibawa-2023/Python-Code-Large/train/row_84690 | 28 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84690:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0333, 0.05, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84690:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84690:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84690:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84690:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import gettext_lazy as _
PROVINCE_CHOICES = (
('EC', _('Eastern Cape')),
('FS', _('Free State')),
('GP', _('Gauteng')),
('KN', _('KwaZulu-Natal')),
('LP', _('Limpopo')),
('MP', _('Mpumalanga')),
('NC', _('Northern Cape')),
('NW', _('North West')),
('WC'... | ajibawa-2023/Python-Code-Large/train/row_84691 | 2 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84691:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
UK-specific Form helpers
"""
import re
from django.forms.fields import CharField, Select
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
class UKPostcodeField(CharField):
"""
A form field that validates its input is a UK postcode.
The regular expressi... | ajibawa-2023/Python-Code-Large/train/row_84692 | 30 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84692:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0377, 0.0566, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84692:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84692:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84692:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84692:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Sources:
English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls
Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area
Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales
Scottish regions: http://... | ajibawa-2023/Python-Code-Large/train/row_84693 | 8 | 97 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84693:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0412, 0.0722, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Finnish municipalities for use as `choices` in a
formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
MUNICIPALITY_CHOICES = (
('akaa', u"Akaa"),
('alajarvi', u"Alajärvi"),
('alavieska', u"Alav... | ajibawa-2023/Python-Code-Large/train/row_84694 | 2 | 353 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84694:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0142, 0.0198, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
FI-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class FIZipCodeField(RegexField):
default_error_messages = {
... | ajibawa-2023/Python-Code-Large/train/row_84695 | 28 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84695:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0392, 0.0588, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84695:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84695:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84695:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84695:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Cod... |
"""
Kuwait-specific Form helpers
"""
import re
from datetime import date
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.translation import gettext as _
id_re = re.compile(r'^(?P<initial>\d{1})(?P<yy>\d\d)(?P<... | ajibawa-2023/Python-Code-Large/train/row_84696 | 32 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84696:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0317, 0.0476, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84696:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84696:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84696:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84696:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django import forms
DEFAULT_DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y', ... | ajibawa-2023/Python-Code-Large/train/row_84697 | 18 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84697:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84697:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84697:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84697:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84697:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.