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 |
|---|---|---|---|---|---|---|---|
import datetime
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation
from django.db import IntegrityError, transaction, router
from django.utils.encoding import force_unicode
class SessionStore(SessionBase):
... | ajibawa-2023/Python-Code-Large/train/row_85683 | 46 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85683:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0122, 0.0122, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85683:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85683:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85683:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85683:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import base64
import os
import random
import sys
import time
from datetime import datetime, timedelta
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.utils.hashcompat import md5_constructor
from ... | ajibawa-2023/Python-Code-Large/train/row_85684 | 174 | 309 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85684:Import_L1_C0", "label": "base64 import base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 0, 0.66, 0.0, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "base64", "arg_names": [], "import_names": ["base64"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85684:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85684:Import_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85684:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85684:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
"""
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_85685 | 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_85685:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0435, 0.0652, 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_85685:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85685:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85685:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85685:FunctionDef_L16_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
su... | ajibawa-2023/Python-Code-Large/train/row_85686 | 37 | 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_85686: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.0172, 0.0172, 0, 0.66, 0.0, 907, 0, 2, 0, 0, 907, 0, 0], "semantic": {"name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85686:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85686:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85686:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85686:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.utils.translation import ungettext, ugettext as _
from django.utils.encoding import force_unicode
from django import template
from django.template import defaultfilters
from datetime import date
import re
register = template.Library()
def ordinal(value):
"""
Converts an integer to its ordinal as a... | ajibawa-2023/Python-Code-Large/train/row_85687 | 71 | 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_85687:ImportFrom_L1_C0", "label": "from django.utils.translation import ungettext, _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0098, 0, 0.66, 0.0, 389, 0, 2, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85687:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85687:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85687:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85687:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.conf.urls.defaults import *
from django.contrib.databrowse import views
# Note: The views in this URLconf all require a 'models' argument,
# which is a list of model classes (*not* instances).
urlpatterns = patterns('',
#(r'^$', views.homepage),
#(r'^([^/]+)/([^/]+)/$', views.model_detail),
(... | ajibawa-2023/Python-Code-Large/train/row_85688 | 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_85688:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names... | [] |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import force_unicode
from dja... | ajibawa-2023/Python-Code-Large/train/row_85689 | 52 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85689:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0116, 0.0116, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85689:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85689:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85689:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85689:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-... |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.contrib.databrowse.sites import DatabrowsePlugin
from django.shortcuts import render_to_response
from django.utils.text import capfirst
from django.utils.encoding import smart_str, force_unico... | ajibawa-2023/Python-Code-Large/train/row_85690 | 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_85690: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_85690:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85690:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85690:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85690: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_85691 | 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_85691: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_85691:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85691:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85691:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85691: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_85692 | 77 | 149 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85692:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85692:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85692:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85692:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85692: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_85693 | 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_85693: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_85693:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85693:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85693:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85693:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite, site
| ajibawa-2023/Python-Code-Large/train/row_85694 | 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_85694:ImportFrom_L1_C0", "label": "from django.contrib.databrowse.sites import DatabrowsePlugin, ModelDatabrowse, DatabrowseSite\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 231, 0, 4, 0, 0, 231, 0, 0], "s... | [] |
"""
These classes are light wrappers around Django's database API that provide
convenience functionality and permalink functions for the databrowse app.
"""
from django.db import models
from django.utils import formats
from django.utils.text import capfirst
from django.utils.encoding import smart_unicode, smart_str, i... | ajibawa-2023/Python-Code-Large/train/row_85695 | 150 | 215 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85695:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0116, 0.0186, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85695:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85695:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85695:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85695: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_85696 | 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_85696: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_85696:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85696:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85696:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85696: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_85697 | 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_85697: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_85697:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85697:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85697:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85697: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_85698 | 33 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85698:ImportFrom_L1_C0", "label": "from django.contrib.webdesign.lorem_ipsum import words, paragraphs", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 74, 0, 2, 0, 0, 74, 0, 0], "semantic": {"name": "django.co... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85698:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85698:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85698:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85698:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
class ContentTypeManager(models.Manager):
# Cache to avoid re-looking up ContentType objects all over the place.
# This cache is shared by all the get_for_* methods.
_cache ... | ajibawa-2023/Python-Code-Large/train/row_85699 | 60 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85699:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0095, 0.0095, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85699:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85699:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85699:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85699:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django import db
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.contenttypes.views import shortcut
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test... | ajibawa-2023/Python-Code-Large/train/row_85700 | 45 | 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_85700:ImportFrom_L1_C0", "label": "from django import db", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0133, 0.0133, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["db"], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85700:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85700:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85700:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85700:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Classes allowing "generic" relations through ContentType and object-id fields.
"""
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db.models import signals
from django.db import models, router, DEFAULT_DB_ALIAS
from django.db.models.fields.related import RelatedFi... | ajibawa-2023/Python-Code-Large/train/row_85701 | 237 | 432 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85701:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0046, 0.0069, 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_85701:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85701:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85701:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85701:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django import http
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site, get_current_site
from django.core.exceptions import ObjectDoesNotExist
def shortcut(request, content_type_id, object_id):
"Redirect to an object's page based on a content-type ID and an ... | ajibawa-2023/Python-Code-Large/train/row_85702 | 35 | 71 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85702:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85702:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85702:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85702:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85702:Try_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.contrib.contenttypes.models import ContentType
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_unicode
def update_contenttypes(app, created_models, verbosity=2, **kwargs):
"""
Creates content types for models in the given app, removing any model
... | ajibawa-2023/Python-Code-Large/train/row_85703 | 37 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85703:ImportFrom_L1_C0", "label": "from django.contrib.contenttypes.models import ContentType", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 0, 0.66, 0.0, 469, 0, 1, 0, 0, 469, 0, 0], "semantic": {"name": "django.contrib.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85703:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85703:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85703:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85703: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_85704 | 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_85704:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 1.0, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ... | [] |
"""
This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
"""
from django.conf.urls.defaults import *
from django.contrib.formtools.tests import *
urlpatterns = patterns('',
(r'^test1/', TestFormPreview(TestForm)),
(r'^test2/', UserSecuredFormPre... | ajibawa-2023/Python-Code-Large/train/row_85705 | 4 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85705:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1176, 0.1765, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import os
from django import forms, http
from django.conf import settings
from django.contrib.formtools import preview, wizard, utils
from django.test import TestCase
from django.utils import unittest
success_string = "Done was called!"
class TestFormPreview(preview.FormPreview):
def get_context(self, request, ... | ajibawa-2023/Python-Code-Large/train/row_85706 | 219 | 425 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85706:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0024, 0.0024, 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_85706:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85706:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85706:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85706:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Formtools Preview application.
"""
import cPickle as pickle
from django.conf import settings
from django.http import Http404
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.utils.hashcompat import md5_constructor
from django.utils.crypto import consta... | ajibawa-2023/Python-Code-Large/train/row_85707 | 79 | 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_85707:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0118, 0.0178, 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_85707:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85707:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85707:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85707:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
try:
import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.forms import BooleanField
from django.utils.crypto import salted_hmac
from django.utils.hashcompat import md5_constructor
def security_hash(request, form, *args):
"""
Calculates a security has... | ajibawa-2023/Python-Code-Large/train/row_85708 | 36 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85708:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0397, 0.0635, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "sni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85708:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85708:Import_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85708:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85708:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
"""
FormWizard class -- implements a multi-page form, validating between each
step and storing the form's state as HTML hidden fields so that no state is
stored on the server side.
"""
import cPickle as pickle
from django import forms
from django.conf import settings
from django.contrib.formtools.utils import securit... | ajibawa-2023/Python-Code-Large/train/row_85709 | 111 | 287 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85709:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0105, 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_85709:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85709:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85709:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85709:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.core.exceptions import MiddlewareNotUsed
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, ... | ajibawa-2023/Python-Code-Large/train/row_85710 | 21 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85710:ImportFrom_L1_C0", "label": "from django.core.exceptions import MiddlewareNotUsed", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0278, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exception... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85710:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85710:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85710:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85710:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"this is the locale selecting middleware that will look at accept headers"
from django.utils.cache import patch_vary_headers
from django.utils import translation
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to install in the... | ajibawa-2023/Python-Code-Large/train/row_85711 | 15 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85711:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.04, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85711:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85711:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85711:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85711:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, so that cac... | ajibawa-2023/Python-Code-Large/train/row_85712 | 23 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85712:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0263, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85712:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85712:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85712:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85712: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_85713 | 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_85713:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85713:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85713:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85713:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85713:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
"""
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import itertools
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache import patch_vary... | ajibawa-2023/Python-Code-Large/train/row_85714 | 127 | 325 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85714:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0108, 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_85714:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85714:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85714:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85714:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
exc... | ajibawa-2023/Python-Code-Large/train/row_85716 | 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_85716: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_85716:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85716:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85716:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85716:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCa... | ajibawa-2023/Python-Code-Large/train/row_85717 | 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_85717: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_85717:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85717:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85717:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85717:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.template import Library, Node, Template, TemplateSyntaxError
from django.template.defaulttags import kwarg_re, include_is_allowed, SsiNode, URLNode
from django.utils.encoding import smart_str
register = Library()
@register.tag
def ssi(parser, token):
"""
Outputs t... | ajibawa-2023/Python-Code-Large/train/row_85718 | 36 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85718:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0101, 0.0101, 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_85718:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85718:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85718:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85718:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.conf import settings
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import formats
from django.utils.encoding import force_unicode
register = Library()
def localize(value):
"""
Forces a value to be rendered as a localized value,
reg... | ajibawa-2023/Python-Code-Large/train/row_85719 | 39 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85719:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85719:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85719:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85719:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85719:Return_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
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:
raise template.Templa... | ajibawa-2023/Python-Code-Large/train/row_85720 | 36 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85720:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0119, 0.0119, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["te... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85720:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85720:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85720:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85720:Return_L9_C8"}, {"f": "ajibawa-2023/Python-Code... |
import re
from django.template import Node, Variable, VariableNode
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.template.base import _render_value_in_context
from django.utils import translation
from django.utils.encoding import for... | ajibawa-2023/Python-Code-Large/train/row_85721 | 185 | 370 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85721:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0027, 0.0027, 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_85721:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85721:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85721:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85721:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-... |
from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.utils.http import urlquote
from django.utils.hashcompat import md5_constructor
regi... | ajibawa-2023/Python-Code-Large/train/row_85722 | 33 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85722:ImportFrom_L1_C0", "label": "from django.template import Library, Node, TemplateSyntaxError\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 213, 0, 5, 0, 0, 213, 0, 0], "semantic": {"name": "djang... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85722:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85722:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85722:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85722:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-... |
# This module is DEPRECATED!
#
# You should no longer be using django.template_loader.
#
# Use django.template.loader instead.
from django.template.loader import *
| ajibawa-2023/Python-Code-Large/train/row_85723 | 1 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85723:ImportFrom_L7_C0", "label": "from django.template.loader import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.1429, 0, 0.66, 0.0, 970, 0, 1, 0, 0, 970, 0, 0], "semantic": {"name": "django.template.loader", "arg_names": []... | [] |
"""
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
from StringIO import StringIO
import decimal
import yaml
from django.db import models
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as... | ajibawa-2023/Python-Code-Large/train/row_85724 | 29 | 56 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85724:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0536, 0.0893, 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_85724:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85724:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85724:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85724:Return_L17_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils import simpl... | ajibawa-2023/Python-Code-Large/train/row_85725 | 40 | 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_85725:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0323, 0.0484, 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_85725:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85725:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85725:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85725:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
XML serializer.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models, DEFAULT_DB_ALIAS
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.encoding import smart_unicode
from xml.dom import pulldom
class Serializer(base.Serializer):
"""
... | ajibawa-2023/Python-Code-Large/train/row_85726 | 161 | 297 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85726:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0067, 0.0101, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85726:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85726:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85726:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85726: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_85727 | 80 | 142 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85727:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0352, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85727:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85727:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85727:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85727:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Module for abstract serializer/unserializer base classes.
"""
from StringIO import StringIO
from django.db import models
from django.utils.encoding import smart_str, smart_unicode
from django.utils import datetime_safe
class SerializationError(Exception):
"""Something bad happened during serialization."""
... | ajibawa-2023/Python-Code-Large/train/row_85728 | 82 | 172 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85728: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_85728:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85728:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85728:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85728:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Interfaces for serializing Django objects.
Usage::
from django.core import serializers
json = serializers.serialize("json", some_query_set)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES = {
... | ajibawa-2023/Python-Code-Large/train/row_85729 | 54 | 117 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85729:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0769, 0.1453, 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_85729:Try_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85729:Import_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85729:Try_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85729:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from django.conf... | ajibawa-2023/Python-Code-Large/train/row_85730 | 54 | 113 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85730:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0398, 0.0708, 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_85730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85730:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85730:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85730:Import_L22_C4"}, {"f": "ajibawa-2023/Python-Code... |
import mimetypes
import os
import random
import time
from email import Charset, Encoders
try:
from email.generator import Generator
except ImportError:
from email.Generator import Generator # TODO: Remove when remove Python 2.4 support
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMult... | ajibawa-2023/Python-Code-Large/train/row_85731 | 209 | 362 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85731: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_85731:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85731:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85731:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85731:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
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_85732 | 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_85732: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_85732:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85732:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85732:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85732: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_85733 | 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_85733: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_85733:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85733:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85733:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85733: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_85734 | 27 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85734:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0541, 0.0811, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85734:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85734:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85734:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85734: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_85735 | 72 | 109 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85735:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0092, 0.0092, 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_85735:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85735:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85735:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85735: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_85736 | 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_85736: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_85736:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85736:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85736:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85736:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
# Mail backends shipped with Django.
| ajibawa-2023/Python-Code-Large/train/row_85737 | 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_85738 | 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_85738: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_85738:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85738:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85738:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85738:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import os
from pprint import pformat
import sys
from warnings import warn
from django import http
from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
from django.utils.encoding import force_unic... | ajibawa-2023/Python-Code-Large/train/row_85741 | 122 | 212 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85741:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0047, 0.0047, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85741:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85741:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85741:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85741:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-... |
import hotshot, time, os
from django.core.handlers.modpython import ModPythonHandler
PROFILE_DATA_DIR = "/var/log/cmsprofile"
def handler(req):
'''
Handler that uses hotshot to store profile data.
Stores profile data in PROFILE_DATA_DIR. Since hotshot has no way (that I
know of) to append profile da... | ajibawa-2023/Python-Code-Large/train/row_85742 | 9 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85742:Import_L1_C0", "label": "hotshot import hotshot, time, os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 974, 0, 3, 0, 0, 974, 0, 0], "semantic": {"name": "hotshot", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85742:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85742:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85742:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85742:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from pprint import pformat
import sys
from threading import Lock
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import socket
from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script_pref... | ajibawa-2023/Python-Code-Large/train/row_85744 | 155 | 286 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85744:ImportFrom_L1_C0", "label": "from pprint import pformat", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 0, 0.66, 0.0, 276, 0, 1, 0, 0, 276, 0, 0], "semantic": {"name": "pprint", "arg_names": [], "import_names": ["pfo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85744:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85744:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85744:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85744:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.dispatch import Signal
request_started = Signal()
request_finished = Signal()
got_request_exception = Signal(providing_args=["request"])
| ajibawa-2023/Python-Code-Large/train/row_85746 | 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_85746: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_85747 | 76 | 120 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85747:ImportFrom_L1_C0", "label": "from math import ceil", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0083, 0.0083, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["ceil"], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85747:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85747:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85747:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85747: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_85750 | 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_85750: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_85750:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85750:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85750:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85750: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 w... | ajibawa-2023/Python-Code-Large/train/row_85752 | 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_85752: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_85752:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85752:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85752:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85752: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_85753 | 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_85753: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_85753:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85753:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85753:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85753: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_85755 | 45 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85755:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0119, 0.0119, 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_85755:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85755:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85755:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85755: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_85756 | 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_85756: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_85756:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85756:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85756:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85756: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_85757 | 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_85757: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_85757:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85757:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85757:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85757: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_85758 | 99 | 167 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85758:Import_L1_C0", "label": "keyword import keyword", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.006, 0.006, 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_85758:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85758:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85758:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85758: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_85760 | 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_85760: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_85760:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85760:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85760:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85760: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_85761 | 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_85761: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_85761:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85761:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85761:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85761: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_85762 | 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_85762: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_85762:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85762:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85762:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85762: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_85763 | 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_85763: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_85763:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85763:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85763:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85763: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_85764 | 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_85764: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_85764:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85764:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85764:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85764: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
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.text import get_text_list
pythonize_re = re.compile(r'(?:^|\n)\s*//')
plur... | ajibawa-2023/Python-Code-Large/train/row_85765 | 223 | 365 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85765:Import_L1_C0", "label": "fnmatch import fnmatch", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0027, 0.0027, 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_85765:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85765:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85765:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85765:Assign_L29_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_85767 | 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_85767: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_85767:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85767:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85767:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85767: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_85768 | 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_85768: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_85768:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85768:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85768:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85768: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_85769 | 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_85769: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_85769:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85769:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85769:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85769:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.core.management.base import BaseCommand
from optparse import make_option
import sys
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for in... | ajibawa-2023/Python-Code-Large/train/row_85770 | 23 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85770:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.025, 0.025, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management.b... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85770:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85770:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85770:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85770:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import LabelCommand
from django.db import connections, transaction, models, DEFAULT_DB_ALIAS
class Command(LabelCommand):
help = "Creates the table needed to use the SQL cache backend."
args = "<tablename>"
label = 'tablename'
option_l... | ajibawa-2023/Python-Code-Large/train/row_85772 | 36 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85772:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0189, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85772:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85772:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85772:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85772:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
import os
import re
from random import choice
class Command(LabelCommand):
help = "Creates a Django project directory structure for the given project name in the current directory."
... | ajibawa-2023/Python-Code-Large/train/row_85773 | 23 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85773:ImportFrom_L1_C0", "label": "from django.core.management.base import copy_helper, CommandError, LabelCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 931, 0, 3, 0, 0, 931, 0, 0], "semantic": {"na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85773:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85773:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85773:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85773:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
class Command(LabelCommand):
help = "Creates a Django app directory structure for the given app name in the current directory."
args = "[appname]"
label = 'application... | ajibawa-2023/Python-Code-Large/train/row_85774 | 24 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85774:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85774:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85774:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85774:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85774:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_delete
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the DROP TABLE SQL statements for the given app name(s)."
option_list = AppComman... | ajibawa-2023/Python-Code-Large/train/row_85775 | 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_85775: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_85775:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85775:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85775:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85775:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_false', dest='interactive', default=True,
help='Tells Django to NOT prompt the user for input of any... | ajibawa-2023/Python-Code-Large/train/row_85776 | 17 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85776:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0263, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85776:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85776:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85776:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85776:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_custom
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the custom table modifying SQL statements for the given app name(s)."
option_list... | ajibawa-2023/Python-Code-Large/train/row_85777 | 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_85777: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_85777:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85777:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85777:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85777:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.core.management.base import AppCommand, CommandError
class Command(AppCommand):
help = "RENAMED: see 'sqlcustom'"
def handle(self, *apps, **options):
raise CommandError("This command has been renamed. Use the 'sqlcustom' command instead.")
| ajibawa-2023/Python-Code-Large/train/row_85779 | 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_85779:ImportFrom_L1_C0", "label": "from django.core.management.base import AppCommand, CommandError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 0, 0.66, 0.0, 931, 0, 2, 0, 0, 931, 0, 0], "semantic": {"name": "django.co... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85779:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85779:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85779:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85779:FunctionDef_L6_C4"}] |
from optparse import make_option
import os
import re
import sys
import socket
from django.core.management.base import BaseCommand, CommandError
from django.core.handlers.wsgi import WSGIHandler
from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException
from django.utils import autoreload
nai... | ajibawa-2023/Python-Code-Large/train/row_85780 | 74 | 137 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85780:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0073, 0.0073, 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_85780:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85780:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85780:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85780:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import datetime
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Can be run as a cronjob or directly to clean out old data from the database (only expired sessions at the moment)."
def handle_noargs(self, **options):
from django.db import transaction
... | ajibawa-2023/Python-Code-Large/train/row_85781 | 9 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85781:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85781:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85781:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85781:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85781:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import os
import re
from django.conf import settings
from django.core.management.base import CommandError
from django.db import models
from django.db.models import get_models
def sql_create(app, style, connection):
"Returns a list of the CREATE TABLE SQL statements for the given app."
if connection.settings_... | ajibawa-2023/Python-Code-Large/train/row_85782 | 112 | 189 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85782:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 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_85782:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85782:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85782:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85782:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Sets up the terminal color scheme.
"""
import os
import sys
from django.utils import termcolors
def supports_color():
"""
Returns True if the running system's terminal supports color, and False
otherwise.
"""
unsupported_platform = (sys.platform in ('win32', 'Pocket PC'))
# isatty is not ... | ajibawa-2023/Python-Code-Large/train/row_85783 | 32 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85783:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.06, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85783:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85783:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85783:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85783:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
import sys
from django.core.management.color import color_style
from django.utils.itercompat import is_iterable
try:
any
except NameError:
from django.utils.itercompat import any
class ModelErrorCollection:
def __init__(self, outfile=sys.stdout):
self.errors = []
self.outfile = outfile
... | ajibawa-2023/Python-Code-Large/train/row_85784 | 201 | 303 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85784:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 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_85784:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85784:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85784:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85784:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"""
Utility functions for handling images.
Requires PIL, as you might imagine.
"""
from django.core.files import File
class ImageFile(File):
"""
A mixin for use alongside django.core.files.base.File, which provides
additional features for dealing with images.
"""
def _get_width(self):
ret... | ajibawa-2023/Python-Code-Large/train/row_85789 | 39 | 62 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85789:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0484, 0.0806, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85789:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85789:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85789:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85789:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
The temp module provides a NamedTemporaryFile that can be re-opened on any
platform. Most platforms use the standard Python tempfile.TemporaryFile class,
but MS Windows users are given a custom class.
This is needed because in Windows NT, the default implementation of
NamedTemporaryFile uses the O_TEMPORARY flag, ... | ajibawa-2023/Python-Code-Large/train/row_85791 | 26 | 56 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85791:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0982, 0.1786, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85791:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85791:ClassDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85791:ClassDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85791:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
class FileProxyMixin(object):
"""
A mixin class used to forward file methods to an underlaying file
object. The internal file object has to be called "file"::
class FileProxy(FileProxyMixin):
def __init__(self, file):
self.file = file
"""
encoding = property(la... | ajibawa-2023/Python-Code-Large/train/row_85792 | 20 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85792:ClassDef_L1_C0", "label": "FileProxyMixin", "type": "class", "loc": [1, 29], "level": 0, "parent": null, "vector": [3, 0, 0.5172, 1.0, 0, 0.66, 0.0, 369, 0, 1, 0, 0, 186, 0, 17], "semantic": {"name": "FileProxyMixin", "arg_names": [], "import_names": [], "rhs_call... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85792:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85792:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85792:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85792:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
import os
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.utils.encoding import smart_str, smart_unicode
from django.core.files.utils import FileProxyMixin
class File(FileProxyMixin):
DEFAULT_CHUNK_SIZE = 64 * 2**10
def __init__(self, file, name=None)... | ajibawa-2023/Python-Code-Large/train/row_85794 | 88 | 140 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85794:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0071, 0.0071, 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_85794:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85794:ImportFrom_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85794:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85794:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.core.files.base import File
| ajibawa-2023/Python-Code-Large/train/row_85795 | 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_85795:ImportFrom_L1_C0", "label": "from django.core.files.base import File", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 293, 0, 1, 0, 0, 293, 0, 0], "semantic": {"name": "django.core.files.base", "arg_names": []... | [] |
"""
Portable file locking utilities.
Based partially on example by Jonathan Feignberg <jdf@pobox.com> in the Python
Cookbook, licensed under the Python Software License.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
Example Usage::
>>> from django.core.files import locks
>>> f = open('./... | ajibawa-2023/Python-Code-Large/train/row_85796 | 36 | 70 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85796:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 16], "level": 0, "parent": null, "vector": [8, 0, 0.1214, 0.2286, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85796:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85796:Import_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85796:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85796:Import_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""
Functions that modify an HTTP request or response in some way.
"""
# This group of functions are run as part of the response handling, after
# everything else, including all response middleware. Think of them as
# "compulsory response middleware". Be careful about what goes here, because
# it's a little fiddly to ... | ajibawa-2023/Python-Code-Large/train/row_85798 | 36 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85798:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0233, 0.0349, 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_85798:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85798:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85798:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85798:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y. F j.'
TIME_FORMAT = 'G:i:s'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =... | ajibawa-2023/Python-Code-Large/train/row_85800 | 6 | 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_85800:Assign_L7_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.3043, 0.0435, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y' # '20 januari 2009'
TIME_FORMAT = 'H:i' ... | ajibawa-2023/Python-Code-Large/train/row_85801 | 14 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85801:Assign_L7_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.1321, 0.0189, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j. F Y. H:i'
YEAR_MONTH_F... | ajibawa-2023/Python-Code-Large/train/row_85802 | 14 | 49 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85802:Assign_L7_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.1429, 0.0204, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y' # 25 Ottobre 2006
TIME_FORMAT = 'H:i:s' # 14:30:59
DATETIME_FORMAT... | ajibawa-2023/Python-Code-Large/train/row_85803 | 14 | 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_85803:Assign_L7_C0", "label": "DATE_FORMAT =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.1522, 0.0217, 0, 0.66, 0.0, 843, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATE_FORMAT", "arg_names": [], "import_names": [], "rh... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.