code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
from django.core.management.base import BaseCommand
from google.appengine.api import apiproxy_stub_map
from google.appengine.datastore import datastore_stub_util
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--noinput', action='store_f... | ajibawa-2023/Python-Code-Large/train/row_82654 | 35 | 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_82654:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0152, 0.0152, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82654:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82654:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82654:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82654:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import logging
from optparse import make_option
import sys
from django.db import connections
from django.core.management.base import BaseCommand
from django.core.management.commands.runserver import BaseRunserverCommand
from django.core.exceptions import ImproperlyConfigured
from google.appengine.tools import dev_app... | ajibawa-2023/Python-Code-Large/train/row_82655 | 62 | 202 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82655:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.005, 0.005, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82655:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82655:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82655:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82655:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| ajibawa-2023/Python-Code-Large/train/row_82656 | 6 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82656:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.1, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "ann... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82656:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82656:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82656:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82656:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| ajibawa-2023/Python-Code-Large/train/row_82657 | 6 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82657:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.1, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "ann... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82657:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82657:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82657:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82657:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
from dbindexer import autodiscover
autodiscover()
| ajibawa-2023/Python-Code-Large/train/row_82658 | 2 | 2 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82658:ImportFrom_L1_C0", "label": "from dbindexer import autodiscover", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 215, 0, 1, 0, 0, 215, 0, 0], "semantic": {"name": "dbindexer", "arg_names": [], "import_names": ... | [] |
from {{ project_name }}.settings import *
| ajibawa-2023/Python-Code-Large/train/row_82659 | 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.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', '{{ project_name }}.views.home', name='home'),
# url(r'^{{ project_name }}/', include('{{ pr... | ajibawa-2023/Python-Code-Large/train/row_82660 | 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_82660:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, include, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 528, 0, 3, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "ar... | [] |
# Django settings for {{ project_name }} project.
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
ADMINS = (
# ('Your Name', 'yo... | ajibawa-2023/Python-Code-Large/train/row_82661 | 25 | 157 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82661:ImportFrom_L6_C0", "label": "from djangoappengine.settings_base import *", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0382, 0.0064, 0, 0.66, 0.0, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "djangoappengine.settings_base"... | [] |
from django.conf import settings
from django.http import HttpResponse
from django.utils.importlib import import_module
def warmup(request):
"""
Provides default procedure for handling warmup requests on App
Engine. Just add this view to your main urls.py.
"""
for app in settings.INSTALLED_APPS:
... | ajibawa-2023/Python-Code-Large/train/row_82662 | 11 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82662:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 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_82662:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82662:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82662:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82662:For_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import django
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.expressions import ExpressionNode
if django.VERSION >= (1, 5):
ExpressionNode_BITAND = ExpressionNode.BITAND
ExpressionNode_BITOR = ExpressionNode.BITOR
def find_col_by_node(cols, node):
col = None
... | ajibawa-2023/Python-Code-Large/train/row_82664 | 34 | 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_82664:Import_L1_C0", "label": "django import django", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["django"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82664:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82664:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82664:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82664:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_826... |
from djangotoolbox.db.creation import NonrelDatabaseCreation
from .db_settings import get_model_indexes
from .stubs import stub_manager
class DatabaseCreation(NonrelDatabaseCreation):
# For TextFields and XMLFields we'll default to the unindexable,
# but not length-limited, db.Text (db_type of "string" fiel... | ajibawa-2023/Python-Code-Large/train/row_82666 | 33 | 76 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82666:ImportFrom_L1_C0", "label": "from djangotoolbox.db.creation import NonrelDatabaseCreation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0132, 0.0132, 0, 0.66, 0.0, 682, 0, 1, 0, 0, 682, 0, 0], "semantic": {"name": "djangotoolbox... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82666:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82666:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82666:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82666:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.db import DEFAULT_DB_ALIAS
from google.appengine.datastore.datastore_query import Cursor
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback.
class CursorQueryMixin(object):
def clone(self, *args, **kwargs):
kwargs... | ajibawa-2023/Python-Code-Large/train/row_82667 | 62 | 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_82667:ImportFrom_L1_C0", "label": "from django.db import DEFAULT_DB_ALIAS", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0109, 0.0109, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82667:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82667:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82667:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82667:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.conf import settings
from django.utils.importlib import import_module
# TODO: Add autodiscover() and make API more like dbindexer's
# register_index.
# TODO: Add support for eventual consistency setting on specific
# models.
_MODULE_NAMES = getattr(settings, 'GAE_SETTINGS_MODULES', ())
FIEL... | ajibawa-2023/Python-Code-Large/train/row_82668 | 19 | 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_82668:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 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_82668:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82668:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82668:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82668:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Co... |
from google.appengine.api.memcache import *
| ajibawa-2023/Python-Code-Large/train/row_82670 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82670:ImportFrom_L1_C0", "label": "from google.appengine.api.memcache import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "google.appengine.api.memcache", "arg... | [] |
# Initialize Django.
from djangoappengine import main
from django.utils.importlib import import_module
from django.conf import settings
# Load all models.py to ensure signal handling installation or index
# loading of some apps
for app in settings.INSTALLED_APPS:
try:
import_module('%s.models' % (app))
... | ajibawa-2023/Python-Code-Large/train/row_82672 | 10 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82672:ImportFrom_L2_C0", "label": "from djangoappengine import main", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0455, 0, 0.66, 0.0, 683, 0, 1, 0, 0, 683, 0, 0], "semantic": {"name": "djangoappengine", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82672:For_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82672:Try_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82672:Try_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82672:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82... |
from django.conf import settings
if 'django.contrib.auth' in settings.INSTALLED_APPS:
from dbindexer.api import register_index
from django.contrib.auth.models import User
register_index(User, {
'username': 'iexact',
'email': 'iexact',
})
if 'django.contrib.admin' in settings.INSTALLE... | ajibawa-2023/Python-Code-Large/train/row_82673 | 9 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82673:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82673:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82673:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82673:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82673:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
#! /usr/bin/env python
__revision__ = "$Id: setup.py,v 1.30 2005/06/14 01:20:22 akuchling Exp $"
from distutils import core
from distutils.core import Extension
from distutils.command.build_ext import build_ext
import os, sys
if sys.version[0:1] == '1':
raise RuntimeError, ("The Python Cryptography Toolkit requi... | ajibawa-2023/Python-Code-Large/train/row_82674 | 33 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82674:ImportFrom_L1_C0", "label": "from distutils import core", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "distutils", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82674:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82674:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82674:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82674:For_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""Miscellaneous modules
Contains useful modules that don't belong into any of the
other Crypto.* subpackages.
Crypto.Util.number Number-theoretic functions (primality testing, etc.)
Crypto.Util.randpool Random number generation
Crypto.Util.RFC1751 Converts between 128-bit keys and human-readable
... | ajibawa-2023/Python-Code-Large/train/row_82680 | 3 | 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_82680:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 11], "level": 0, "parent": null, "vector": [8, 0, 0.375, 0.6875, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import time
from Crypto.Util import number
# Test of prime-generation speed
# This randfunc is deterministic, so we should always find the same primes.
chars = ''.join(map(chr, range(255, 0, -1)))
def randfunc (N):
s = ''
while len(s)<N:
s += chars
return s[:N]
def main ():
for i in range(12... | ajibawa-2023/Python-Code-Large/train/row_82681 | 16 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82681:Import_L2_C0", "label": "time import time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0417, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82681:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82681:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82681:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82681:While_L11_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""Secret-key encryption algorithms.
Secret-key encryption algorithms transform plaintext in some way that
is dependent on a key, producing ciphertext. This transformation can
easily be reversed, if (and, hopefully, only if) one knows the key.
The encryption modules here all support the interface described in PEP
272... | ajibawa-2023/Python-Code-Large/train/row_82682 | 3 | 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_82682:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 24], "level": 0, "parent": null, "vector": [8, 0, 0.3788, 0.7273, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
"""Cryptographic protocols
Implements various cryptographic protocols. (Don't expect to find
network protocols here.)
Crypto.Protocol.AllOrNothing Transforms a message into a set of message
blocks, such that the blocks can be
recombined to get the mess... | ajibawa-2023/Python-Code-Large/train/row_82685 | 3 | 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_82685:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 14], "level": 0, "parent": null, "vector": [8, 0, 0.4706, 0.7647, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
#! /usr/bin/env python
__revision__ = "$Id: setup.py,v 1.30 2005/06/14 01:20:22 akuchling Exp $"
from distutils import core
from distutils.core import Extension
from distutils.command.build_ext import build_ext
import os, sys
if sys.version[0:1] == '1':
raise RuntimeError, ("The Python Cryptography Toolkit requi... | ajibawa-2023/Python-Code-Large/train/row_82686 | 33 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82686:ImportFrom_L1_C0", "label": "from distutils import core", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "distutils", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82686:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82686:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82686:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82686:For_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
#
# Test script for the Python Cryptography Toolkit.
#
__revision__ = "$Id: test.py,v 1.7 2002/07/11 14:31:19 akuchling Exp $"
import os, sys
# Add the build directory to the front of sys.path
from distutils.util import get_platform
s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
s = os.path.join(os.getcwd(... | ajibawa-2023/Python-Code-Large/train/row_82687 | 25 | 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_82687:Assign_L5_C0", "label": "__revision__ =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.1316, 0.0263, 0, 0.66, 0.0, 809, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__revision__", "arg_names": [], "import_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82687:If_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82687:Expr_L22_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82687:If_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82687:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82... |
"""Public-key encryption and signature algorithms.
Public-key encryption uses two different keys, one for encryption and
one for decryption. The encryption key can be made public, and the
decryption key is kept private. Many public-key algorithms can also
be used to sign messages, and some can *only* be used for sig... | ajibawa-2023/Python-Code-Large/train/row_82692 | 3 | 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_82692:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 13], "level": 0, "parent": null, "vector": [8, 0, 0.4118, 0.7647, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
#!/usr/bin/env python
# Script to time fast and slow RSA operations
# Contributed by Joris Bontje.
import time, pprint
from Crypto.PublicKey import *
from Crypto.Util.randpool import RandomPool
from Crypto.Util import number
pool = RandomPool()
pool.stir()
KEYSIZE=2048
COUNT=5
fasttime=0
slowtime=0
for x in range(C... | ajibawa-2023/Python-Code-Large/train/row_82694 | 34 | 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_82694:Import_L6_C0", "label": "time import time, pprint", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0208, 0, 0.66, 0.0, 654, 0, 2, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time", "ppri... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82694:For_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82694:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82694:For_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82694:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
#!/usr/bin/env python
# Script to time fast and slow RSA operations
# Contributed by Joris Bontje.
import time, pprint
from Crypto.PublicKey import *
from Crypto.Util.randpool import RandomPool
from Crypto.Util import number
pool = RandomPool()
pool.stir()
KEYSIZE=2048
COUNT=5
fasttime=0
slowtime=0
for x in range(C... | ajibawa-2023/Python-Code-Large/train/row_82695 | 34 | 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_82695:Import_L6_C0", "label": "time import time, pprint", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0208, 0, 0.66, 0.0, 654, 0, 2, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time", "ppri... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82695:For_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82695:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82695:For_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82695:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
# Just use the MD5 module from the Python standard library
__revision__ = "$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $"
from md5 import *
import md5
if hasattr(md5, 'digestsize'):
digest_size = digestsize
del digestsize
del md5
| ajibawa-2023/Python-Code-Large/train/row_82696 | 5 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82696:Assign_L4_C0", "label": "__revision__ =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3077, 0.0769, 0, 0.66, 0.0, 809, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__revision__", "arg_names": [], "import_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82696:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82696:Assign_L10_C4"}] |
"""HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
This is just a copy of the Python 2.2 HMAC module, modified to work when
used on versions of Python before 2.2.
"""
__revision__ = "$Id: HMAC.py,v 1.5 2002/07/25 17:19:02 z3p Exp $"
import strin... | ajibawa-2023/Python-Code-Large/train/row_82697 | 51 | 108 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82697:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.037, 0.0648, 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_82697:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82697:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82697:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82697:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code... |
# Just use the SHA module from the Python standard library
__revision__ = "$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $"
from sha import *
import sha
if hasattr(sha, 'digestsize'):
digest_size = digestsize
del digestsize
del sha
| ajibawa-2023/Python-Code-Large/train/row_82698 | 5 | 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_82698:Assign_L4_C0", "label": "__revision__ =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.3636, 0.0909, 0, 0.66, 0.0, 809, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__revision__", "arg_names": [], "import_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82698:If_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82698:Assign_L9_C4"}] |
"""Hashing algorithms
Hash functions take arbitrary strings as input, and produce an output
of fixed size that is dependent on the input; it should never be
possible to derive the input data given only the hash function's
output. Hash functions can be used simply as a checksum, or, in
association with a public-key al... | ajibawa-2023/Python-Code-Large/train/row_82699 | 3 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82699:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 20], "level": 0, "parent": null, "vector": [8, 0, 0.4375, 0.8333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
"""Python Cryptography Toolkit
A collection of cryptographic modules implementing various algorithms
and protocols.
Subpackages:
Crypto.Cipher Secret-key encryption algorithms (AES, DES, ARC4)
Crypto.Hash Hashing algorithms (MD5, SHA, HMAC)
Crypto.Protocol Cryptographic protocols ... | ajibawa-2023/Python-Code-Large/train/row_82700 | 4 | 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_82700:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 18], "level": 0, "parent": null, "vector": [8, 0, 0.4, 0.68, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [] |
#
# testdata.py : Test data for the various algorithms
#
# Part of the Python Cryptography Toolkit
#
# Distribute and use freely; there are no restrictions on further
# dissemination and usage except those imposed by the laws of your
# country of residence. This software is provided "as is" without
# warranty of fitn... | ajibawa-2023/Python-Code-Large/train/row_82701 | 36 | 681 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82701:Assign_L19_C0", "label": "md2 =", "type": "assigned_variable", "loc": [19, 29], "level": 0, "parent": null, "vector": [14, 0, 0.0352, 0.0162, 0, 0.66, 0.0, 922, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "md2", "arg_names": [], "import_names": [], "rhs_call_name":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82701:For_L412_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82701:Expr_L413_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82701:For_L414_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82701:Expr_L415_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
#!/usr/bin/python
import code
import getpass
import sys
sys.path.append("/usr/local/google_appengine")
sys.path.append("/usr/local/google_appengine/lib/yaml/lib")
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db
def auth_func():
return raw_input('Username:'), getpas... | ajibawa-2023/Python-Code-Large/train/row_82702 | 17 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82702:Import_L2_C0", "label": "code import code", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0417, 0, 0.66, 0.0, 44, 0, 1, 0, 0, 44, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": ["code"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82702:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82702:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82702:If_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82702:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
#!/usr/bin/python
import code
import getpass
import sys
sys.path.append("/usr/local/google_appengine")
sys.path.append("/usr/local/google_appengine/lib/yaml/lib")
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.ext import db
def auth_func():
return raw_input('Username:'), getpas... | ajibawa-2023/Python-Code-Large/train/row_82703 | 17 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82703:Import_L2_C0", "label": "code import code", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0417, 0, 0.66, 0.0, 44, 0, 1, 0, 0, 44, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": ["code"], "rhs_call_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82703:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82703:Return_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82703:If_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82703:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to ... | ajibawa-2023/Python-Code-Large/train/row_82705 | 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_82705:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82705:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82705:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82705:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82705:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.contrib import admin
from django.views.generic.base import *
import dbindexer
#from ragendja.urlsauto import urlpatterns
#from ragendja.auth.urls import urlpatterns as auth_patterns
from astoundlearning_app import views
handler500 = 'djangotoo... | ajibawa-2023/Python-Code-Large/train/row_82706 | 15 | 127 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82706:ImportFrom_L2_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0157, 0.0079, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82706:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82706:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82706:If_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82706:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
from __future__ import with_statement
from decimal import Decimal, InvalidOperation
import time
from django.core import serializers
from django.db import models
from django.db.models import Q
from django.db.models.signals import post_save
from django.db.utils import DatabaseError
from django.dispatch.dispatcher import... | ajibawa-2023/Python-Code-Large/train/row_82707 | 462 | 832 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82707:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0012, 0.0012, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82707:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82707:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82707:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82707:Return_L21_C8"}, {"f": "ajibawa-2023/Pyth... |
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse
from django.utils import simplejson
from django.utils.encoding import force_unicode
from django.utils.functional import Promise
class LazyEncoder(DjangoJSONEncoder):
def default(self, ... | ajibawa-2023/Python-Code-Large/train/row_82708 | 17 | 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_82708:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 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_82708:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82708:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82708:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82708:If_L12_C8"}, {"f": "ajibawa-2023/Python-Code-... |
# All fields except for BlobField written by Jonas Haag <jonas@lophus.org>
from django.core.exceptions import ValidationError
from django.utils.importlib import import_module
from django.db import models
from django.db.models.fields.subclassing import Creator
from django.db.utils import IntegrityError
from django.db.m... | ajibawa-2023/Python-Code-Large/train/row_82709 | 183 | 443 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82709:ImportFrom_L3_C0", "label": "from django.core.exceptions import ValidationError", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0023, 0, 0.66, 0.0, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82709:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82709:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82709:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82709:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.http import HttpResponseRedirect
from django.utils.cache import patch_cache_control
LOGIN_REQUIRED_PREFIXES = getattr(settings, 'LOGIN_REQUIRED_PREFIXES', ())
NO_LOGIN_REQUIRED_PREFIXES = getattr(settings,
'NO_LOGIN_REQUIRED_PREFIXES', ... | ajibawa-2023/Python-Code-Large/train/row_82710 | 33 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82710:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0139, 0.0139, 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_82710:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82710:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82710:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82710:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.core.cache import cache
from django.contrib.sites.models import Site
from djangotoolbox.utils import make_tls_property
_default_site_id = getattr(settings, 'SITE_ID', None)
SITE_ID = settings.__class__.SITE_ID = make_tls_property()
class DynamicSiteIDMiddleware(object):
... | ajibawa-2023/Python-Code-Large/train/row_82711 | 36 | 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_82711:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0164, 0.0164, 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_82711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82711:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82711:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82711:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.test import TestCase
from django.utils.unittest import TextTestResult, TextTestRunner
try:
from django.test.runner import DiscoverRunner as TestRunner
except ImportError:
from django.test.simple import DjangoTestSuiteRunner as TestRunner
from .utils import object_list_to_table
import re
class M... | ajibawa-2023/Python-Code-Large/train/row_82712 | 44 | 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_82712:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.009, 0.009, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82712:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82712:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82712:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82712:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
def make_tls_property(default=None):
"""
Creates a class-wide instance property with a thread-specific
value.
"""
class TLSProperty(object):
def __init__(self):
from threading import local
self.local = local()
def __get__(self, instance, cls):
i... | ajibawa-2023/Python-Code-Large/train/row_82713 | 48 | 107 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82713:FunctionDef_L1_C0", "label": "make_tls_property", "type": "function", "loc": [1, 28], "level": 0, "parent": null, "vector": [2, 0, 0.1355, 0.2617, 0, 0.66, 0.0, 317, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "make_tls_property", "arg_names": ["default"], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82713:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82713:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82713:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82713:ClassDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django import forms
from django.contrib import admin
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User, Group
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ('username', 'email'... | ajibawa-2023/Python-Code-Large/train/row_82714 | 19 | 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_82714:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0323, 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_82714:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82714:ClassDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82714:ClassDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82714:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.forms import widgets
from django.template.defaultfilters import filesizeformat
from django.utils.safestring import mark_safe
class BlobWidget(widgets.FileInput):
def render(self, name, value, attrs=None):
try:
blob_size = len(value)
except:
blob_size = 0
... | ajibawa-2023/Python-Code-Large/train/row_82715 | 11 | 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_82715:ImportFrom_L1_C0", "label": "from django.forms import widgets", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 666, 0, 1, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "import_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82715:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82715:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82715:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82715:Try_L9_C8"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.db.backends.creation import BaseDatabaseCreation
class NonrelDatabaseCreation(BaseDatabaseCreation):
# "Types" used by database conversion methods to decide how to
# convert data for or from the database. Type is understood here
# a bit differently than in vanilla Django -- it should be read
... | ajibawa-2023/Python-Code-Large/train/row_82716 | 12 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82716:ImportFrom_L1_C0", "label": "from django.db.backends.creation import BaseDatabaseCreation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0091, 0.0091, 0, 0.66, 0.0, 340, 0, 1, 0, 0, 340, 0, 0], "semantic": {"name": "django.db.bac... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82716:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82716:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82716:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82716:FunctionDef_L76_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import datetime
import django
from django.conf import settings
from django.db.models.fields import NOT_PROVIDED
from django.db.models.query import QuerySet
from django.db.models.sql import aggregates as sqlaggregates
from django.db.models.sql.compiler import SQLCompiler
from django.db.models.sql.constants import MULTI... | ajibawa-2023/Python-Code-Large/train/row_82717 | 267 | 655 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82717:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0015, 0.0015, 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_82717:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82717:ImportFrom_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82717:Try_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82717:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.db.backends.util import format_number
def decimal_to_string(value, max_digits=16, decimal_places=0):
"""
Converts decimal to a unicode string for storage / lookup by nonrel
databases that don't support decimals natively.
This is an extension to `django.db.backends.util.format_number`
... | ajibawa-2023/Python-Code-Large/train/row_82718 | 14 | 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_82718:ImportFrom_L1_C0", "label": "from django.db.backends.util import format_number", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 446, 0, 1, 0, 0, 446, 0, 0], "semantic": {"name": "django.db.backends.util"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82718:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82718:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82718:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82718:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import cPickle as pickle
import datetime
from django.conf import settings
from django.db.backends import (
BaseDatabaseFeatures,
BaseDatabaseOperations,
BaseDatabaseWrapper,
BaseDatabaseClient,
BaseDatabaseValidation,
BaseDatabaseIntrospection)
from django.db.utils import DatabaseError
from dja... | ajibawa-2023/Python-Code-Large/train/row_82719 | 219 | 726 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82719:Import_L1_C0", "label": "cPickle import pickle", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0014, 0.0014, 0, 0.66, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pickle"], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82719:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82719:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82719:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82719:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django import http
from django.template import RequestContext, loader
def server_error(request, template_name='500.html'):
"""
500 error handler.
Templates: `500.html`
Context:
request_path
The path of the requested URL (e.g., '/app/pages/bad_page/')
"""
# You need t... | ajibawa-2023/Python-Code-Large/train/row_82720 | 6 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82720:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82720:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82720:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82720:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82720:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# -*- coding: utf-8 -*-
#from ragendja.settings_pre import *
from djangoappengine.settings_base import *
import logging
import os
#import cookie_based_session_storage_for_django
from djangoappengine.utils import on_production_server, have_appserver
GOOGLE_FRIEND_CONNECT_SITE_ID = '02335252261937609627'
GOOGLE_FRIEND_C... | ajibawa-2023/Python-Code-Large/train/row_82721 | 39 | 142 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82721:ImportFrom_L3_C0", "label": "from djangoappengine.settings_base import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0211, 0.007, 0, 0.66, 0.0, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "djangoappengine.settings_base",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82721:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82721:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82721:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82721:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"""
Forms and validation code for user registration.
"""
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import ugettext_lazy as _
from registration.models import RegistrationProfile
# I put this on all required fields, because it's easier to pick up
# on them wit... | ajibawa-2023/Python-Code-Large/train/row_82722 | 44 | 136 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82722:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0184, 0.0294, 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_82722:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82722:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82722:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82722:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import datetime
import random
import re
import sha
from google.appengine.ext import db
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db import models
from django.template.loader import render_to_string
from django.utils.translatio... | ajibawa-2023/Python-Code-Large/train/row_82723 | 77 | 258 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82723:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0039, 0.0039, 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_82723:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82723:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82723:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82723:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Unit tests for django-registration.
These tests assume that you've completed all the prerequisites for
getting django-registration running in the default setup, to wit:
1. You have ``registration`` in your ``INSTALLED_APPS`` setting.
2. You have created all of the templates mentioned in this
application's doc... | ajibawa-2023/Python-Code-Large/train/row_82724 | 132 | 359 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82724:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 20], "level": 0, "parent": null, "vector": [8, 0, 0.0292, 0.0557, 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_82724:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82724:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82724:ClassDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82724:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.dispatch import Signal
# A new user has registered.
user_registered = Signal(providing_args=["user"])
# A user has activated his or her account.
user_activated = Signal(providing_args=["user"])
| ajibawa-2023/Python-Code-Large/train/row_82725 | 3 | 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_82725:ImportFrom_L1_C0", "label": "from django.dispatch import Signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "django.dispatch", "arg_names": [], "impor... | [] |
"""
URLConf for Django user registration and authentication.
If the default behavior of the registration views is acceptable to
you, simply use a line like this in your root URLConf to set up the
default URLs for registration::
(r'^accounts/', include('registration.urls')),
This will also automatically set up th... | ajibawa-2023/Python-Code-Large/train/row_82726 | 7 | 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_82726:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 20], "level": 0, "parent": null, "vector": [8, 0, 0.1479, 0.2817, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
from ragendja.settings_post import *
try:
ACCOUNT_ACTIVATION_DAYS
except:
ACCOUNT_ACTIVATION_DAYS = 30
| ajibawa-2023/Python-Code-Large/train/row_82727 | 4 | 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_82727:ImportFrom_L1_C0", "label": "from ragendja.settings_post import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 898, 0, 1, 0, 0, 898, 0, 0], "semantic": {"name": "ragendja.settings_post", "arg_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82727:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82727:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82727:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82727:Assign_L6_C4"}] |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^account/', include('registration.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_82728 | 2 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82728:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names":... | [] |
from django.contrib import admin
from registration.models import RegistrationProfile
class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
search_fields = ('user__username', 'user__first_name')
admin.site.register(RegistrationProfile, RegistrationAdmin)
| ajibawa-2023/Python-Code-Large/train/row_82729 | 6 | 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_82729:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 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_82729:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82729:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82729:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82729:Assign_L8_C4"}] |
"""
A management command which deletes expired accounts (e.g.,
accounts which signed up but never activated) from the database.
Calls ``RegistrationProfile.objects.delete_expired_users()``, which
contains the actual logic for determining which accounts are deleted.
"""
from django.core.management.base import NoArgsC... | ajibawa-2023/Python-Code-Large/train/row_82730 | 7 | 19 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82730:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2368, 0.4211, 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_82730:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82730:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82730:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82730:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Cod... |
"""
Views which allow users to create and activate accounts.
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from registration.forms import Registr... | ajibawa-2023/Python-Code-Large/train/row_82731 | 33 | 153 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82731:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0163, 0.0261, 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_82731:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82731:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82731:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82731:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code... |
import re
import cgi
re_string = re.compile(r'(?P<htmlchars>[<&>])|(?P<space>^[ \t]+)|(?P<lineend>\r\n|\r|\n)|(?P<protocal>(^|\s)((http|ftp)://.*?))(\s|$)', re.S|re.M|re.I)
def plaintext2html(text, tabstop=4):
def do_sub(m):
c = m.groupdict()
if c['htmlchars']:
return cgi.escape... | ajibawa-2023/Python-Code-Large/train/row_82733 | 26 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82733:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0345, 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_82733:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82733:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82733:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82733:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-C... |
# Load the siteconf module
from django.conf import settings
from django.utils.importlib import import_module
SITECONF_MODULE = getattr(settings, 'AUTOLOAD_SITECONF', settings.ROOT_URLCONF)
import_module(SITECONF_MODULE)
| ajibawa-2023/Python-Code-Large/train/row_82734 | 4 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82734:ImportFrom_L2_C0", "label": "from django.conf import settings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ... | [] |
from django.utils.importlib import import_module
from django.conf import settings
# load all models.py to ensure signal handling installation or index loading
# of some apps
for app in settings.INSTALLED_APPS:
try:
import_module('%s.models' % (app))
except ImportError:
pass
class AutoloadMidd... | ajibawa-2023/Python-Code-Large/train/row_82735 | 7 | 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_82735:ImportFrom_L1_C0", "label": "from django.utils.importlib import import_module", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 118, 0, 1, 0, 0, 118, 0, 0], "semantic": {"name": "django.utils.importlib", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82735:For_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82735:Try_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82735:Try_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82735:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82735:... |
def autodiscover(module_name):
"""
Automatically loads modules specified by module_name for each app in
installed apps.
"""
from django.conf import settings
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule
for app in settings.... | ajibawa-2023/Python-Code-Large/train/row_82736 | 10 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82736:FunctionDef_L1_C0", "label": "autodiscover", "type": "function", "loc": [1, 20], "level": 0, "parent": null, "vector": [2, 0, 0.525, 1.0, 0, 0.66, 0.0, 798, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "autodiscover", "arg_names": ["module_name"], "import_names": []... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82736:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82736:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82736:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82736:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code... |
import settings
def all(request):
return {
'baseURL': 'http://' + request.get_host(),
'environment': settings.ENVIRONMENT,
'FACEBOOK_API_KEY': settings.FACEBOOK_API_KEY,
'GOOGLE_FRIEND_CONNECT_SITE_ID': settings.GOOGLE_FRIEND_CONNECT_SITE_ID
}
| ajibawa-2023/Python-Code-Large/train/row_82737 | 3 | 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_82737:Import_L1_C0", "label": "settings import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82737:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82737:Return_L3_C4"}] |
from google.appengine.ext import db
from google.appengine.api import memcache
from django.utils import simplejson
import logging
class CustomUser(db.Model):
class Meta:
db_table = 'CustomUser'
isSocial = db.BooleanProperty(default = False)
viewerID = db.StringProperty(default = '')
consumerKey = db.StringProperty... | ajibawa-2023/Python-Code-Large/train/row_82738 | 286 | 337 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82738:ImportFrom_L1_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.003, 0.003, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82738:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82738:ClassDef_L6_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82738:ClassDef_L6_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_82738:Assign_L7_C2"}, {"f": "ajibawa-2023/Python-Code-Large... |
import cgi
import urllib
import time
import random
import urlparse
import hmac
import binascii
VERSION = '1.0' # Hi Blaine!
HTTP_METHOD = 'GET'
SIGNATURE_METHOD = 'PLAINTEXT'
# Generic exception class
class OAuthError(RuntimeError):
def __init__(self, message='OAuth error occured.'):
self.message = messag... | ajibawa-2023/Python-Code-Large/train/row_82739 | 293 | 538 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82739:Import_L1_C0", "label": "cgi import cgi", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0019, 0.0019, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82739:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82739:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82739:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82739:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-... |
#!/usr/bin/python
# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. The original code had the following copyright and
# license.
#
# /* jsmin.c
# 2007-05-22
#
# Copyright (c) 2002 Douglas Crockford (www.crockford.com)
#
# Permission is hereby granted,... | ajibawa-2023/Python-Code-Large/train/row_82740 | 125 | 218 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82740:ImportFrom_L33_C0", "label": "from StringIO import StringIO", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.1514, 0.0046, 0, 0.66, 0.0, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82740:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82740:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82740:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82740:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Co... |
#!/usr/bin/python
# This code is original from jsmin by Douglas Crockford, it was translated to
# Python by Baruch Even. The original code had the following copyright and
# license.
#
# /* jsmin.c
# 2007-05-22
#
# Copyright (c) 2002 Douglas Crockford (www.crockford.com)
#
# Permission is hereby granted,... | ajibawa-2023/Python-Code-Large/train/row_82741 | 125 | 218 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82741:ImportFrom_L33_C0", "label": "from StringIO import StringIO", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.1514, 0.0046, 0, 0.66, 0.0, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82741:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82741:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82741:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82741:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Co... |
import cgi, urllib, logging
from django.utils import simplejson
from google.appengine.api import urlfetch
class BitLy():
def __init__(self, login, apikey):
self.login = login
self.apikey = apikey
def shorten(self,longUrl):
longUrl = urllib.quote_plus(longUrl)
request = "http://api.bit.ly/v3/shorten?longUrl=... | ajibawa-2023/Python-Code-Large/train/row_82742 | 20 | 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_82742:Import_L1_C0", "label": "cgi import cgi, urllib, logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.04, 0, 0.66, 0.0, 934, 0, 3, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi", "ur... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82742:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82742:FunctionDef_L6_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82742:FunctionDef_L6_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_82742:Assign_L7_C2"}, {"f": "ajibawa-2023/Python-Code... |
from django.shortcuts import render_to_response, redirect
from django.template.loader import get_template
from django.template import Context, Template, RequestContext
from django.http import HttpResponse
from django.utils import simplejson
from django.utils.decorators import decorator_from_middleware
from django.core ... | ajibawa-2023/Python-Code-Large/train/row_82743 | 1,502 | 1,771 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82743:ImportFrom_L1_C0", "label": "from django.shortcuts import render_to_response, redirect", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0006, 0.0006, 0, 0.66, 0.0, 852, 0, 2, 0, 0, 852, 0, 0], "semantic": {"name": "django.shortcuts... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82743:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82743:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82743:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82743:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Co... |
import logging
import pickle
import cPickle
from google.appengine.api import users
from google.appengine.api import memcache
from google.appengine.api import mail
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
import os
import re
imp... | ajibawa-2023/Python-Code-Large/train/row_82744 | 226 | 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_82744:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82744:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82744:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82744:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82744:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from astoundlearning_app.models import StudySet, SetEntry
from google.appengine.ext import db
# This script is for manipulating the data on the live GAE datastore via the remote_api.
# If we need to manipulate the data on live GAE datastore, modify this script, and execute it:
# python manage.py shell --remote
# impor... | ajibawa-2023/Python-Code-Large/train/row_82745 | 21 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82745:ImportFrom_L1_C0", "label": "from astoundlearning_app.models import StudySet, SetEntry", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 376, 0, 2, 0, 0, 376, 0, 0], "semantic": {"name": "astoundlearning_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82745:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82745:Assign_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82745:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82745:Assign_L12_C1"}, {"f": "ajibawa-2023/Python-Co... |
from __future__ import unicode_literals
import datetime
import os
import re
import sys
import types
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import (HttpResponse, HttpResponseServerError,
HttpResponseNotFound, HttpRequest, build_request_repr)
from d... | ajibawa-2023/Python-Code-Large/train/row_82746 | 276 | 1,120 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82746:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0009, 0.0009, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82746:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82746:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82746:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82746:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Decorators for views based on HTTP headers.
"""
import logging
from calendar import timegm
from functools import wraps
from django.utils.decorators import decorator_from_middleware, available_attrs
from django.utils.http import http_date, parse_http_date_safe, parse_etags, quote_etag
from django.middleware.http i... | ajibawa-2023/Python-Code-Large/train/row_82747 | 74 | 166 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82747:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.012, 0.0181, 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_82747:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82747:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82747:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82747:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python... |
import functools
from django.http import HttpRequest
def sensitive_variables(*variables):
"""
Indicates which variables used in the decorated function are sensitive, so
that those variables can later be treated in a special way, for example
by hiding them when logging unhandled exceptions.
Two f... | ajibawa-2023/Python-Code-Large/train/row_82748 | 22 | 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_82748:Import_L1_C0", "label": "functools import functools", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.013, 0, 0.66, 0.0, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": ["functo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82748:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82748:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82748:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82748:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Co... |
from functools import wraps
from django.utils.cache import patch_vary_headers
from django.utils.decorators import available_attrs
def vary_on_headers(*headers):
"""
A view decorator that adds the specified headers to the Vary header of the
response. Usage:
@vary_on_headers('Cookie', 'Accept-languag... | ajibawa-2023/Python-Code-Large/train/row_82749 | 19 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82749:ImportFrom_L1_C0", "label": "from functools import wraps", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82749:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82749:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82749:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82749:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Co... |
from django.utils.decorators import decorator_from_middleware
from django.middleware.gzip import GZipMiddleware
gzip_page = decorator_from_middleware(GZipMiddleware)
gzip_page.__doc__ = "Decorator for views that gzips pages if the client supports it."
| ajibawa-2023/Python-Code-Large/train/row_82750 | 4 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82750:ImportFrom_L1_C0", "label": "from django.utils.decorators import decorator_from_middleware", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 532, 0, 1, 0, 0, 532, 0, 0], "semantic": {"name": "django.utils.decor... | [] |
import warnings
from django.middleware.csrf import CsrfViewMiddleware, get_token
from django.utils.decorators import decorator_from_middleware, available_attrs
from functools import wraps
csrf_protect = decorator_from_middleware(CsrfViewMiddleware)
csrf_protect.__name__ = "csrf_protect"
csrf_protect.__doc__ = """
Thi... | ajibawa-2023/Python-Code-Large/train/row_82751 | 37 | 79 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82751:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0127, 0.0127, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82751:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82751:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82751:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82751:Return_L20_C8"}, {"f": "ajibawa-2023/Python-... |
from functools import wraps
from django.utils.decorators import available_attrs
def xframe_options_deny(view_func):
"""
Modifies a view function so its response has the X-Frame-Options HTTP
header set to 'DENY' as long as the response doesn't already have that
header set.
e.g.
@xframe_optio... | ajibawa-2023/Python-Code-Large/train/row_82752 | 25 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82752:ImportFrom_L1_C0", "label": "from functools import wraps", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 0, 0.66, 0.0, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82752:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82752:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82752:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82752:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Co... |
from functools import wraps
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cache import CacheMiddleware
def cache_page(*args, **kwargs):
"""
Decorator for views that tri... | ajibawa-2023/Python-Code-Large/train/row_82753 | 39 | 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_82753:ImportFrom_L1_C0", "label": "from functools import wraps", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0109, 0.0109, 0, 0.66, 0.0, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82753:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82753:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82753:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82753:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
from __future__ import unicode_literals
import mimetypes
import os
import stat
import posixpath
import re
try:
from urllib.parse import unquote
except ImportError: ... | ajibawa-2023/Python-Code-Large/train/row_82754 | 68 | 145 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82754:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0172, 0.0276, 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_82754:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82754:ImportFrom_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82754:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82754:ImportFrom_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.http import HttpResponseForbidden
from django.template import Context, Template
from django.conf import settings
# We include the template inline since we need to be able to reliably display
# this error message, especially for the sake of developers, and there isn't any
# other way of making it available ... | ajibawa-2023/Python-Code-Large/train/row_82755 | 10 | 104 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82755:ImportFrom_L1_C0", "label": "from django.http import HttpResponseForbidden", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0096, 0.0096, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82755:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82755:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82755:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82755:ImportFrom_L98_C4"}, {"f": "ajibawa-2023/Python-... |
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.util... | ajibawa-2023/Python-Code-Large/train/row_82756 | 363 | 782 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82756:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0013, 0.0013, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82756:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82756:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82756:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82756:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from __future__ import unicode_literals
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
c... | ajibawa-2023/Python-Code-Large/train/row_82757 | 91 | 176 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82757:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0057, 0.0057, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82757:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82757:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82757:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.db import models
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
class Sin... | ajibawa-2023/Python-Code-Large/train/row_82758 | 77 | 165 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82758:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0061, 0.0061, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82758:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82758:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82758:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82758:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
from django.views.generic.detail import (Single... | ajibawa-2023/Python-Code-Large/train/row_82759 | 135 | 273 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82759:ImportFrom_L1_C0", "label": "from django.forms import model_forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0037, 0.0037, 0, 0.66, 0.0, 666, 0, 1, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82759:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82759:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82759:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82759:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from __future__ import unicode_literals
import logging
from functools import update_wrapper
from django import http
from django.core.exceptions import ImproperlyConfigured
from django.template.response import TemplateResponse
from django.utils.decorators import classonlymethod
from django.utils import six
logger = l... | ajibawa-2023/Python-Code-Large/train/row_82760 | 104 | 208 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82760:ImportFrom_L1_C0", "label": "from __future__ import unicode_literals", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0048, 0.0048, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82760:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82760:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82760:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82760:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.views.generic.base import View, TemplateView, RedirectView
from django.views.generic.dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView,
WeekArchiveView, DayArchiveView, TodayArchiveView,
DateDetailView)
from django.vie... | ajibawa-2023/Python-Code-Large/train/row_82761 | 7 | 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_82761:ImportFrom_L1_C0", "label": "from django.views.generic.base import View, TemplateView, RedirectView", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 48, 0, 3, 0, 0, 48, 0, 0], "semantic": {"name": "djang... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82761:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82761:Expr_L11_C4"}] |
from django import http
from django.template import (Context, RequestContext,
loader, Template, TemplateDoesNotExist)
from django.views.decorators.csrf import requires_csrf_token
# This can be called when CsrfViewMiddleware.process_view has not run,
# therefore need @requires_csrf_token i... | ajibawa-2023/Python-Code-Large/train/row_82762 | 24 | 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_82762:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0135, 0.0135, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82762:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82762:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82762:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82762:Try_L20_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import os
import gettext as gettext_module
from django import http
from django.conf import settings
from django.utils import importlib
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
from django.utils.encoding import smart_text
f... | ajibawa-2023/Python-Code-Large/train/row_82763 | 133 | 284 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82763: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_82763:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82763:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82763:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82763:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
import warnings
from django.template import loader, RequestContext
from django.http import HttpResponse, Http404
from django.http i... | ajibawa-2023/Python-Code-Large/train/row_82764 | 63 | 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_82764:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0186, 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_82764:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82764:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82764:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82764:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""Multi-consumer multi-producer dispatching mechanism
Originally based on pydispatch (BSD) http://pypi.python.org/pypi/PyDispatcher/2.0.1
See license.txt for original license.
Heavily modified for Django's purposes.
"""
from django.dispatch.dispatcher import Signal, receiver | ajibawa-2023/Python-Code-Large/train/row_82765 | 2 | 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_82765:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.4444, 0.7778, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import weakref
import threading
from django.dispatch import saferef
from django.utils.six.moves import xrange
WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)
def _make_id(target):
if hasattr(target, '__func__'):
return (id(target.__self__), id(target.__func__))
return id(target)
... | ajibawa-2023/Python-Code-Large/train/row_82766 | 98 | 273 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82766:Import_L1_C0", "label": "weakref import weakref", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0037, 0.0037, 0, 0.66, 0.0, 708, 0, 1, 0, 0, 708, 0, 0], "semantic": {"name": "weakref", "arg_names": [], "import_names": ["weakref"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82766:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82766:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82766:If_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_82766:Return_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
"""
"Safe weakrefs", originally from pyDispatcher.
Provides a way to safely weakref any function, including bound methods (which
aren't handled by the core weakref module).
"""
import traceback
import weakref
def safeRef(target, onDelete = None):
"""Return a *safe* weak reference to a callable target
target... | ajibawa-2023/Python-Code-Large/train/row_82767 | 91 | 257 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82767:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0136, 0.0233, 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_82767:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82767:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82767:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82767:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Common checksum routines (used in multiple localflavor/ cases, for example).
"""
__all__ = ['luhn',]
from django.utils import six
LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) # sum_of_digits(index * 2)
def luhn(candidate):
"""
Checks a candidate number for validity according to the Luhn
algorith... | ajibawa-2023/Python-Code-Large/train/row_82768 | 13 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82768:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0833, 0.125, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82768:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82768:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82768:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82768:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"Commonly-used date structures"
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
WEEKDAYS = {
0:_('Monday'), 1:_('Tuesday'), 2:_('Wednesday'), 3:_('Thursday'), 4:_('Friday'),
5:_('Saturday'), 6:_('Sunday')
}
WEEKDAYS_ABBR = {
0:_('Mon'), 1:_('Tue'), 2:_('Wed'), 3:_('Thu'), 4:_('Fri')... | ajibawa-2023/Python-Code-Large/train/row_82769 | 10 | 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_82769:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
import imp
import os
import sys
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.importlib import import_module
def import_by_path(dotted_path, error_prefix=''):
"""
Import a dotted module path and return the attribute/class designated by the
last nam... | ajibawa-2023/Python-Code-Large/train/row_82770 | 51 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82770:Import_L1_C0", "label": "imp import imp", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0102, 0.0102, 0, 0.66, 0.0, 201, 0, 1, 0, 0, 201, 0, 0], "semantic": {"name": "imp", "arg_names": [], "import_names": ["imp"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_82770:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82770:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82770:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82770:Try_L15_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
termcolors.py
"""
from django.utils import six
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
RESET = '0'
opt_dict = {'bold': '1', 'undersco... | ajibawa-2023/Python-Code-Large/train/row_82771 | 61 | 200 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_82771:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.01, 0.015, 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_82771:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82771:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_82771:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_82771:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.