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 |
|---|---|---|---|---|---|---|---|
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.cache import patch_vary_headers
from django.utils.decorators import available_attrs
def vary_on_headers(*headers):
"""
A view decorator that adds the speci... | ajibawa-2023/Python-Code-Large/train/row_98373 | 21 | 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_98373:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.061, 0.0976, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snip... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98373:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98373:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98373:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98373:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"Decorator for views that gzips pages if the client supports it."
from django.utils.decorators import decorator_from_middleware
from django.middleware.gzip import GZipMiddleware
gzip_page = decorator_from_middleware(GZipMiddleware)
| ajibawa-2023/Python-Code-Large/train/row_98374 | 4 | 6 | 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_98374:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
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(CsrfViewM... | ajibawa-2023/Python-Code-Large/train/row_98375 | 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_98375: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_98375:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98375:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98375:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98375:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
Decorator for views that tries getting the page from the cache and
populates the cache if the page isn't in the cache yet.
The cache is keyed by the URL and some data from the headers. Additionally
there is the key prefix that is used to distinguish different cache areas
in a multi-site setup. You could use ... | ajibawa-2023/Python-Code-Large/train/row_98376 | 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_98376:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0802, 0.1481, 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_98376:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98376:ImportFrom_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98376:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98376:ImportFrom_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
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
import warnings
from email.Utils import parsedate_tz, mktime_tz
from django.... | ajibawa-2023/Python-Code-Large/train/row_98377 | 18 | 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_98377:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.061, 0.0976, 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_98377:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98377:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98377:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98377:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
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 avai... | ajibawa-2023/Python-Code-Large/train/row_98378 | 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_98378: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_98378:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98378:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98378:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98378:ImportFrom_L96_C4"}, {"f": "ajibawa-2023/Python-... |
import time
import datetime
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.views.generic.base import View
from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResponseMixin
from django.views.generic.list impo... | ajibawa-2023/Python-Code-Large/train/row_98379 | 282 | 595 | 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_98379:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0017, 0.0017, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98379:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98379:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98379:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98379:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
from django.utils.log import getLogger
import warnings
warnings.warn(
'Function-based generic views have been deprecated; use class-based views instea... | ajibawa-2023/Python-Code-Large/train/row_98380 | 28 | 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_98380:ImportFrom_L1_C0", "label": "from django.template import loader, RequestContext", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 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_98380:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98380:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98380:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98380:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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 dj... | ajibawa-2023/Python-Code-Large/train/row_98381 | 108 | 221 | 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_98381:ImportFrom_L1_C0", "label": "from django.forms.models import ModelFormMetaclass, ModelForm", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0045, 0.0045, 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_98381:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98381:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98381:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98381:For_L23_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.encoding import smart_str
from django.views.generic.base import TemplateResponseMixin, View
class MultipleObjectMixin(object):
allow_empty = True... | ajibawa-2023/Python-Code-Large/train/row_98382 | 77 | 138 | 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_98382:ImportFrom_L1_C0", "label": "from django.core.paginator import Paginator, InvalidPage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0072, 0.0072, 0, 0.66, 0.0, 831, 0, 2, 0, 0, 831, 0, 0], "semantic": {"name": "django.core.pagin... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98382:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98382:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98382:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98382:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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
import warnings
warnings.warn(
'Function-based g... | ajibawa-2023/Python-Code-Large/train/row_98383 | 59 | 152 | 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_98383:ImportFrom_L1_C0", "label": "from django.template import loader, RequestContext", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0066, 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_98383:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98383:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98383:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98383:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import re
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import Http404
from django.views.generic.base import TemplateResponseMixin, View
class SingleObjectMixin(object):
"""
Provides the ability to retrieve a single object for further manipulation.
... | ajibawa-2023/Python-Code-Large/train/row_98384 | 68 | 144 | 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_98384:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0069, 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_98384:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98384:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98384:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98384:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.views.generic.base import TemplateResponseMixin, View
from django.views.generic.detail import (SingleObjectMixin,
SingleObjectTempl... | ajibawa-2023/Python-Code-Large/train/row_98385 | 126 | 251 | 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_98385:ImportFrom_L1_C0", "label": "from django.forms import model_forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.004, 0.004, 0, 0.66, 0.0, 666, 0, 1, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "import... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98385:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98385:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98385:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98385:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import copy
from django import http
from django.core.exceptions import ImproperlyConfigured
from django.template import RequestContext, loader
from django.utils.translation import ugettext_lazy as _
from django.utils.functional import update_wrapper
from django.utils.log import getLogger
logger = getLogger('dj... | ajibawa-2023/Python-Code-Large/train/row_98386 | 100 | 196 | 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_98386:Import_L1_C0", "label": "copy import copy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0051, 0.0051, 0, 0.66, 0.0, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["copy"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98386:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98386:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98386:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98386:If_L13_C8"}, {"f": "ajibawa-2023/Python-Code... |
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
import warnings
warnings.war... | ajibawa-2023/Python-Code-Large/train/row_98387 | 183 | 375 | 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_98387: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_98387:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98387:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98387:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98387:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.views.generic.base import View, TemplateView, RedirectView
from django.views.generic.dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView,
WeekArchiveView, DayArchiveView, TodayArchiveView,
DateDetailView)
from django... | ajibawa-2023/Python-Code-Large/train/row_98388 | 7 | 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_98388:ImportFrom_L1_C0", "label": "from django.views.generic.base import View, TemplateView, RedirectView", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 48, 0, 3, 0, 0, 48, 0, 0], "semantic": {"name": "djang... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98388:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98388:Expr_L11_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_cs... | ajibawa-2023/Python-Code-Large/train/row_98389 | 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_98389: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_98389:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98389:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98389:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98389: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 smar... | ajibawa-2023/Python-Code-Large/train/row_98390 | 128 | 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_98390:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 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_98390:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98390:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98390:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98390: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 HttpResponseRedire... | ajibawa-2023/Python-Code-Large/train/row_98391 | 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_98391: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_98391:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98391:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98391:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98391: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, receiver | ajibawa-2023/Python-Code-Large/train/row_98392 | 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_98392: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 validati... | ajibawa-2023/Python-Code-Large/train/row_98395 | 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_98395: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_98395:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98395:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98395:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98395: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'),
... | ajibawa-2023/Python-Code-Large/train/row_98396 | 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_98396: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])
if name in sys.modules:
return True
for finder in sys.meta_path:
if finder.find_module(name):
... | ajibawa-2023/Python-Code-Large/train/row_98397 | 34 | 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_98397:Import_L1_C0", "label": "imp import imp", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 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_98397:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98397:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98397:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98397: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... | ajibawa-2023/Python-Code-Large/train/row_98398 | 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_98398: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_98398:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98398:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98398:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98398: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-lo... | ajibawa-2023/Python-Code-Large/train/row_98400 | 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_98400: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_98400:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98400:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98400:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98400: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_98401 | 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_98401: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_98401:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98401:Import_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98401:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98401:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_9... |
"""
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 MO... | ajibawa-2023/Python-Code-Large/train/row_98402 | 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_98402: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_98402:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98402:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98402:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98402: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 ... | ajibawa-2023/Python-Code-Large/train/row_98403 | 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_98403: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_98403:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98403:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98403:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98403: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... | ajibawa-2023/Python-Code-Large/train/row_98404 | 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_98404: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_98404:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98404:Import_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98404:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98404:Import_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
import re
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_98405 | 52 | 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_98405:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0084, 0.0084, 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_98405:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98405:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98405:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98405:Return_L17_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
# otherwi... | ajibawa-2023/Python-Code-Large/train/row_98406 | 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_98406: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_98406:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98406:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98406:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98406: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 = {}
se... | ajibawa-2023/Python-Code-Large/train/row_98407 | 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_98407: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_98407:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98407:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98407:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98407: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
... | ajibawa-2023/Python-Code-Large/train/row_98408 | 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_98408: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_98408:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98408:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98408:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98408: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.
... | ajibawa-2023/Python-Code-Large/train/row_98410 | 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_98410: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_98410:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98410:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98410:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98410:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
import sys
try:
from functools import wraps
except ImportError:
# only needed for Python 2.4
def wraps(_):
def _wraps(func):
return func
return _wraps
__unittest = True
def _relpath_nt(path, start=os.path.curdir):
"""Return a relative version of a ... | ajibawa-2023/Python-Code-Large/train/row_98411 | 37 | 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_98411:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 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_98411:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98411:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98411:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98411:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
import signal
import weakref
from django.utils.unittest.compatibility import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
inst... | ajibawa-2023/Python-Code-Large/train/row_98413 | 39 | 57 | 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_98413:Import_L1_C0", "label": "signal import signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 621, 0, 1, 0, 0, 621, 0, 0], "semantic": {"name": "signal", "arg_names": [], "import_names": ["signal"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98413:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98413:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98413:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98413:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
"""Test result object"""
import sys
import traceback
import unittest
from StringIO import StringIO
from django.utils.unittest import util
from django.utils.unittest.compatibility import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if get... | ajibawa-2023/Python-Code-Large/train/row_98414 | 120 | 183 | 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_98414:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0055, 0.0055, 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_98414:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98414:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98414:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98414:If_L17_C8"}, {"f": "ajibawa-2023/Python-C... |
import os
import sys
from django.utils.unittest.loader import defaultTestLoader
def collector():
# import __main__ triggers code re-execution
__main__ = sys.modules['__main__']
setupDir = os.path.abspath(os.path.dirname(__main__.__file__))
return defaultTestLoader.discover(setupDir)
| ajibawa-2023/Python-Code-Large/train/row_98415 | 7 | 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_98415:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 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_98415:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98415:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98415:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98415:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""Various utility functions."""
__unittest = True
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(result) < _MAX_LENGTH:
return result
return result[:_MAX_LENGTH] + ' [t... | ajibawa-2023/Python-Code-Large/train/row_98418 | 60 | 99 | 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_98418:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0101, 0.0101, 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_98418:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98418:Try_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98418:Try_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98418:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
"""
unittest2
unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7. It is tested to run on Python 2.4 - 2.6.
To use unittest2 instead of unittest simply replace ``import unittest`` with
``import unittest2``.
Copyright (c) 1999-2003 Steve Purcell
Copyright (c) ... | ajibawa-2023/Python-Code-Large/train/row_98419 | 21 | 80 | 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_98419:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 27], "level": 0, "parent": null, "vector": [8, 0, 0.175, 0.3375, 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_98419:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98419:ImportFrom_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98419:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98419:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""Main entry point"""
import sys
if sys.argv[0].endswith("__main__.py"):
sys.argv[0] = "unittest2"
__unittest = True
from django.utils.unittest.main import main_
main_()
| ajibawa-2023/Python-Code-Large/train/row_98420 | 7 | 10 | 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_98420:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.1, 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_98420:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98420:Assign_L5_C4"}] |
"""Running tests"""
import sys
import time
import unittest
from django.utils.unittest import result
try:
from django.utils.unittest.signals import registerResult
except ImportError:
def registerResult(_):
pass
__unittest = True
class _WritelnDecorator(object):
"""Used to deco... | ajibawa-2023/Python-Code-Large/train/row_98422 | 156 | 206 | 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_98422:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0049, 0.0049, 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_98422:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98422:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98422:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98422:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
"""
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 prefere... | ajibawa-2023/Python-Code-Large/train/row_98423 | 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_98423: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_98423:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98423:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98423:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98423: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):
... | ajibawa-2023/Python-Code-Large/train/row_98424 | 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_98424: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_98424:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98424:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98424:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98424: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
# form... | ajibawa-2023/Python-Code-Large/train/row_98425 | 98 | 165 | 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_98425:Import_L1_C0", "label": "decimal import decimal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0061, 0.0061, 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_98425:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98425:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98425:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98425:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
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 characte... | ajibawa-2023/Python-Code-Large/train/row_98426 | 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_98426: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_98426:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98426:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98426:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98426: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... | ajibawa-2023/Python-Code-Large/train/row_98427 | 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_98427: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_98427:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98427:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98427:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98427: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
... | ajibawa-2023/Python-Code-Large/train/row_98428 | 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_98428: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_98428:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98428:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98428:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98428:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
import logging
import sys
from django.core import mail
# Make sure a NullHandler is available
# This was added in Python 2.7/3.2
try:
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
# Make sure that dictConfi... | ajibawa-2023/Python-Code-Large/train/row_98429 | 46 | 86 | 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_98429:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0116, 0.0116, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98429:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98429:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98429:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98429:ClassDef_L10_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',
... | ajibawa-2023/Python-Code-Large/train/row_98430 | 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_98430: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_98430:For_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98430:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98430:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98430: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
versi... | ajibawa-2023/Python-Code-Large/train/row_98432 | 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_98432: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_98432:Try_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98432:Import_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98432:Try_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98432: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))
de... | ajibawa-2023/Python-Code-Large/train/row_98434 | 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_98434: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_98434:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98434:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98434:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98434: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 o... | ajibawa-2023/Python-Code-Large/train/row_98435 | 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_98435: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_98435:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98435:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98435:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98435: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 ... | ajibawa-2023/Python-Code-Large/train/row_98436 | 23 | 39 | 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_98436:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.1282, 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_98436:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98436:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98436:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98436: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 sho... | ajibawa-2023/Python-Code-Large/train/row_98437 | 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_98437: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_98437:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98437:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98437:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98437: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 separat... | ajibawa-2023/Python-Code-Large/train/row_98439 | 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_98439: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_98439:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98439:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98439:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98439:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
The MIT License
Copyright (c) 2007 Leah Culver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publis... | ajibawa-2023/Python-Code-Large/train/row_98441 | 389 | 655 | 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_98441:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 23], "level": 0, "parent": null, "vector": [8, 0, 0.0183, 0.0351, 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_98441:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98441:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98441:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98441:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""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... | ajibawa-2023/Python-Code-Large/train/row_98442 | 107 | 167 | 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_98442:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.006, 0.006, 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_98442:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98442:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98442:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98442:Return_L34_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Django's standard crypto functions and utilities.
"""
import hmac
from django.conf import settings
from django.utils.hashcompat import sha_constructor, sha_hmac
def salted_hmac(key_salt, value, secret=None):
"""
Returns the HMAC-SHA1 of 'value', using a key generated from key_salt and a
s... | ajibawa-2023/Python-Code-Large/train/row_98443 | 17 | 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_98443:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0444, 0.0667, 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_98443:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98443:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98443:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98443:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# 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)
f... | ajibawa-2023/Python-Code-Large/train/row_98444 | 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_98444: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_98444:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98444:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98444:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98444: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] = co... | ajibawa-2023/Python-Code-Large/train/row_98445 | 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_98445: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_98445:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98445: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 = ... | ajibawa-2023/Python-Code-Large/train/row_98446 | 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_98446: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_98446:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98446:Import_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98446:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98446:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98... |
from types import GeneratorType
from django.utils.copycompat import copy, 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 t... | ajibawa-2023/Python-Code-Large/train/row_98447 | 290 | 496 | 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_98447:ImportFrom_L1_C0", "label": "from types import GeneratorType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.002, 0.002, 0, 0.66, 0.0, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "types", "arg_names": [], "import_names": ["G... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98447:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98447:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98447:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98447: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... | ajibawa-2023/Python-Code-Large/train/row_98448 | 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_98448: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_98448:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98448:If_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98448:If_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98448: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/... | ajibawa-2023/Python-Code-Large/train/row_98449 | 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_98449: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_98449:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98449:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98449:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98449: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 for... | ajibawa-2023/Python-Code-Large/train/row_98451 | 42 | 78 | 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_98451:Import_L5_C0", "label": "warnings import warnings", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0641, 0.0128, 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_98451:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98451:If_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98451:If_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98451: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_bid... | ajibawa-2023/Python-Code-Large/train/row_98452 | 61 | 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_98452:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0168, 0.0252, 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_98452:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98452:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98452:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98452:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
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:
... | ajibawa-2023/Python-Code-Large/train/row_98453 | 110 | 218 | 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_98453:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 18], "level": 0, "parent": null, "vector": [8, 0, 0.0436, 0.0826, 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_98453:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98453:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98453:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98453: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 __i... | ajibawa-2023/Python-Code-Large/train/row_98454 | 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_98454: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_98454:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98454:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98454:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98454: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
fro... | ajibawa-2023/Python-Code-Large/train/row_98455 | 107 | 217 | 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_98455:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0046, 0.0046, 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_98455:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98455:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98455:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98455: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,... | ajibawa-2023/Python-Code-Large/train/row_98456 | 63 | 141 | 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_98456:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0142, 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_98456:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98456:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98456:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98456: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')),
... | ajibawa-2023/Python-Code-Large/train/row_98457 | 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_98457: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 INZipCodeFie... | ajibawa-2023/Python-Code-Large/train/row_98458 | 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_98458: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_98458:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98458:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98458:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98458: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', ... | ajibawa-2023/Python-Code-Large/train/row_98459 | 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_98459: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... | ajibawa-2023/Python-Code-Large/train/row_98460 | 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_98460: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_98460:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98460:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98460:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98460: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')),
... | ajibawa-2023/Python-Code-Large/train/row_98461 | 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_98461: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_uni... | ajibawa-2023/Python-Code-Large/train/row_98462 | 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_98462: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_98462:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98462:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98462:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98462: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... | ajibawa-2023/Python-Code-Large/train/row_98463 | 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_98463: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... | ajibawa-2023/Python-Code-Large/train/row_98464 | 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_98464: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_98464:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98464:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98464:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98464: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_C... | ajibawa-2023/Python-Code-Large/train/row_98465 | 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_98465: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:
tm... | ajibawa-2023/Python-Code-Large/train/row_98466 | 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_98466: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_98466:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98466:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98466:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98466: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.localf... | ajibawa-2023/Python-Code-Large/train/row_98467 | 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_98467: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_98467:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98467:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98467:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98467: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'),
... | ajibawa-2023/Python-Code-Large/train/row_98468 | 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_98468: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,... | ajibawa-2023/Python-Code-Large/train/row_98469 | 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_98469: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_98469:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98469:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98469:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98469: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 startin... | ajibawa-2023/Python-Code-Large/train/row_98470 | 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_98470: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... | ajibawa-2023/Python-Code-Large/train/row_98471 | 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_98471: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_98471:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98471:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98471:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98471: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(... | ajibawa-2023/Python-Code-Large/train/row_98472 | 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_98472: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(Sele... | ajibawa-2023/Python-Code-Large/train/row_98473 | 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_98473: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_98473:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98473:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98473:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98473: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'Re... | ajibawa-2023/Python-Code-Large/train/row_98474 | 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_98474: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.utils.translation import ugettext_lazy as _
from django.forms.fields import Field, RegexField, Select
from django.forms import ValidationError
re_ssn = re.compile(r'^\d{4} \d{6}')
class ATZipCodeField(RegexField):
"""
A form field that val... | ajibawa-2023/Python-Code-Large/train/row_98475 | 28 | 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_98475:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0308, 0.0462, 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_98475:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98475:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98475:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98475:Assign_L19_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', _('... | ajibawa-2023/Python-Code-Large/train/row_98476 | 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_98476: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})... | ajibawa-2023/Python-Code-Large/train/row_98477 | 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_98477: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_98477:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98477:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98477:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98477: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', _('Mec... | ajibawa-2023/Python-Code-Large/train/row_98478 | 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_98478: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... | ajibawa-2023/Python-Code-Large/train/row_98479 | 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_98479: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_98479:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98479:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98479:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98479: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'),
... | ajibawa-2023/Python-Code-Large/train/row_98480 | 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_98480: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_... | ajibawa-2023/Python-Code-Large/train/row_98481 | 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_98481: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_98481:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98481:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98481:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98481: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... | ajibawa-2023/Python-Code-Large/train/row_98482 | 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_98482: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_98482:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98482:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98482:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98482: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 = ... | ajibawa-2023/Python-Code-Large/train/row_98483 | 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_98483: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_l... | ajibawa-2023/Python-Code-Large/train/row_98484 | 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_98484: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_98484:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98484:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98484:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98484: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', 'Am... | ajibawa-2023/Python-Code-Large/train/row_98485 | 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_98485: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... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.