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 |
|---|---|---|---|---|---|---|---|
"""
A generic comment-moderation system which allows configuration of
moderation options on a per-model basis.
To use, do two things:
1. Create or import a subclass of ``CommentModerator`` defining the
options you want.
2. Import ``moderator`` from this module and register one or more
models, passing... | ajibawa-2023/Python-Code-Large/train/row_98589 | 97 | 355 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98589:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 55], "level": 0, "parent": null, "vector": [8, 0, 0.0789, 0.1549, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98589:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98589:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98589:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98589:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Signals relating to comments.
"""
from django.dispatch import Signal
# Sent just before a comment will be posted (after it's been approved and
# moderated; this can be used to modify the comment (in place) with posting
# details or other such actions. If any receiver returns False the comment will be
# dis... | ajibawa-2023/Python-Code-Large/train/row_98590 | 5 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98590:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0952, 0.1429, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
from django.utils.translation import ugettext as _
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def ... | ajibawa-2023/Python-Code-Large/train/row_98591 | 28 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98591:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0263, 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_98591:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98591:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98591:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98591:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_unicode
class CommentManager(models.Manager):
def in_moderation(self):
"""
QuerySet for all comments currently in the moderation queue.
"""
retu... | ajibawa-2023/Python-Code-Large/train/row_98592 | 14 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98592:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98592:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98592:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98592:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98592:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls.defaults import *
urlpatterns = patterns('django.contrib.comments.views',
url(r'^post/$', 'comments.post_comment', name='comments-post-comment'),
url(r'^posted/$', 'comments.comment_done', name='comments-comment-done'),
url(r'^flag/(\d+)/$', 'modera... | ajibawa-2023/Python-Code-Large/train/row_98593 | 2 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98593:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib import comments
from django.utils.encoding import smart_unicode
register = template.Library()
class BaseCommentNode(t... | ajibawa-2023/Python-Code-Large/train/row_98594 | 146 | 333 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98594:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.003, 0.003, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["temp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98594:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98594:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98594:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98594:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib import admin
from django.contrib.comments.models import Comment
from django.utils.translation import ugettext_lazy as _, ungettext
from django.contrib.comments import get_model
from django.contrib.comments.views.moderation import perform_flag, perform_approve, perform_delete
class CommentsAdm... | ajibawa-2023/Python-Code-Large/train/row_98595 | 40 | 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_98595:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 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_98595:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98595:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98595:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98595:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.conf import settings
from django.core import urlresolvers
from django.core.exceptions import ImproperlyConfigured
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
from django.utils.importlib import import_module
DEFAULT_COMMENTS_APP = 'django.c... | ajibawa-2023/Python-Code-Large/train/row_98596 | 47 | 91 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98596:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.011, 0.011, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98596:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98596:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98596:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98596:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Create a superuser from the command line. Deprecated; use manage.py
createsuperuser instead.
"""
if __name__ == "__main__":
from django.core.management import call_command
call_command("createsuperuser")
| ajibawa-2023/Python-Code-Large/train/row_98597 | 4 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98597:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.3125, 0.5, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98597:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98597:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98597:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98597:Expr_L8_C4"}] |
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site
from django.template import Context, loader
from django import forms
from django.utils.translation import... | ajibawa-2023/Python-Code-Large/train/row_98598 | 132 | 214 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98598:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0047, 0.0047, 0, 0.66, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98598:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98598:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98598:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98598:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.core.context_processors import PermWrapper
from django.utils.functional import lazy, memoize, SimpleLazyObject
from django.contrib import messages
def auth(request):
"""
Returns context variables required by apps that use Django's authentication
system.
If there is no 'user' attri... | ajibawa-2023/Python-Code-Large/train/row_98599 | 11 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98599:ImportFrom_L1_C0", "label": "from django.core.context_processors import PermWrapper", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 55, 0, 1, 0, 0, 55, 0, 0], "semantic": {"name": "django.core.context_p... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98599:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98599:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98599:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98599:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Co... |
from django.db import connection
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
supports_object_permissions = False
supports_anonymous_user = True
# TODO: Model, login attribute name... | ajibawa-2023/Python-Code-Large/train/row_98600 | 59 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98600:ImportFrom_L1_C0", "label": "from django.db import connection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0084, 0.0084, 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_98600:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98600:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98600:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98600:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import datetime
import urllib
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.manager import EmptyManager
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import smart_str
from djang... | ajibawa-2023/Python-Code-Large/train/row_98601 | 276 | 474 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98601:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0021, 0.0021, 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_98601:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98601:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98601:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98601:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code... |
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.updat... | ajibawa-2023/Python-Code-Large/train/row_98602 | 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_98602: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_98602:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98602:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98602:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98602:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
import warnings
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib.auth.backends.ModelBackend'
... | ajibawa-2023/Python-Code-Large/train/row_98603 | 183 | 253 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98603:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.004, 0.004, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warnings"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98603:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98603:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98603:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98603:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
from django.test import TestCase
class UserCreationFormTest(TestCase):
fixtures = ['authtestdata.json']
def... | ajibawa-2023/Python-Code-Large/train/row_98604 | 127 | 252 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98604:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.004, 0.004, 0, 0.66, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "ar... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98604:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98604:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98604:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98604:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf import settings
from django.test import TestCase
from django.contrib.auth.models import User, SiteProfileNotAvailable
class ProfileTestCase(TestCase):
fixtures = ['authtestdata.json']
def setUp(self):
"""Backs up the AUTH_PROFILE_MODULE"""
self.old_AUTH_PROFILE_MODULE =... | ajibawa-2023/Python-Code-Large/train/row_98605 | 21 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98605:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0286, 0.0286, 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_98605:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98605:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98605:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98605:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.test import TestCase
from django.contrib.auth.models import User, AnonymousUser
from django.core.management import call_command
from StringIO import StringIO
class BasicTestCase(TestCase):
def test_user(self):
"Check that users can be created and can set their password"
u = User... | ajibawa-2023/Python-Code-Large/train/row_98606 | 61 | 92 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98606:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0109, 0.0109, 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_98606:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98606:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98606:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98606:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls.defaults import patterns
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.http import HttpResponse
from django.template import Template, RequestContext
def remote_user... | ajibawa-2023/Python-Code-Large/train/row_98607 | 12 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98607:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import patterns", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98607:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98607:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98607:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98607:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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
class RemoteUserTest(TestCase):
urls = 'django.contrib.auth.tests.urls'
middleware = 'django.contr... | ajibawa-2023/Python-Code-Large/train/row_98608 | 100 | 170 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98608:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0059, 0.0059, 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_98608:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98608:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98608:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98608:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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... | ajibawa-2023/Python-Code-Large/train/row_98609 | 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_98609: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_98609:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98609:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98609:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98609: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, AnonymousUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
class TokenGeneratorTest(TestCase):
def test_make_token(self):
"... | ajibawa-2023/Python-Code-Large/train/row_98610 | 47 | 74 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98610:ImportFrom_L1_C0", "label": "from datetime import date, timedelta", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0135, 0.0135, 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_98610:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98610:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98610:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98610:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Cod... |
import os
import re
import urllib
from django.conf import settings
from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import User
from django.test im... | ajibawa-2023/Python-Code-Large/train/row_98611 | 176 | 285 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98611:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 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_98611:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98611:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98611:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98611:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest
from django.contrib.auth.tests.basic import BasicTestCase
from django.contrib.auth.tests.decorators import LoginRequiredTestCase
from django.contrib.auth.tests.forms import UserC... | ajibawa-2023/Python-Code-Large/train/row_98612 | 8 | 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_98612:ImportFrom_L1_C0", "label": "from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 769, 0, ... | [] |
# These URLs are normally mapped to /admin/urls.py. This URLs file is
# provided as a convenience to those who want to deploy these URLs elsewhere.
# This file is also used to provide a reliable view deployment for test purposes.
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^login... | ajibawa-2023/Python-Code-Large/train/row_98613 | 2 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98613:ImportFrom_L5_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2941, 0.0588, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
class LazyUser(object):
def __get__(self, request, obj_type=None):
if not hasattr(request, '_cached_user'):
from django.contrib.auth import get_user
request._cached_user = get_user(reque... | ajibawa-2023/Python-Code-Large/train/row_98614 | 34 | 81 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98614:ImportFrom_L1_C0", "label": "from django.contrib import auth", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0123, 0.0123, 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_98614:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98614:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98614:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98614:If_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
try:
from functools import update_wrapper, wraps
except ImportError:
from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
from django.utils.decorators import available_attrs
fro... | ajibawa-2023/Python-Code-Large/train/row_98615 | 30 | 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_98615:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0472, 0.0755, 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_98615:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98615:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98615:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98615:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django import template
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
fr... | ajibawa-2023/Python-Code-Large/train/row_98616 | 77 | 143 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98616:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.007, 0.007, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["temp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98616:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98616:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98616:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98616:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Management utility to create superusers.
"""
import getpass
import os
import re
import sys
from optparse import make_option
from django.contrib.auth.models import User
from django.core import exceptions
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation impo... | ajibawa-2023/Python-Code-Large/train/row_98617 | 74 | 138 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98617:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0145, 0.0217, 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_98617:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98617:If_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98617:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98617:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
import getpass
class Command(BaseCommand):
help = "Change a user's password for django.contrib.auth."
requires_model_validation = False
def _get_pass(self, prompt="Password: "):
... | ajibawa-2023/Python-Code-Large/train/row_98618 | 31 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98618:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand, CommandError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 931, 0, 2, 0, 0, 931, 0, 0], "semantic": {"name": "django.c... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98618:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98618:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98618:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98618:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Creates permissions for all installed apps that need permissions.
"""
from django.contrib.auth import models as auth_app
from django.db.models import get_models, signals
def _get_permission_codename(action, opts):
return u'%s_%s' % (action, opts.object_name.lower())
def _get_all_permissions(opts)... | ajibawa-2023/Python-Code-Large/train/row_98619 | 43 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98619:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.026, 0.039, 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_98619:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98619:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98619:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98619:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from datetime import date
from django.conf import settings
from django.utils.hashcompat import sha_constructor
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 u... | ajibawa-2023/Python-Code-Large/train/row_98620 | 39 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98620:ImportFrom_L1_C0", "label": "from datetime import date", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0122, 0.0122, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["da... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98620:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98620:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98620:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98620:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import re
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
# Avoid shadowing the login() view below.
from django.contrib.auth import login as auth_login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from djan... | ajibawa-2023/Python-Code-Large/train/row_98621 | 112 | 189 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98621:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98621:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98621:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98621:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98621:Assign_L28_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 b... | ajibawa-2023/Python-Code-Large/train/row_98623 | 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_98623: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_98623:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98623:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98623:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98623: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... | ajibawa-2023/Python-Code-Large/train/row_98624 | 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_98624: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_98624:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98624:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98624:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98624: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(R... | ajibawa-2023/Python-Code-Large/train/row_98625 | 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_98625: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_98625:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98625:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98625:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98625: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_98626 | 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_98627 | 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_98627: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_98627:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98627: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,
... | ajibawa-2023/Python-Code-Large/train/row_98628 | 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_98628: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_98628:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98628:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98628:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98628:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-C... |
from django.conf.urls.defaults import *
from django.contrib.admindocs import views
urlpatterns = patterns('',
url('^$',
views.doc_index,
name='django-admindocs-docroot'
),
url('^bookmarklets/$',
views.bookmarklets,
name='django-admindocs-bookmarklets'
),
... | ajibawa-2023/Python-Code-Large/train/row_98629 | 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_98629:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
"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 ... | ajibawa-2023/Python-Code-Large/train/row_98630 | 69 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98630:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0095, 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_98630:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98630:Import_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98630:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98630:Import_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
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 f... | ajibawa-2023/Python-Code-Large/train/row_98632 | 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_98632: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_98632:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98632:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98632:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98632: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=s... | ajibawa-2023/Python-Code-Large/train/row_98633 | 37 | 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_98633:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0179, 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_98633:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98633:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98633:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98633: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... | ajibawa-2023/Python-Code-Large/train/row_98634 | 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_98634: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_98634:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98634:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98634:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98634: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_98635 | 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_98635: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_98635:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98635:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98635:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98635:Assign_L7_C4"}] |
"""
Creates the default Site object.
"""
from django.db.models import signals
from django.contrib.sites.models import Site
from django.contrib.sites import models as site_app
def create_default_site(app, created_models, verbosity, db, **kwargs):
if Site in created_models:
if verbosity >= 2:
... | ajibawa-2023/Python-Code-Large/train/row_98636 | 12 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98636:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1176, 0.1765, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98636:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98636:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98636:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98636:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
from django.contrib.admin.filterspecs import FilterSpec
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.util import quote
from django.core.paginator import Paginator, InvalidPage
from django.db import models
from django.utils.encoding import force_unicode, smart_str
fr... | ajibawa-2023/Python-Code-Large/train/row_98637 | 159 | 244 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98637:ImportFrom_L1_C0", "label": "from django.contrib.admin.filterspecs import FilterSpec", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0041, 0, 0.66, 0.0, 229, 0, 1, 0, 0, 229, 0, 0], "semantic": {"name": "django.contrib.adm... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98637:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98637:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98637:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98637:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-... |
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django import http, template
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response
from ... | ajibawa-2023/Python-Code-Large/train/row_98638 | 43 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98638:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0333, 0.0533, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "sni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98638:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98638:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98638:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98638:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
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 impor... | ajibawa-2023/Python-Code-Large/train/row_98639 | 42 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98639:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0185, 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_98639:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98639:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98639:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98639:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-... |
#!/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 Goo... | ajibawa-2023/Python-Code-Large/train/row_98640 | 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_98640: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_98640:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98640:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98640:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98640:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code... |
#!/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 Goo... | ajibawa-2023/Python-Code-Large/train/row_98641 | 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_98641: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_98641:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98641:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98641:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98641:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
FilterSpec encapsulates the logic for displaying filters in the Django admin.
Filters are specified in models with the "list_filter" option.
Each filter subclass knows how to display a filter for a field that passes a
certain test -- e.g. being a DateField or ForeignKey.
"""
from django.db import models
... | ajibawa-2023/Python-Code-Large/train/row_98642 | 105 | 179 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98642:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0223, 0.0391, 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_98642:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98642:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98642:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98642:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django import template
register = template.Library()
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 inlines.
"""
prepopulated_fields = []
if context['add'] and '... | ajibawa-2023/Python-Code-Large/train/row_98643 | 23 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98643:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 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_98643:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98643:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98643:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98643:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.template import Library
from django.utils.encoding import iri_to_uri
register = Library()
def admin_media_prefix():
"""
Returns the string contained in the setting ADMIN_MEDIA_PREFIX.
"""
try:
from django.conf import settings
except ImportError:
return ''
... | ajibawa-2023/Python-Code-Large/train/row_98644 | 10 | 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_98644:ImportFrom_L1_C0", "label": "from django.template import Library", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 213, 0, 1, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "im... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98644:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98644:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98644:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98644:Try_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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... | ajibawa-2023/Python-Code-Large/train/row_98645 | 29 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98645:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 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_98645:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98645:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98645:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98645:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code... |
import datetime
from django.conf import settings
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
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
from djan... | ajibawa-2023/Python-Code-Large/train/row_98646 | 165 | 303 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98646:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 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_98646:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98646:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98646:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98646:If_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.db import models
from django.db.models.deletion import Collector
from django.db.models.related import RelatedObject
from django.forms.forms import pretty_name
from django.utils import formats
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.text imp... | ajibawa-2023/Python-Code-Large/train/row_98647 | 177 | 282 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98647:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 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_98647:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98647:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98647:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98647:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,
_get_foreign_key)
from django.contrib.admin.options import flatten_fieldsets, BaseModelAdmin
from django.contrib.admin.options import HORIZONT... | ajibawa-2023/Python-Code-Large/train/row_98648 | 169 | 378 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98648:ImportFrom_L1_C0", "label": "from django.core.exceptions import ImproperlyConfigured", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 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_98648:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98648:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98648:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98648:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django import forms
from django.conf import settings
from django.contrib.admin.util import flatten_fieldsets, lookup_field
from django.contrib.admin.util import display_for_field, label_for_field
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
... | ajibawa-2023/Python-Code-Large/train/row_98649 | 233 | 340 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98649:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0029, 0.0029, 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_98649:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98649:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98649:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98649:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django import forms, template
from django.forms.formsets import all_valid
from django.forms.models import modelform_factory, modelformset_factory, inlineformset_factory
from django.forms.models import BaseInlineFormSet
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin import... | ajibawa-2023/Python-Code-Large/train/row_98650 | 679 | 1,289 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98650:ImportFrom_L1_C0", "label": "from django import forms, template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0008, 0.0008, 0, 0.66, 0.0, 294, 0, 2, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98650:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98650:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98650:ClassDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98650:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import re
from django import http, template
from django.contrib.admin import ModelAdmin
from django.contrib.admin import actions
from django.contrib.auth import authenticate, login
from django.views.decorators.csrf import csrf_protect
from django.db.models.base import ModelBase
from django.core.exceptions import... | ajibawa-2023/Python-Code-Large/train/row_98651 | 218 | 462 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98651:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0022, 0.0022, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98651:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98651:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98651:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98651:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Form Widget classes specific to the Django admin site.
"""
import django.utils.copycompat as copy
from django import forms
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
from django.utils.html import escape
from django.utils.text import truncate_words
from dja... | ajibawa-2023/Python-Code-Large/train/row_98652 | 203 | 287 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98652:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.007, 0.0105, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98652:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98652:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98652:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98652:ClassDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# 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, Tabular... | ajibawa-2023/Python-Code-Large/train/row_98653 | 17 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98653: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.0789, 0.0263, 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_98653:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98653:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98653:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98653:Import_L16_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
Built-in, globally-available admin actions.
"""
from django import template
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.shortcuts import rende... | ajibawa-2023/Python-Code-Large/train/row_98654 | 29 | 74 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98654:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.027, 0.0405, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98654:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98654:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98654:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98654:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
import cStringIO, 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 = cStringIO.StringIO()
zf = zipfile.ZipFile(kmz, 'a', zipfile.ZIP_DEFLATED)
zf.write... | ajibawa-2023/Python-Code-Large/train/row_98655 | 21 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98655:Import_L1_C0", "label": "cStringIO import cStringIO, zipfile", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 764, 0, 2, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98655:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98655:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98655:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98655:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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.o... | ajibawa-2023/Python-Code-Large/train/row_98656 | 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_98656: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_98656:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98656:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98656:If_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98656: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 (a... | ajibawa-2023/Python-Code-Large/train/row_98657 | 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_98657: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_98657:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98657:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98657:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98657: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, lo... | ajibawa-2023/Python-Code-Large/train/row_98658 | 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_98658: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_98658:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98658:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98658:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98658: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 ... | ajibawa-2023/Python-Code-Large/train/row_98659 | 68 | 111 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98659:ImportFrom_L1_C0", "label": "from django.http import HttpResponse, Http404", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.009, 0.009, 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_98659:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98659:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98659:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98659:Assign_L18_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_98660 | 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_98660: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_98661 | 1 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98661:ImportFrom_L1_C0", "label": "from django.contrib.gis.geos import Geometry, GeometryException", "type": "import", "loc": [1, 3], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 1.0, 0, 0.66, 0.0, 886, 0, 2, 0, 0, 886, 0, 0], "semantic": {"name": "django.contri... | [] |
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... | ajibawa-2023/Python-Code-Large/train/row_98662 | 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_98662: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=(?... | ajibawa-2023/Python-Code-Large/train/row_98663 | 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_98663: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, cos, log, exp, atan
# Constants used for degree to radian conversion, and vice-versa.
DTOR = pi / 180.
RTOD = 180. / pi
class GoogleZoom(obj... | ajibawa-2023/Python-Code-Large/train/row_98664 | 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_98664: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_98664:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98664:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98664:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98664: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.
... | ajibawa-2023/Python-Code-Large/train/row_98665 | 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_98665: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_98665:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98665:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98665:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98665: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' : Google... | ajibawa-2023/Python-Code-Large/train/row_98666 | 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_98666: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.contrib.gis import geos
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class GoogleMapException(Exception): pass
from django.contrib.gis.maps.google.overlays import GPolygon, GPolyline, GMarker, GIcon
# The default... | ajibawa-2023/Python-Code-Large/train/row_98667 | 109 | 226 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98667: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_98667:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98667:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98667:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98667:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.contrib.syndication.feeds import Feed as BaseFeed, FeedDoesNotExist
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.
... | ajibawa-2023/Python-Code-Large/train/row_98668 | 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_98668:ImportFrom_L1_C0", "label": "from django.contrib.syndication.feeds import BaseFeed, FeedDoesNotExist", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 211, 0, 2, 0, 0, 211, 0, 0], "semantic": {"name": "dj... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98668:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98668:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98668:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98668: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:
... | ajibawa-2023/Python-Code-Large/train/row_98669 | 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_98669: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_98669:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98669:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98669:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98669:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
"""
This module houses the GeoIP object, a ctypes wrapper for the MaxMind GeoIP(R)
C API (http://www.maxmind.com/app/c). This is an alternative to the GPL
licensed Python GeoIP interface provided by MaxMind.
GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts.
For IP-based geoloca... | ajibawa-2023/Python-Code-Large/train/row_98670 | 169 | 361 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98670:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 40], "level": 0, "parent": null, "vector": [8, 0, 0.0568, 0.1108, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98670:If_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98670:Expr_L45_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98670:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98670:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
"""
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 ... | ajibawa-2023/Python-Code-Large/train/row_98671 | 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_98671: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_98671:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98671:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98671:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98671: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_sou... | ajibawa-2023/Python-Code-Large/train/row_98672 | 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_98672: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_98672:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98672:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98672:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98672: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, ogrins... | ajibawa-2023/Python-Code-Large/train/row_98674 | 13 | 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_98674: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_98674:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98674:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98674:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98674:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
from django.contrib.gis.gdal import SpatialReference
from django.db import connections, DEFAULT_DB_ALIAS
def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None,
database=DEFAULT_DB_ALIAS):
"""
This function takes a GDAL SpatialReference system and adds its informatio... | ajibawa-2023/Python-Code-Large/train/row_98675 | 20 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98675:ImportFrom_L1_C0", "label": "from django.contrib.gis.gdal import SpatialReference", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.013, 0, 0.66, 0.0, 793, 0, 1, 0, 0, 793, 0, 0], "semantic": {"name": "django.contrib.gis.gdal... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98675:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98675:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98675:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98675:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap
from models import City, Country
from feeds import feed_dict
sitemaps = {'kml' : KMLSitemap([City, Country]),
'kmz' : KMZSitemap([City, Country]),
'georss' : GeoRSSSitemap(feed_dict),
}
| ajibawa-2023/Python-Code-Large/train/row_98676 | 4 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98676:ImportFrom_L1_C0", "label": "from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 123, 0, 3, 0, 0, 123, 0, 0], "semantic": {"name":... | [] |
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, i... | ajibawa-2023/Python-Code-Large/train/row_98677 | 40 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98677:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0222, 0.0222, 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_98677:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98677:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98677:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98677:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import re, os, unittest
from django.db import connection
from django.contrib.gis import gdal
from django.contrib.gis.geos import *
from django.contrib.gis.measure import Distance
from django.contrib.gis.tests.utils import \
no_mysql, no_oracle, no_postgis, no_spatialite, \
mysql, oracle, postgis, spatial... | ajibawa-2023/Python-Code-Large/train/row_98678 | 438 | 742 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98678:Import_L1_C0", "label": "re import re, os, unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0013, 0.0013, 0, 0.66, 0.0, 540, 0, 3, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re", "os", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98678:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98678:ImportFrom_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98678:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98678:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.gis import feeds
from django.contrib.gis.tests.utils import mysql
from models import City, Country
class TestGeoRSS1(feeds.Feed):
link = '/city/'
title = 'Test GeoDjango Cities'
def items(self):
return City.objects.all()
def item_link(self, item):
retur... | ajibawa-2023/Python-Code-Large/train/row_98679 | 33 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98679:ImportFrom_L1_C0", "label": "from django.contrib.gis import feeds", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "django.contrib.gis", "arg_names": [],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98679:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98679:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98679:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98679:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.conf.urls.defaults import *
from feeds import feed_dict
urlpatterns = patterns('',
(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feed_dict}),
)
from sitemaps import sitemaps
urlpatterns += patterns('django.contrib.gis.sitemaps.views',
(r'^sitemap.xml$', ... | ajibawa-2023/Python-Code-Large/train/row_98680 | 4 | 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_98680:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
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_lengt... | ajibawa-2023/Python-Code-Large/train/row_98681 | 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_98681: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_98681:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98681:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98681:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98681:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os, re, unittest
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, Interstate2D, Interstate3D, \
InterstateProj2D, InterstateProj3D, \
... | ajibawa-2023/Python-Code-Large/train/row_98682 | 122 | 234 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98682:Import_L1_C0", "label": "os import os, re, unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0043, 0.0043, 0, 0.66, 0.0, 688, 0, 3, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98682:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98682:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98682:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98682:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Co... |
# Create your views here.
| ajibawa-2023/Python-Code-Large/train/row_98683 | 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"] | [] | [] |
au_cities = (('Wollongong', 150.902, -34.4245),
('Shellharbour', 150.87, -34.5789),
('Thirroul', 150.924, -34.3147),
('Mittagong', 150.449, -34.4509),
('Batemans Bay', 150.175, -35.7082),
('Canberra', 144.963, -37.8143),
('Melbourne', 1... | ajibawa-2023/Python-Code-Large/train/row_98684 | 5 | 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_98684:Assign_L1_C0", "label": "au_cities =", "type": "assigned_variable", "loc": [1, 12], "level": 0, "parent": null, "vector": [14, 0, 0.1806, 0.3333, 0, 0.66, 0.0, 425, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "au_cities", "arg_names": [], "import_names": [], "rhs_c... | [] |
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
clas... | ajibawa-2023/Python-Code-Large/train/row_98685 | 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_98685: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_98685:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98685:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98685:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98685:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import os, unittest
from decimal import Decimal
from django.db import connection
from django.db.models import Q
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.geos import GEOSGeometry, Point, LineString
from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gi... | ajibawa-2023/Python-Code-Large/train/row_98686 | 211 | 389 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98686:Import_L1_C0", "label": "os import os, unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0026, 0.0026, 0, 0.66, 0.0, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "unittest"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98686:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98686:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98686:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98686:Assign_L23_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)
... | ajibawa-2023/Python-Code-Large/train/row_98687 | 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_98687: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_98687:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98687:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98687:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98687:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Tests for geography support in PostGIS 1.5+
"""
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(self):
"Ensure geography f... | ajibawa-2023/Python-Code-Large/train/row_98688 | 53 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98688:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.023, 0.0345, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98688:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98688:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98688:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98688:Expr_L13_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) # Multip... | ajibawa-2023/Python-Code-Large/train/row_98689 | 39 | 66 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98689:ImportFrom_L1_C0", "label": "from django.contrib.gis.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0152, 0.0152, 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_98689:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98689:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98689:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98689:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
from decimal import Decimal
from django.utils import unittest
from django.utils.copycompat import copy
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal, Missin... | ajibawa-2023/Python-Code-Large/train/row_98690 | 148 | 272 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98690:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0037, 0.0037, 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_98690:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98690:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98690:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98690:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Co... |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^geoapp/', include('django.contrib.gis.tests.geoapp.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_98691 | 2 | 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_98691:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.