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 |
|---|---|---|---|---|---|---|---|
"""
Convenience routines for creating non-trivial Field subclasses, as well as
backwards compatibility utilities.
Add SubfieldBase as the __metaclass__ for your Field subclass, implement
to_python() and the other necessary methods and everything will work seamlessly.
"""
from inspect import getargspec
from warnings i... | ajibawa-2023/Python-Code-Large/train/row_85917 | 66 | 117 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85917:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0342, 0.0598, 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_85917:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85917:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85917:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85917:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Co... |
"Utilities for loading models and the modules that contain them."
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule
im... | ajibawa-2023/Python-Code-Large/train/row_85919 | 111 | 227 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85919:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0044, 0.0044, 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_85919:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85919:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85919:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85919:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Classes to represent the definitions of aggregate functions.
"""
class Aggregate(object):
"""
Default Aggregate definition.
"""
def __init__(self, lookup, **extra):
"""Instantiate a new aggregate.
* lookup is the field on which the aggregate operates.
* extra is a diction... | ajibawa-2023/Python-Code-Large/train/row_85920 | 29 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85920:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0299, 0.0448, 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_85920:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85920:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85920:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85920:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
import re
from bisect import bisect
from django.conf import settings
from django.db.models.related import RelatedObject
from django.db.models.fields.related import ManyToManyRel
from django.db.models.fields import AutoField, FieldDoesNotExist
from django.db.models.fields.proxy import OrderWrt
from django.db.models.loa... | ajibawa-2023/Python-Code-Large/train/row_85921 | 306 | 502 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85921:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.002, 0.002, 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_85921:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85921:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85921:Try_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85921:ImportFrom_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
from django.utils.encoding import smart_unicode
from django.db.models.fields import BLANK_CHOICE_DASH
class BoundRelatedObject(object):
def __init__(self, related_object, field_mapping, original):
self.relation = related_object
self.field_mappings = field_mapping[related_object.name]
def templ... | ajibawa-2023/Python-Code-Large/train/row_85923 | 42 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85923:ImportFrom_L1_C0", "label": "from django.utils.encoding import smart_unicode", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 0, 0.66, 0.0, 96, 0, 1, 0, 0, 96, 0, 0], "semantic": {"name": "django.utils.encoding", "arg... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85923:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85923:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85923:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85923:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.db import connection
from django.db.models.loading import get_apps, get_app, get_models, get_model, register_models
from django.db.models.query import Q
from django.db.models.expressions import F
fro... | ajibawa-2023/Python-Code-Large/train/row_85924 | 24 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85924:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0278, 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_85924:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85924:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85924:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85924:ImportFrom_L31_C4"}, {"f": "ajibawa-2023/Python-... |
from django.utils import copycompat as copy
from django.conf import settings
from django.db import router
from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet
from django.db.models import signals
from django.db.models.fields import FieldDoesNotExist
def ensure_default_manager(sender, ... | ajibawa-2023/Python-Code-Large/train/row_85925 | 131 | 216 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85925:ImportFrom_L1_C0", "label": "from django.utils import copy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0046, 0.0046, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.utils", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85925:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85925:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85925:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85925:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
import weakref
from django.utils.copycompat import deepcopy
from django.d... | ajibawa-2023/Python-Code-Large/train/row_85926 | 85 | 171 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85926:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0234, 0.0409, 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_85926:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85926:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85926:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85926:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
This module implements a transaction manager that can be used to define
transaction handling in a request or view function. It is used by transaction
control middleware and decorators.
The transaction manager can be in managed or in auto state. Auto state means the
system is using a commit-on-save strategy (actual... | ajibawa-2023/Python-Code-Large/train/row_85928 | 156 | 304 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85928:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 13], "level": 0, "parent": null, "vector": [8, 0, 0.023, 0.0428, 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_85928:Try_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85928:ImportFrom_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85928:Try_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85928:ImportFrom_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.db.backends.postgresql.introspection import DatabaseIntrospection as PostgresDatabaseIntrospection
class DatabaseIntrospection(PostgresDatabaseIntrospection):
def get_relations(self, cursor, table_name):
"""
Returns a dictionary of {field_index: (field_index_other_table, other_table)}
... | ajibawa-2023/Python-Code-Large/train/row_85929 | 9 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85929:ImportFrom_L1_C0", "label": "from django.db.backends.postgresql.introspection import PostgresDatabaseIntrospection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0476, 0, 0.66, 0.0, 789, 0, 1, 0, 0, 789, 0, 0], "semantic"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85929:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85929:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85929:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85929:Expr_L6_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.db.backends import BaseDatabaseIntrospection
from MySQLdb import ProgrammingError, OperationalError
from MySQLdb.constants import FIELD_TYPE
import re
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
class DatabaseIntrospection(BaseDatabaseI... | ajibawa-2023/Python-Code-Large/train/row_85931 | 46 | 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_85931:ImportFrom_L1_C0", "label": "from django.db.backends import BaseDatabaseIntrospection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0102, 0.0102, 0, 0.66, 0.0, 981, 0, 1, 0, 0, 981, 0, 0], "semantic": {"name": "django.db.backend... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85931:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85931:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85931:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85931:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.db.models.sql import compiler
class SQLCompiler(compiler.SQLCompiler):
def resolve_columns(self, row, fields=()):
values = []
index_extra_select = len(self.query.extra_select.keys())
for value, field in map(None, row[index_extra_select:], fields):
if (field and field... | ajibawa-2023/Python-Code-Large/train/row_85932 | 15 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85932:ImportFrom_L1_C0", "label": "from django.db.models.sql import compiler", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "django.db.models.sql", "arg_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85932:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85932:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85932:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85932:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code... |
import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'mysql'
def runshell(self):
settings_dict = self.connection.settings_dict
args = [self.executable_name]
db = settings_dict['OPTIONS'].get('db', settings_d... | ajibawa-2023/Python-Code-Large/train/row_85933 | 24 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85933:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.025, 0.025, 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_85933:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85933:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85933:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85933:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.db.backends.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated MySQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dict_... | ajibawa-2023/Python-Code-Large/train/row_85934 | 20 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85934:ImportFrom_L1_C0", "label": "from django.db.backends.creation import BaseDatabaseCreation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0154, 0.0154, 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_85934:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85934:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85934:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85934:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.db.backends import BaseDatabaseValidation
class DatabaseValidation(BaseDatabaseValidation):
def validate_field(self, errors, opts, f):
"""
There are some field length restrictions for MySQL:
- Prior to version 5.0.3, character fields could not exceed 255
characters in... | ajibawa-2023/Python-Code-Large/train/row_85935 | 15 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85935:ImportFrom_L1_C0", "label": "from django.db.backends import BaseDatabaseValidation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 981, 0, 1, 0, 0, 981, 0, 0], "semantic": {"name": "django.db.backends",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85935:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85935:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85935:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85935:Expr_L5_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.dispatch import Signal
connection_created = Signal(providing_args=["connection"])
| ajibawa-2023/Python-Code-Large/train/row_85937 | 2 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85937:ImportFrom_L1_C0", "label": "from django.dispatch import Signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "django.dispatch", "arg_names": [], "imp... | [] |
"""
Dummy database backend for Django.
Django uses this if the database ENGINE setting is empty (None or empty string).
Each of these API functions, except connection.close(), raises
ImproperlyConfigured.
"""
from django.core.exceptions import ImproperlyConfigured
from django.db.backends import *
from django.db.back... | ajibawa-2023/Python-Code-Large/train/row_85938 | 40 | 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_85938:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0682, 0.1212, 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_85938:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85938:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85938:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85938:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.db.backends import BaseDatabaseIntrospection
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type codes to Django Field types.
data_types_reverse = {
16: 'BooleanField',
20: 'BigIntegerField',
21: 'SmallIntegerField',
23: 'IntegerField',
25: 'T... | ajibawa-2023/Python-Code-Large/train/row_85940 | 27 | 88 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85940:ImportFrom_L1_C0", "label": "from django.db.backends import BaseDatabaseIntrospection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0114, 0.0114, 0, 0.66, 0.0, 981, 0, 1, 0, 0, 981, 0, 0], "semantic": {"name": "django.db.backend... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85940:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85940:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85940:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85940:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'psql'
def runshell(self):
settings_dict = self.connection.settings_dict
args = [self.executable_name]
if settings_dict['USER']:
args += ["-U"... | ajibawa-2023/Python-Code-Large/train/row_85941 | 16 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85941:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 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_85941:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85941:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85941:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85941:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import re
from django.db.backends import BaseDatabaseOperations
# This DatabaseOperations class lives in here instead of base.py because it's
# used by both the 'postgresql' and 'postgresql_psycopg2' backends.
class DatabaseOperations(BaseDatabaseOperations):
def __init__(self, connection):
super(Databas... | ajibawa-2023/Python-Code-Large/train/row_85942 | 97 | 205 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85942:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 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_85942:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85942:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85942:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85942:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-... |
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.util import truncate_name
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated PostgreSQL column
# types, as strings. Column-type strings can contain format strings; they'll
... | ajibawa-2023/Python-Code-Large/train/row_85943 | 29 | 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_85943:ImportFrom_L1_C0", "label": "from django.db.backends.creation import BaseDatabaseCreation", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0132, 0.0132, 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_85943:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85943:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85943:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85943:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
Extracts the version of the PostgreSQL server.
"""
import re
# This reg-exp is intentionally fairly flexible here.
# Needs to be able to handle stuff like:
# PostgreSQL 8.3.6
# EnterpriseDB 8.3
# PostgreSQL 8.3 beta4
# PostgreSQL 8.4beta1
VERSION_RE = re.compile(r'\S+ (\d+)\.(\d+)\.?(\d+)?')
def _parse_v... | ajibawa-2023/Python-Code-Large/train/row_85944 | 13 | 31 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85944:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0645, 0.0968, 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_85944:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85944:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85944:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85944:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code... |
import datetime
import decimal
from time import time
from django.utils.hashcompat import md5_constructor
from django.utils.log import getLogger
logger = getLogger('django.db.backends')
class CursorWrapper(object):
def __init__(self, cursor, db):
self.cursor = cursor
self.db = db
def __geta... | ajibawa-2023/Python-Code-Large/train/row_85946 | 95 | 147 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85946:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0068, 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_85946:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85946:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85946:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85946:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-... |
import re
from django.db.backends import BaseDatabaseIntrospection
# This light wrapper "fakes" a dictionary interface, because some SQLite data
# types include variables in them -- e.g. "varchar(30)" -- and can't be matched
# as a simple dictionary lookup.
class FlexibleFieldLookupDict(object):
# Maps SQL types t... | ajibawa-2023/Python-Code-Large/train/row_85947 | 62 | 138 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85947:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0072, 0.0072, 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_85947:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85947:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85947:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85947:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'sqlite3'
def runshell(self):
args = [self.executable_name,
self.connection.settings_dict['NAME']]
if os.name == 'nt':
sys.exit(os.sys... | ajibawa-2023/Python-Code-Large/train/row_85948 | 10 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85948:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 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_85948:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85948:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85948:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85948:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import decimal
try:
import thread
except ImportError:
import dummy_thread as thread
from threading import local
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import util
from django.db.transaction import TransactionManagementError
from django.utils import datet... | ajibawa-2023/Python-Code-Large/train/row_85951 | 417 | 886 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85951:Import_L1_C0", "label": "decimal import decimal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0011, 0.0011, 0, 0.66, 0.0, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["decimal"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85951:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85951:Import_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85951:Try_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85951:Import_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_8... |
from django.db.backends import BaseDatabaseIntrospection
import cx_Oracle
import re
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type objects to Django Field types.
data_types_re... | ajibawa-2023/Python-Code-Large/train/row_85952 | 49 | 122 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85952:ImportFrom_L1_C0", "label": "from django.db.backends import BaseDatabaseIntrospection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0082, 0.0082, 0, 0.66, 0.0, 981, 0, 1, 0, 0, 981, 0, 0], "semantic": {"name": "django.db.backend... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85952:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85952:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85952:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85952:Try_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.db.models.sql import compiler
class SQLCompiler(compiler.SQLCompiler):
def resolve_columns(self, row, fields=()):
# If this query has limit/offset information, then we expect the
# first column to be an extra "_RN" column that we need to throw
# away.
if self.query.high... | ajibawa-2023/Python-Code-Large/train/row_85953 | 29 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85953:ImportFrom_L1_C0", "label": "from django.db.models.sql import compiler", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0147, 0.0147, 0, 0.66, 0.0, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "django.db.models.sql", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85953:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85953:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85953:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85953:If_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'sqlplus'
def runshell(self):
conn_string = self.connection._connect_string()
args = [self.executable_name, "-L", conn_string]
if os.name == 'nt':
... | ajibawa-2023/Python-Code-Large/train/row_85954 | 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_85954:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 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_85954:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85954:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85954:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85954:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.conf import settings
from django.core import signals
from django.core.exceptions import ImproperlyConfigured
from django.db.utils import ConnectionHandler, ConnectionRouter, load_backend, DEFAULT_DB_ALIAS, \
DatabaseError, IntegrityError
from django.utils.functional import curry
... | ajibawa-2023/Python-Code-Large/train/row_85957 | 44 | 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_85957:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0096, 0.0096, 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_85957:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85957:If_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85957:If_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85957:Import_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_859... |
import re
import sys
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
from django.conf import settings
from django.core import mail
from django.core.management import call_command
from django.core.signals import request_started
from django.core.urlresolvers import clear_url_cache... | ajibawa-2023/Python-Code-Large/train/row_85958 | 331 | 633 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85958:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0016, 0.0016, 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_85958:Try_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85958:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85958:Try_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85958:ImportFrom_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
from django.dispatch import Signal
template_rendered = Signal(providing_args=["template", "context"])
| ajibawa-2023/Python-Code-Large/train/row_85962 | 2 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85962:ImportFrom_L1_C0", "label": "from django.dispatch import Signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 548, 0, 1, 0, 0, 548, 0, 0], "semantic": {"name": "django.dispatch", "arg_names": [], "imp... | [] |
import sys
import time
import os
import warnings
from django.conf import settings
from django.core import mail
from django.core.mail.backends import locmem
from django.test import signals
from django.template import Template, loader, TemplateDoesNotExist
from django.template.loaders import cached
from django.utils.tran... | ajibawa-2023/Python-Code-Large/train/row_85963 | 87 | 168 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85963:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.006, 0.006, 0, 0.66, 0.0, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85963:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85963:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85963:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85963:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Django Unit Test and Doctest framework.
"""
from django.test.client import Client, RequestFactory
from django.test.testcases import TestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature
from django.test.utils import Approximate
| ajibawa-2023/Python-Code-Large/train/row_85964 | 4 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85964:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.2857, 0.4286, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from webob.multidict import MultiDict
from UserDict import DictMixin
__all__ = ['ResponseHeaders', 'EnvironHeaders']
class ResponseHeaders(MultiDict):
"""
Dictionary view on the response headerlist.
Keys are normalized for case and whitespace.
"""
def __getitem__(self, key):
key = ... | ajibawa-2023/Python-Code-Large/train/row_85965 | 94 | 146 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85965:ImportFrom_L1_C0", "label": "from webob.multidict import MultiDict", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0068, 0.0068, 0, 0.66, 0.0, 955, 0, 1, 0, 0, 955, 0, 0], "semantic": {"name": "webob.multidict", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85965:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85965:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85965:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85965:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import re, time, string
from datetime import datetime, date, timedelta
__all__ = ['Cookie']
class Cookie(dict):
def __init__(self, input=None):
if input:
self.load(input)
def load(self, data):
ckey = None
for key, val in _rx_cookie.findall(data):
if key.lower()... | ajibawa-2023/Python-Code-Large/train/row_85966 | 128 | 204 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85966:Import_L1_C0", "label": "re import re, time, string", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 0, 0.66, 0.0, 540, 0, 3, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re", "time"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85966:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85966:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85966:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85966:If_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
Gives a multi-value dictionary object (MultiDict) plus several wrappers
"""
import cgi, copy, sys, warnings, urllib
from UserDict import DictMixin
... | ajibawa-2023/Python-Code-Large/train/row_85968 | 395 | 632 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85968:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0063, 0.0047, 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_85968:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85968:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85968:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85968:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Represents the Cache-Control header
"""
import re
class UpdateDict(dict):
"""
Dict that has a callback on all updates
"""
# these are declared as class attributes so that
# we don't need to override constructor just to
# set some defaults
updated = None
updated_args = None
def ... | ajibawa-2023/Python-Code-Large/train/row_85971 | 137 | 227 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85971:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0088, 0.0132, 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_85971:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85971:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85971:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85971:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
import cgi, warnings
from webob.headers import _trans_key
def html_escape(s):
"""HTML-escape a string or object
This converts any non-string objects passed into it to strings
(actually, using ``unicode()``). All values returned are
non-unicode strings (using ``&#num;`` entities for all non-ASCII
... | ajibawa-2023/Python-Code-Large/train/row_85972 | 31 | 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_85972:Import_L1_C0", "label": "cgi import cgi, warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0091, 0.0091, 0, 0.66, 0.0, 934, 0, 2, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi", "warni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85972:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85972:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85972:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85972:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import re
from datetime import datetime, date
from webob.byterange import Range, ContentRange
from webob.etag import IfRange, NoIfRange
from webob.datetime_utils import parse_date, serialize_date
from webob.util import header_docstring
CHARSET_RE = re.compile(r';\s*charset=([^;]*)', re.I)
QUOTES_RE = re.compile('"(.*... | ajibawa-2023/Python-Code-Large/train/row_85973 | 178 | 279 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85973:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 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_85973:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85973:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85973:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85973:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
"""
Parses a variety of ``Accept-*`` headers.
These headers generally take the form of::
value1; q=0.5, value2; q=0
Where the ``q`` parameter is optional. In theory other parameters
exists, but this ignores them.
"""
import re
from webob.util import header_docstring, warn_deprecation
from webob.headers import ... | ajibawa-2023/Python-Code-Large/train/row_85974 | 212 | 361 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85974:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0152, 0.0277, 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_85974:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85974:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85974:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85974:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
import time
import calendar
from datetime import datetime, date, timedelta, tzinfo
from email.utils import parsedate_tz, mktime_tz, formatdate
__all__ = [
'UTC', 'timedelta_to_seconds',
'year', 'month', 'week', 'day', 'hour', 'minute', 'second',
'parse_date', 'serialize_date',
'parse_date_delta', 'seri... | ajibawa-2023/Python-Code-Large/train/row_85975 | 64 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85975:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0101, 0.0101, 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_85975:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85975:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85975:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85975:Return_L17_C8"}, {"f": "ajibawa-2023/Python-... |
"""
Does parsing of ETag-related headers: If-None-Matches, If-Matches
Also If-Range parsing
"""
from webob.datetime_utils import *
from webob.util import header_docstring, warn_deprecation
__all__ = ['AnyETag', 'NoETag', 'ETagMatcher', 'IfRange', 'NoIfRange', 'etag_property']
def etag_property(key, default, rfc_se... | ajibawa-2023/Python-Code-Large/train/row_85976 | 151 | 242 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85976:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0124, 0.0207, 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_85976:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85976:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85976:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85976:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Pyth... |
from webob.datetime_utils import *
from webob.request import *
from webob.response import *
from webob.util import html_escape
__all__ = [
'Request', 'Response',
'UTC', 'day', 'week', 'hour', 'minute', 'second', 'month', 'year',
'html_escape'
]
BaseRequest.ResponseClass = Response
Response.RequestClass = ... | ajibawa-2023/Python-Code-Large/train/row_85977 | 8 | 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_85977:ImportFrom_L1_C0", "label": "from webob.datetime_utils import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0526, 0, 0.66, 0.0, 676, 0, 1, 0, 0, 676, 0, 0], "semantic": {"name": "webob.datetime_utils", "arg_names": [],... | [] |
# Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Implements ProcessPoolExecutor.
The follow diagram and text describe the data-flow through the system:
|======================= In-process =====================|== Out-of-process ==|
+----------+ +----------... | ajibawa-2023/Python-Code-Large/train/row_85980 | 133 | 345 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85980:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 44], "level": 0, "parent": null, "vector": [8, 0, 0.0696, 0.1188, 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_85980:Try_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85980:Import_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85980:Try_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85980:Import_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
# Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Implements ThreadPoolExecutor."""
from __future__ import with_statement
import atexit
import threading
import weakref
from concurrent.futures import _base
try:
import queue
except ImportError:
import Que... | ajibawa-2023/Python-Code-Large/train/row_85981 | 76 | 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_85981:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0294, 0.0074, 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_85981:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85981:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85981:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85981:Import_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
# Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
from __future__ import with_statement
import functools
import logging
import threading
import time
try:
from collections import namedtuple
except ImportError:
from concurrent.futures._compat import namedtuple... | ajibawa-2023/Python-Code-Large/train/row_85982 | 268 | 574 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85982:ImportFrom_L4_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.007, 0.0017, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85982:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85982:ImportFrom_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85982:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85982:ImportFrom_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from keyword import iskeyword as _iskeyword
from operator import itemgetter as _itemgetter
import sys as _sys
def namedtuple(typename, field_names):
"""Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', 'x y')
>>> Point.__doc__ # docstring for the new cla... | ajibawa-2023/Python-Code-Large/train/row_85983 | 31 | 101 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85983:ImportFrom_L1_C0", "label": "from keyword import _iskeyword", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0099, 0.0099, 0, 0.66, 0.0, 454, 0, 1, 0, 0, 454, 0, 0], "semantic": {"name": "keyword", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85983:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85983:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85983:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85983:If_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
# Copyright 2009 Brian Quinlan. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Execute computations asynchronously using threads or processes."""
__author__ = 'Brian Quinlan (brian@sweetapp.com)'
from concurrent.futures._base import (FIRST_COMPLETED,
FI... | ajibawa-2023/Python-Code-Large/train/row_85984 | 5 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85984:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.2222, 0.0556, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| ajibawa-2023/Python-Code-Large/train/row_85985 | 2 | 3 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85985:ImportFrom_L1_C0", "label": "from pkgutil import extend_path", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 670, 0, 1, 0, 0, 670, 0, 0], "semantic": {"name": "pkgutil", "arg_names": [], "import_names":... | [] |
import os
import sys
from setuptools import setup, Extension, Feature
from distutils.command.build_ext import build_ext
from distutils.errors import CCompilerError, DistutilsExecError, \
DistutilsPlatformError
# fail safe compilation shamelessly stolen from the simplejson
# setup.py file. Original author: Bob Ip... | ajibawa-2023/Python-Code-Large/train/row_85986 | 49 | 128 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85986:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0078, 0.0078, 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_85986:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85986:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85986:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85986:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
import gc
import unittest
from markupsafe import Markup, escape, escape_silent
class MarkupTestCase(unittest.TestCase):
def test_markup_operations(self):
# adding two strings should escape the unsafe one
unsafe = '<script type="application/x-some-script">alert("foo");</script>'
safe = Mar... | ajibawa-2023/Python-Code-Large/train/row_85987 | 36 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85987:Import_L1_C0", "label": "gc import gc", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0125, 0.0125, 0, 0.66, 0.0, 92, 0, 1, 0, 0, 92, 0, 0], "semantic": {"name": "gc", "arg_names": [], "import_names": ["gc"], "rhs_call_name": "", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85987:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85987:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85987:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85987:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
markupsafe._constants
~~~~~~~~~~~~~~~~~~~~~
Highlevel implementation of the Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
HTML_ENTITIES = {
'AElig': 198,
'Aacute': 193,
'Acirc': 194,
'Agrave': 1... | ajibawa-2023/Python-Code-Large/train/row_85988 | 2 | 267 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85988:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0225, 0.0337, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
# -*- coding: utf-8 -*-
"""
markupsafe
~~~~~~~~~~
Implements a Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
from itertools import imap
__all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
_striptags_re = re.compile... | ajibawa-2023/Python-Code-Large/train/row_85989 | 112 | 229 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85989:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0262, 0.0393, 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_85989:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85989:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85989:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85989:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
"""
markupsafe._native
~~~~~~~~~~~~~~~~~~
Native Python implementation the C module is not compiled.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from markupsafe import Markup
def escape(s):
"""Convert the characters &, <, >... | ajibawa-2023/Python-Code-Large/train/row_85990 | 17 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_85990:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 10], "level": 0, "parent": null, "vector": [8, 0, 0.1333, 0.2, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85990:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85990:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85990:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85990:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Decorators for views based on HTTP headers.
"""
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.utils.log import getLogger
from ... | ajibawa-2023/Python-Code-Large/train/row_85993 | 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_85993: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_85993:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85993:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85993:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85993:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python... |
import functools
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 forms are accepted:
* with specif... | ajibawa-2023/Python-Code-Large/train/row_85994 | 21 | 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_85994:Import_L1_C0", "label": "functools import functools", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 0, 0.66, 0.0, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_names": ["func... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_85994:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85994:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85994:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85994:FunctionDef_L27_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_85995 | 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_85995: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_85995:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85995:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85995:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85995: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_85996 | 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_85996: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_85997 | 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_85997: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_85997:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85997:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85997:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_85997: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_85998 | 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_85998: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_85998:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85998:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85998:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85998: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_85999 | 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_85999: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_85999:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85999:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_85999:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_85999: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 with_statement
import mimetypes
import os
import stat
import posixpath
import re
import urllib
from django.http import Http404, HttpResponse, HttpR... | ajibawa-2023/Python-Code-Large/train/row_86000 | 66 | 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_86000:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0176, 0.0282, 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_86000:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86000:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86000:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86000:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code... |
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_86001 | 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_86001: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_86001:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86001:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86001:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86001:ImportFrom_L98_C4"}, {"f": "ajibawa-2023/Python-... |
import datetime
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext as _
from django.utils import timezone
from django.views.generic.base import View
from django... | ajibawa-2023/Python-Code-Large/train/row_86002 | 287 | 607 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86002:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0016, 0.0016, 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_86002:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86002:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86002:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86002:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
from django.utils.log import getLogger
import warnings
warnings.warn(
'Function-based generic views have been deprecated; use class-based views instead.',
... | ajibawa-2023/Python-Code-Large/train/row_86003 | 30 | 68 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86003:ImportFrom_L1_C0", "label": "from django.template import loader, RequestContext", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0147, 0.0147, 0, 0.66, 0.0, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86003:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86003:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86003:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86003:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.forms.models import ModelFormMetaclass, ModelForm
from django.template import RequestContext, loader
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.core.xheaders import populate_xheaders
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.... | ajibawa-2023/Python-Code-Large/train/row_86004 | 108 | 221 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86004:ImportFrom_L1_C0", "label": "from django.forms.models import ModelFormMetaclass, ModelForm", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0045, 0.0045, 0, 0.66, 0.0, 625, 0, 2, 0, 0, 625, 0, 0], "semantic": {"name": "django.forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86004:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86004:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86004:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86004:For_L23_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.encoding import smart_str
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, View
class Multip... | ajibawa-2023/Python-Code-Large/train/row_86005 | 82 | 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_86005:ImportFrom_L1_C0", "label": "from django.core.paginator import Paginator, InvalidPage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0065, 0, 0.66, 0.0, 831, 0, 2, 0, 0, 831, 0, 0], "semantic": {"name": "django.core.pagin... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86005:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86005:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86005:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86005:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.template import loader, RequestContext
from django.http import Http404, HttpResponse
from django.core.xheaders import populate_xheaders
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ObjectDoesNotExist
import warnings
warnings.warn(
'Function-based generic v... | ajibawa-2023/Python-Code-Large/train/row_86006 | 59 | 152 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86006:ImportFrom_L1_C0", "label": "from django.template import loader, RequestContext", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0066, 0, 0.66, 0.0, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86006:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86006:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86006:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86006:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import Http404
from django.utils.encoding import smart_str
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, View
class SingleObjectMixin(object):
"""
Prov... | ajibawa-2023/Python-Code-Large/train/row_86007 | 73 | 150 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86007:ImportFrom_L1_C0", "label": "from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 0, 0.66, 0.0, 160, 0, 2, 0, 0, 160, 0, 0], "semantic": {"name":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86007:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86007:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86007:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86007:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.views.generic.base import TemplateResponseMixin, View
from django.views.generic.detail import (SingleObjectMixin,
SingleObjectTemplateRe... | ajibawa-2023/Python-Code-Large/train/row_86008 | 126 | 242 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86008:ImportFrom_L1_C0", "label": "from django.forms import model_forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0041, 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_86008:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86008:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86008:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86008:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from functools import update_wrapper
from django import http
from django.core.exceptions import ImproperlyConfigured
from django.template.response import TemplateResponse
from django.utils.log import getLogger
from django.utils.decorators import classonlymethod
logger = getLogger('django.request')
class View(object)... | ajibawa-2023/Python-Code-Large/train/row_86009 | 89 | 178 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86009:ImportFrom_L1_C0", "label": "from functools import update_wrapper", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0056, 0.0056, 0, 0.66, 0.0, 711, 0, 1, 0, 0, 711, 0, 0], "semantic": {"name": "functools", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86009:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86009:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86009:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86009:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import datetime
import time
from django.template import loader, RequestContext
from django.core.exceptions import ObjectDoesNotExist
from django.core.xheaders import populate_xheaders
from django.db.models.fields import DateTimeField
from django.http import Http404, HttpResponse
from django.utils import timezone
impo... | ajibawa-2023/Python-Code-Large/train/row_86010 | 184 | 376 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86010:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0027, 0.0027, 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_86010:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86010:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86010:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86010:If_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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_86011 | 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_86011: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_86011:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86011:Expr_L11_C4"}] |
from django import http
from django.template import (Context, RequestContext,
loader, 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 in case the... | ajibawa-2023/Python-Code-Large/train/row_86012 | 20 | 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_86012:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0152, 0.0152, 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_86012:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86012:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86012:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86012:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code... |
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_unicod... | ajibawa-2023/Python-Code-Large/train/row_86013 | 131 | 283 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86013: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_86013:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86013:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86013:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86013:Assign_L25_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.
"""
from django.template import loader, RequestContext
from django.http import HttpResponse, Http404
from django.http import HttpRespon... | ajibawa-2023/Python-Code-Large/train/row_86014 | 52 | 130 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86014:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0385, 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_86014:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86014:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86014:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86014:Assign_L19_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_86015 | 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_86015: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... | [] |
"""
Common checksum routines (used in multiple localflavor/ cases, for example).
"""
__all__ = ['luhn',]
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
algorithm (used in validation of, for ... | ajibawa-2023/Python-Code-Large/train/row_86018 | 12 | 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_86018:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0909, 0.1364, 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_86018:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86018:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86018:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86018:If_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"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_86019 | 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_86019: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
def module_has_submodule(package, module_name):
"""See if 'module' is in 'package'."""
name = ".".join([package.__name__, module_name])
try:
# None indicates a cached miss; see mark_miss() in Python/import.c.
return sys.modules[name] is not None
except K... | ajibawa-2023/Python-Code-Large/train/row_86020 | 37 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86020:Import_L1_C0", "label": "imp import imp", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 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_86020:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86020:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86020:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86020:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
termcolors.py
"""
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', 'underscore': '4', 'blink': '5', 'rever... | ajibawa-2023/Python-Code-Large/train/row_86021 | 60 | 198 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86021:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0101, 0.0152, 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_86021:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86021:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86021:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86021:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""JsLex: a lexer for Javascript"""
# Originally from https://bitbucket.org/ned/jslex
import re
class Tok(object):
"""
A specification for a token class.
"""
num = 0
def __init__(self, name, regex, next=None):
self.id = Tok.num
Tok.num += 1
self.name = name
self.reg... | ajibawa-2023/Python-Code-Large/train/row_86023 | 70 | 219 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86023:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0046, 0.0046, 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_86023:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86023:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86023:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86023:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print df.format('jS F Y H:i')
7th October 2003 11:39
>>>
"""
import re
import time
import calendar
import datetime
from django.utils.dates import M... | ajibawa-2023/Python-Code-Large/train/row_86024 | 217 | 315 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86024:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0206, 0.0381, 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_86024:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86024:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86024:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86024:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-... |
import datetime
from django.utils.timezone import is_aware, utc
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None, reversed=False):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, e.g. "10 minutes". If d occurs after now... | ajibawa-2023/Python-Code-Large/train/row_86025 | 28 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86025:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0167, 0.0167, 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_86025:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86025:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86025:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86025:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# Copyright (c) 2010 Taurinus Collective. All rights reserved.
# Copyright (c) 2009 Simon Willison. All rights reserved.
# Copyright (c) 2002 Drew Perttula. All rights reserved.
#
# License:
# Python Software Foundation License version 2
#
# See the file "LICENSE" for terms & conditions for usage, and a DISCLAIMER OF... | ajibawa-2023/Python-Code-Large/train/row_86026 | 47 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86026:Expr_L18_C0", "label": "expression", "type": "expression", "loc": [18, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2828, 0.2121, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86026:ClassDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86026:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86026:ClassDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86026:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | ajibawa-2023/Python-Code-Large/train/row_86027 | 81 | 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_86027:Import_L31_C0", "label": "os import os, sys, time\u2026", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.2138, 0.0069, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86027:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86027:Import_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86027:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86027:Import_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
import calendar
import datetime
import re
import sys
import urllib
import urlparse
from email.utils import formatdate
from django.utils.datastructures import MultiValueDict
from django.utils.encoding import smart_str, force_unicode
from django.utils.functional import allow_lazy
ETAG_MATCH = re.compile(r'(?:W/)?"((?:\... | ajibawa-2023/Python-Code-Large/train/row_86028 | 116 | 238 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86028:Import_L1_C0", "label": "calendar import calendar", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0042, 0.0042, 0, 0.66, 0.0, 917, 0, 1, 0, 0, 917, 0, 0], "semantic": {"name": "calendar", "arg_names": [], "import_names": ["calenda... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86028:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86028:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86028:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86028:Return_L33_C4"}, {"f": "ajibawa-2023/Python-Code... |
import copy
import operator
from functools import wraps, update_wrapper
# You can't trivially replace this `functools.partial` because this binds to
# classes and returns bound instances, whereas functools.partial (on CPython)
# is a type and its instances don't bind.
def curry(_curried_func, *args, **kwargs):
de... | ajibawa-2023/Python-Code-Large/train/row_86029 | 169 | 312 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86029:Import_L1_C0", "label": "copy import copy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 0, 0.66, 0.0, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["copy"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86029:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86029:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86029:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86029:Return_L11_C8"}, {"f": "ajibawa-2023/Pytho... |
"""
Utilities for XML generation/parsing.
"""
from xml.sax.saxutils import XMLGenerator
class SimplerXMLGenerator(XMLGenerator):
def addQuickElement(self, name, contents=None, attrs=None):
"Convenience method for adding an element with no children"
if attrs is None: attrs = {}
self.startEl... | ajibawa-2023/Python-Code-Large/train/row_86030 | 11 | 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_86030:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2143, 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_86030:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86030:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86030:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86030:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
Functions for working with "safe strings": strings that can be displayed safely
without further escaping in HTML. Marking something as a "safe string" means
that the producer of the string has already turned characters that should not
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
"""
f... | ajibawa-2023/Python-Code-Large/train/row_86032 | 64 | 125 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86032:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.028, 0.048, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86032:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86032:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86032:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86032:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
import sys
try:
from functools import wraps
except ImportError:
# only needed for Python 2.4
def wraps(_):
def _wraps(func):
return func
return _wraps
__unittest = True
def _relpath_nt(path, start=os.path.curdir):
"""Return a relative version of a path"""
if... | ajibawa-2023/Python-Code-Large/train/row_86033 | 37 | 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_86033:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 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_86033:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86033:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86033:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86033:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
import signal
import weakref
from django.utils.unittest.compatibility import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
installed_handler ... | ajibawa-2023/Python-Code-Large/train/row_86035 | 39 | 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_86035:Import_L1_C0", "label": "signal import signal", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 621, 0, 1, 0, 0, 621, 0, 0], "semantic": {"name": "signal", "arg_names": [], "import_names": ["signal"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86035:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86035:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86035:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86035:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
"""Test result object"""
import sys
import traceback
import unittest
from StringIO import StringIO
from django.utils.unittest import util
from django.utils.unittest.compatibility import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'fail... | ajibawa-2023/Python-Code-Large/train/row_86036 | 120 | 183 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86036:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0055, 0.0055, 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_86036:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86036:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86036:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86036:If_L17_C8"}, {"f": "ajibawa-2023/Python-C... |
import os
import sys
from django.utils.unittest.loader import defaultTestLoader
def collector():
# import __main__ triggers code re-execution
__main__ = sys.modules['__main__']
setupDir = os.path.abspath(os.path.dirname(__main__.__file__))
return defaultTestLoader.discover(setupDir)
| ajibawa-2023/Python-Code-Large/train/row_86037 | 7 | 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_86037:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.1111, 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_86037:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86037:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86037:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86037:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""Various utility functions."""
__unittest = True
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(result) < _MAX_LENGTH:
return result
return result[:_MAX_LENGTH] + ' [truncated]...'... | ajibawa-2023/Python-Code-Large/train/row_86040 | 60 | 99 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86040:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0101, 0.0101, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86040:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86040:Try_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86040:Try_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86040:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
"""
unittest2
unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7. It is tested to run on Python 2.4 - 2.6.
To use unittest2 instead of unittest simply replace ``import unittest`` with
``import unittest2``.
Copyright (c) 1999-2003 Steve Purcell
Copyright (c) 2003-2010 P... | ajibawa-2023/Python-Code-Large/train/row_86041 | 21 | 80 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86041:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 27], "level": 0, "parent": null, "vector": [8, 0, 0.175, 0.3375, 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_86041:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86041:ImportFrom_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86041:Try_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86041:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
"""Main entry point"""
import sys
if sys.argv[0].endswith("__main__.py"):
sys.argv[0] = "unittest2"
__unittest = True
from django.utils.unittest.main import main_
main_()
| ajibawa-2023/Python-Code-Large/train/row_86042 | 7 | 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_86042:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.1, 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_86042:If_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86042:Assign_L5_C4"}] |
"""Running tests"""
import sys
import time
import unittest
from django.utils.unittest import result
try:
from django.utils.unittest.signals import registerResult
except ImportError:
def registerResult(_):
pass
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like obj... | ajibawa-2023/Python-Code-Large/train/row_86044 | 156 | 206 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86044:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0049, 0.0049, 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_86044:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86044:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86044:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86044:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
"""
Synchronization primitives:
- reader-writer lock (preference to writers)
(Contributed to Django by eugene@lazutkin.com)
"""
from __future__ import with_statement
import contextlib
try:
import threading
except ImportError:
import dummy_threading as threading
class RWLock(object):
"""
Classi... | ajibawa-2023/Python-Code-Large/train/row_86045 | 45 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86045:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0421, 0.0737, 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_86045:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86045:Import_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86045:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86045:Import_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.