code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import cache
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
def __init__(self, session_key=None):
self._cache = cache
super(SessionStore, self).__init__(sess... | ajibawa-2023/Python-Code-Large/train/row_98798 | 36 | 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_98798:ImportFrom_L1_C0", "label": "from django.contrib.sessions.backends.base import SessionBase, CreateError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0179, 0, 0.66, 0.0, 907, 0, 2, 0, 0, 907, 0, 0], "semantic": {"name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98798:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98798:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98798:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98798:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.utils.translation import ungettext, ugettext as _
from django.utils.encoding import force_unicode
from django import template
from django.template import defaultfilters
from datetime import date
import re
register = template.Library()
def ordinal(value):
"""
Converts an integer to its o... | ajibawa-2023/Python-Code-Large/train/row_98799 | 69 | 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_98799:ImportFrom_L1_C0", "label": "from django.utils.translation import ungettext, _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0101, 0.0101, 0, 0.66, 0.0, 389, 0, 2, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98799:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98799:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98799:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98799:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.conf.urls.defaults import *
from django.contrib.databrowse import views
# Note: The views in this URLconf all require a 'models' argument,
# which is a list of model classes (*not* instances).
urlpatterns = patterns('',
#(r'^$', views.homepage),
#(r'^([^/]+)/([^/]+)/$', views.model_detail)... | ajibawa-2023/Python-Code-Large/train/row_98800 | 3 | 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_98800:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names... | [] |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import force_unicode
f... | ajibawa-2023/Python-Code-Large/train/row_98801 | 52 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98801:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0116, 0.0116, 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_98801:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98801:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98801:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98801:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import smart_str, force... | ajibawa-2023/Python-Code-Large/train/row_98802 | 48 | 74 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98802:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0135, 0.0135, 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_98802:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98802:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98802:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98802:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
from django import http
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
import urlparse
class ObjectDetailPlugin(DatabrowsePlugin):
def model_view(self, request, model_databrowse, url)... | ajibawa-2023/Python-Code-Large/train/row_98803 | 12 | 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_98803:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 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_98803:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98803:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98803:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98803:If_L10_C8"}, {"f": "ajibawa-2023/Python-Code-La... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class Dat... | ajibawa-2023/Python-Code-Large/train/row_98804 | 77 | 149 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98804:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 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_98804:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98804:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98804:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98804:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.http import Http404
from django.shortcuts import render_to_response
###########
# CHOICES #
###########
def choice_list(request, app_label, module_name, field_name, models):
m, f = lookup_field(app_label, module_name, field_name, models)
return render_to_response('databrowse/choice_list.h... | ajibawa-2023/Python-Code-Large/train/row_98805 | 11 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98805:ImportFrom_L1_C0", "label": "from django.http import Http404", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98805:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98805:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98805:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98805:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
| ajibawa-2023/Python-Code-Large/train/row_98806 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98806:ImportFrom_L1_C0", "label": "from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 231, 0, 4, 0, 0, 231, 0, 0], "s... | [] |
"""
These classes are light wrappers around Django's database API that provide
convenience functionality and permalink functions for the databrowse app.
"""
from django.db import models
from django.utils import formats
from django.utils.text import capfirst
from django.utils.encoding import smart_unicode, smar... | ajibawa-2023/Python-Code-Large/train/row_98807 | 150 | 215 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98807:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0116, 0.0186, 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_98807:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98807:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98807:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98807:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-... |
# -*- coding: utf-8 -*-
import unittest
from django.contrib.webdesign.lorem_ipsum import *
from django.template import loader, Context
class WebdesignTest(unittest.TestCase):
def test_words(self):
self.assertEqual(words(7), u'lorem ipsum dolor sit amet consectetur adipisicing')
def te... | ajibawa-2023/Python-Code-Large/train/row_98808 | 11 | 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_98808:Import_L3_C0", "label": "unittest import unittest", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0476, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98808:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98808:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98808:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98808:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Cod... |
"""
Utility functions for generating "lorem ipsum" Latin text.
"""
import random
COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commo... | ajibawa-2023/Python-Code-Large/train/row_98809 | 32 | 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_98809: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_98809:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98809:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98809:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98809:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib.webdesign.lorem_ipsum import words, paragraphs
from django import template
register = template.Library()
class LoremNode(template.Node):
def __init__(self, count, method, common):
self.count, self.method, self.common = count, method, common
def render(self, context):
... | ajibawa-2023/Python-Code-Large/train/row_98810 | 33 | 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_98810:ImportFrom_L1_C0", "label": "from django.contrib.webdesign.lorem_ipsum import words, paragraphs", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 74, 0, 2, 0, 0, 74, 0, 0], "semantic": {"name": "django.co... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98810:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98810:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98810:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98810:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
class ContentTypeManager(models.Manager):
# Cache to avoid re-looking up ContentType objects all over the place.
# This cache is shared by all the get_for_* methods.
... | ajibawa-2023/Python-Code-Large/train/row_98811 | 60 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98811:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0095, 0.0095, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98811:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98811:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98811:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98811:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django import db
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.contenttypes.views import shortcut
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from djan... | ajibawa-2023/Python-Code-Large/train/row_98812 | 43 | 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_98812:ImportFrom_L1_C0", "label": "from django import db", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["db"], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98812:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98812:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98812:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98812:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Classes allowing "generic" relations through ContentType and object-id fields.
"""
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import signals
from django.db import models, router, DEFAULT_DB_ALIAS
from django.db.models.fields.related import R... | ajibawa-2023/Python-Code-Large/train/row_98813 | 233 | 426 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98813:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0047, 0.007, 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_98813:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98813:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98813:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98813:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django import http
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site, get_current_site
from django.core.exceptions import ObjectDoesNotExist
def shortcut(request, content_type_id, object_id):
"Redirect to an object's page based on a content-type ID a... | ajibawa-2023/Python-Code-Large/train/row_98814 | 35 | 71 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98814:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 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_98814:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98814:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98814:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98814:Try_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.contrib.contenttypes.models import ContentType
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_unicode
def update_contenttypes(app, created_models, verbosity=2, **kwargs):
"""
Creates content types for models in the given app, removing any mo... | ajibawa-2023/Python-Code-Large/train/row_98815 | 37 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98815:ImportFrom_L1_C0", "label": "from django.contrib.contenttypes.models import ContentType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 0, 0.66, 0.0, 469, 0, 1, 0, 0, 469, 0, 0], "semantic": {"name": "django.contrib.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98815:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98815:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98815:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98815:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
""" models.py (even empty) currently required by the runtests.py to enable unit tests """
| ajibawa-2023/Python-Code-Large/train/row_98816 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98816:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
"""
This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
"""
from django.conf.urls.defaults import *
from django.contrib.formtools.tests import *
urlpatterns = patterns('',
(r'^test1/', TestFormPreview(TestForm)),
(r'^test2/', UserSecur... | ajibawa-2023/Python-Code-Large/train/row_98817 | 4 | 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_98817:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1176, 0.1765, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import os
from django import forms
from django import http
from django.conf import settings
from django.contrib.formtools import preview, wizard, utils
from django.test import TestCase
from django.utils import unittest
success_string = "Done was called!"
class TestFormPreview(preview.FormPreview):
... | ajibawa-2023/Python-Code-Large/train/row_98818 | 180 | 362 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98818:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0028, 0.0028, 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_98818:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98818:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98818:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98818:Return_L16_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Formtools Preview application.
"""
import cPickle as pickle
from django.conf import settings
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.utils.hashcompat import md5_constructor
from django.utils.crypto im... | ajibawa-2023/Python-Code-Large/train/row_98819 | 70 | 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_98819:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0133, 0.02, 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_98819:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98819:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98819:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98819:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.forms import BooleanField
from django.utils.crypto import salted_hmac
from django.utils.hashcompat import md5_constructor
def security_hash(request, form, *args):
"""
Calculates a... | ajibawa-2023/Python-Code-Large/train/row_98820 | 36 | 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_98820:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0397, 0.0635, 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_98820:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98820:Import_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98820:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98820:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_9... |
"""
FormWizard class -- implements a multi-page form, validating between each
step and storing the form's state as HTML hidden fields so that no state is
stored on the server side.
"""
import cPickle as pickle
from django import forms
from django.conf import settings
from django.contrib.formtools.utils impo... | ajibawa-2023/Python-Code-Large/train/row_98821 | 109 | 283 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98821:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0106, 0.0177, 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_98821:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98821:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98821:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98821:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.core.exceptions import MiddlewareNotUsed
from django.utils.http import http_date
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has a ETag or
Last-Modified header, and the request has If-None-Match or
If-Modified-Since, the response is... | ajibawa-2023/Python-Code-Large/train/row_98822 | 17 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98822:ImportFrom_L1_C0", "label": "from django.core.exceptions import MiddlewareNotUsed", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exception... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98822:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98822:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98822:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98822:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"this is the locale selecting middleware that will look at accept headers"
from django.utils.cache import patch_vary_headers
from django.utils import translation
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to instal... | ajibawa-2023/Python-Code-Large/train/row_98823 | 15 | 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_98823:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.04, 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_98823:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98823:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98823:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98823:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, s... | ajibawa-2023/Python-Code-Large/train/row_98824 | 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_98824:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0263, 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_98824:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98824:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98824:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98824:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.conf import settings
from django import http
class XViewMiddleware(object):
"""
Adds an X-View header to internal HEAD requests -- used by the documentation system.
"""
def process_view(self, request, view_func, view_args, view_kwargs):
"""
If the request method is ... | ajibawa-2023/Python-Code-Large/train/row_98825 | 10 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98825:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 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_98825:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98825:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98825:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98825:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import itertools
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache impo... | ajibawa-2023/Python-Code-Large/train/row_98826 | 126 | 345 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98826:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0101, 0.0174, 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_98826:If_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98826:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98826:If_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98826:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
... | ajibawa-2023/Python-Code-Large/train/row_98828 | 19 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98828:ImportFrom_L1_C0", "label": "from django.db import transaction", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98828:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98828:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98828:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98828:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.U... | ajibawa-2023/Python-Code-Large/train/row_98829 | 66 | 159 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98829:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 49], "level": 0, "parent": null, "vector": [8, 0, 0.1572, 0.3082, 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_98829:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98829:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98829:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98829:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import formats
from django.utils.encoding import force_unicode
register = Library()
def localize(value):
"""
Forces a value to be rendered as a localized val... | ajibawa-2023/Python-Code-Large/train/row_98830 | 39 | 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_98830:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 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_98830:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98830:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98830:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98830:Return_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.utils.encoding import force_unicode
register = L... | ajibawa-2023/Python-Code-Large/train/row_98831 | 142 | 274 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98831:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 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_98831:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98831:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98831:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98831:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-... |
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.utils.http import urlquote
from django.utils.hashcompat import md5_constructor
... | ajibawa-2023/Python-Code-Large/train/row_98832 | 33 | 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_98832:ImportFrom_L1_C0", "label": "from django.template import Library, Node, TemplateSyntaxError\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 213, 0, 5, 0, 0, 213, 0, 0], "semantic": {"name": "djang... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98832:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98832:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98832:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98832:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-... |
# This module is DEPRECATED!
#
# You should no longer be using django.template_loader.
#
# Use django.template.loader instead.
from django.template.loader import *
| ajibawa-2023/Python-Code-Large/train/row_98833 | 1 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98833:ImportFrom_L7_C0", "label": "from django.template.loader import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.1429, 0, 0.66, 0.0, 970, 0, 1, 0, 0, 970, 0, 0], "semantic": {"name": "django.template.loader", "arg_names": []... | [] |
"""
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
from StringIO import StringIO
import decimal
import yaml
from django.db import models
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Des... | ajibawa-2023/Python-Code-Large/train/row_98834 | 32 | 59 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98834:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0508, 0.0847, 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_98834:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98834:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98834:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98834:Return_L17_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils i... | ajibawa-2023/Python-Code-Large/train/row_98835 | 43 | 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_98835:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0308, 0.0462, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98835:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98835:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98835:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98835:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
XML serializer.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.encoding import smart_unicode
from xml.dom import pulldom
class Serializer(base.Serializer... | ajibawa-2023/Python-Code-Large/train/row_98836 | 161 | 297 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98836:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0067, 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_98836:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98836:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98836:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98836:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS... | ajibawa-2023/Python-Code-Large/train/row_98837 | 80 | 142 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98837:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0352, 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_98837:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98837:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98837:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98837:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Module for abstract serializer/unserializer base classes.
"""
from StringIO import StringIO
from django.db import models
from django.utils.encoding import smart_str, smart_unicode
from django.utils import datetime_safe
class SerializationError(Exception):
"""Something bad happened during serializa... | ajibawa-2023/Python-Code-Large/train/row_98838 | 82 | 172 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98838:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0116, 0.0174, 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_98838:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98838:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98838:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98838:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Interfaces for serializing Django objects.
Usage::
from django.core import serializers
json = serializers.serialize("json", some_query_set)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES ... | ajibawa-2023/Python-Code-Large/train/row_98839 | 50 | 113 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98839:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0796, 0.1504, 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_98839:Try_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98839:Import_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98839:Try_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98839:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from dj... | ajibawa-2023/Python-Code-Large/train/row_98840 | 54 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98840:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0433, 0.0769, 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_98840:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98840:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98840:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98840:Import_L22_C4"}, {"f": "ajibawa-2023/Python-Code... |
import mimetypes
import os
import random
import time
from email import Charset, Encoders
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.Header import Header
from email.Utils import formatdate, getaddresses, formataddr
from dja... | ajibawa-2023/Python-Code-Large/train/row_98841 | 183 | 297 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98841:Import_L1_C0", "label": "mimetypes import mimetypes", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0034, 0.0034, 0, 0.66, 0.0, 583, 0, 1, 0, 0, 583, 0, 0], "semantic": {"name": "mimetypes", "arg_names": [], "import_names": ["mime... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98841:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98841:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98841:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98841:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Email message and email sending related helper functions.
"""
import socket
# Cache the hostname, but do it lazily: socket.getfqdn() can take a couple of
# seconds, which slows down the restart of the server.
class CachedDnsName(object):
def __str__(self):
return self.get_fqdn()
def... | ajibawa-2023/Python-Code-Large/train/row_98842 | 10 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98842:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1053, 0.1579, 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_98842:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98842:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98842:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98842:Return_L12_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Dummy email backend that does nothing.
"""
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def send_messages(self, email_messages):
return len(email_messages)
| ajibawa-2023/Python-Code-Large/train/row_98843 | 5 | 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_98843:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.2222, 0.3333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98843:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98843:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98843:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98843:Return_L9_C8"}] |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop('stream', sys.stdout)
... | ajibawa-2023/Python-Code-Large/train/row_98844 | 27 | 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_98844: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_98844:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98844:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98844:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98844:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
"""SMTP email backend class."""
import smtplib
import socket
import threading
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail.utils import DNS_NAME
class EmailBackend(BaseEmailBackend):
"""
A wrapper that manages the SMTP network ... | ajibawa-2023/Python-Code-Large/train/row_98845 | 69 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98845:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0094, 0.0094, 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_98845:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98845:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98845:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98845:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""Base email backend class."""
class BaseEmailBackend(object):
"""
Base class for email backend implementations.
Subclasses must at least overwrite send_messages().
"""
def __init__(self, fail_silently=False, **kwargs):
self.fail_silently = fail_silently
def open(self):
... | ajibawa-2023/Python-Code-Large/train/row_98846 | 11 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98846:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0256, 0.0256, 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_98846:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98846:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98846:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98846:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
# Mail backends shipped with Django.
| ajibawa-2023/Python-Code-Large/train/row_98847 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
"""
Backend for test environment.
"""
from django.core import mail
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
"""A email backend for use during test sessions.
The test connection stores email messages in a dummy outbox,
rather than sending... | ajibawa-2023/Python-Code-Large/train/row_98848 | 13 | 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_98848:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0833, 0.125, 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_98848:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98848:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98848:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98848:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import os
from pprint import pformat
import sys
from warnings import warn
from django import http
from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
from django.utils.encoding import ... | ajibawa-2023/Python-Code-Large/train/row_98851 | 122 | 213 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98851:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0047, 0.0047, 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_98851:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98851:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98851:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98851:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-... |
import hotshot, time, os
from django.core.handlers.modpython import ModPythonHandler
PROFILE_DATA_DIR = "/var/log/cmsprofile"
def handler(req):
'''
Handler that uses hotshot to store profile data.
Stores profile data in PROFILE_DATA_DIR. Since hotshot has no way (that I
know of) to append ... | ajibawa-2023/Python-Code-Large/train/row_98852 | 9 | 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_98852:Import_L1_C0", "label": "hotshot import hotshot, time, os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 974, 0, 3, 0, 0, 974, 0, 0], "semantic": {"name": "hotshot", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98852:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98852:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98852:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98852:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from pprint import pformat
import sys
from threading import Lock
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import socket
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set... | ajibawa-2023/Python-Code-Large/train/row_98854 | 152 | 279 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98854:ImportFrom_L1_C0", "label": "from pprint import pformat", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 0, 0.66, 0.0, 276, 0, 1, 0, 0, 276, 0, 0], "semantic": {"name": "pprint", "arg_names": [], "import_names": ["pfo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98854:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98854:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98854:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98854:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.dispatch import Signal
request_started = Signal()
request_finished = Signal()
got_request_exception = Signal(providing_args=["request"])
| ajibawa-2023/Python-Code-Large/train/row_98856 | 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_98856:ImportFrom_L1_C0", "label": "from django.dispatch import Signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "django.dispatch", "arg_names": [], "import_na... | [] |
from math import ceil
class InvalidPage(Exception):
pass
class PageNotAnInteger(InvalidPage):
pass
class EmptyPage(InvalidPage):
pass
class Paginator(object):
def __init__(self, object_list, per_page, orphans=0, allow_empty_first_page=True):
self.object_list = object_list
... | ajibawa-2023/Python-Code-Large/train/row_98857 | 76 | 120 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98857:ImportFrom_L1_C0", "label": "from math import ceil", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0083, 0.0083, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["ceil"], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98857:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98857:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98857:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98857:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Pages in Django can are served up with custom HTTP headers containing useful
information about those pages -- namely, the content type and object ID.
This module contains utility functions for retrieving and doing interesting
things with these special "X-Headers" (so called because the HTTP spec demands
that... | ajibawa-2023/Python-Code-Large/train/row_98860 | 7 | 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_98860:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.2292, 0.4167, 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_98860:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98860:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98860:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98860:ImportFrom_L19_C4"}, {"f": "ajibawa-2023/Python-... |
"""
Global Django exception and warning classes.
"""
class DjangoRuntimeWarning(RuntimeWarning):
pass
class ObjectDoesNotExist(Exception):
"The requested object does not exist"
silent_variable_failure = True
class MultipleObjectsReturned(Exception):
"The query returned multiple objects whe... | ajibawa-2023/Python-Code-Large/train/row_98862 | 51 | 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_98862:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.023, 0.0345, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98862:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98862:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98862:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98862:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_all
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model m... | ajibawa-2023/Python-Code-Large/train/row_98863 | 10 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98863:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98863:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98863:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98863:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98863:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import os
from django.core.management.base import NoArgsCommand
from optparse import make_option
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
make_option('--plain', action='store_true', dest='plain',
help='Tells Django to use plain Python, not IPython.'),
... | ajibawa-2023/Python-Code-Large/train/row_98865 | 30 | 59 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98865:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0169, 0.0169, 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_98865:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98865:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98865:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98865:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import codecs
import os
import sys
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
def has_bom(fn):
f = open(fn, 'r')
sample = f.read(4)
return sample[:3] == '\xef\xbb\xbf' or \
sample.startswith(codecs.BOM_UTF16_LE) or \
... | ajibawa-2023/Python-Code-Large/train/row_98866 | 40 | 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_98866:Import_L1_C0", "label": "codecs import codecs", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 220, 0, 1, 0, 0, 220, 0, 0], "semantic": {"name": "codecs", "arg_names": [], "import_names": ["codecs"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98866:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98866:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98866:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98866:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.core.management.base import NoArgsCommand
def module_to_dict(module, omittable=lambda k: k.startswith('_')):
"Converts a module namespace to a Python dictionary. Used by get_settings_diff."
return dict([(k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)])
class Command(NoAr... | ajibawa-2023/Python-Code-Large/train/row_98867 | 21 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98867:ImportFrom_L1_C0", "label": "from django.core.management.base import NoArgsCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.manageme... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98867:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98867:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98867:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98867:Return_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import keyword
from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
class Command(NoArgsCommand):
help = "Introspects the database tables in the given database and outputs a Django model module."
opti... | ajibawa-2023/Python-Code-Large/train/row_98868 | 99 | 164 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98868:Import_L1_C0", "label": "keyword import keyword", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0061, 0.0061, 0, 0.66, 0.0, 454, 0, 1, 0, 0, 454, 0, 0], "semantic": {"name": "keyword", "arg_names": [], "import_names": ["keyword"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98868:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98868:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98868:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98868:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_reset
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s)."
... | ajibawa-2023/Python-Code-Large/train/row_98870 | 10 | 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_98870:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98870:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98870:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98870:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98870:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
class Command(BaseCommand):
help = ("Runs the command-line client for specified database, or the "
"default database if none is provided.")
o... | ajibawa-2023/Python-Code-Large/train/row_98871 | 11 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98871:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98871:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98871:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98871:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98871:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Validates all installed models."
requires_model_validation = False
def handle_noargs(self, **options):
self.validate(display_num_errors=True)
| ajibawa-2023/Python-Code-Large/train/row_98872 | 6 | 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_98872:ImportFrom_L1_C0", "label": "from django.core.management.base import NoArgsCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.manageme... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98872:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98872:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98872:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98872:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Runs this project as a FastCGI application. Requires flup."
args = '[various KEY=val options, use `runfcgi help` for help]'
def handle(self, *args, **options):
from django.conf import settings
f... | ajibawa-2023/Python-Code-Large/train/row_98873 | 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_98873:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management.bas... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98873:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98873:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98873:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98873:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_indexes
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE INDEX SQL statements for the given model module name(s)."
op... | ajibawa-2023/Python-Code-Large/train/row_98874 | 10 | 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_98874:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98874:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98874:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98874:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98874:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_create
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the CREATE TABLE SQL statements for the given app name(s)."
option_list ... | ajibawa-2023/Python-Code-Large/train/row_98877 | 10 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98877:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98877:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98877:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98877:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98877:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import NoArgsCommand
from django.core.management.sql import sql_flush
from django.db import connections, DEFAULT_DB_ALIAS
class Command(NoArgsCommand):
help = "Returns a list of the SQL statements required to return all tables in the databas... | ajibawa-2023/Python-Code-Large/train/row_98878 | 10 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98878:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98878:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98878:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98878:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98878:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.db import connections, models, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = 'Prints the SQL statements for resetting sequences for the given app name(s).'
option_list = AppCommand.option_list + (
... | ajibawa-2023/Python-Code-Large/train/row_98879 | 10 | 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_98879:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98879:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98879:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98879:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98879:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.core.management.base import BaseCommand
from optparse import make_option
import sys
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user... | ajibawa-2023/Python-Code-Large/train/row_98880 | 23 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98880:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.025, 0.025, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management.b... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98880:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98880:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98880:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98880:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import LabelCommand
from django.db import connections, transaction, models, DEFAULT_DB_ALIAS
class Command(LabelCommand):
help = "Creates the table needed to use the SQL cache backend."
args = "<tablename>"
label = 'tablename'
... | ajibawa-2023/Python-Code-Large/train/row_98882 | 36 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98882:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0189, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98882:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98882:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98882:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98882:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
import os
import re
from random import choice
class Command(LabelCommand):
help = "Creates a Django project directory structure for the given project name in the current directory... | ajibawa-2023/Python-Code-Large/train/row_98883 | 23 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98883:ImportFrom_L1_C0", "label": "from django.core.management.base import copy_helper, CommandError, LabelCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 931, 0, 3, 0, 0, 931, 0, 0], "semantic": {"na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98883:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98883:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98883:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98883:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
class Command(LabelCommand):
help = "Creates a Django app directory structure for the given app name in the current directory."
args = "[appname]"
label = 'app... | ajibawa-2023/Python-Code-Large/train/row_98884 | 24 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98884:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 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_98884:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98884:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98884:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98884:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_delete
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the DROP TABLE SQL statements for the given app name(s)."
option_list = ... | ajibawa-2023/Python-Code-Large/train/row_98885 | 10 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98885:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98885:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98885:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98885:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98885:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input... | ajibawa-2023/Python-Code-Large/train/row_98886 | 17 | 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_98886:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0278, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98886:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98886:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98886:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98886:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_custom
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the custom table modifying SQL statements for the given app name(s)."
op... | ajibawa-2023/Python-Code-Large/train/row_98887 | 10 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98887:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98887:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98887:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98887:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98887:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.core.management.base import AppCommand, CommandError
class Command(AppCommand):
help = "RENAMED: see 'sqlcustom'"
def handle(self, *apps, **options):
raise CommandError("This command has been renamed. Use the 'sqlcustom' command instead.")
| ajibawa-2023/Python-Code-Large/train/row_98889 | 4 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98889:ImportFrom_L1_C0", "label": "from django.core.management.base import AppCommand, CommandError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 0, 0.66, 0.0, 931, 0, 2, 0, 0, 931, 0, 0], "semantic": {"name": "django.co... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98889:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98889:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98889:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98889:FunctionDef_L6_C4"}] |
from optparse import make_option
import os
import sys
from django.core.management.base import BaseCommand, CommandError
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException
from django.utils import autoreload
class BaseRunserve... | ajibawa-2023/Python-Code-Large/train/row_98890 | 60 | 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_98890:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0088, 0.0088, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98890:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98890:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98890:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98890:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import datetime
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Can be run as a cronjob or directly to clean out old data from the database (only expired sessions at the moment)."
def handle_noargs(self, **options):
from django.db import transaction
... | ajibawa-2023/Python-Code-Large/train/row_98891 | 9 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98891:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 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_98891:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98891:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98891:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98891:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import os
import re
from django.conf import settings
from django.core.management.base import CommandError
from django.db import models
from django.db.models import get_models
def sql_create(app, style, connection):
"Returns a list of the CREATE TABLE SQL statements for the given app."
if connectio... | ajibawa-2023/Python-Code-Large/train/row_98892 | 110 | 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_98892:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0055, 0.0055, 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_98892:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98892:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98892:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98892:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Sets up the terminal color scheme.
"""
import os
import sys
from django.utils import termcolors
def supports_color():
"""
Returns True if the running system's terminal supports color, and False
otherwise.
"""
unsupported_platform = (sys.platform in ('win32', 'Pocket PC'))
#... | ajibawa-2023/Python-Code-Large/train/row_98893 | 32 | 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_98893: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_98893:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98893:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98893:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98893:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
import sys
from django.core.management.color import color_style
from django.utils.itercompat import is_iterable
class ModelErrorCollection:
def __init__(self, outfile=sys.stdout):
self.errors = []
self.outfile = outfile
self.style = color_style()
def add(self, context, error)... | ajibawa-2023/Python-Code-Large/train/row_98894 | 191 | 288 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98894:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 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_98894:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98894:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98894:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98894:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code... |
"""
Utility functions for handling images.
Requires PIL, as you might imagine.
"""
from django.core.files import File
class ImageFile(File):
"""
A mixin for use alongside django.core.files.base.File, which provides
additional features for dealing with images.
"""
def _get_width(self)... | ajibawa-2023/Python-Code-Large/train/row_98899 | 39 | 62 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98899:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0484, 0.0806, 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_98899:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98899:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98899:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98899:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
The temp module provides a NamedTemporaryFile that can be re-opened on any
platform. Most platforms use the standard Python tempfile.TemporaryFile class,
but MS Windows users are given a custom class.
This is needed because in Windows NT, the default implementation of
NamedTemporaryFile uses the O_TEMPORARY ... | ajibawa-2023/Python-Code-Large/train/row_98901 | 26 | 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_98901:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0982, 0.1786, 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_98901:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98901:ClassDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98901:ClassDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98901:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
class FileProxyMixin(object):
"""
A mixin class used to forward file methods to an underlaying file
object. The internal file object has to be called "file"::
class FileProxy(FileProxyMixin):
def __init__(self, file):
self.file = file
"""
encoding = p... | ajibawa-2023/Python-Code-Large/train/row_98902 | 20 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98902:ClassDef_L1_C0", "label": "FileProxyMixin", "type": "class", "loc": [1, 29], "level": 0, "parent": null, "vector": [3, 0, 0.5172, 1.0, 0, 0.66, 0.0, 369, 0, 1, 0, 0, 186, 0, 17], "semantic": {"name": "FileProxyMixin", "arg_names": [], "import_names": [], "rhs_call... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98902:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98902:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98902:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98902:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
import os
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.utils.encoding import smart_str, smart_unicode
from django.core.files.utils import FileProxyMixin
class File(FileProxyMixin):
DEFAULT_CHUNK_SIZE = 64 * 2**10
def __init__(self, file... | ajibawa-2023/Python-Code-Large/train/row_98904 | 84 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98904:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0075, 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_98904:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98904:ImportFrom_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98904:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98904:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.core.files.base import File
| ajibawa-2023/Python-Code-Large/train/row_98905 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98905:ImportFrom_L1_C0", "label": "from django.core.files.base import File", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 293, 0, 1, 0, 0, 293, 0, 0], "semantic": {"name": "django.core.files.base", "arg_names": []... | [] |
"""
Portable file locking utilities.
Based partially on example by Jonathan Feignberg <jdf@pobox.com> in the Python
Cookbook, licensed under the Python Software License.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
Example Usage::
>>> from django.core.files import locks
>>> f... | ajibawa-2023/Python-Code-Large/train/row_98906 | 36 | 70 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98906:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 16], "level": 0, "parent": null, "vector": [8, 0, 0.1214, 0.2286, 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_98906:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98906:Import_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98906:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98906:Import_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
Functions that modify an HTTP request or response in some way.
"""
# This group of functions are run as part of the response handling, after
# everything else, including all response middleware. Think of them as
# "compulsory response middleware". Be careful about what goes here, because
# it's a little fid... | ajibawa-2023/Python-Code-Large/train/row_98908 | 34 | 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_98908: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_98908:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98908:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98908:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98908:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'Y. F j.'
TIME_FORMAT = 'G:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
MONTH_DAY_FORMAT = 'F j.'
SHORT_DATE_FORMAT = 'Y.m.d.'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPU... | ajibawa-2023/Python-Code-Large/train/row_98910 | 6 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98910:Assign_L5_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2778, 0.0556, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'j F Y' # '20 januari 2009'
TIME_FORMAT = 'H:i' # '15:23'
DATETIME_FORMAT = 'j F Y H:i' # '20 januari 2009 15:23'
YEAR_MONTH_FORMAT = 'F Y' ... | ajibawa-2023/Python-Code-Large/train/row_98911 | 14 | 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_98911:Assign_L5_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.1042, 0.0208, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DAY_FORMAT =
SHORT_DATE_FORMAT = 'd.n.Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FORMA... | ajibawa-2023/Python-Code-Large/train/row_98912 | 5 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98912:Assign_L5_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2778, 0.0556, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'd F Y' # 25 Ottobre 2006
TIME_FORMAT = 'H:i:s' # 14:30:59
DATETIME_FORMAT = 'l d F Y H:i:s' # Mercoledì 25 Ottobre 2006 14:30:59
YEAR_MONTH_FORMAT = 'F Y' # Ottobre 2006
MONTH_DAY_FORMAT = 'j/F' ... | ajibawa-2023/Python-Code-Large/train/row_98913 | 14 | 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_98913:Assign_L5_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.122, 0.0244, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rhs... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# DATE_FORMAT =
# TIME_FORMAT =
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DAY_FORMAT =
# SHORT_DATE_FORMAT =
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FORMATS =
# TIME_I... | ajibawa-2023/Python-Code-Large/train/row_98914 | 0 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd.m.Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FO... | ajibawa-2023/Python-Code-Large/train/row_98915 | 6 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98915:Assign_L5_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2778, 0.0556, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'G:i:s'
DATETIME_FORMAT = 'j. F Y G:i:s'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s'
FIRST_DAY_O... | ajibawa-2023/Python-Code-Large/train/row_98916 | 14 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98916:Assign_L5_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.1562, 0.0312, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'G:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd.m.Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FO... | ajibawa-2023/Python-Code-Large/train/row_98917 | 6 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98917:Assign_L5_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2778, 0.0556, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# DATE_FORMAT =
# TIME_FORMAT =
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DAY_FORMAT =
# SHORT_DATE_FORMAT =
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FORMATS =
# TIME_I... | ajibawa-2023/Python-Code-Large/train/row_98918 | 0 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
# MONTH_DAY_FORMAT =
SHORT_DATE_FORMAT = 'j M Y'
# SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK =
# DATE_INPUT_FORMATS ... | ajibawa-2023/Python-Code-Large/train/row_98919 | 3 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98919:Assign_L5_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2778, 0.0556, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.