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 |
|---|---|---|---|---|---|---|---|
"""
HTTP Exception
--------------
This module processes Python exceptions that relate to HTTP exceptions
by defining a set of exceptions, all subclasses of HTTPException.
Each exception, in addition to being a Python exception that can be
raised and caught, is also a WSGI application and ``webob.Response``
object.
Thi... | ajibawa-2023/Python-Code-Large/train/row_85257 | 376 | 1,139 | 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_85257:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 164], "level": 0, "parent": null, "vector": [8, 0, 0.0724, 0.144, 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_85257:FunctionDef_L187_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85257:If_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85257:If_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85257:Return_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import re
__all__ = ['Range', 'ContentRange']
_rx_range = re.compile('bytes *= *(\d*) *- *(\d*)', flags=re.I)
_rx_content_range = re.compile(r'bytes (?:(\d+)-(\d+)|[*])/(?:(\d+)|[*])')
class Range(object):
"""
Represents the Range header.
"""
def __init__(self, start, end):
assert end is... | ajibawa-2023/Python-Code-Large/train/row_85258 | 98 | 160 | 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_85258:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 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_85258:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85258:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85258:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85258:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import datetime
import os
import re
import sys
import types
from django.conf import settings
from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound
from django.template import (Template, Context, TemplateDoesNotExist,
TemplateSyntaxError)
from django.template.defaultfilters import forc... | ajibawa-2023/Python-Code-Large/train/row_85259 | 189 | 894 | 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_85259:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0011, 0.0011, 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_85259:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85259:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85259:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85259:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Decorators for views based on HTTP headers.
"""
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from calendar import timegm
from datetime import timedelta
from django.utils.decorators import decorator_from_middleware, available_attrs
... | ajibawa-2023/Python-Code-Large/train/row_85260 | 75 | 166 | 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_85260:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.012, 0.0181, 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_85260:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85260:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85260:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85260:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.cache import patch_vary_headers
from django.utils.decorators import available_attrs
def vary_on_headers(*headers):
"""
A view decorator that adds the specified heade... | ajibawa-2023/Python-Code-Large/train/row_85261 | 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_85261: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_85261:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85261:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85261:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85261:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.utils.decorators import decorator_from_middleware
from django.middleware.gzip import GZipMiddleware
gzip_page = decorator_from_middleware(GZipMiddleware)
gzip_page.__doc__ = "Decorator for views that gzips pages if the client supports it."
| ajibawa-2023/Python-Code-Large/train/row_85262 | 4 | 5 | 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_85262:ImportFrom_L1_C0", "label": "from django.utils.decorators import decorator_from_middleware", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 532, 0, 1, 0, 0, 532, 0, 0], "semantic": {"name": "django.utils.decor... | [] |
from django.middleware.csrf import CsrfViewMiddleware
from django.utils.decorators import decorator_from_middleware, available_attrs
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
csrf_protect = decorator_from_middleware(CsrfViewMiddlewar... | ajibawa-2023/Python-Code-Large/train/row_85263 | 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_85263: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_85263:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85263:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85263:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85263:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cach... | ajibawa-2023/Python-Code-Large/train/row_85264 | 35 | 82 | 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_85264:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0305, 0.0488, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "sni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85264:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85264:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85264:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85264:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
import mimetypes
import os
import posixpath
import re
import urllib
from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified
from djan... | ajibawa-2023/Python-Code-Large/train/row_85265 | 61 | 135 | 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_85265:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0185, 0.0296, 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_85265:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85265:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85265:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85265:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.http import HttpResponseForbidden
from django.template import Context, Template
from django.conf import settings
# We include the template inline since we need to be able to reliably display
# this error message, especially for the sake of developers, and there isn't any
# other way of making it available ... | ajibawa-2023/Python-Code-Large/train/row_85266 | 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_85266: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_85266:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85266:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85266:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85266: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.utils.encoding import force_unicode
from django.utils.translation import ugettext as _
from django.views.generic.base import View
from django.views.generic.detail ... | ajibawa-2023/Python-Code-Large/train/row_85267 | 287 | 606 | 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_85267: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_85267:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85267:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85267:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85267:Assign_L14_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 instead.',
... | ajibawa-2023/Python-Code-Large/train/row_85268 | 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_85268: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_85268:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85268:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85268:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85268: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 django.... | ajibawa-2023/Python-Code-Large/train/row_85269 | 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_85269: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_85269:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85269:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85269:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85269:For_L23_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import re
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.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, View
c... | ajibawa-2023/Python-Code-Large/train/row_85270 | 83 | 155 | 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_85270:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0065, 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_85270:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85270:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85270:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85270:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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 generic v... | ajibawa-2023/Python-Code-Large/train/row_85271 | 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_85271: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_85271:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85271:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85271:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85271: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.utils.encoding import smart_str
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, View
class SingleObjectMixin(object):
"... | ajibawa-2023/Python-Code-Large/train/row_85272 | 72 | 150 | 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_85272:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 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_85272:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85272:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85272:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85272:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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,
SingleObjectTemplateRe... | ajibawa-2023/Python-Code-Large/train/row_85273 | 126 | 242 | 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_85273:ImportFrom_L1_C0", "label": "from django.forms import model_forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0041, 0, 0.66, 0.0, 666, 0, 1, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85273:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85273:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85273:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85273:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django import http
from django.core.exceptions import ImproperlyConfigured
from django.template import RequestContext, loader
from django.template.response import TemplateResponse
from django.utils.functional import update_wrapper
from django.utils.log import getLogger
from django.utils.decorators import classonly... | ajibawa-2023/Python-Code-Large/train/row_85274 | 88 | 178 | 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_85274:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0056, 0.0056, 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_85274:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85274:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85274:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85274:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import datetime
import time
from django.template import loader, RequestContext
from django.core.exceptions import ObjectDoesNotExist
from django.core.xheaders import populate_xheaders
from django.db.models.fields import DateTimeField
from django.http import Http404, HttpResponse
import warnings
warnings.warn(
'Fu... | ajibawa-2023/Python-Code-Large/train/row_85275 | 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_85275: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_85275:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85275:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85275:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85275: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.vie... | ajibawa-2023/Python-Code-Large/train/row_85276 | 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_85276: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_85276:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85276: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_csrf_toke... | ajibawa-2023/Python-Code-Large/train/row_85277 | 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_85277: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_85277:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85277:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85277:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85277:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import os
import gettext as gettext_module
from django import http
from django.conf import settings
from django.utils import importlib
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
from django.utils.encoding import smart_unicod... | ajibawa-2023/Python-Code-Large/train/row_85278 | 130 | 281 | 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_85278:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 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_85278:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85278:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85278:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85278: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, RequestContext
from django.http import HttpResponse, Http404
from django.http import HttpRespon... | ajibawa-2023/Python-Code-Large/train/row_85279 | 52 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85279:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0385, 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_85279:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85279:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85279:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85279: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_85280 | 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_85280:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.4444, 0.7778, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
Common checksum routines (used in multiple localflavor/ cases, for example).
"""
__all__ = ['luhn',]
LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) # sum_of_digits(index * 2)
def luhn(candidate):
"""
Checks a candidate number for validity according to the Luhn
algorithm (used in validation of, for ... | ajibawa-2023/Python-Code-Large/train/row_85283 | 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_85283: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_85283:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85283:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85283:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85283:If_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"Commonly-used date structures"
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
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_85284 | 10 | 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_85284:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import imp
import os
import sys
def module_has_submodule(package, module_name):
"""See if 'module' is in 'package'."""
name = ".".join([package.__name__, module_name])
try:
# None indicates a cached miss; see mark_miss() in Python/import.c.
return sys.modules[name] is not None
except K... | ajibawa-2023/Python-Code-Large/train/row_85285 | 34 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85285:Import_L1_C0", "label": "imp import imp", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "imp", "arg_names": [], "import_names": ["imp"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85285:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85285:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85285:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85285:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
termcolors.py
"""
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
RESET = '0'
opt_dict = {'bold': '1', 'underscore': '4', 'blink': '5', 'rever... | ajibawa-2023/Python-Code-Large/train/row_85286 | 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_85286: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_85286:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85286:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85286:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85286:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""Thread-local objects
(Note that this module provides a Python version of thread
threading.local class. Depending on the version of Python you're
using, there may be a faster one available. You should always import
the local class from threading.)
Thread-local objects support the management of thread-local dat... | ajibawa-2023/Python-Code-Large/train/row_85288 | 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_85288: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_85288:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85288:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85288:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85288:FunctionDef_L141_C4"}, {"f": "ajibawa-2023/Python... |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print df.format('jS F Y H:i')
7th October 2003 11:39
>>>
"""
import re
import time
import calendar
from django.utils.dates import MONTHS, MONTHS_3, ... | ajibawa-2023/Python-Code-Large/train/row_85289 | 202 | 290 | 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_85289:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0224, 0.0414, 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_85289:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85289:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85289:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85289:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-... |
import datetime
import time
from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, e.g. "10 minutes". If d occurs after now,
... | ajibawa-2023/Python-Code-Large/train/row_85290 | 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_85290: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_85290:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85290:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85290:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85290:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | ajibawa-2023/Python-Code-Large/train/row_85291 | 76 | 139 | 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_85291:Import_L31_C0", "label": "os import os, sys, time\u2026", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.223, 0.0072, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85291:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85291:Import_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85291:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85291:Import_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
import calendar
import datetime
import re
import sys
import urllib
import urlparse
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/)?"((?:\\.|[^"])*)"')
MONTHS = 'jan feb mar apr may jun jul au... | ajibawa-2023/Python-Code-Large/train/row_85292 | 98 | 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_85292:Import_L1_C0", "label": "calendar import calendar", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 917, 0, 1, 0, 0, 917, 0, 0], "semantic": {"name": "calendar", "arg_names": [], "import_names": ["calenda... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85292:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85292:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85292:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85292:Return_L32_C4"}, {"f": "ajibawa-2023/Python-Code... |
# License for code in this file that was taken from Python 2.5.
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# --------------------------------------------
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF"), and the Individual or Organization ("Licensee") accessing and
# otherwise usin... | ajibawa-2023/Python-Code-Large/train/row_85293 | 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_85293: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_85293:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85293:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85293:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85293:Return_L55_C8"}, {"f": "ajibawa-2023/Pyth... |
"""
Utilities for XML generation/parsing.
"""
from xml.sax.saxutils import XMLGenerator
class SimplerXMLGenerator(XMLGenerator):
def addQuickElement(self, name, contents=None, attrs=None):
"Convenience method for adding an element with no children"
if attrs is None: attrs = {}
self.startEl... | ajibawa-2023/Python-Code-Large/train/row_85294 | 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_85294: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_85294:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85294:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85294:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85294:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
# Performance note: I benchmarked this code using a set instead of
# a list for the stopwords and was surprised to find that the list
# performed /better/ than the set - maybe because it's only a small
# list.
stopwords = '''
i
a
an
are
as
at
be
by
for
from
how
in
is
it
of
on
or
that
the
this
to
was
what
when
where
''... | ajibawa-2023/Python-Code-Large/train/row_85295 | 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_85295: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_85295:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85295:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85295:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85295:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Functions for working with "safe strings": strings that can be displayed safely
without further escaping in HTML. Marking something as a "safe string" means
that the producer of the string has already turned characters that should not
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
"""
f... | ajibawa-2023/Python-Code-Large/train/row_85297 | 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_85297: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_85297:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85297:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85297:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85297: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 path"""
if... | ajibawa-2023/Python-Code-Large/train/row_85298 | 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_85298: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_85298:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85298:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85298:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85298: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):
installed_handler ... | ajibawa-2023/Python-Code-Large/train/row_85300 | 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_85300: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_85300:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85300:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85300:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85300: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 getattr(self, 'fail... | ajibawa-2023/Python-Code-Large/train/row_85301 | 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_85301: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_85301:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85301:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85301:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85301: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_85302 | 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_85302: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_85302:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85302:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85302:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85302: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] + ' [truncated]...'... | ajibawa-2023/Python-Code-Large/train/row_85305 | 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_85305: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_85305:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85305:Try_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85305:Try_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85305: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) 2003-2010 P... | ajibawa-2023/Python-Code-Large/train/row_85306 | 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_85306: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_85306:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85306:ImportFrom_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85306:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85306: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_85307 | 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_85307: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_85307:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85307: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 decorate file-like obj... | ajibawa-2023/Python-Code-Large/train/row_85309 | 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_85309: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_85309:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85309:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85309:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85309: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 preference to writers.... | ajibawa-2023/Python-Code-Large/train/row_85310 | 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_85310: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_85310:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85310:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85310:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85310:Import_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"Implementation of tzinfo classes for use with datetime.datetime."
import time
from datetime import timedelta, tzinfo
from django.utils.encoding import smart_unicode, smart_str, DEFAULT_LOCALE_ENCODING
class FixedOffset(tzinfo):
"Fixed offset in minutes east from UTC."
def __init__(self, offset):
if i... | ajibawa-2023/Python-Code-Large/train/row_85311 | 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_85311: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_85311:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85311:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85311:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85311:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
import decimal
import datetime
from django.conf import settings
from django.utils.translation import get_language, to_locale, check_for_language
from django.utils.importlib import import_module
from django.utils.encoding import smart_str
from django.utils import dateformat, numberformat, datetime_safe
from django.util... | ajibawa-2023/Python-Code-Large/train/row_85312 | 107 | 180 | 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_85312:Import_L1_C0", "label": "decimal import decimal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0056, 0.0056, 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_85312:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85312:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85312:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85312:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Functions for reversing a regular expression (used in reverse URL resolving).
Used internally by Django and not intended for external use.
This is not, and is not intended to be, a complete reg-exp decompiler. It
should be good enough for a large class of URLS, however.
"""
# Mapping of an escape character to a r... | ajibawa-2023/Python-Code-Large/train/row_85313 | 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_85313: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_85313:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85313:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85313:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85313: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, ugettext as _
from htmlentitydefs import name2codepoint
# Capitalizes the first letter of a string.
capfirst = lambda x: x and force_unicode(x)[0].upper() + force... | ajibawa-2023/Python-Code-Large/train/row_85314 | 158 | 285 | 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_85314: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_85314:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85314:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85314:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85314:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code... |
import os
import stat
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... | ajibawa-2023/Python-Code-Large/train/row_85315 | 27 | 67 | 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_85315:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 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_85315:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85315:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85315:If_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85315:FunctionDef_L15_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 dictConfig is availabl... | ajibawa-2023/Python-Code-Large/train/row_85316 | 55 | 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_85316:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0099, 0.0099, 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_85316:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85316:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85316:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85316: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',
'\f': '\\f',
... | ajibawa-2023/Python-Code-Large/train/row_85317 | 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_85317: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_85317:For_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85317:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85317:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85317:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | ajibawa-2023/Python-Code-Large/train/row_85319 | 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_85319: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_85319:Try_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85319:Import_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85319:Try_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85319:If_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | ajibawa-2023/Python-Code-Large/train/row_85321 | 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_85321: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_85321:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85321:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85321:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85321:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
from django.utils.copycompat import deepcopy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
... | ajibawa-2023/Python-Code-Large/train/row_85322 | 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_85322: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_85322:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85322:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85322:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85322:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
"""
Providing iterator functions that are not in all version of Python we support.
Where possible, we try to use the system-native version and only fall back to
these implementations if necessary.
"""
import itertools
# Fallback for Python 2.4, Python 2.5
def product(*args, **kwds):
"""
Taken from http://docs... | ajibawa-2023/Python-Code-Large/train/row_85323 | 28 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85323:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.1111, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85323:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85323:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85323:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85323:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code... |
import django
import os.path
import re
def get_svn_revision(path=None):
"""
Returns the SVN revision in the form SVN-XXXX,
where XXXX is the revision number.
Returns SVN-unknown if anything goes wrong, such as an unexpected
format of internal SVN files.
If path is provided, it should be a dir... | ajibawa-2023/Python-Code-Large/train/row_85324 | 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_85324: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_85324:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85324:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85324:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85324:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.conf import settings
from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):
"""
Gets a number (as a number or string), and returns it as a string,
using formats definied as arguments:
* decimal_sep: Decimal separator symbol... | ajibawa-2023/Python-Code-Large/train/row_85326 | 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_85326: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_85326:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85326:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85326:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85326:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""HTML utilities suitable for global use."""
import re
import string
from django.utils.safestring import SafeData, mark_safe
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.http import urlquote
# Configuration for urlize() function.
LEADING_PUNCTUATIO... | ajibawa-2023/Python-Code-Large/train/row_85328 | 115 | 192 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85328:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0052, 0.0052, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85328:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85328:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85328:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85328: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
secret (which... | ajibawa-2023/Python-Code-Large/train/row_85329 | 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_85329: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_85329:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85329:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85329:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85329: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)
for x in ... | ajibawa-2023/Python-Code-Large/train/row_85330 | 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_85330: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_85330:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85330:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85330:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85330:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Fixes Python 2.4's failure to deepcopy unbound functions.
"""
import copy
import types
# Monkeypatch copy's deepcopy registry to handle functions correctly.
if (hasattr(copy, '_deepcopy_dispatch') and types.FunctionType not in copy._deepcopy_dispatch):
copy._deepcopy_dispatch[types.FunctionType] = copy._deepc... | ajibawa-2023/Python-Code-Large/train/row_85331 | 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_85331: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_85331:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85331:Assign_L10_C4"}] |
"""
The md5 and sha modules are deprecated since Python 2.5, replaced by the
hashlib module containing both hash algorithms. Here, we provide a common
interface to the md5 and sha constructors, depending on system version.
"""
import sys
if sys.version_info >= (2, 5):
import hashlib
md5_constructor = hashlib.m... | ajibawa-2023/Python-Code-Large/train/row_85332 | 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_85332: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_85332:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85332:Import_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85332:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85332:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85... |
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 the given d... | ajibawa-2023/Python-Code-Large/train/row_85333 | 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_85333: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_85333:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85333:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85333:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85333:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Syndication feed generation library -- used for generating RSS, etc.
Sample usage:
>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
... title=u"Poynter E-Media Tidbits",
... link=u"http://www.poynter.org/column.asp?id=31",
... description=u"A group Weblog by the shar... | ajibawa-2023/Python-Code-Large/train/row_85334 | 224 | 384 | 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_85334:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 24], "level": 0, "parent": null, "vector": [8, 0, 0.0326, 0.0625, 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_85334:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85334:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85334:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85334:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Co... |
# Python's datetime strftime doesn't handle dates before 1900.
# These classes override date and datetime to support the formatting of a date
# through its full "proleptic Gregorian" date range.
#
# Based on code submitted to comp.lang.python by Andrew Dalke
#
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was... | ajibawa-2023/Python-Code-Large/train/row_85335 | 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_85335: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_85335:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85335:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85335:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85335:Return_L16_C8"}, {"f": "ajibawa-2023/Python-... |
"""Translation helper functions."""
import locale
import os
import re
import sys
import warnings
import gettext as gettext_module
from cStringIO import StringIO
from threading import local
from django.utils.importlib import import_module
from django.utils.safestring import mark_safe, SafeData
# Translations are cac... | ajibawa-2023/Python-Code-Large/train/row_85336 | 365 | 607 | 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_85336:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0016, 0.0016, 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_85336:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85336:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85336:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85336:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code... |
# These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
import warnings
from django.conf import settings
from django.utils.encoding import force_uni... | ajibawa-2023/Python-Code-Large/train/row_85337 | 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_85337: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_85337:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85337:If_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85337:If_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85337:Return_L11_C20"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
Internationalization support.
"""
import warnings
from os import path
from django.utils.encoding import force_unicode
from django.utils.functional import lazy
from django.utils.importlib import import_module
__all__ = ['gettext', 'gettext_noop', 'gettext_lazy', 'ngettext',
'ngettext_lazy', 'string_concat... | ajibawa-2023/Python-Code-Large/train/row_85338 | 75 | 145 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85338:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0138, 0.0207, 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_85338:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85338:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85338:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85338:FunctionDef_L41_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:
http... | ajibawa-2023/Python-Code-Large/train/row_85339 | 123 | 238 | 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_85339:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 18], "level": 0, "parent": null, "vector": [8, 0, 0.0399, 0.0756, 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_85339:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85339:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85339:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85339:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python... |
from django.contrib.syndication import views
from django.core.exceptions import ObjectDoesNotExist
import warnings
# This is part of the deprecated API
from django.contrib.syndication.views import FeedDoesNotExist, add_domain
class Feed(views.Feed):
"""Provided for backwards compatibility."""
def __init__(sel... | ajibawa-2023/Python-Code-Large/train/row_85340 | 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_85340: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_85340:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85340:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85340:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85340:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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, TemplateDoesNotExist, RequestContext
from django.utils import feedgenera... | ajibawa-2023/Python-Code-Large/train/row_85341 | 113 | 229 | 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_85341:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0044, 0.0044, 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_85341:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85341:If_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85341:If_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85341:If_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/ro... |
"""
Czech-specific form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Select, RegexField, Field
from django.utils.translation import ugettext_lazy as _
import re
birth_number = re.compile(r'^(?P<birth>\d{6})/?(?P<id>\d{3,4})$')
ic_... | ajibawa-2023/Python-Code-Large/train/row_85342 | 65 | 145 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85342:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0138, 0.0207, 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_85342:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85342:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85342:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85342:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Czech regions, translations get from http://www.crwflags.com/fotw/Flags/cz-re.html
"""
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('PR', _('Prague')),
('CE', _('Central Bohemian Region')),
('SO', _('South Bohemian Region')),
('PI', _('Pilsen Region')),
('CA', _(... | ajibawa-2023/Python-Code-Large/train/row_85343 | 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_85343:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0909, 0.1364, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
India-specific Form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import gettext
import re
class INZipCodeField(RegexFiel... | ajibawa-2023/Python-Code-Large/train/row_85344 | 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_85344: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_85344:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85344:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85344:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85344:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Cod... |
"""
A mapping of state misspellings/abbreviations to normalized abbreviations, and
an alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('KA', 'Karnataka'),
('AP', 'Andhra Pr... | ajibawa-2023/Python-Code-Large/train/row_85345 | 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_85345:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0476, 0.0833, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
NL-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
pc_re = re.compile('^\d{4}[A-Z]{2}$... | ajibawa-2023/Python-Code-Large/train/row_85346 | 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_85346: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_85346:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85346:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85346:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85346:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import ugettext_lazy as _
PROVINCE_CHOICES = (
('DR', _('Drenthe')),
('FL', _('Flevoland')),
('FR', _('Friesland')),
('GL', _('Gelderland')),
('GR', _('Groningen')),
('LB', _('Limburg')),
('NB', _('Noord-Brabant')),
('NH', _('Noord-Holland')),
('OV', _(... | ajibawa-2023/Python-Code-Large/train/row_85347 | 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_85347:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Iceland specific form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField
from django.forms.widgets import Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
cla... | ajibawa-2023/Python-Code-Large/train/row_85348 | 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_85348: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_85348:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85348:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85348:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85348:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
IS_POSTALCODES = (
('101', u'101 Reykjavík'),
('103', u'103 Reykjavík'),
('104', u'104 Reykjavík'),
('105', u'105 Reykjavík'),
('107', u'107 Reykjavík'),
('108', u'108 Reykjavík'),
('109', u'109 Reykjavík'),
('110', u'110 Reykjavík'),
('111', u'111 Reykjavík'... | ajibawa-2023/Python-Code-Large/train/row_85349 | 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_85349:Assign_L3_C0", "label": "IS_POSTALCODES =", "type": "assigned_variable", "loc": [3, 151], "level": 0, "parent": null, "vector": [14, 0, 0.5099, 0.9868, 0, 0.66, 0.0, 247, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "IS_POSTALCODES", "arg_names": [], "import_names":... | [] |
# -*- coding: utf-8 -*-
"""
Swedish specific Form helpers
"""
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.validators import EMPTY_VALUES
from django.contrib.localflavor.se.utils import (id_number_checksum,
validate_id_birthday, format_personal_id_numbe... | ajibawa-2023/Python-Code-Large/train/row_85350 | 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_85350: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_85350:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85350:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85350:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85350:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Swedish counties, sorted by codes.
http://en.wikipedia.org/wiki/Counties_of_Sweden
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from django.utils.translation import ugettext_lazy as _
COUNTY_CHOICES = (
... | ajibawa-2023/Python-Code-Large/train/row_85351 | 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_85351:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 10], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.25, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
import re
import datetime
def id_number_checksum(gd):
"""
Calculates a Swedish ID number checksum, using the
"Luhn"-algoritm
"""
n = s = 0
for c in (gd['year'] + gd['month'] + gd['day'] + gd['serial']):
tmp = ((n % 2) and 1 or 2) * int(c)
if tmp > 9:
tmp = sum([int(... | ajibawa-2023/Python-Code-Large/train/row_85352 | 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_85352: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_85352:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85352:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85352:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85352:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
IT-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.contrib.localflavor.it.... | ajibawa-2023/Python-Code-Large/train/row_85353 | 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_85353: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_85353:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85353:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85353:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85353:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*
REGION_CHOICES = (
('ABR', 'Abruzzo'),
('BAS', 'Basilicata'),
('CAL', 'Calabria'),
('CAM', 'Campania'),
('EMR', 'Emilia-Romagna'),
('FVG', 'Friuli-Venezia Giulia'),
('LAZ', 'Lazio'),
('LIG', 'Liguria'),
('LOM', 'Lombardia'),
('MAR', 'Marche'),
('MOL', ... | ajibawa-2023/Python-Code-Large/train/row_85354 | 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_85354:Assign_L3_C0", "label": "REGION_CHOICES =", "type": "assigned_variable", "loc": [3, 24], "level": 0, "parent": null, "vector": [14, 0, 0.5625, 0.9167, 0, 0.66, 0.0, 868, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "REGION_CHOICES", "arg_names": [], "import_names": ... | [] |
from django.utils.encoding import smart_str, smart_unicode
def ssn_check_digit(value):
"Calculate Italian social security number check digit."
ssn_even_chars = {
'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
'9': 9, 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': ... | ajibawa-2023/Python-Code-Large/train/row_85355 | 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_85355: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_85355:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85355:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85355:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85355:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*
PROVINCE_CHOICES = (
('AG', 'Agrigento'),
('AL', 'Alessandria'),
('AN', 'Ancona'),
('AO', 'Aosta'),
('AR', 'Arezzo'),
('AP', 'Ascoli Piceno'),
('AT', 'Asti'),
('AV', 'Avellino'),
('BA', 'Bari'),
('BT', 'Barletta-Andria-Trani'), # active starting from 2009
... | ajibawa-2023/Python-Code-Large/train/row_85356 | 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_85356:Assign_L3_C0", "label": "PROVINCE_CHOICES =", "type": "assigned_variable", "loc": [3, 114], "level": 0, "parent": null, "vector": [14, 0, 0.5132, 0.9825, 0, 0.66, 0.0, 540, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "PROVINCE_CHOICES", "arg_names": [], "import_nam... | [] |
"""
JP-specific Form helpers
"""
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import RegexField, Select
class JPPostalCodeField(RegexField):
"""
A form field that validates its input is a Japanese postcode.
Accepts 7 digits, wit... | ajibawa-2023/Python-Code-Large/train/row_85357 | 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_85357: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_85357:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85357:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85357:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85357:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.utils.translation import ugettext_lazy
JP_PREFECTURES = (
('hokkaido', ugettext_lazy('Hokkaido'),),
('aomori', ugettext_lazy('Aomori'),),
('iwate', ugettext_lazy('Iwate'),),
('miyagi', ugettext_lazy('Miyagi'),),
('akita', ugettext_lazy('Akita'),),
('yamagata', ugettext_lazy('Yamagat... | ajibawa-2023/Python-Code-Large/train/row_85358 | 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_85358:ImportFrom_L1_C0", "label": "from django.utils.translation import ugettext_lazy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translatio... | [] |
"""
Chile specific form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
class CLRegionSelect(Select):
""... | ajibawa-2023/Python-Code-Large/train/row_85359 | 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_85359: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_85359:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85359:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85359:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85359:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Chilean regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
REGION_CHOICES = (
('RM', u'Región Metropolitana de Santiago'),
('I', u'Región de Tarapacá'),
('II', u'Región de Ant... | ajibawa-2023/Python-Code-Large/train/row_85360 | 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_85360:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.18, 0.24, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [] |
"""
AT-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
re_ssn = re.compile(r'^\d{4} \d{6}')
class ATZipCodeField(RegexField)... | ajibawa-2023/Python-Code-Large/train/row_85361 | 32 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85361:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.029, 0.0435, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85361:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85361:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85361:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85361:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('BL', _('Burgenland')),
('KA', _('Carinthia')),
('NO', _('Lower Austria')),
('OO', _('Upper Austria')),
('SA', _('Salzburg')),
('ST', _('Styria')),
('TI', _('Tyrol')),
('VO', _('Vorarlberg'... | ajibawa-2023/Python-Code-Large/train/row_85362 | 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_85362:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
DE-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
import re
id_re = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})[-\ ]?(?P<... | ajibawa-2023/Python-Code-Large/train/row_85363 | 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_85363: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_85363:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85363:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85363:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85363:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('BW', _('Baden-Wuerttemberg')),
('BY', _('Bavaria')),
('BE', _('Berlin')),
('BB', _('Brandenburg')),
('HB', _('Bremen')),
('HH', _('Hamburg')),
('HE', _('Hessen')),
('MV', _('Mecklenburg-We... | ajibawa-2023/Python-Code-Large/train/row_85364 | 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_85364:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0476, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Australian-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
PHONE_DIGITS_RE ... | ajibawa-2023/Python-Code-Large/train/row_85365 | 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_85365: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_85365:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85365:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85365:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85365:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
An alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('ACT', 'Australian Capital Territory'),
('NSW', 'New South Wales'),
('NT', 'Northern Territory'),
('QLD', 'Q... | ajibawa-2023/Python-Code-Large/train/row_85366 | 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_85366:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.2059, 0.3529, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
PT-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re.com... | ajibawa-2023/Python-Code-Large/train/row_85367 | 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_85367: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_85367:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85367:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85367:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85367:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
AR-specific Form helpers.
"""
from django.forms import ValidationError
from django.core.validators import EMPTY_VALUES
from django.forms.fields import RegexField, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
class... | ajibawa-2023/Python-Code-Large/train/row_85368 | 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_85368: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_85368:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85368:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85368:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85368:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.