code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
from django.contrib.messages import constants
from django.contrib.messages.storage.fallback import (FallbackStorage,
CookieStorage)
from django.contrib.messages.tests.base import BaseTest
from django.contrib.messages.tests.cookie import (set_cookie_data,
stored_cookie_messages_count)
from django.contrib.message... | ajibawa-2023/Python-Code-Large/train/row_82972 | 101 | 175 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82972:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0057, 0.0057, 0, 0.66, 0.0, 698, 0, 1, 0, 0, 698, 0, 0], "semantic": {"name": "django.contrib.messages", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82972:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82972:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82972:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82972:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.contrib.messages import constants
from django.contrib.messages.tests.base import BaseTest
from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.session import SessionStorage
from django.utils.safestring import SafeData, mark_safe
def set_session_data(storage, messag... | ajibawa-2023/Python-Code-Large/train/row_82973 | 32 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82973:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0192, 0.0192, 0, 0.66, 0.0, 698, 0, 1, 0, 0, 698, 0, 0], "semantic": {"name": "django.contrib.messages", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82973:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82973:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82973:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82973:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import json
from django.contrib.messages import constants
from django.contrib.messages.tests.base import BaseTest
from django.contrib.messages.storage.cookie import (CookieStorage,
MessageEncoder, MessageDecoder)
from django.contrib.messages.storage.base import Message
from django.test.utils import override_settin... | ajibawa-2023/Python-Code-Large/train/row_82974 | 86 | 153 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82974:Import_L1_C0", "label": "json import json", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0065, 0, 0.66, 0.0, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82974:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82974:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82974:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82974:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.conf.urls import patterns
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext, Template
from django.template.response import TemplateResponse
from django.views.decorators.cache ... | ajibawa-2023/Python-Code-Large/train/row_82975 | 27 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82975:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 528, 0, 1, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names": [], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82975:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82975:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82975:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82975:For_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django import http
from django.contrib.messages.middleware import MessageMiddleware
from django.utils import unittest
class MiddlewareTest(unittest.TestCase):
def setUp(self):
self.middleware = MessageMiddleware()
def test_response_without_messages(self):
"""
Makes sure that the... | ajibawa-2023/Python-Code-Large/train/row_82976 | 11 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82976:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 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_82976:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82976:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82976:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82976:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django import http
from django.conf import settings, global_settings
from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.storage import default_storage, base
from django.contrib.messages.storage.base import M... | ajibawa-2023/Python-Code-Large/train/row_82977 | 206 | 369 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82977:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0027, 0.0027, 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_82977:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82977:Return_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82977:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82977:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib.messages.tests.cookie import CookieTest
from django.contrib.messages.tests.fallback import FallbackTest
from django.contrib.messages.tests.middleware import MiddlewareTest
from django.contrib.messages.tests.session import SessionTest
| ajibawa-2023/Python-Code-Large/train/row_82978 | 4 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82978:ImportFrom_L1_C0", "label": "from django.contrib.messages.tests.cookie import CookieTest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 410, 0, 1, 0, 0, 410, 0, 0], "semantic": {"name": "django.contrib.mes... | [] |
DEBUG = 10
INFO = 20
SUCCESS = 25
WARNING = 30
ERROR = 40
DEFAULT_TAGS = {
DEBUG: 'debug',
INFO: 'info',
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'error',
}
| ajibawa-2023/Python-Code-Large/train/row_82979 | 6 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82979:Assign_L1_C0", "label": "DEBUG =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 309, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name"... | [] |
from django.conf import settings
from django.contrib.messages.storage import default_storage
class MessageMiddleware(object):
"""
Middleware that handles temporary messages.
"""
def process_request(self, request):
request._messages = default_storage(request)
def process_response(self, re... | ajibawa-2023/Python-Code-Large/train/row_82980 | 12 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82980:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 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_82980:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82980:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82980:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82980:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.conf import settings
from django.contrib.messages import constants
def get_level_tags():
"""
Returns the message level tags.
"""
level_tags = constants.DEFAULT_TAGS.copy()
level_tags.update(getattr(settings, 'MESSAGE_TAGS', {}))
return level_tags
| ajibawa-2023/Python-Code-Large/train/row_82981 | 7 | 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_82981:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 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_82981:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82981:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82981:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82981:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import absolute_import
from django.contrib.messages.api import *
from django.contrib.messages.constants import *
| ajibawa-2023/Python-Code-Large/train/row_82982 | 3 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82982:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_n... | [] |
from django.contrib.messages import constants
from django.contrib.messages.storage import default_storage
__all__ = (
'add_message', 'get_messages',
'get_level', 'set_level',
'debug', 'info', 'success', 'warning', 'error',
)
class MessageFailure(Exception):
pass
def add_message(request, level, mess... | ajibawa-2023/Python-Code-Large/train/row_82983 | 41 | 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_82983:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0098, 0, 0.66, 0.0, 698, 0, 1, 0, 0, 698, 0, 0], "semantic": {"name": "django.contrib.messages", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82983:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82983:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82983:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82983:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import absolute_import
from django import template
from django.conf import settings
from django.contrib import comments
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirec... | ajibawa-2023/Python-Code-Large/train/row_82984 | 48 | 165 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82984:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0061, 0.0061, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82984:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82984:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82984:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82984:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
A few bits of helper functions for comment views.
"""
import textwrap
try:
from urllib.parse import urlencode
except ImportError: # Python 2
from urllib import urlencode
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, resolve_url
from django.template impor... | ajibawa-2023/Python-Code-Large/train/row_82985 | 34 | 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_82985:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0286, 0.0429, 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_82985:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82985:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82985:Try_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82985:ImportFrom_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from __future__ import absolute_import
from django import http
from django.conf import settings
from django.contrib import comments
from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist, Validat... | ajibawa-2023/Python-Code-Large/train/row_82986 | 58 | 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_82986:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0073, 0.0073, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82986:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82986:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82986:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82986:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import time
from django import forms
from django.forms.util import ErrorDict
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.comments.models import Comment
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.encoding import... | ajibawa-2023/Python-Code-Large/train/row_82987 | 98 | 194 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82987:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0052, 0.0052, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82987:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82987:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82987:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82987:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.conf import settings
from django.contrib.comments.managers import CommentManager
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core import urlresolvers
from django.db import models
from djan... | ajibawa-2023/Python-Code-Large/train/row_82988 | 104 | 200 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82988:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.005, 0.005, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82988:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82988:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82988:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82988:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
A generic comment-moderation system which allows configuration of
moderation options on a per-model basis.
To use, do two things:
1. Create or import a subclass of ``CommentModerator`` defining the
options you want.
2. Import ``moderator`` from this module and register one or more
models, passing the model... | ajibawa-2023/Python-Code-Large/train/row_82989 | 98 | 356 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82989:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 55], "level": 0, "parent": null, "vector": [8, 0, 0.0787, 0.1545, 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_82989:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82989:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82989:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82989:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Signals relating to comments.
"""
from django.dispatch import Signal
# Sent just before a comment will be posted (after it's been approved and
# moderated; this can be used to modify the comment (in place) with posting
# details or other such actions. If any receiver returns False the comment will be
# discarded a... | ajibawa-2023/Python-Code-Large/train/row_82990 | 5 | 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_82990:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0952, 0.1429, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import get_current_site
from django.contrib import comments
from django.utils.translation import ugettext as _
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def __call__(self, request, *args,... | ajibawa-2023/Python-Code-Large/train/row_82991 | 20 | 31 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82991:ImportFrom_L1_C0", "label": "from django.contrib.syndication.views import Feed", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0323, 0, 0.66, 0.0, 264, 0, 1, 0, 0, 264, 0, 0], "semantic": {"name": "django.contrib.syndicati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82991:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82991:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82991:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82991:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_text
class CommentManager(models.Manager):
def in_moderation(self):
"""
QuerySet for all comments currently in the moderation queue.
"""
return self.get_q... | ajibawa-2023/Python-Code-Large/train/row_82992 | 14 | 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_82992:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 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_82992:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82992:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82992:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82992:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls import patterns, url
urlpatterns = patterns('django.contrib.comments.views',
url(r'^post/$', 'comments.post_comment', name='comments-post-comment'),
url(r'^posted/$', 'comments.comment_done', name='comments-comment-done'),
url(r'^flag/(\d+)/$', 'moderati... | ajibawa-2023/Python-Code-Large/train/row_82993 | 2 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82993:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [] |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib import comments
from django.utils.encoding import smart_text
register = template.Library()
class BaseCommentNode(template.Node... | ajibawa-2023/Python-Code-Large/train/row_82994 | 142 | 332 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82994:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.003, 0.003, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["temp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82994:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82994:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82994:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82994:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.comments.models import Comment
from django.utils.translation import ugettext_lazy as _, ungettext
from django.contrib.comments import get_model
from django.contrib.comments.views.... | ajibawa-2023/Python-Code-Large/train/row_82995 | 48 | 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_82995:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0116, 0.0116, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82995:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82995:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82995:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82995:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.core import urlresolvers
from django.core.exceptions import ImproperlyConfigured
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
from django.utils.importlib import import_module
DEFAULT_COMMENTS_APP = 'django.contrib.... | ajibawa-2023/Python-Code-Large/train/row_82996 | 47 | 91 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82996:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.011, 0.011, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82996:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82996:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82996:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82996:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Create a superuser from the command line. Deprecated; use manage.py
createsuperuser instead.
"""
if __name__ == "__main__":
from django.core.management import call_command
call_command("createsuperuser")
| ajibawa-2023/Python-Code-Large/train/row_82997 | 4 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82997:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.3125, 0.5, 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_82997:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82997:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82997:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82997:Expr_L8_C4"}] |
from __future__ import unicode_literals
from django import forms
from django.forms.util import flatatt
from django.template import loader
from django.utils.datastructures import SortedDict
from django.utils.html import format_html, format_html_join
from django.utils.http import urlsafe_base64_encode
from django.utils.... | ajibawa-2023/Python-Code-Large/train/row_82998 | 178 | 379 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82998:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82998:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82998:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82998:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82998:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-... |
# PermWrapper and PermLookupDict proxy the permissions system into objects that
# the template system can understand.
class PermLookupDict(object):
def __init__(self, user, module_name):
self.user, self.module_name = user, module_name
def __repr__(self):
return str(self.user.get_all_permission... | ajibawa-2023/Python-Code-Large/train/row_82999 | 31 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82999:ClassDef_L4_C0", "label": "PermLookupDict", "type": "class", "loc": [4, 23], "level": 0, "parent": null, "vector": [3, 0, 0.2077, 0.3077, 0, 0.66, 0.0, 495, 0, 6, 0, 0, 186, 0, 7], "semantic": {"name": "PermLookupDict", "arg_names": [], "import_names": [], "rhs_ca... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82999:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82999:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82999:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82999:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code... |
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
class ModelBackend(object):
"""
Authenticates against settings.AUTH_USER_MODEL.
"""
def authenticate(self, username=None, password=None, **kwargs):
UserMode... | ajibawa-2023/Python-Code-Large/train/row_83000 | 74 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83000:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0075, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83000:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83000:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83000:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83000:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import unicode_literals
import re
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import send_mail
from django.core import validators
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.crypto import get_random_s... | ajibawa-2023/Python-Code-Large/train/row_83001 | 271 | 535 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83001:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0019, 0.0019, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83001:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83001:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83001:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83001:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib import auth
from django import db
from django.utils.encoding import force_bytes
def check_password(environ, username, password):
"""
Authenticates against Django's auth database
mod_wsgi docs specify None, True, False as return value depending
on whether the user exists and authen... | ajibawa-2023/Python-Code-Large/train/row_83002 | 27 | 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_83002:ImportFrom_L1_C0", "label": "from django.contrib import auth", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83002:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83002:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83002:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83002:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.dispatch import Signal
user_logged_in = Signal(providing_args=['request', 'user'])
user_login_failed = Signal(providing_args=['credentials'])
user_logged_out = Signal(providing_args=['request', 'user'])
| ajibawa-2023/Python-Code-Large/train/row_83003 | 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_83003: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 __future__ import unicode_literals
from datetime import date
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.tests.custom_user import ExtensionUser, CustomPermission... | ajibawa-2023/Python-Code-Large/train/row_83004 | 229 | 394 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83004:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0025, 0.0025, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83004:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83004:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83004:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83004:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from __future__ import unicode_literals
import os
from django.contrib.auth.models import User
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm,
ReadOnlyPasswordHashWidget)
from django.contrib.auth.tests.utils imp... | ajibawa-2023/Python-Code-Large/train/row_83005 | 215 | 394 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83005:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0025, 0.0025, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83005:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83005:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83005:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83005:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from __future__ import unicode_literals
from django.contrib.auth.handlers.modwsgi import check_password, groups_for_user
from django.contrib.auth.models import User, Group
from django.contrib.auth.tests import CustomUser
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TransactionTe... | ajibawa-2023/Python-Code-Large/train/row_83006 | 32 | 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_83006:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83006:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83006:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83006:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83006:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import os
from django.conf import global_settings
from django.contrib.auth import authenticate
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.models import User, Permission
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.context_processors impo... | ajibawa-2023/Python-Code-Large/train/row_83007 | 85 | 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_83007:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0059, 0.0059, 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_83007:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83007:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83007:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83007:If_L17_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import (Group, User, SiteProfileNotAvailable,
UserManager)
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase
from django.test.utils import override_settings
fro... | ajibawa-2023/Python-Code-Large/train/row_83008 | 72 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83008:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0075, 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_83008:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83008:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83008:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83008:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
from django.contrib.auth import signals
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
@skipIfCustomUser
@override_settings(USE_TZ=Fa... | ajibawa-2023/Python-Code-Large/train/row_83009 | 57 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83009:ImportFrom_L1_C0", "label": "from django.contrib.auth import signals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 895, 0, 1, 0, 0, 895, 0, 0], "semantic": {"name": "django.contrib.auth", "arg_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83009:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83009:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83009:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83009:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import locale
from django.contrib.auth import get_user_model
from django.contrib.auth.management.commands import createsuperuser
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.tests.custom_user import CustomUser
fro... | ajibawa-2023/Python-Code-Large/train/row_83010 | 137 | 234 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83010:ImportFrom_L2_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0085, 0.0043, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83010:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83010:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83010:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83010:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python... |
from django.db import models
from django.contrib.auth.models import (
BaseUserManager,
AbstractBaseUser,
AbstractUser,
UserManager,
PermissionsMixin
)
# The custom User uses email as the unique identifier, and requires
# that every user provide a date of birth. This lets us test
# changes in usern... | ajibawa-2023/Python-Code-Large/train/row_83011 | 90 | 168 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83011:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.006, 0.006, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["mo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83011:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83011:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83011:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83011:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.conf.urls import patterns, url
from django.contrib.auth import context_processors
from django.contrib.auth.urls import urlpatterns
from django.contrib.auth.views import password_reset
from django.contrib.auth.decorators import login_required
from django.contrib.messages.api import info
from django.http impo... | ajibawa-2023/Python-Code-Large/train/row_83012 | 32 | 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_83012:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0143, 0.0143, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83012:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83012:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83012:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83012:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
from django.contrib.auth.hashers import (is_password_usable,
check_password, make_password, PBKDF2PasswordHasher, load_hashers,
PBKDF2SHA1PasswordHasher, get_hasher, ident... | ajibawa-2023/Python-Code-Large/train/row_83013 | 142 | 238 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83013:ImportFrom_L2_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0084, 0.0042, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83013:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83013:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83013:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83013:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
from datetime import datetime
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase... | ajibawa-2023/Python-Code-Large/train/row_83014 | 116 | 198 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83014:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0051, 0.0051, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83014:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83014:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83014:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83014:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.contrib.auth.decorators import login_required
from django.contrib.auth.tests.views import AuthViewsTestCase
from django.contrib.auth.tests.utils import skipIfCustomUser
@skipIfCustomUser
class LoginRequiredTestCase(AuthViewsTestCase):
"""
Tests the login_required decorators
"""
urls = 'dja... | ajibawa-2023/Python-Code-Large/train/row_83015 | 26 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83015:ImportFrom_L1_C0", "label": "from django.contrib.auth.decorators import login_required", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 885, 0, 1, 0, 0, 885, 0, 0], "semantic": {"name": "django.contrib.a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83015:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83015:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83015:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83015:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from django.conf import settings
from django.utils.unittest import skipIf
def skipIfCustomUser(test_func):
"""
Skip a test if a custom user model is in use.
"""
return skipIf(settings.AUTH_USER_MODEL != 'auth.User', 'Custom user model in use')(test_func)
| ajibawa-2023/Python-Code-Large/train/row_83016 | 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_83016:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 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_83016:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83016:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83016:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83016:Return_L9_C4"}] |
import sys
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase
from django.utils import unittest... | ajibawa-2023/Python-Code-Large/train/row_83017 | 42 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83017:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 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_83017:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83017:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83017:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83017:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Co... |
"""
Test URLs for auth admins.
"""
from django.conf.urls import patterns, include
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.contrib.auth.models import User, Group
from django.contrib.auth.urls import urlpatterns
# Create a silo'd admin site for just the u... | ajibawa-2023/Python-Code-Large/train/row_83018 | 10 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83018:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1111, 0.1667, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import os
import re
from django.conf import global_settings, settings
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import User
from django.core import mail
from django.core.exceptions import SuspiciousOperation
from django.core.urlresolvers import reverse, NoReverseMatch
fr... | ajibawa-2023/Python-Code-Large/train/row_83019 | 316 | 578 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83019:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0017, 0.0017, 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_83019:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83019:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83019:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83019:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from __future__ import unicode_literals
from datetime import date
from django.contrib.auth import models, management
from django.contrib.auth.management import create_permissions
from django.contrib.auth.management.commands import changepassword
from django.contrib.auth.models import User
from django.contrib.auth.test... | ajibawa-2023/Python-Code-Large/train/row_83020 | 118 | 228 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83020:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0044, 0.0044, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83020:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83020:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83020:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83020:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-... |
from django.contrib.auth.tests.custom_user import *
from django.contrib.auth.tests.auth_backends import *
from django.contrib.auth.tests.basic import *
from django.contrib.auth.tests.context_processors import *
from django.contrib.auth.tests.decorators import *
from django.contrib.auth.tests.forms import *
from django.... | ajibawa-2023/Python-Code-Large/train/row_83021 | 22 | 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_83021:ImportFrom_L1_C0", "label": "from django.contrib.auth.tests.custom_user import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0345, 0, 0.66, 0.0, 284, 0, 1, 0, 0, 284, 0, 0], "semantic": {"name": "django.contrib.auth.te... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83021:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83021:If_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83021:If_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83021:ImportFrom_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/... |
# The views used below are normally mapped in django.contrib.admin.urls.py
# This URLs file is used to provide a reliable view deployment for test purposes.
# It is also provided as a convenience to those who want to deploy these URLs
# elsewhere.
from django.conf.urls import patterns, url
urlpatterns = patterns('',
... | ajibawa-2023/Python-Code-Large/train/row_83022 | 2 | 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_83022:ImportFrom_L6_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.3158, 0.0526, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [] |
from django.contrib import auth
from django.contrib.auth import load_backend
from django.contrib.auth.backends import RemoteUserBackend
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import SimpleLazyObject
def get_user(request):
if not hasattr(request, '_cached_user'):
... | ajibawa-2023/Python-Code-Large/train/row_83023 | 40 | 91 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83023:ImportFrom_L1_C0", "label": "from django.contrib import auth", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.011, 0.011, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83023:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83023:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83023:If_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83023:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
from __future__ import unicode_literals
import base64
import functools
import hashlib
from django.dispatch import receiver
from django.conf import settings
from django.test.signals import setting_changed
from django.utils import importlib
from django.utils.datastructures import SortedDict
from django.utils.encoding i... | ajibawa-2023/Python-Code-Large/train/row_83024 | 226 | 488 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83024:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.002, 0.002, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83024:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83024:If_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83024:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83024:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
try:
from urllib.parse import urlparse
except ImportError: # Python 2
from urlparse import urlparse
from functools import wraps
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import PermissionDenied
from django.utils.decorators import availab... | ajibawa-2023/Python-Code-Large/train/row_83025 | 40 | 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_83025:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0333, 0.0533, 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_83025:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83025:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83025:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83025:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.db import transaction
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.forms import (UserCreationForm, UserChangeForm,
AdminPasswordChangeForm)
from django.contrib.auth.models import User, Group
from django.contrib import messages
from django.core.exceptions imp... | ajibawa-2023/Python-Code-Large/train/row_83026 | 88 | 180 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83026:ImportFrom_L1_C0", "label": "from django.db import transaction", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0056, 0.0056, 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_83026:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83026:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83026:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83026:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Management utility to create superusers.
"""
import getpass
import sys
from optparse import make_option
from django.contrib.auth import get_user_model
from django.contrib.auth.management import get_default_username
from django.core import exceptions
from django.core.management.base import BaseCommand, CommandErro... | ajibawa-2023/Python-Code-Large/train/row_83027 | 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_83027:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0141, 0.0211, 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_83027:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83027:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83027:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83027:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Co... |
import getpass
from optparse import make_option
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--database', action='s... | ajibawa-2023/Python-Code-Large/train/row_83028 | 35 | 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_83028:Import_L1_C0", "label": "getpass import getpass", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 0, 0.66, 0.0, 784, 0, 1, 0, 0, 784, 0, 0], "semantic": {"name": "getpass", "arg_names": [], "import_names": ["getpass"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83028:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83028:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83028:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83028:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Creates permissions for all installed apps that need permissions.
"""
from __future__ import unicode_literals
import getpass
import locale
import unicodedata
from django.contrib.auth import models as auth_app, get_user_model
from django.core import exceptions
from django.core.management.base import CommandError
f... | ajibawa-2023/Python-Code-Large/train/row_83029 | 100 | 191 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83029:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0105, 0.0157, 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_83029:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83029:Return_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83029:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83029:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
from datetime import date
from django.conf import settings
from django.utils.http import int_to_base36, base36_to_int
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils import six
class PasswordResetTokenGenerator(object):
"""
Strategy object used to generate and check tokens... | ajibawa-2023/Python-Code-Large/train/row_83030 | 35 | 73 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83030:ImportFrom_L1_C0", "label": "from datetime import date", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0137, 0.0137, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["da... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83030:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83030:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83030:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83030:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
try:
from urllib.parse import urlparse, urlunparse
except ImportError: # Python 2
from urlparse import urlparse, urlunparse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, QueryDict
from django.template.response import TemplateResp... | ajibawa-2023/Python-Code-Large/train/row_83031 | 133 | 275 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83031:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0091, 0.0145, 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_83031:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83031:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83031:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83031:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import re
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.middleware.csrf import rotate_token
from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
SESSION_KEY = '_auth_user_id'
BACKEND_SESSION_KEY = '_auth_user_... | ajibawa-2023/Python-Code-Large/train/row_83032 | 82 | 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_83032:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.007, 0.007, 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_83032:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83032:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83032:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83032:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Co... |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Redirect(models.Model):
site = models.ForeignKey(Site)
old_path = models.CharField(_... | ajibawa-2023/Python-Code-Large/train/row_83033 | 16 | 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_83033:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 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_83033:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83033:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83033:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83033:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import six
from .middleware import RedirectFallbackMiddleware
from .models import Redi... | ajibawa-2023/Python-Code-Large/train/row_83034 | 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_83034:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 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_83034:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83034:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83034:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83034:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-... |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.redirects.models import Redirect
from django.contrib.sites.models import get_current_site
from django.core.exceptions import ImproperlyConfigured
from django import http
class RedirectFallbackMiddleware(object):
def __in... | ajibawa-2023/Python-Code-Large/train/row_83035 | 27 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83035:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0227, 0.0227, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83035:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83035:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83035:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83035:If_L12_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib import admin
from django.contrib.redirects.models import Redirect
class RedirectAdmin(admin.ModelAdmin):
list_display = ('old_path', 'new_path')
list_filter = ('site',)
search_fields = ('old_path', 'new_path')
radio_fields = {'site': admin.VERTICAL}
admin.site.register(Redirect, R... | ajibawa-2023/Python-Code-Large/train/row_83036 | 8 | 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_83036:ImportFrom_L2_C0", "label": "from django.contrib import admin", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83036:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83036:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83036:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83036:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
# Empty models.py to allow for specifying admindocs as a test label.
| ajibawa-2023/Python-Code-Large/train/row_83037 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
from django.db import models
class CustomField(models.Field):
description = "A custom field type"
class DescriptionLackingField(models.Field):
pass
| ajibawa-2023/Python-Code-Large/train/row_83038 | 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_83038:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 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_83038:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83038:Assign_L4_C4"}] |
from __future__ import absolute_import, unicode_literals
from django.contrib.admindocs import views
from django.db.models import fields as builtin_fields
from django.utils import unittest
from django.utils.translation import ugettext as _
from . import fields
class TestFieldType(unittest.TestCase):
def setUp(se... | ajibawa-2023/Python-Code-Large/train/row_83039 | 15 | 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_83039:ImportFrom_L1_C0", "label": "from __future__ import absolute_import, unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0278, 0, 0.66, 0.0, 777, 0, 2, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83039:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83039:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83039:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83039:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Pytho... |
from django.conf.urls import patterns, url
from django.contrib.admindocs import views
urlpatterns = patterns('',
url('^$',
views.doc_index,
name='django-admindocs-docroot'
),
url('^bookmarklets/$',
views.bookmarklets,
name='django-admindocs-bookmarklets'
),
url('^tag... | ajibawa-2023/Python-Code-Large/train/row_83040 | 3 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83040:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [] |
"Misc. utility functions/classes for admin documentation generator."
import re
from email.parser import HeaderParser
from email.errors import HeaderParseError
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.utils.encoding import force_bytes
try:
import docuti... | ajibawa-2023/Python-Code-Large/train/row_83041 | 69 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83041:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83041:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83041:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83041:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83041:Import_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
import inspect
import os
import re
from django import template
from django.template import RequestContext
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
from django.shortcuts import render_to_response
from django.core.exceptions imp... | ajibawa-2023/Python-Code-Large/train/row_83042 | 204 | 384 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83042:Import_L1_C0", "label": "inspect import inspect", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "inspect", "arg_names": [], "import_names": ["inspect"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83042:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83042:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83042:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83042:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
SITE_CACHE = {}
class SiteManager(models.Manager):
def get_current(self):
"""
Returns the current ``Site`` based on the SITE_ID in the
proje... | ajibawa-2023/Python-Code-Large/train/row_83043 | 51 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83043:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0102, 0.0102, 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_83043:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83043:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83043:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83043:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.sites.models import Site, RequestSite, get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test import TestCase
from django.test.utils import override_settings... | ajibawa-2023/Python-Code-Large/train/row_83044 | 41 | 66 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83044:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0152, 0.0152, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83044:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83044:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83044:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83044:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.conf import settings
from django.db import models
from django.db.models.fields import FieldDoesNotExist
class CurrentSiteManager(models.Manager):
"Use this to limit objects to those associated with the current site."
def __init__(self, field_name=None):
super(CurrentSiteManager, self).__ini... | ajibawa-2023/Python-Code-Large/train/row_83045 | 24 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83045:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 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_83045:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83045:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83045:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83045:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.contrib import admin
from django.contrib.sites.models import Site
class SiteAdmin(admin.ModelAdmin):
list_display = ('domain', 'name')
search_fields = ('domain', 'name')
admin.site.register(Site, SiteAdmin) | ajibawa-2023/Python-Code-Large/train/row_83046 | 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_83046:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83046:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83046:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83046:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83046:Assign_L7_C4"}] |
"""
Creates the default Site object.
"""
from django.db.models import signals
from django.db import connections
from django.db import router
from django.contrib.sites.models import Site
from django.contrib.sites import models as site_app
from django.core.management.color import no_style
def create_default_site(app, c... | ajibawa-2023/Python-Code-Large/train/row_83047 | 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_83047:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0556, 0.0833, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83047:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83047:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83047:If_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83047:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/ro... |
import operator
from functools import reduce
from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured
from django.core.paginator import InvalidPage
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.utils.datas... | ajibawa-2023/Python-Code-Large/train/row_83048 | 219 | 384 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83048:Import_L1_C0", "label": "operator import operator", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 616, 0, 1, 0, 0, 616, 0, 0], "semantic": {"name": "operator", "arg_names": [], "import_names": ["operato... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83048:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83048:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83048:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83048:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-... |
from functools import wraps
from django.utils.translation import ugettext as _
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth.views import login
from django.contrib.auth import REDIRECT_FIELD_NAME
def staff_member_required(view_func):
"""
Decorator for views that check... | ajibawa-2023/Python-Code-Large/train/row_83049 | 13 | 30 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83049:ImportFrom_L1_C0", "label": "from functools import wraps", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0333, 0.0333, 0, 0.66, 0.0, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83049:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83049:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83049:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83049:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Co... |
from __future__ import unicode_literals
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy
ERROR_MESSAGE = ugettext_lazy("Please enter the correct %(username)s and password "
"for a ... | ajibawa-2023/Python-Code-Large/train/row_83050 | 19 | 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_83050:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.027, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83050:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83050:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83050:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83050:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin.util import quote
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.encoding import smart_text
fro... | ajibawa-2023/Python-Code-Large/train/row_83051 | 53 | 76 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83051:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0132, 0.0132, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83051:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83051:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83051:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83051:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-... |
from django.test import LiveServerTestCase
from django.utils.importlib import import_module
from django.utils.unittest import SkipTest
from django.utils.translation import ugettext as _
class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
... | ajibawa-2023/Python-Code-Large/train/row_83052 | 59 | 115 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83052:ImportFrom_L1_C0", "label": "from django.test import LiveServerTestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0087, 0.0087, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83052:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83052:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83052:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83052:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf import settings
from django.template import Library
register = Library()
if 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
from django.contrib.staticfiles.templatetags.staticfiles import static
else:
from django.templatetags.static import static
static = register.simple_tag(static)... | ajibawa-2023/Python-Code-Large/train/row_83053 | 7 | 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_83053:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 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_83053:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83053:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83053:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83053:ImportFrom_L9_C4"}] |
from django import template
register = template.Library()
@register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
the prepopulated fields for both the admin form and in... | ajibawa-2023/Python-Code-Large/train/row_83054 | 32 | 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_83054:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 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_83054:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83054:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83054:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83054:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django import template
from django.contrib.admin.models import LogEntry
register = template.Library()
class AdminLogNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAdminLog Node>"
... | ajibawa-2023/Python-Code-Large/train/row_83055 | 25 | 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_83055:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0179, 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_83055:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83055:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83055:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_83055:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.core.urlresolvers import reverse
from django import template
from django.contrib.admin.util import quote
register = template.Library()
@register.filter
def admin_urlname(value, arg):
return 'admin:%s_%s_%s' % (value.app_label, value.module_name, arg)
@register.filter
def admin_urlquote(value):
r... | ajibawa-2023/Python-Code-Large/train/row_83056 | 8 | 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_83056:ImportFrom_L1_C0", "label": "from django.core.urlresolvers import reverse", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83056:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83056:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83056:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83056:Return_L14_C4"}] |
from __future__ import unicode_literals
import datetime
from django.contrib.admin.util import (lookup_field, display_for_field,
display_for_value, label_for_field)
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
ORDER_VAR, PAGE_VAR, SEARCH_VAR)
from django.contrib.admin.templatet... | ajibawa-2023/Python-Code-Large/train/row_83057 | 199 | 388 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83057:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83057:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83057:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83057:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83057:If_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import unicode_literals
import datetime
import decimal
from django.db import models
from django.db.models.constants import LOOKUP_SEP
from django.db.models.deletion import Collector
from django.db.models.related import RelatedObject
from django.forms.forms import pretty_name
from django.utils import f... | ajibawa-2023/Python-Code-Large/train/row_83058 | 277 | 455 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83058:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0022, 0.0022, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83058:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83058:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83058:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83058:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,
_get_foreign_key)
from django.contrib.admin import ListFilter, FieldListFilter
from django.co... | ajibawa-2023/Python-Code-Large/train/row_83059 | 183 | 421 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83059:ImportFrom_L1_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0024, 0.0024, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.except... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83059:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83059:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83059:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83059:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from __future__ import unicode_literals
from django import forms
from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
display_for_field, label_for_field, help_text_for_field)
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.contenttypes.models import ContentT... | ajibawa-2023/Python-Code-Large/train/row_83060 | 237 | 351 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83060:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0028, 0.0028, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83060:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83060:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83060:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83060:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import copy
from functools import update_wrapper, partial
import warnings
from django import forms
from django.conf import settings
from django.forms.formsets import all_valid
from django.forms.models import (modelform_factory, modelformset_factory,
inlineformset_factory, BaseInlineFormSet)
from django.contrib.con... | ajibawa-2023/Python-Code-Large/train/row_83061 | 778 | 1,524 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83061:Import_L1_C0", "label": "copy import copy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0007, 0.0007, 0, 0.66, 0.0, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["copy"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83061:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83061:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83061:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83061:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from functools import update_wrapper
from django.http import Http404, HttpResponseRedirect
from django.contrib.admin import ModelAdmin, actions
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.contenttypes import views as contenttype_... | ajibawa-2023/Python-Code-Large/train/row_83062 | 197 | 452 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83062:ImportFrom_L1_C0", "label": "from functools import update_wrapper", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0022, 0.0022, 0, 0.66, 0.0, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83062:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83062:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83062:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83062:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Form Widget classes specific to the Django admin site.
"""
from __future__ import unicode_literals
import copy
from django import forms
from django.contrib.admin.templatetags.admin_static import static
from django.core.urlresolvers import reverse
from django.forms.widgets import RadioFieldRenderer
from django.for... | ajibawa-2023/Python-Code-Large/train/row_83063 | 230 | 339 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83063:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0059, 0.0088, 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_83063:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83063:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83063:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83063:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here
# has been referenced in documentation.
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
from django.contrib.admin.options import StackedInline, TabularInli... | ajibawa-2023/Python-Code-Large/train/row_83064 | 18 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83064:ImportFrom_L3_C0", "label": "from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0732, 0.0244, 0, 0.66, 0.0, 140, 0, 1, 0, 0, 140, 0, 0], "semantic": {"name": "django.contr... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83064:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83064:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83064:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83064:Import_L19_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
This encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
import datetime
from django.db import models... | ajibawa-2023/Python-Code-Large/train/row_83065 | 178 | 404 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83065:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0099, 0.0173, 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_83065:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83065:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83065:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83065:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Built-in, globally-available admin actions.
"""
from django.core.exceptions import PermissionDenied
from django.contrib.admin import helpers
from django.contrib.admin.util import get_deleted_objects, model_ngettext
from django.db import router
from django.template.response import TemplateResponse
from django.utils... | ajibawa-2023/Python-Code-Large/train/row_83066 | 34 | 83 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83066:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0241, 0.0361, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83066:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83066:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83066:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83066:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code... |
import zipfile
from io import BytesIO
from django.conf import settings
from django.http import HttpResponse
from django.template import loader
def compress_kml(kml):
"Returns compressed KMZ from the given KML string."
kmz = BytesIO()
zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED)
zf.writestr('do... | ajibawa-2023/Python-Code-Large/train/row_83067 | 22 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83067:Import_L1_C0", "label": "zipfile import zipfile", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 93, 0, 1, 0, 0, 93, 0, 0], "semantic": {"name": "zipfile", "arg_names": [], "import_names": ["zipfile"], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83067:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83067:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83067:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83067:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.db import connection
if (hasattr(connection.ops, 'spatial_version') and
not connection.ops.mysql):
# Getting the `SpatialRefSys` and `GeometryColumns`
# models for the default spatial backend. These
# aliases are provided for backwards-compatibility.
SpatialRefSys = connection.ops.spat... | ajibawa-2023/Python-Code-Large/train/row_83068 | 4 | 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_83068:ImportFrom_L1_C0", "label": "from django.db import connection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 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_83068:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83068:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83068:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83068:Assign_L9_C4"}] |
from django.core import urlresolvers
from django.contrib.sitemaps import Sitemap
class GeoRSSSitemap(Sitemap):
"""
A minimal hook to produce sitemaps for GeoRSS feeds.
"""
def __init__(self, feed_dict, slug_dict=None):
"""
This sitemap object initializes on a feed dictionary (as would b... | ajibawa-2023/Python-Code-Large/train/row_83069 | 25 | 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_83069:ImportFrom_L1_C0", "label": "from django.core import urlresolvers", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0189, 0, 0.66, 0.0, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83069:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83069:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83069:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83069:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.core import urlresolvers
from django.contrib.sitemaps import Sitemap
from django.contrib.gis.db.models.fields import GeometryField
from django.db import models
class KMLSitemap(Sitemap):
"""
A minimal hook to produce KML sitemaps.
"""
geo_format = 'kml'
def __init__(self, locations=Non... | ajibawa-2023/Python-Code-Large/train/row_83070 | 35 | 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_83070:ImportFrom_L1_C0", "label": "from django.core import urlresolvers", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83070:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83070:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83070:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83070:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from __future__ import unicode_literals
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.contrib.gis.db.models.fields i... | ajibawa-2023/Python-Code-Large/train/row_83071 | 70 | 114 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_83071:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0088, 0.0088, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_83071:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83071:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_83071:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_83071:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.