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 mod_python import apache
import os
def authenhandler(req, **kwargs):
"""
Authentication handler that checks against Django's auth database.
"""
# mod_python fakes the environ, and thus doesn't process SetEnv. This fixes
# that so that the following import works
os.environ.update(req.subp... | ajibawa-2023/Python-Code-Large/train/row_86254 | 34 | 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_86254:ImportFrom_L1_C0", "label": "from mod_python import apache", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0179, 0, 0.66, 0.0, 889, 0, 1, 0, 0, 889, 0, 0], "semantic": {"name": "mod_python", "arg_names": [], "import_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86254:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86254:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86254:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86254:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.dispatch import Signal
user_logged_in = Signal(providing_args=['request', 'user'])
user_logged_out = Signal(providing_args=['request', 'user'])
| ajibawa-2023/Python-Code-Large/train/row_86255 | 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_86255:ImportFrom_L1_C0", "label": "from django.dispatch import Signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "django.dispatch", "arg_names": [], "import_... | [] |
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib... | ajibawa-2023/Python-Code-Large/train/row_86256 | 218 | 308 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86256:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 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_86256:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86256:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86256:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86256:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from __future__ import with_statement
import os
from django.contrib.auth.models import User
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm)
from django.core import mail
from django.forms.fields import Field, EmailFi... | ajibawa-2023/Python-Code-Large/train/row_86257 | 189 | 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_86257:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0029, 0.0029, 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_86257:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86257:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86257:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86257:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Cod... |
import os
from django.conf import global_settings
from django.contrib.auth import authenticate
from django.contrib.auth.context_processors import PermWrapper, PermLookupDict
from django.db.models import Q
from django.template import context
from django.test import TestCase
from django.test.utils import override_settin... | ajibawa-2023/Python-Code-Large/train/row_86258 | 75 | 150 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86258:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 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_86258:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86258:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86258:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86258:If_L14_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.contrib.auth.models import (Group, User,
SiteProfileNotAvailable, UserManager)
class ProfileTestCase(TestCase):
fixtures = ['authtestdata.json']
def setUp(self):
"""Backs ... | ajibawa-2023/Python-Code-Large/train/row_86259 | 65 | 107 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86259:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0093, 0.0093, 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_86259:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86259:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86259:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86259:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.test import TestCase
from django.test.utils import override_settings
from django.contrib.auth import signals
class SignalTestCase(TestCase):
urls = 'django.contrib.auth.tests.urls'
fixtures = ['authtestdata.json']
def listener_login(self, user, **kwargs):
self.logged_in.append(user)
... | ajibawa-2023/Python-Code-Large/train/row_86260 | 36 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86260:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.02, 0.02, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86260:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86260:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86260:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86260:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.test import TestCase
from django.utils.unittest import skipUnless
from django.contrib.auth.models import User, AnonymousUser
from django.core.management import call_command
from StringIO import StringIO
try:
import crypt as crypt_module
except ImportError:
crypt_module = None
class BasicTestCase(... | ajibawa-2023/Python-Code-Large/train/row_86261 | 73 | 112 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86261:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0089, 0.0089, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86261:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86261:Import_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86261:Try_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86261:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
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_86262 | 30 | 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_86262:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0154, 0.0154, 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_86262:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86262:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86262:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86262:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
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, UNUSABLE_PASSWORD)
from django.utils import unittest
from django.util... | ajibawa-2023/Python-Code-Large/train/row_86263 | 103 | 133 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86263:ImportFrom_L1_C0", "label": "from django.conf.global_settings import default_hashers", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0075, 0, 0.66, 0.0, 930, 0, 1, 0, 0, 930, 0, 0], "semantic": {"name": "django.conf.global... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86263:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86263:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86263:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86263:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
from datetime import datetime
from django.conf import settings
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
class RemoteUserTest(TestCase):
urls = 'django.contrib.auth.tests.urls'
mid... | ajibawa-2023/Python-Code-Large/train/row_86264 | 103 | 173 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86264:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0058, 0.0058, 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_86264:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86264:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86264:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86264:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.tests.views import AuthViewsTestCase
class LoginRequiredTestCase(AuthViewsTestCase):
"""
Tests the login_required decorators
"""
urls = 'django.contrib.auth.tests.urls'
def testCalla... | ajibawa-2023/Python-Code-Large/train/row_86265 | 26 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86265:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0217, 0.0217, 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_86265:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86265:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86265:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86265:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
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.test import TestCase
class TokenGeneratorTest(TestCase):
def test_make_token(self):
"""
Ensure that we ... | ajibawa-2023/Python-Code-Large/train/row_86266 | 39 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86266:ImportFrom_L1_C0", "label": "from datetime import date, timedelta", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 0, 0.66, 0.0, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86266:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86266:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86266:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86266:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from __future__ import with_statement
import os
import re
import urllib
from django.conf import 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.urlresolver... | ajibawa-2023/Python-Code-Large/train/row_86267 | 290 | 500 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86267:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "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": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86267:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86267:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86267:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86267:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from StringIO import StringIO
from django.contrib.auth import models, management
from django.contrib.auth.management.commands import changepassword
from django.test import TestCase
class GetDefaultUsernameTestCase(TestCase):
def setUp(self):
self._getpass_getuser = management.get_system_username
de... | ajibawa-2023/Python-Code-Large/train/row_86268 | 42 | 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_86268:ImportFrom_L1_C0", "label": "from StringIO import StringIO", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 0, 0.66, 0.0, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86268:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86268:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86268:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86268:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
from django.contrib.auth.tests.auth_backends import (BackendTest,
RowlevelBackendTest, AnonymousUserBackendTest, NoBackendsTest,
InActiveUserBackendTest, NoInActiveUserBackendTest)
from django.contrib.auth.tests.basic import BasicTestCase
from django.contrib.auth.tests.context_processors import AuthContextProce... | ajibawa-2023/Python-Code-Large/train/row_86269 | 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_86269:ImportFrom_L1_C0", "label": "from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest\u2026", "type": "import", "loc": [1, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.1154, 0, 0.66, 0.0, 769, 0, ... | [] |
# 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_86270 | 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_86270: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.core.exceptions import ImproperlyConfigured
from django.utils.functional import SimpleLazyObject
def get_user(request):
if not hasattr(request, '_cached_user'):
request._cached_user = auth.get_user(request)
return request._cached_user
class AuthenticationM... | ajibawa-2023/Python-Code-Large/train/row_86271 | 32 | 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_86271:ImportFrom_L1_C0", "label": "from django.contrib import auth", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 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_86271:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86271:If_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86271:If_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86271:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/ro... |
import hashlib
from django.conf import settings
from django.utils import importlib
from django.utils.datastructures import SortedDict
from django.utils.encoding import smart_str
from django.core.exceptions import ImproperlyConfigured
from django.utils.crypto import (
pbkdf2, constant_time_compare, get_random_strin... | ajibawa-2023/Python-Code-Large/train/row_86272 | 188 | 393 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86272:Import_L1_C0", "label": "hashlib import hashlib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0025, 0.0025, 0, 0.66, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86272:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86272:Return_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86272:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86272:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code... |
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 available_attrs
def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NA... | ajibawa-2023/Python-Code-Large/train/row_86273 | 35 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86273:Import_L1_C0", "label": "urlparse import urlparse", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlpars... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86273:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86273:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86273:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86273:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-C... |
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_86274 | 83 | 173 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86274:ImportFrom_L1_C0", "label": "from django.db import transaction", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0058, 0.0058, 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_86274:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86274:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86274:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86274:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Management utility to create superusers.
"""
import getpass
import re
import sys
from optparse import make_option
from django.contrib.auth.models import User
from django.contrib.auth.management import get_default_username
from django.core import exceptions
from django.core.management.base import BaseCommand, Comm... | ajibawa-2023/Python-Code-Large/train/row_86275 | 69 | 127 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86275:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0157, 0.0236, 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_86275:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86275:If_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86275:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86275:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
import getpass
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.db import DEFAULT_DB_ALIAS
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--database', action='stor... | ajibawa-2023/Python-Code-Large/train/row_86276 | 34 | 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_86276:Import_L1_C0", "label": "getpass import getpass", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0179, 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_86276:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86276:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86276:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86276:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Creates permissions for all installed apps that need permissions.
"""
import getpass
import locale
import unicodedata
from django.contrib.auth import models as auth_app
from django.db.models import get_models, signals
from django.contrib.auth.models import User
def _get_permission_codename(action, opts):
retu... | ajibawa-2023/Python-Code-Large/train/row_86277 | 62 | 127 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86277:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0157, 0.0236, 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_86277:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86277:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86277:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86277:Expr_L17_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
class PasswordResetTokenGenerator(object):
"""
Strategy object used to generate and check tokens for the password
reset me... | ajibawa-2023/Python-Code-Large/train/row_86278 | 34 | 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_86278:ImportFrom_L1_C0", "label": "from datetime import date", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 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_86278:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86278:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86278:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86278:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import urlparse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, QueryDict
from django.template.response import TemplateResponse
from django.utils.http import base36_to_int, is_safe_url
from django.utils.translation import ugettext as _
from dj... | ajibawa-2023/Python-Code-Large/train/row_86279 | 130 | 261 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86279:Import_L1_C0", "label": "urlparse import urlparse", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0038, 0.0038, 0, 0.66, 0.0, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlpars... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86279:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86279:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86279:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86279:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class Redirect(models.Model):
site = models.ForeignKey(Site)
old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,
help_text=_("This should be an ab... | ajibawa-2023/Python-Code-Large/train/row_86281 | 15 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86281:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["mode... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86281:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86281:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86281:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86281:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.contrib.redirects.models import Redirect
from django import http
from django.conf import settings
class RedirectFallbackMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a redirect for non-404 re... | ajibawa-2023/Python-Code-Large/train/row_86282 | 19 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86282:ImportFrom_L1_C0", "label": "from django.contrib.redirects.models import Redirect", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 909, 0, 1, 0, 0, 909, 0, 0], "semantic": {"name": "django.contrib.redirect... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86282:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86282:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86282:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86282:If_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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_86283 | 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_86283: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_86283:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86283:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86283:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86283: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_86284 | 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_86285 | 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_86285: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_86285:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86285:Assign_L4_C4"}] |
from django.contrib.admindocs import views
from django.db.models import fields as builtin_fields
from django.utils import unittest
import fields
class TestFieldType(unittest.TestCase):
def setUp(self):
pass
def test_field_name(self):
self.assertRaises(AttributeError,
views.get_re... | ajibawa-2023/Python-Code-Large/train/row_86286 | 13 | 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_86286:ImportFrom_L1_C0", "label": "from django.contrib.admindocs import views", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0323, 0, 0.66, 0.0, 601, 0, 1, 0, 0, 601, 0, 0], "semantic": {"name": "django.contrib.admindocs", "arg... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86286:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86286:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86286:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86286:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-C... |
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_86287 | 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_86287: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 smart_str
try:
import docutils... | ajibawa-2023/Python-Code-Large/train/row_86288 | 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_86288: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_86288:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86288:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86288:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86288:Import_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
SITE_CACHE = {}
class SiteManager(models.Manager):
def get_current(self):
"""
Returns the current ``Site`` based on the SITE_ID in the
project's settings. The ``Site`` object is cached the first
... | ajibawa-2023/Python-Code-Large/train/row_86290 | 50 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86290:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0105, 0.0105, 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_86290:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86290:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86290:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86290:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
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
class SitesFrameworkTests(TestCase):
def setUp(self):
Site(id=settings.SI... | ajibawa-2023/Python-Code-Large/train/row_86291 | 39 | 62 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86291:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0161, 0.0161, 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_86291:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86291:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86291:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86291:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
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_86292 | 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_86292: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_86292:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86292:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86292:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86292: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_86293 | 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_86293: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_86293:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86293:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86293:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86293: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_86294 | 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_86294: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_86294:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86294:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86294:If_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86294:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/ro... |
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 checks... | ajibawa-2023/Python-Code-Large/train/row_86296 | 13 | 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_86296:ImportFrom_L1_C0", "label": "from functools import wraps", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0345, 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_86296:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86296:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86296:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86296:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Co... |
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy, ugettext as _
ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password "
... | ajibawa-2023/Python-Code-Large/train/row_86297 | 24 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86297:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86297:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86297:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86297:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86297:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.contrib.admin.util import quote
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.utils.safestring import mark... | ajibawa-2023/Python-Code-Large/train/row_86298 | 52 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86298:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0147, 0.0147, 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_86298:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86298:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86298:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86298:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-... |
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_86300 | 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_86300: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_86300:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86300:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86300:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86300: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_86301 | 29 | 56 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86301: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_86301:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86301:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86301:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86301:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import warnings
from django.template import Library
from django.templatetags.static import PrefixNode
register = Library()
@register.simple_tag
def admin_media_prefix():
"""
Returns the string contained in the setting ADMIN_MEDIA_PREFIX.
"""
warnings.warn(
"The admin_media_prefix template tag ... | ajibawa-2023/Python-Code-Large/train/row_86302 | 8 | 15 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86302:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86302:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86302:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86302:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86302:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
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_86303 | 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_86303: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_86303:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86303:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86303:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86303:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.core.urlresolvers import reverse, NoReverseMatch
from django import template
register = template.Library()
@register.filter
def admin_urlname(value, arg):
return 'admin:%s_%s_%s' % (value.app_label, value.module_name, arg)
| ajibawa-2023/Python-Code-Large/train/row_86304 | 5 | 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_86304:ImportFrom_L1_C0", "label": "from django.core.urlresolvers import reverse, NoReverseMatch", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 749, 0, 2, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.url... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86304:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86304:Return_L8_C4"}] |
import datetime
from django.contrib.admin.util import lookup_field, display_for_field, 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.templatetags.admin_static import static
from django.core.exceptions import ... | ajibawa-2023/Python-Code-Large/train/row_86305 | 198 | 380 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86305:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86305:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86305:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86305:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86305:If_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
#!/usr/bin/env python
import os
import optparse
import subprocess
import sys
here = os.path.dirname(__file__)
def main():
usage = "usage: %prog [file1..fileN]"
description = """With no file paths given this script will automatically
compress all jQuery-based files of the admin app. Requires the Google Closure... | ajibawa-2023/Python-Code-Large/train/row_86306 | 33 | 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_86306:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0426, 0.0213, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86306:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86306:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86306:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86306:Assign_L11_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_86308 | 181 | 419 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86308: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_86308:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86308:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86308:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86308:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
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 ContentType
from django.core.exceptions import Ob... | ajibawa-2023/Python-Code-Large/train/row_86309 | 238 | 352 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86309:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0028, 0.0028, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86309:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86309:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86309:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86309:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from functools import update_wrapper, partial
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.contenttypes.models import Conte... | ajibawa-2023/Python-Code-Large/train/row_86310 | 752 | 1,464 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86310:ImportFrom_L1_C0", "label": "from functools import update_wrapper, partial", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0007, 0.0007, 0, 0.66, 0.0, 711, 0, 2, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86310:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86310:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86310:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86310:Assign_L62_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_86311 | 196 | 444 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86311:ImportFrom_L1_C0", "label": "from functools import update_wrapper", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0023, 0.0023, 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_86311:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86311:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86311:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86311:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Form Widget classes specific to the Django admin site.
"""
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.forms.util import flatatt
from django.utils.... | ajibawa-2023/Python-Code-Large/train/row_86312 | 218 | 317 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86312:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0063, 0.0095, 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_86312:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86312:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86312:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86312:FunctionDef_L26_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_86313 | 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_86313: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_86313:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86313:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86313:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86313:Import_L19_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
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_86315 | 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_86315: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_86315:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86315:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86315:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86315:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code... |
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import zipfile
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 = StringIO()
... | ajibawa-2023/Python-Code-Large/train/row_86316 | 24 | 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_86316:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0694, 0.1111, 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_86316:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86316:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86316:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86316:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
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_86317 | 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_86317: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_86317:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86317:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86317:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86317: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_86318 | 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_86318: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_86318:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86318:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86318:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86318: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_86319 | 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_86319: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_86319:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86319:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86319:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86319:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
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 import GeometryField
from django.db import... | ajibawa-2023/Python-Code-Large/train/row_86320 | 69 | 112 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86320:ImportFrom_L1_C0", "label": "from django.http import HttpResponse, Http404", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0089, 0.0089, 0, 0.66, 0.0, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86320:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86320:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86320:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86320:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code... |
# Geo-enabled Sitemap classes.
from django.contrib.gis.sitemaps.georss import GeoRSSSitemap
from django.contrib.gis.sitemaps.kml import KMLSitemap, KMZSitemap
| ajibawa-2023/Python-Code-Large/train/row_86321 | 2 | 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_86321:ImportFrom_L2_C0", "label": "from django.contrib.gis.sitemaps.georss import GeoRSSSitemap", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.25, 0, 0.66, 0.0, 81, 0, 1, 0, 0, 81, 0, 0], "semantic": {"name": "django.contrib.gis.s... | [] |
from django.contrib.gis.geos import (
GEOSGeometry as Geometry, GEOSException as GeometryException)
| ajibawa-2023/Python-Code-Large/train/row_86322 | 1 | 2 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86322:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos import Geometry, GeometryException", "type": "import", "loc": [1, 2], "level": 0, "parent": null, "vector": [1, 0, 0.75, 1.0, 0, 0.66, 0.0, 886, 0, 2, 0, 0, 886, 0, 0], "semantic": {"name": "django.contrib.... | [] |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
geom_backend = getattr(settings, 'GEOMETRY_BACKEND', 'geos')
try:
module = import_module('.%s' % geom_backend, 'django.contrib.gis.geometry.backend')
except ImportError, e:
... | ajibawa-2023/Python-Code-Large/train/row_86323 | 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_86323:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names"... | [] |
import re
# Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure
# to prevent potentially malicious input from reaching the underlying C
# library. Not a substitute for good Web security programming practices.
hex_regex = re.compile(r'^[0-9A-F]+$', re.I)
wkt_regex = re.compile(r'^(SRID=(?P<srid... | ajibawa-2023/Python-Code-Large/train/row_86324 | 4 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86324:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [] |
from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point
from django.contrib.gis.maps.google.gmap import GoogleMapException
from math import pi, sin, log, exp, atan
# Constants used for degree to radian conversion, and vice-versa.
DTOR = pi / 180.
RTOD = 180. / pi
class GoogleZoom(object):
"""... | ajibawa-2023/Python-Code-Large/train/row_86325 | 70 | 161 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86325:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0062, 0.0062, 0, 0.66, 0.0, 886, 0, 4, 0, 0, 886, 0, 0], "semantic": {"name":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86325:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86325:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86325:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86325:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.utils.safestring import mark_safe
from django.contrib.gis.geos import fromstr, Point, LineString, LinearRing, Polygon
class GEvent(object):
"""
A Python wrapper for the Google GEvent object.
Events can be attached to any object derived from GOverlayBase with the
add_event() call.
For ... | ajibawa-2023/Python-Code-Large/train/row_86326 | 98 | 301 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86326:ImportFrom_L1_C0", "label": "from django.utils.safestring import mark_safe", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 0, 0.66, 0.0, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.safestring", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86326:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86326:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86326:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86326:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
This module houses the GoogleMap object, used for generating
the needed javascript to embed Google Maps in a Web page.
Google(R) is a registered trademark of Google, Inc. of Mountain View, California.
Example:
* In the view:
return render_to_response('template.html', {'google' : GoogleMap(key="... | ajibawa-2023/Python-Code-Large/train/row_86327 | 4 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86327:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 58], "level": 0, "parent": null, "vector": [8, 0, 0.4836, 0.9508, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker
class GoogleMapException(Exception):
pass
# The default Google Maps URL (for the API javascript)
# T... | ajibawa-2023/Python-Code-Large/train/row_86328 | 108 | 229 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86328:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0044, 0.0044, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86328:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86328:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86328:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86328:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.contrib.syndication.views import Feed as BaseFeed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
class GeoFeedMixin(object):
"""
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C Geo elements.
"""
def georss_coor... | ajibawa-2023/Python-Code-Large/train/row_86329 | 78 | 135 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86329:ImportFrom_L1_C0", "label": "from django.contrib.syndication.views import BaseFeed", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 264, 0, 1, 0, 0, 264, 0, 0], "semantic": {"name": "django.contrib.syndi... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86329:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86329:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86329:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86329:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Utilities for manipulating Geometry WKT.
"""
def precision_wkt(geom, prec):
"""
Returns WKT text of the geometry according to the given precision (an
integer or a string). If the precision is an integer, then the decimal
places of coordinates WKT will be truncated to that number:
>>> pnt =... | ajibawa-2023/Python-Code-Large/train/row_86330 | 29 | 55 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86330:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0364, 0.0545, 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_86330:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86330:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86330:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86330:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import warnings
from django.contrib.gis import geoip
HAS_GEOIP = geoip.HAS_GEOIP
if HAS_GEOIP:
BaseGeoIP = geoip.GeoIP
GeoIPException = geoip.GeoIPException
class GeoIP(BaseGeoIP):
def __init__(self, *args, **kwargs):
warnings.warn('GeoIP class has been moved to `django.contrib.gis.geo... | ajibawa-2023/Python-Code-Large/train/row_86331 | 10 | 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_86331:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86331:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86331:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86331:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86331:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_863... |
"""
This module is for inspecting OGR data sources and generating either
models for GeoDjango and/or mapping dictionaries for use with the
`LayerMapping` utility.
Author: Travis Pinney, Dane Springmeyer, & Justin Bronn
"""
from itertools import izip
# Requires GDAL to use.
from django.contrib.gis.gdal import DataSourc... | ajibawa-2023/Python-Code-Large/train/row_86332 | 90 | 225 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86332:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0178, 0.0311, 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_86332:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86332:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86332:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86332:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
This module includes some utility functions for inspecting the layout
of a GDAL data source -- the functionality is analogous to the output
produced by the `ogrinfo` utility.
"""
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.gdal.geometries import GEO_CLASSES
def ogrinfo(data_source, num_... | ajibawa-2023/Python-Code-Large/train/row_86333 | 31 | 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_86333:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0566, 0.0943, 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_86333:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86333:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86333:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86333:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
This module contains useful utilities for GeoDjango.
"""
# Importing the utilities that depend on GDAL, if available.
from django.contrib.gis.gdal import HAS_GDAL
if HAS_GDAL:
from django.contrib.gis.utils.ogrinfo import ogrinfo, sample
from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect
... | ajibawa-2023/Python-Code-Large/train/row_86335 | 14 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86335:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.08, 0.12, 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_86335:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86335:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86335:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86335:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
from django.contrib.gis.gdal import SpatialReference
def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
database=None):
"""
This function takes a GDAL SpatialReference system and adds its information
to the `spatial_ref_sys` table of the spatial backend. Doing th... | ajibawa-2023/Python-Code-Large/train/row_86336 | 22 | 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_86336:ImportFrom_L1_C0", "label": "from django.contrib.gis.gdal import SpatialReference", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gd... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86336:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86336:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86336:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86336:ImportFrom_L35_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from __future__ import absolute_import
from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap
from .feeds import feed_dict
from .models import City, Country
sitemaps = {'kml' : KMLSitemap([City, Country]),
'kmz' : KMZSitemap([City, Country]),
'georss' : GeoRSSSitemap(f... | ajibawa-2023/Python-Code-Large/train/row_86337 | 5 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86337:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impo... | [] |
from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import mysql, spatialite
# MySQL spatial indices can't handle NULL geometries.
null_flag = not mysql
class Country(models.Model):
name = models.CharField(max_length=30)
mpoly = models.MultiPolygonField() # SRID, by default, is 4326
... | ajibawa-2023/Python-Code-Large/train/row_86338 | 44 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86338:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.02, 0.02, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86338:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86338:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86338:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86338:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from __future__ import absolute_import
import re
from django.db import connection
from django.db.utils import DatabaseError
from django.contrib.gis import gdal
from django.contrib.gis.geos import (fromstr, GEOSGeometry,
Point, LineString, LinearRing, Polygon, GeometryCollection)
from django.contrib.gis.tests.util... | ajibawa-2023/Python-Code-Large/train/row_86339 | 432 | 741 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86339:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0013, 0.0013, 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_86339:If_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86339:ImportFrom_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86339:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86339:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from __future__ import absolute_import
from django.contrib.gis import feeds
from .models import City
class TestGeoRSS1(feeds.Feed):
link = '/city/'
title = 'Test GeoDjango Cities'
def items(self):
return City.objects.all()
def item_link(self, item):
return '/city/%s/' % item.pk
... | ajibawa-2023/Python-Code-Large/train/row_86340 | 33 | 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_86340:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "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": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86340:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86340:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86340:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86340:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from __future__ import absolute_import
from django.conf.urls import patterns
from .feeds import feed_dict
from .sitemaps import sitemaps
urlpatterns = patterns('',
(r'^feeds/(?P<url>.*)/$', 'django.contrib.gis.views.feed', {'feed_dict': feed_dict}),
)
urlpatterns += patterns('django.contrib.gis.sitemaps.views'... | ajibawa-2023/Python-Code-Large/train/row_86341 | 5 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86341:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impo... | [] |
from django.contrib.gis.db import models
class City3D(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(dim=3)
objects = models.GeoManager()
def __unicode__(self):
return self.name
class Interstate2D(models.Model):
name = models.CharField(max_length=30)
l... | ajibawa-2023/Python-Code-Large/train/row_86342 | 52 | 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_86342:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86342:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86342:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86342:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86342:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from __future__ import absolute_import
import os
import re
from django.utils.unittest import TestCase
from django.contrib.gis.db.models import Union, Extent3D
from django.contrib.gis.geos import GEOSGeometry, Point, Polygon
from django.contrib.gis.utils import LayerMapping, LayerMapError
from .models import (City3D,... | ajibawa-2023/Python-Code-Large/train/row_86343 | 121 | 233 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86343:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0043, 0.0043, 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_86343:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86343:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86343:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86343:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Co... |
# Create your views here.
| ajibawa-2023/Python-Code-Large/train/row_86344 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
from django.contrib.gis.db import models
class SouthTexasCity(models.Model):
"City model on projected coordinate system for South Texas."
name = models.CharField(max_length=30)
point = models.PointField(srid=32140)
objects = models.GeoManager()
def __unicode__(self): return self.name
class SouthTe... | ajibawa-2023/Python-Code-Large/train/row_86345 | 50 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86345:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.02, 0.02, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86345:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86345:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86345:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86345:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from __future__ import absolute_import
from django.db import connection
from django.db.models import Q
from django.contrib.gis.geos import GEOSGeometry, LineString
from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gis.tests.utils import oracle, postgis, spatialite, no_oracle, no_spatial... | ajibawa-2023/Python-Code-Large/train/row_86346 | 190 | 358 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86346:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "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": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86346:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86346:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86346:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86346:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.contrib.gis.db import models
class City(models.Model):
name = models.CharField(max_length=30)
point = models.PointField(geography=True)
objects = models.GeoManager()
def __unicode__(self): return self.name
class Zipcode(models.Model):
code = models.CharField(max_length=10)
poly = m... | ajibawa-2023/Python-Code-Large/train/row_86347 | 20 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86347:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86347:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86347:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86347:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86347:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Tests for geography support in PostGIS 1.5+
"""
from __future__ import absolute_import
import os
from django.contrib.gis import gdal
from django.contrib.gis.measure import D
from django.test import TestCase
from .models import City, County, Zipcode
class GeographyTest(TestCase):
def test01_fixture_load(se... | ajibawa-2023/Python-Code-Large/train/row_86348 | 53 | 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_86348:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.022, 0.033, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86348:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86348:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86348:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86348:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.contrib.gis.db import models
class State(models.Model):
name = models.CharField(max_length=20)
objects = models.GeoManager()
class County(models.Model):
name = models.CharField(max_length=25)
state = models.ForeignKey(State)
mpoly = models.MultiPolygonField(srid=4269) # Multipolygon in... | ajibawa-2023/Python-Code-Large/train/row_86349 | 41 | 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_86349:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86349:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86349:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86349:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86349:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from __future__ import absolute_import
import os
from copy import copy
from decimal import Decimal
from django.utils.unittest import TestCase
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, ... | ajibawa-2023/Python-Code-Large/train/row_86350 | 151 | 280 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86350:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 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_86350:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86350:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86350:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86350:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.contrib.gis.db import models
from django.contrib.localflavor.us.models import USStateField
class Location(models.Model):
point = models.PointField()
objects = models.GeoManager()
def __unicode__(self): return self.point.wkt
class City(models.Model):
name = models.CharField(max_length=50)
... | ajibawa-2023/Python-Code-Large/train/row_86351 | 43 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86351:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.02, 0.02, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86351:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86351:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86351:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86351:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from __future__ import absolute_import
from datetime import date
from django.contrib.gis.geos import GEOSGeometry, Point, MultiPoint
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.tests.utils import mysql, orac... | ajibawa-2023/Python-Code-Large/train/row_86352 | 175 | 302 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86352:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 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_86352:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86352:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86352:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86352:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
# function that will pass a test.
def pass_test(*args): return
def no_backend(test_func, backend):
"Use this decorator to disable test on specified backend."
if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] == backend:
... | ajibawa-2023/Python-Code-Large/train/row_86353 | 22 | 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_86353: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_86353:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86353:Return_L5_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86353:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86353:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.contrib.gis.db import models
class AllOGRFields(models.Model):
f_decimal = models.FloatField()
f_float = models.FloatField()
f_int = models.IntegerField()
f_char = models.CharField(max_length=10)
f_date = models.DateField()
f_datetime = models.DateTimeField()
f_time = models.Tim... | ajibawa-2023/Python-Code-Large/train/row_86354 | 11 | 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_86354:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86354:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86354:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86354:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86354:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from __future__ import absolute_import
import os
from django.db import connections
from django.test import TestCase
from django.contrib.gis.gdal import Driver
from django.contrib.gis.geometry.test_data import TEST_DATA
from django.contrib.gis.utils.ogrinspect import ogrinspect
from .models import AllOGRFields
clas... | ajibawa-2023/Python-Code-Large/train/row_86355 | 45 | 126 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86355:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0079, 0.0079, 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_86355:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86355:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86355:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86355:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
from django.contrib.gis.db import models
from django.contrib.gis import admin
class City(models.Model):
name = models.CharField(max_length=30)
point = models.PointField()
objects = models.GeoManager()
def __unicode__(self): return self.name
admin.site.register(City, admin.OSMGeoAdmin)
| ajibawa-2023/Python-Code-Large/train/row_86356 | 9 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86356:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.1, 0, 0.66, 0.0, 964, 0, 1, 0, 0, 964, 0, 0], "semantic": {"name": "django.contrib.gis.db", "arg_names": []... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86356:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86356:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86356:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86356:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from __future__ import absolute_import
from django.test import TestCase
from django.contrib.gis import admin
from .models import City
class GeoAdminTest(TestCase):
urls = 'django.contrib.gis.tests.geoadmin.urls'
def test01_ensure_geographic_media(self):
geoadmin = admin.site._registry[City]
... | ajibawa-2023/Python-Code-Large/train/row_86357 | 10 | 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_86357:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 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_86357:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86357:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86357:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86357:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf.urls import patterns, include
from django.contrib import admin
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
)
| ajibawa-2023/Python-Code-Large/train/row_86358 | 3 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86358:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, include", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_nam... | [] |
from django.conf import settings
from django.test.simple import build_suite, DjangoTestSuiteRunner
from django.utils import unittest
def run_tests(*args, **kwargs):
from django.test.simple import run_tests as base_run_tests
return base_run_tests(*args, **kwargs)
def geo_apps(namespace=True, runtests=False):
... | ajibawa-2023/Python-Code-Large/train/row_86359 | 68 | 131 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86359:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0076, 0.0076, 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_86359:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86359:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86359:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86359:Return_L7_C4"}, {"f": "ajibawa-2023/Python-Co... |
# Copyright (c) 2007, Robert Coup <robert.coup@onetrackmind.co.nz>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#... | ajibawa-2023/Python-Code-Large/train/row_86360 | 129 | 336 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86360:Expr_L29_C0", "label": "expression", "type": "expression", "loc": [29, 37], "level": 0, "parent": null, "vector": [8, 0, 0.0982, 0.0268, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86360:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86360:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86360:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86360:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.