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 |
|---|---|---|---|---|---|---|---|
"""
Cached, database-backed sessions.
"""
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import cache
KEY_PREFIX = "django.contrib.sessions.cached_db"
class SessionStore(DBStore):
"""
Implements cached, database backed sessions... | ajibawa-2023/Python-Code-Large/train/row_86467 | 38 | 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_86467:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0333, 0.05, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86467:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86467:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86467:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86467:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.cache import cache
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
def __init__(self, session_key=None):
self._cache = cache
s... | ajibawa-2023/Python-Code-Large/train/row_86468 | 39 | 66 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86468: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.0152, 0.0152, 0, 0.66, 0.0, 907, 0, 2, 0, 0, 907, 0, 0], "semantic": {"name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86468:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86468:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86468:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86468:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import with_statement
import datetime
import new
from django.template import Template, Context, defaultfilters
from django.test import TestCase
from django.utils import translation, tzinfo
from django.utils.translation import ugettext as _
from django.utils.html import escape
from django.utils.timezon... | ajibawa-2023/Python-Code-Large/train/row_86469 | 89 | 202 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86469:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.005, 0.005, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86469:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86469:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86469:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86469:For_L19_C8"}, {"f": "ajibawa-2023/Python-Cod... |
import re
from datetime import date, datetime, timedelta
from django import template
from django.conf import settings
from django.template import defaultfilters
from django.utils.encoding import force_unicode
from django.utils.formats import number_format
from django.utils.translation import pgettext, ungettext, ugett... | ajibawa-2023/Python-Code-Large/train/row_86470 | 107 | 224 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86470:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0045, 0.0045, 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_86470:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86470:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86470:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86470:Try_L20_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# Empty models.py to allow for specifying databrowse as a test label.
| ajibawa-2023/Python-Code-Large/train/row_86471 | 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"] | [] | [] |
from django.contrib import databrowse
from django.db import models
from django.test import TestCase
class SomeModel(models.Model):
some_field = models.CharField(max_length=50)
def __unicode__(self):
return self.some_field
class SomeOtherModel(models.Model):
some_other_field = models.CharField(m... | ajibawa-2023/Python-Code-Large/train/row_86472 | 30 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86472:ImportFrom_L1_C0", "label": "from django.contrib import databrowse", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0172, 0.0172, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "i... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86472:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86472:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86472:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86472:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.conf.urls import patterns
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),
(r'... | ajibawa-2023/Python-Code-Large/train/row_86473 | 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_86473:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 528, 0, 1, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names": [], "imp... | [] |
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
from dja... | ajibawa-2023/Python-Code-Large/train/row_86474 | 69 | 144 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86474:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0069, 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_86474:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86474:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86474:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86474:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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_unico... | ajibawa-2023/Python-Code-Large/train/row_86475 | 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_86475: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_86475:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86475:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86475:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86475: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_86476 | 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_86476: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_86476:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86476:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86476:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86476: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 DatabrowsePlugi... | ajibawa-2023/Python-Code-Large/train/row_86477 | 73 | 145 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86477:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0069, 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_86477:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86477:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86477:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86477: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.html', {'m... | ajibawa-2023/Python-Code-Large/train/row_86478 | 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_86478: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_86478:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86478:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86478:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86478:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import warnings
from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
warnings.warn("The Databrowse contrib app is deprecated",
PendingDeprecationWarning)
| ajibawa-2023/Python-Code-Large/train/row_86479 | 3 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86479:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [] |
"""
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, smart_str, i... | ajibawa-2023/Python-Code-Large/train/row_86480 | 151 | 217 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86480:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0115, 0.0184, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86480:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86480:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86480:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86480: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 test_paragraphs... | ajibawa-2023/Python-Code-Large/train/row_86481 | 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_86481: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_86481:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86481:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86481:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86481: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 commodo con... | ajibawa-2023/Python-Code-Large/train/row_86482 | 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_86482: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_86482:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86482:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86482:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86482: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):
try:
... | ajibawa-2023/Python-Code-Large/train/row_86483 | 32 | 66 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86483: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.0152, 0.0152, 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_86483:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86483:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86483:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86483: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, force_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_* metho... | ajibawa-2023/Python-Code-Large/train/row_86484 | 95 | 169 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86484:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0059, 0.0059, 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_86484:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86484:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86484:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86484:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from __future__ import with_statement
import urllib
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.views import shortcut
from django.contrib.sites.models import Site
from django.http import HttpRequest, Http404
from django.test import TestCase
... | ajibawa-2023/Python-Code-Large/train/row_86485 | 83 | 186 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86485:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0054, 0.0054, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86485:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86485:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86485:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86485:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Classes allowing "generic" relations through ContentType and object-id fields.
"""
from collections import defaultdict
from functools import partial
from operator import attrgetter
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import signals
from djan... | ajibawa-2023/Python-Code-Large/train/row_86486 | 273 | 498 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86486:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.004, 0.006, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86486:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86486:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86486:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86486:FunctionDef_L27_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
from django.utils.translation import ugettext as _
def shortcut(request, content_type_id, object_id):
"""
Redir... | ajibawa-2023/Python-Code-Large/train/row_86487 | 37 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86487:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 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_86487:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86487:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86487:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86487:Try_L12_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 model
... | ajibawa-2023/Python-Code-Large/train/row_86488 | 35 | 79 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86488:ImportFrom_L1_C0", "label": "from django.contrib.contenttypes.models import ContentType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0127, 0.0127, 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_86488:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86488:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86488:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86488: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_86489 | 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_86489: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": ... | [] |
from django import forms
class ManagementForm(forms.Form):
"""
``ManagementForm`` is used to keep track of the current wizard step.
"""
current_step = forms.CharField(widget=forms.HiddenInput)
| ajibawa-2023/Python-Code-Large/train/row_86490 | 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_86490:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86490:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86490:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86490:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86490:Assign_L7_C4"}] |
from django.contrib.formtools.wizard import storage
class SessionStorage(storage.BaseStorage):
def __init__(self, *args, **kwargs):
super(SessionStorage, self).__init__(*args, **kwargs)
if self.prefix not in self.request.session:
self.init_data()
def _get_data(self):
self... | ajibawa-2023/Python-Code-Large/train/row_86491 | 13 | 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_86491:ImportFrom_L1_C0", "label": "from django.contrib.formtools.wizard import storage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "django.contrib.formtoo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86491:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86491:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86491:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86491:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.core.exceptions import SuspiciousOperation
from django.core.signing import BadSignature
from django.utils import simplejson as json
from django.contrib.formtools.wizard import storage
class CookieStorage(storage.BaseStorage):
encoder = json.JSONEncoder(separators=(',', ':'))
def __init__(self, *... | ajibawa-2023/Python-Code-Large/train/row_86492 | 22 | 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_86492:ImportFrom_L1_C0", "label": "from django.core.exceptions import SuspiciousOperation", "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.excepti... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86492:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86492:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86492:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86492:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.core.exceptions import ImproperlyConfigured
class MissingStorageModule(ImproperlyConfigured):
pass
class MissingStorageClass(ImproperlyConfigured):
pass
class NoFileStorageConfigured(ImproperlyConfigured):
pass
| ajibawa-2023/Python-Code-Large/train/row_86493 | 4 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86493:ImportFrom_L1_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.1, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions",... | [] |
from django.core.files.uploadedfile import UploadedFile
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import smart_str
from django.utils.functional import lazy_property
from django.contrib.formtools.wizard.storage.exceptions import NoFileStorageConfigured
class BaseStorage(object)... | ajibawa-2023/Python-Code-Large/train/row_86494 | 59 | 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_86494:ImportFrom_L1_C0", "label": "from django.core.files.uploadedfile import UploadedFile", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.core.files.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86494:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86494:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86494:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86494:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import re
from django import forms
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.forms import formsets, ValidationError
from django.views.generic import TemplateView
from django.utils.datastructures import SortedDict
from django.utils.decorators import classonlymethod
... | ajibawa-2023/Python-Code-Large/train/row_86496 | 308 | 702 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86496:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0014, 0.0014, 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_86496:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86496:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86496:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86496:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib.formtools.wizard.legacy import FormWizard
| ajibawa-2023/Python-Code-Large/train/row_86497 | 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_86497:ImportFrom_L1_C0", "label": "from django.contrib.formtools.wizard.legacy import FormWizard", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 255, 0, 1, 0, 0, 255, 0, 0], "semantic": {"name": "django.contrib.for... | [] |
"""
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.
"""
from django.forms import HiddenInput
from django.http import Http404
from django.shortcuts import render_to_response
from django.templa... | ajibawa-2023/Python-Code-Large/train/row_86498 | 104 | 270 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86498:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0111, 0.0185, 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_86498:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86498:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86498:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86498:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django import forms
from django.contrib.formtools.wizard import FormWizard
from django.http import HttpResponse
class Page1(forms.Form):
name = forms.CharField(max_length=100)
thirsty = forms.NullBooleanField()
class Page2(forms.Form):
address1 = forms.CharField(max_length=100)
address2 = forms.C... | ajibawa-2023/Python-Code-Large/train/row_86499 | 32 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86499:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86499:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86499:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86499:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86499:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from datetime import datetime
from django.http import HttpRequest
from django.conf import settings
from django.utils.importlib import import_module
from django.contrib.auth.models import User
def get_request():
request = HttpRequest()
engine = import_module(settings.SESSION_ENGINE)
request.session = eng... | ajibawa-2023/Python-Code-Large/train/row_86500 | 50 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86500:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.013, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86500:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86500:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86500:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86500:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Co... |
import os
import tempfile
from django import forms
from django.contrib.auth.models import User
from django.core.files.storage import FileSystemStorage
from django.forms.formsets import formset_factory
from django.forms.models import modelformset_factory
from django.http import HttpResponse
from django.template import ... | ajibawa-2023/Python-Code-Large/train/row_86501 | 46 | 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_86501:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86501:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86501:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86501:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86501:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import with_statement
import os
from django import forms
from django.test import TestCase
from django.test.client import RequestFactory
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.formtools.wizard.views import CookieWizardView
from django.contrib.for... | ajibawa-2023/Python-Code-Large/train/row_86502 | 210 | 379 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86502:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86502:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86502:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86502:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86502:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.conf.urls import patterns, url
from django.contrib.formtools.tests.wizard.wizardtests.forms import (
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
urlpatterns = patterns('',
url(r'^wiz_session/$', SessionContactWizard.as_view(
[('form1', Page1),
('form2', P... | ajibawa-2023/Python-Code-Large/train/row_86503 | 3 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86503:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [] |
from django import forms, http
from django.conf import settings
from django.test import TestCase
from django.template.response import TemplateResponse
from django.utils.importlib import import_module
from django.contrib.auth.models import User
from django.contrib.formtools.wizard.views import (WizardView,
... | ajibawa-2023/Python-Code-Large/train/row_86504 | 134 | 205 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86504:ImportFrom_L1_C0", "label": "from django import forms, http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 294, 0, 2, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86504:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86504:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86504:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86504:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.test import TestCase
from django.core import signing
from django.core.exceptions import SuspiciousOperation
from django.http import HttpResponse
from django.contrib.formtools.wizard.storage.cookie import CookieStorage
from django.contrib.formtools.tests.wizard.storage import get_request, TestStorage
clas... | ajibawa-2023/Python-Code-Large/train/row_86505 | 30 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86505:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86505:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86505:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86505:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86505:Return_L12_C8"}, {"f": "ajibawa-2023/Python-... |
from django.test import TestCase
from django.contrib.formtools.tests.wizard.storage import TestStorage
from django.contrib.formtools.wizard.storage.session import SessionStorage
class TestSessionStorage(TestStorage, TestCase):
def get_storage(self):
return SessionStorage
| ajibawa-2023/Python-Code-Large/train/row_86506 | 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_86506:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86506:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86506:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86506:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86506:Return_L9_C8"}] |
import os
import tempfile
from django import forms
from django.core.files.storage import FileSystemStorage
from django.forms.formsets import formset_factory
from django.http import HttpResponse
from django.template import Template, Context
from django.contrib.auth.models import User
from django.contrib.formtools.wiz... | ajibawa-2023/Python-Code-Large/train/row_86507 | 34 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86507:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0192, 0.0192, 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_86507:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86507:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86507:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86507:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.core.urlresolvers import reverse
from django.http import QueryDict
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.formtools.wizard.views import (NamedUrlSessionWizardView,
NamedUrlCookieWizardView)
from dj... | ajibawa-2023/Python-Code-Large/train/row_86508 | 175 | 366 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86508:ImportFrom_L1_C0", "label": "from django.core.urlresolvers import reverse", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0027, 0.0027, 0, 0.66, 0.0, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86508:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86508:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86508:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86508:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.conf.urls import patterns, url
from django.contrib.formtools.tests.wizard.namedwizardtests.forms import (
SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
def get_named_session_wizard():
return SessionContactWizard.as_view(
[('form1', Page1), ('form2', Page2), ('form3'... | ajibawa-2023/Python-Code-Large/train/row_86509 | 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_86509:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86509:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86509:Return_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86509:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86509:Return_L13_C4"}] |
from django.test import TestCase
from django.contrib.formtools.wizard.storage import (get_storage,
MissingStorageModule,
MissingStorageClass)
from django.contrib.formtools.wizard.storage.base import BaseStorage
... | ajibawa-2023/Python-Code-Large/train/row_86510 | 10 | 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_86510:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86510:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86510:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86510:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86510:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from django.contrib.formtools.tests.wizard.cookiestorage import TestCookieStorage
from django.contrib.formtools.tests.wizard.forms import FormTests, SessionFormTests, CookieFormTests
from django.contrib.formtools.tests.wizard.loadstorage import TestLoadStorage
from django.contrib.formtools.tests.wizard.namedwizardtests... | ajibawa-2023/Python-Code-Large/train/row_86511 | 6 | 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_86511:ImportFrom_L1_C0", "label": "from django.contrib.formtools.tests.wizard.cookiestorage import TestCookieStorage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 832, 0, 1, 0, 0, 832, 0, 0], "semantic": {"... | [] |
"""
This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
"""
from __future__ import absolute_import
from django.conf.urls import patterns, url
from django.contrib.formtools.tests import TestFormPreview, TestWizardClass
from django.contrib.formtools.tests.forms import (ContactWizard, Page1,... | ajibawa-2023/Python-Code-Large/train/row_86512 | 6 | 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_86512: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... | [] |
import os
import re
import warnings
from django import http
from django.conf import settings
from django.contrib.formtools import preview, utils
from django.contrib.formtools.wizard import FormWizard
from django.test import TestCase
from django.test.utils import get_warnings_state, restore_warnings_state
from django.u... | ajibawa-2023/Python-Code-Large/train/row_86513 | 247 | 462 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86513:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0022, 0.0022, 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_86513:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86513:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86513:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86513:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Formtools Preview application.
"""
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.utils.crypto import constant_time_compare
from django.contrib.formtools.utils import form_hmac
AUTO_ID = 'formtools_%s' # Each form here... | ajibawa-2023/Python-Code-Large/train/row_86514 | 70 | 148 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86514:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0135, 0.0203, 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_86514:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86514:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86514:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86514:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
try:
import cPickle as pickle
except ImportError:
import pickle
import hashlib
from django.conf import settings
from django.utils.crypto import salted_hmac
def security_hash(request, form, *args):
"""
Calculates a security hash for the given Form instance.
This creates a list of the form field n... | ajibawa-2023/Python-Code-Large/train/row_86515 | 35 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86515:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.041, 0.0656, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snip... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86515:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86515:Import_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86515:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86515:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
from django.utils.http import http_date, parse_http_date_safe
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 replaced by an HttpNotModified.
... | ajibawa-2023/Python-Code-Large/train/row_86516 | 20 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86516:ImportFrom_L1_C0", "label": "from django.utils.http import http_date, parse_http_date_safe", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0286, 0.0286, 0, 0.66, 0.0, 516, 0, 2, 0, 0, 516, 0, 0], "semantic": {"name": "django.utils... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86516:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86516:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86516:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86516:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"This is the locale selecting middleware that will look at accept headers"
from django.conf import settings
from django.core.urlresolvers import (is_valid_path, get_resolver,
LocaleRegexURLResolver)
from django.http import HttpResponseRedirect
from django.utils.cache import patch_... | ajibawa-2023/Python-Code-Large/train/row_86517 | 34 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86517:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86517:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86517:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86517:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86517:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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, so that cac... | ajibawa-2023/Python-Code-Large/train/row_86518 | 28 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86518:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0217, 0.0217, 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_86518:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86518:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86518:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86518: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 HEAD and ... | ajibawa-2023/Python-Code-Large/train/row_86519 | 10 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86519:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 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_86519:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86519:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86519:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86519: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 hashlib
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache import patch_vary_h... | ajibawa-2023/Python-Code-Large/train/row_86520 | 85 | 216 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86520:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0162, 0.0278, 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_86520:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86520:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86520:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86520:Return_L32_C4"}, {"f": "ajibawa-2023/Python-Code... |
import hashlib
import re
from django.conf import settings
from django import http
from django.core.mail import mail_managers
from django.utils.http import urlquote
from django.core import urlresolvers
from django.utils.log import getLogger
logger = getLogger('django.request')
class CommonMiddleware(object):
"""... | ajibawa-2023/Python-Code-Large/train/row_86521 | 76 | 153 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86521:Import_L1_C0", "label": "hashlib import hashlib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0065, 0, 0.66, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86521:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86521:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86521:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86521:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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
exc... | ajibawa-2023/Python-Code-Large/train/row_86522 | 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_86522: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_86522:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86522:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86522:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86522:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Clickjacking Protection Middleware.
This module provides a middleware that implements protection against a
malicious site loading resources from your site in a hidden frame.
"""
from django.conf import settings
class XFrameOptionsMiddleware(object):
"""
Middleware that sets the X-Frame-Options HTTP heade... | ajibawa-2023/Python-Code-Large/train/row_86523 | 14 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86523:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0686, 0.1176, 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_86523:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86523:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86523:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86523:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
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.UpdateCa... | ajibawa-2023/Python-Code-Large/train/row_86524 | 93 | 205 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86524:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 49], "level": 0, "parent": null, "vector": [8, 0, 0.122, 0.239, 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_86524:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86524:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86524:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86524:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.template import Library, TemplateSyntaxError
from django.template.defaulttags import kwarg_re, SsiNode, URLNode
register = Library()
@register.tag
def ssi(parser, token):
"""
Outputs the contents of a given file into the page.
Like a simple "include" tag, the ``ssi`` tag includes the contents... | ajibawa-2023/Python-Code-Large/train/row_86525 | 34 | 124 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86525:ImportFrom_L1_C0", "label": "from django.template import Library, TemplateSyntaxError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0081, 0.0081, 0, 0.66, 0.0, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86525:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86525:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86525:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86525:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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()
@register.filter(is_safe=False)
def localize(value):
"""
Forces a value to be rendered as a localized value,
regar... | ajibawa-2023/Python-Code-Large/train/row_86526 | 34 | 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_86526:ImportFrom_L1_C0", "label": "from django.template import Node", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0161, 0.0161, 0, 0.66, 0.0, 213, 0, 1, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86526:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86526:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86526:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86526:Return_L14_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from urlparse import urljoin
from django import template
from django.utils.encoding import iri_to_uri
register = template.Library()
class PrefixNode(template.Node):
def __repr__(self):
return "<PrefixNode for %r>" % self.name
def __init__(self, varname=None, name=None):
if name is None:
... | ajibawa-2023/Python-Code-Large/train/row_86527 | 40 | 102 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86527:ImportFrom_L1_C0", "label": "from urlparse import urljoin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0098, 0, 0.66, 0.0, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86527:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86527:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86527:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86527:Return_L10_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from __future__ import with_statement
from datetime import datetime, tzinfo
try:
import pytz
except ImportError:
pytz = None
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import timezone
register = Library()
# HACK: datetime is an old-style cla... | ajibawa-2023/Python-Code-Large/train/row_86528 | 87 | 202 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86528:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.005, 0.005, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86528:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86528:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86528:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86528:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
from __future__ import with_statement
import re
from django.template import (Node, Variable, TemplateSyntaxError,
TokenParser, Library, TOKEN_TEXT, TOKEN_VAR)
from django.template.base import _render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import translation
regist... | ajibawa-2023/Python-Code-Large/train/row_86529 | 221 | 477 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86529:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0021, 0.0021, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86529:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86529:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86529:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86529:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
import hashlib
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.http import urlquote
register = Library()
class CacheNode(Node):
def __init__(self, nodelist, expire_time... | ajibawa-2023/Python-Code-Large/train/row_86530 | 31 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86530:Import_L1_C0", "label": "hashlib import hashlib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0164, 0.0164, 0, 0.66, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86530:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86530:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86530:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86530:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
"""
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.base import DeserializationError
from django.core.serializers.python import Serializer as PythonSeriali... | ajibawa-2023/Python-Code-Large/train/row_86531 | 31 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86531:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0492, 0.082, 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_86531:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86531:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86531:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86531:Return_L18_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from dj... | ajibawa-2023/Python-Code-Large/train/row_86532 | 49 | 78 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86532:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0256, 0.0385, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86532:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86532:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86532:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86532:Assign_L19_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_86533 | 159 | 292 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86533:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0068, 0.0103, 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_86533:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86533:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86533:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86533: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
from dj... | ajibawa-2023/Python-Code-Large/train/row_86534 | 79 | 139 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86534:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0216, 0.036, 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_86534:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86534:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86534:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86534: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_unicode
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
pass
class SerializationError(Exception):
"""... | ajibawa-2023/Python-Code-Large/train/row_86535 | 81 | 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_86535: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_86535:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86535:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86535:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86535:Expr_L15_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_86536 | 58 | 124 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86536:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0726, 0.1371, 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_86536:Try_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86536:Import_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86536:Try_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86536:Assign_L33_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 django.conf... | ajibawa-2023/Python-Code-Large/train/row_86537 | 51 | 100 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86537:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.045, 0.08, 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_86537:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86537:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86537:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86537:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python... |
import mimetypes
import os
import random
import time
from email import charset as Charset, encoders as Encoders
from email.generator import Generator
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.header import Header
from email.utils ... | ajibawa-2023/Python-Code-Large/train/row_86538 | 210 | 363 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86538:Import_L1_C0", "label": "mimetypes import mimetypes", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0028, 0.0028, 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_86538:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86538:ImportFrom_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86538:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86538:ImportFrom_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
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 get_fqdn(sel... | ajibawa-2023/Python-Code-Large/train/row_86539 | 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_86539: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_86539:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86539:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86539:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86539: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_86540 | 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_86540: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_86540:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86540:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86540:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86540: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)
self._loc... | ajibawa-2023/Python-Code-Large/train/row_86541 | 26 | 34 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86541:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0588, 0.0882, 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_86541:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86541:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86541:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86541: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
from django.core.mail.message import sanitize_address
class EmailBackend(BaseEmailBackend):
"""
... | ajibawa-2023/Python-Code-Large/train/row_86542 | 76 | 115 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86542:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0087, 0.0087, 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_86542:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86542:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86542:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86542:FunctionDef_L16_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):
"""Op... | ajibawa-2023/Python-Code-Large/train/row_86543 | 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_86543: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_86543:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86543:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86543:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86543:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
# Mail backends shipped with Django.
| ajibawa-2023/Python-Code-Large/train/row_86544 | 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 them out o... | ajibawa-2023/Python-Code-Large/train/row_86545 | 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_86545: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_86545:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86545:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86545:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86545:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import os
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 force_unicode, iri_to_uri
from django... | ajibawa-2023/Python-Code-Large/train/row_86548 | 105 | 180 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86548:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0056, 0.0056, 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_86548:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86548:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86548:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86548:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-... |
import hotshot
import os
import time
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 appe... | ajibawa-2023/Python-Code-Large/train/row_86549 | 11 | 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_86549:Import_L1_C0", "label": "hotshot import hotshot", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.04, 0, 0.66, 0.0, 974, 0, 1, 0, 0, 974, 0, 0], "semantic": {"name": "hotshot", "arg_names": [], "import_names": ["hotshot"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86549:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86549:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86549:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86549:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import sys
from threading import Lock
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructure... | ajibawa-2023/Python-Code-Large/train/row_86551 | 134 | 254 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86551:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0039, 0.0039, 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_86551:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86551:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86551:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86551:ImportFrom_L6_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_86553 | 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_86553: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
self.per_pa... | ajibawa-2023/Python-Code-Large/train/row_86554 | 98 | 158 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86554:ImportFrom_L1_C0", "label": "from math import ceil", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 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_86554:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86554:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86554:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86554: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 custo... | ajibawa-2023/Python-Code-Large/train/row_86558 | 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_86558: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_86558:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86558:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86558:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86558: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 when only one ... | ajibawa-2023/Python-Code-Large/train/row_86560 | 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_86560: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_86560:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86560:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86560:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86560: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 module n... | ajibawa-2023/Python-Code-Large/train/row_86562 | 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_86562: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_86562:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86562:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86562:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86562: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_86564 | 44 | 83 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86564:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.012, 0.012, 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_86564:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86564:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86564:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86564: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 \
sample.sta... | ajibawa-2023/Python-Code-Large/train/row_86565 | 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_86565: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_86565:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86565:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86565:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86565: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(NoArgsComm... | ajibawa-2023/Python-Code-Large/train/row_86566 | 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_86566: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_86566:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86566:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86566:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86566: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."
option_list =... | ajibawa-2023/Python-Code-Large/train/row_86567 | 103 | 173 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86567:Import_L1_C0", "label": "keyword import keyword", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0058, 0.0058, 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_86567:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86567:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86567:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86567: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)."
option_... | ajibawa-2023/Python-Code-Large/train/row_86569 | 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_86569: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_86569:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86569:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86569:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86569: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.")
option_lis... | ajibawa-2023/Python-Code-Large/train/row_86570 | 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_86570: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_86570:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86570:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86570:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86570: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_86571 | 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_86571: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_86571:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86571:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86571:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86571: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
from djan... | ajibawa-2023/Python-Code-Large/train/row_86572 | 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_86572: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_86572:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86572:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86572:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86572: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)."
option_list... | ajibawa-2023/Python-Code-Large/train/row_86573 | 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_86573: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_86573:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86573:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86573:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86573:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import fnmatch
import glob
import os
import re
import sys
from itertools import dropwhile
from optparse import make_option
from subprocess import PIPE, Popen
import django
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.text import get_text_list
from django.utils.jslex import prep... | ajibawa-2023/Python-Code-Large/train/row_86574 | 237 | 406 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86574:Import_L1_C0", "label": "fnmatch import fnmatch", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0025, 0.0025, 0, 0.66, 0.0, 626, 0, 1, 0, 0, 626, 0, 0], "semantic": {"name": "fnmatch", "arg_names": [], "import_names": ["fnmatch"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86574:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86574:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86574:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86574:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code... |
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 = AppComm... | ajibawa-2023/Python-Code-Large/train/row_86576 | 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_86576: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_86576:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86576:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86576:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86576: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 database to th... | ajibawa-2023/Python-Code-Large/train/row_86577 | 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_86577: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_86577:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86577:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86577:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86577: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 + (
mak... | ajibawa-2023/Python-Code-Large/train/row_86578 | 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_86578: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_86578:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86578:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86578:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86578:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import sys
import os
from optparse import make_option, OptionParser
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.utils import get_runner
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput',
actio... | ajibawa-2023/Python-Code-Large/train/row_86579 | 36 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86579:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0133, 0.0133, 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_86579:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86579:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86579:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86579:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.