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 |
|---|---|---|---|---|---|---|---|
"""
UK-specific Form helpers
"""
from django.forms.fields import Select
class IECountySelect(Select):
"""
A Select widget that uses a list of Irish Counties as its choices.
"""
def __init__(self, attrs=None):
from ie_counties import IE_COUNTY_CHOICES
super(IECountySelect, self).__init_... | ajibawa-2023/Python-Code-Large/train/row_84698 | 7 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84698:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1538, 0.2308, 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_84698:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84698:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84698:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84698:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Sources:
Irish Counties: http://en.wikipedia.org/wiki/Counties_of_Ireland
"""
from django.utils.translation import ugettext_lazy as _
IE_COUNTY_CHOICES = (
('antrim', _('Antrim')),
('armagh', _('Armagh')),
('carlow', _('Carlow')),
('cavan', _('Cavan')),
('clare', _('Clare')),
('cork... | ajibawa-2023/Python-Code-Large/train/row_84699 | 3 | 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_84699:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0625, 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... | [] |
# -*- coding: utf-8 -*-
"""
Romanian specific form helpers.
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError, Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class ROCIFField(RegexField):
"""
A Romanian fiscal identity co... | ajibawa-2023/Python-Code-Large/train/row_84700 | 112 | 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_84700:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0146, 0.0146, 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_84700:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84700:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84700:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84700:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
"""
A list of Romanian counties as `choices` in a formfield.
This exists as a standalone file so that it's only imported into memory when
explicitly needed.
"""
COUNTIES_CHOICES = (
('AB', u'Alba'),
('AR', u'Arad'),
('AG', u'Argeş'),
('BC', u'Bacău'),
('BH', u'Bihor'),
... | ajibawa-2023/Python-Code-Large/train/row_84701 | 2 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84701:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0865, 0.1154, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
Polish-specific form helpers
"""
import re
from django.forms import ValidationError
from django.forms.fields import Select, RegexField
from django.utils.translation import ugettext_lazy as _
from django.core.validators import EMPTY_VALUES
class PLProvinceSelect(Select):
"""
A select widget with list of P... | ajibawa-2023/Python-Code-Large/train/row_84702 | 78 | 160 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84702:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0125, 0.0187, 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_84702:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84702:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84702:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84702:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
Polish voivodeship as in http://en.wikipedia.org/wiki/Poland#Administrative_division
"""
from django.utils.translation import ugettext_lazy as _
VOIVODESHIP_CHOICES = (
('lower_silesia', _('Lower Silesia')),
('kuyavia-pomerania', _('Kuyavia-Pomerania')),
('lublin', _('Lublin')),
('lubusz', _('Lubu... | ajibawa-2023/Python-Code-Large/train/row_84703 | 3 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84703:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0833, 0.125, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [] |
# -*- coding: utf-8 -*-
"""
Polish administrative units as in http://pl.wikipedia.org/wiki/Podzia%C5%82_administracyjny_Polski
"""
ADMINISTRATIVE_UNIT_CHOICES = (
('wroclaw', u'Wrocław'),
('jeleniagora', u'Jelenia Góra'),
('legnica', u'Legnica'),
('boleslawiecki', u'bolesławiecki'),
('dzierzoniows... | ajibawa-2023/Python-Code-Large/train/row_84704 | 2 | 385 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84704:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0078, 0.0078, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
# -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.localflavor.uy.util import get_vali... | ajibawa-2023/Python-Code-Large/train/row_84705 | 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_84705:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.05, 0.05, 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_84705:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84705:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84705:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84705:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""A list of Urguayan departaments as `choices` in a formfield."""
DEPARTAMENT_CHOICES = (
('G', u'Artigas'),
('A', u'Canelones'),
('E', u'Cerro Largo'),
('L', u'Colonia'),
('Q', u'Durazno'),
('N', u'Flores'),
('O', u'Florida'),
('P', u'Lavalleja'),
('B', u'M... | ajibawa-2023/Python-Code-Large/train/row_84706 | 2 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84706:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0833, 0.0417, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
# -*- coding: utf-8 -*-
def get_validation_digit(number):
""" Calculates the validation digit for the given number. """
sum = 0
dvs = [4, 3, 6, 7, 8, 9, 2]
number = str(number)
for i in range(0, len(number)):
sum = (int(number[-1 - i]) * dvs[i] + sum) % 10
return (10-sum) % 10
| ajibawa-2023/Python-Code-Large/train/row_84707 | 8 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84707:FunctionDef_L3_C0", "label": "get_validation_digit", "type": "function", "loc": [3, 12], "level": 0, "parent": null, "vector": [2, 0, 0.625, 0.8333, 0, 0.66, 0.0, 198, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "get_validation_digit", "arg_names": ["number"], "imp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84707:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84707:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84707:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84707:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*-
"""
PE-specific Form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, CharField, Select
from django.utils.translation import ugettext_lazy as _
class PERegionSelect(Select):
"""
A Select wi... | ajibawa-2023/Python-Code-Large/train/row_84708 | 36 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84708:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0417, 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_84708:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84708:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84708:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84708:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Peru regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
REGION_CHOICES = (
('AMA', u'Amazonas'),
('ANC', u'Ancash'),
('APU', u'Apurímac'),
('ARE', u'Arequipa'),
('AYA', u'... | ajibawa-2023/Python-Code-Large/train/row_84709 | 2 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84709:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1286, 0.1714, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
USA-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits... | ajibawa-2023/Python-Code-Large/train/row_84710 | 53 | 113 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84710:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0177, 0.0265, 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_84710:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84710:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84710:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84710:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from django.contrib.localflavor.us.us_states import STATE_CHOICES
class USStateField(CharField):
description = _("U.S. state (two uppercase letters)")
def __init__(self, *arg... | ajibawa-2023/Python-Code-Large/train/row_84711 | 20 | 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_84711:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84711:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84711:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84711:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84711:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
A mapping of state misspellings/abbreviations to normalized abbreviations, and
an alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('AL', 'Alabama'),
('AK', 'Alaska'),
... | ajibawa-2023/Python-Code-Large/train/row_84712 | 3 | 234 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84712:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0171, 0.0299, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
ID-specific Form helpers
"""
import re
import time
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
postcode_re = re.compil... | ajibawa-2023/Python-Code-Large/train/row_84713 | 96 | 211 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84713:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0095, 0.0142, 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_84713:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84713:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84713:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84713:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import ugettext_lazy as _
# Reference: http://id.wikipedia.org/wiki/Daftar_provinsi_Indonesia
# Indonesia does not have an official Province code standard.
# I decided to use unambiguous and consistent (some are common) 3-letter codes.
PROVINCE_CHOICES = (
('BLI', _('Bali')),
('... | ajibawa-2023/Python-Code-Large/train/row_84714 | 3 | 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_84714:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0099, 0.0099, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Canada-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re... | ajibawa-2023/Python-Code-Large/train/row_84715 | 69 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84715:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0149, 0.0224, 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_84715:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84715:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84715:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84715:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
An alphabetical list of provinces and territories for use as `choices`
in a formfield., and a mapping of province misspellings/abbreviations to
normalized abbreviations
Source: http://www.canada.gc.ca/othergov/prov_e.html
This exists in this standalone file so that it's only imported into memory
when explici... | ajibawa-2023/Python-Code-Large/train/row_84716 | 3 | 59 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84716:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0932, 0.1695, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
"""
Swiss-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
id_re = re.compile(r"... | ajibawa-2023/Python-Code-Large/train/row_84717 | 67 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84717:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0168, 0.0252, 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_84717:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84717:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84717:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84717:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('AG', _('Aargau')),
('AI', _('Appenzell Innerrhoden')),
('AR', _('Appenzell Ausserrhoden')),
('BS', _('Basel-Stadt')),
('BL', _('Basel-Land')),
('BE', _('Berne')),
('FR', _('Fribourg')),
('... | ajibawa-2023/Python-Code-Large/train/row_84718 | 2 | 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_84718:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0323, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Norwegian-specific Form helpers
"""
import re, datetime
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class NOZipCodeField(RegexField):
default_error_mes... | ajibawa-2023/Python-Code-Large/train/row_84719 | 49 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84719:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0244, 0.0366, 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_84719:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84719:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84719:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84719:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Norwegian municipalities (fylker) fro use as `choices`
in a formfield.
This exists in this standalone file so that it's on ly imported into memory
when explicitly needed.
"""
MUNICIPALITY_CHOICES = (
('akershus', u'Akershus'),
('austagder', u'Aust-Agder'),
... | ajibawa-2023/Python-Code-Large/train/row_84720 | 2 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84720:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 8], "level": 0, "parent": null, "vector": [8, 0, 0.1562, 0.2188, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from django.middleware.csrf import CsrfMiddleware, CsrfViewMiddleware, CsrfResponseMiddleware
from django.views.decorators.csrf import csrf_exempt, csrf_view_exempt, csrf_response_exempt
import warnings
warnings.warn("This import for CSRF functionality is deprecated. Please use django.middleware.csrf for the middlewa... | ajibawa-2023/Python-Code-Large/train/row_84721 | 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_84721:ImportFrom_L1_C0", "label": "from django.middleware.csrf import CsrfMiddleware, CsrfViewMiddleware, CsrfResponseMiddleware", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 0, 0.66, 0.0, 574, 0, 3, 0, 0, 574, 0, 0], "s... | [] |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class FlatPage(models.Model):
url = models.CharField(_('URL'), max_length=100, db_index=True)
title = models.CharField(_('title'), max_length=200)
content = models.TextField(_(... | ajibawa-2023/Python-Code-Large/train/row_84722 | 20 | 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_84722:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84722:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84722:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84722:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84722:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.conf.urls.defaults import *
# special urls for flatpage test cases
urlpatterns = patterns('',
(r'^flatpage_root', include('django.contrib.flatpages.urls')),
(r'^accounts/', include('django.contrib.auth.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_84723 | 2 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84723:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_nam... | [] |
import os
from django.conf import settings
from django.test import TestCase
class FlatpageMiddlewareTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES
flatpage_middleware_c... | ajibawa-2023/Python-Code-Large/train/row_84724 | 44 | 59 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84724:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0169, 0.0169, 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_84724:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84724:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84724:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84724:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
from django.conf import settings
from django.test import TestCase, Client
class FlatpageCSRFTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.client = Client(enforce_csrf_checks=True)
self.old_MIDDLEWARE_CLASSES = ... | ajibawa-2023/Python-Code-Large/train/row_84725 | 55 | 73 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84725:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0137, 0.0137, 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_84725:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84725:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84725:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84725:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
from django.conf import settings
from django.test import TestCase
class FlatpageViewTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES
flatpage_middleware_class =... | ajibawa-2023/Python-Code-Large/train/row_84726 | 40 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84726:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0189, 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_84726:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84726:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84726:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84726:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.contrib.flatpages.tests.csrf import *
from django.contrib.flatpages.tests.middleware import *
from django.contrib.flatpages.tests.views import *
| ajibawa-2023/Python-Code-Large/train/row_84727 | 3 | 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_84727:ImportFrom_L1_C0", "label": "from django.contrib.flatpages.tests.csrf import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 500, 0, 1, 0, 0, 500, 0, 0], "semantic": {"name": "django.contrib.flatpages... | [] |
from django.conf.urls.defaults import *
urlpatterns = patterns('django.contrib.flatpages.views',
(r'^(?P<url>.*)$', 'flatpage'),
)
| ajibawa-2023/Python-Code-Large/train/row_84728 | 2 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84728:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names":... | [] |
from django.contrib.flatpages.views import flatpage
from django.http import Http404
from django.conf import settings
class FlatpageFallbackMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a flatpage for non... | ajibawa-2023/Python-Code-Large/train/row_84729 | 12 | 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_84729:ImportFrom_L1_C0", "label": "from django.contrib.flatpages.views import flatpage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 240, 0, 1, 0, 0, 240, 0, 0], "semantic": {"name": "django.contrib.flatpag... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84729:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84729:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84729:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84729:If_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django import forms
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/]+$',
help_text = _("Example: '/a... | ajibawa-2023/Python-Code-Large/train/row_84730 | 15 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84730:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84730:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84730:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84730:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84730:ClassDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.contrib.flatpages.models import FlatPage
from django.template import loader, RequestContext
from django.shortcuts import get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.core.xheaders import populate_xheaders
from django.utils.safestri... | ajibawa-2023/Python-Code-Large/train/row_84731 | 31 | 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_84731:ImportFrom_L1_C0", "label": "from django.contrib.flatpages.models import FlatPage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 0, 0.66, 0.0, 268, 0, 1, 0, 0, 268, 0, 0], "semantic": {"name": "django.contrib.flatpa... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84731:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84731:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84731:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84731:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# This file intentionally left blank | ajibawa-2023/Python-Code-Large/train/row_84732 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
from datetime import date
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sitemaps import Sitemap
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils.formats import locali... | ajibawa-2023/Python-Code-Large/train/row_84733 | 65 | 129 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84733:ImportFrom_L1_C0", "label": "from datetime import date", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0078, 0.0078, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["da... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84733:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84733:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84733:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84733:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from datetime import datetime
from django.conf.urls.defaults import *
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap
from django.contrib.auth.models import User
class SimpleSitemap(Sitemap):
changefreq = "never"
priority = 0.5
location = '/location/'
lastmod = datetime.now... | ajibawa-2023/Python-Code-Large/train/row_84734 | 15 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84734:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84734:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84734:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84734:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84734:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.contrib.sitemaps.tests.basic import *
| ajibawa-2023/Python-Code-Large/train/row_84735 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84735:ImportFrom_L1_C0", "label": "from django.contrib.sitemaps.tests.basic import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "django.contrib.sitemaps.tests.ba... | [] |
from django.core.management.base import BaseCommand
from django.contrib.sitemaps import ping_google
class Command(BaseCommand):
help = "Ping Google with an updated sitemap, pass optional url of sitemap"
def execute(self, *args, **options):
if len(args) == 1:
sitemap_url = args[0]
... | ajibawa-2023/Python-Code-Large/train/row_84736 | 9 | 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_84736:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 931, 0, 1, 0, 0, 931, 0, 0], "semantic": {"name": "django.core.management... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84736:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84736:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84736:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84736:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.utils.encoding import smart_str
from django.core.paginator import EmptyPage, PageNotAnInteger
def index(request, sitemaps):
curr... | ajibawa-2023/Python-Code-Large/train/row_84737 | 37 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84737:ImportFrom_L1_C0", "label": "from django.http import HttpResponse, Http404", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84737:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84737:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84737:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84737:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.sites.models import Site, get_current_site
from django.core import urlresolvers, paginator
from django.core.exceptions import ImproperlyConfigured
import urllib
PING_URL = "http://www.google.com/webmasters/tools/ping"
class SitemapNotFound(Exception):
pass
def ping_google(sitemap_url=None, pi... | ajibawa-2023/Python-Code-Large/train/row_84738 | 68 | 109 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84738:ImportFrom_L1_C0", "label": "from django.contrib.sites.models import Site, get_current_site", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0092, 0, 0.66, 0.0, 890, 0, 2, 0, 0, 890, 0, 0], "semantic": {"name": "django.cont... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84738:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84738:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84738:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84738:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.contrib.messages.storage.base import BaseStorage
from django.contrib.messages.storage.cookie import CookieStorage
from django.contrib.messages.storage.session import SessionStorage
class FallbackStorage(BaseStorage):
"""
Tries to store all messages in the first backend, storing any unstored
mes... | ajibawa-2023/Python-Code-Large/train/row_84739 | 30 | 54 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84739:ImportFrom_L1_C0", "label": "from django.contrib.messages.storage.base import BaseStorage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0185, 0, 0.66, 0.0, 63, 0, 1, 0, 0, 63, 0, 0], "semantic": {"name": "django.contrib.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84739:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84739:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84739:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84739:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
from django.contrib.messages.storage.base import BaseStorage
class SessionStorage(BaseStorage):
"""
Stores messages in the session (that is, django.contrib.sessions).
"""
session_key = '_messages'
def __init__(self, request, *args, **kwargs):
assert hasattr(request, 'session'), "The sessi... | ajibawa-2023/Python-Code-Large/train/row_84740 | 15 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84740:ImportFrom_L1_C0", "label": "from django.contrib.messages.storage.base import BaseStorage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 63, 0, 1, 0, 0, 63, 0, 0], "semantic": {"name": "django.contrib.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84740:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84740:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84740:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84740:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import hmac
from django.conf import settings
from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import CompatCookie
from django.utils import simplejson as json
from django.utils.hashcompat import sha_hmac
class MessageEncoder(json.JSON... | ajibawa-2023/Python-Code-Large/train/row_84741 | 85 | 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_84741:Import_L1_C0", "label": "hmac import hmac", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0066, 0, 0.66, 0.0, 993, 0, 1, 0, 0, 993, 0, 0], "semantic": {"name": "hmac", "arg_names": [], "import_names": ["hmac"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84741:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84741:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84741:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84741:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.conf import settings
from django.utils.encoding import force_unicode, StrAndUnicode
from django.contrib.messages import constants, utils
LEVEL_TAGS = utils.get_level_tags()
class Message(StrAndUnicode):
"""
Represents an actual message that can be stored in any of the supported
storage class... | ajibawa-2023/Python-Code-Large/train/row_84742 | 89 | 181 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84742:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0055, 0.0055, 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_84742:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84742:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84742:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84742:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
Storages used to assist in the deprecation of contrib.auth User messages.
"""
from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.contrib.auth.models import User
from django.contrib.messages.storage.fallback import FallbackStorage
class ... | ajibawa-2023/Python-Code-Large/train/row_84743 | 32 | 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_84743:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0391, 0.0625, 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_84743:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84743:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84743:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84743:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.contrib.messages.api import get_messages
def messages(request):
"""
Returns a lazy 'messages' context variable.
"""
return {'messages': get_messages(request)}
| ajibawa-2023/Python-Code-Large/train/row_84745 | 4 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84745:ImportFrom_L1_C0", "label": "from django.contrib.messages.api import get_messages", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 488, 0, 1, 0, 0, 488, 0, 0], "semantic": {"name": "django.contrib.messages... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84745:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84745:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84745:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84745:Return_L8_C4"}] |
# Models module required so tests are discovered.
| ajibawa-2023/Python-Code-Large/train/row_84746 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
from django.contrib.messages import constants
from django.contrib.messages.storage.fallback import FallbackStorage, \
CookieStorage
from django.contrib.messages.tests.base import BaseTest
from django.contrib.messages.tests.cookie import set_cookie_data, \
stored_cookie_messages_count
from django.contrib.message... | ajibawa-2023/Python-Code-Large/train/row_84747 | 101 | 175 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84747:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0057, 0.0057, 0, 0.66, 0.0, 698, 0, 1, 0, 0, 698, 0, 0], "semantic": {"name": "django.contrib.messages", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84747:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84747:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84747:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84747:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.contrib.messages.tests.base import BaseTest
from django.contrib.messages.storage.session import SessionStorage
def set_session_data(storage, messages):
"""
Sets the messages into the backend request's session and remove the
backend's loaded data cache.
"""
storage.request.session[stora... | ajibawa-2023/Python-Code-Large/train/row_84748 | 23 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84748:ImportFrom_L1_C0", "label": "from django.contrib.messages.tests.base import BaseTest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0263, 0, 0.66, 0.0, 377, 0, 1, 0, 0, 377, 0, 0], "semantic": {"name": "django.contrib.mes... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84748:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84748:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84748:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84748:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.contrib.messages import constants
from django.contrib.messages.tests.base import BaseTest
from django.contrib.messages.storage.cookie import CookieStorage, \
MessageEncoder, MessageDecoder
from django.contrib.messages.storage.base import Message
from django.utils ... | ajibawa-2023/Python-Code-Large/train/row_84749 | 57 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84749:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 698, 0, 1, 0, 0, 698, 0, 0], "semantic": {"name": "django.contrib.messages", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84749:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84749:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84749:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84749:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls.defaults import *
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext, Template
def add(request, message_type):
#... | ajibawa-2023/Python-Code-Large/train/row_84750 | 18 | 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_84750:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84750:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84750:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84750:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84750:For_L13_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
import unittest
from django import http
from django.contrib.messages.middleware import MessageMiddleware
class MiddlewareTest(unittest.TestCase):
def setUp(self):
self.middleware = MessageMiddleware()
def test_response_without_messages(self):
"""
Makes sure that the response middlewa... | ajibawa-2023/Python-Code-Large/train/row_84751 | 11 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84751:Import_L1_C0", "label": "unittest import unittest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84751:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84751:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84751:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84751:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django import http
from django.test import TestCase
from django.conf import settings
from django.utils.translation import ugettext_lazy
from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.storage import defau... | ajibawa-2023/Python-Code-Large/train/row_84752 | 250 | 405 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84752:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0025, 0.0025, 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_84752:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84752:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84752:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84752:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django import http
from django.contrib.auth.models import User
from django.contrib.messages.storage.user_messages import UserMessagesStorage,\
LegacyFallbackStorage
from django.contrib.messages.tests.cookie import set_cookie_data
from django.contrib.messages.tests.fallback import FallbackTest
from django.test ... | ajibawa-2023/Python-Code-Large/train/row_84753 | 45 | 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_84753:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0154, 0.0154, 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_84753:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84753:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84753:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84753:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-... |
from django.contrib.messages.tests.cookie import CookieTest
from django.contrib.messages.tests.fallback import FallbackTest
from django.contrib.messages.tests.middleware import MiddlewareTest
from django.contrib.messages.tests.session import SessionTest
from django.contrib.messages.tests.user_messages import \
... | ajibawa-2023/Python-Code-Large/train/row_84754 | 5 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84754:ImportFrom_L1_C0", "label": "from django.contrib.messages.tests.cookie import CookieTest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 410, 0, 1, 0, 0, 410, 0, 0], "semantic": {"name": "django.contrib... | [] |
DEBUG = 10
INFO = 20
SUCCESS = 25
WARNING = 30
ERROR = 40
DEFAULT_TAGS = {
DEBUG: 'debug',
INFO: 'info',
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'error',
}
| ajibawa-2023/Python-Code-Large/train/row_84755 | 6 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84755:Assign_L1_C0", "label": "DEBUG =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 309, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name"... | [] |
from django.conf import settings
from django.contrib.messages.storage import default_storage
class MessageMiddleware(object):
"""
Middleware that handles temporary messages.
"""
def process_request(self, request):
request._messages = default_storage(request)
def process_response(self, re... | ajibawa-2023/Python-Code-Large/train/row_84756 | 12 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84756:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84756:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84756:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84756:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.conf import settings
from django.contrib.messages import constants
def get_level_tags():
"""
Returns the message level tags.
"""
level_tags = constants.DEFAULT_TAGS.copy()
level_tags.update(getattr(settings, 'MESSAGE_TAGS', {}))
return level_tags
| ajibawa-2023/Python-Code-Large/train/row_84757 | 7 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84757:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84757:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84757:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84757:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84757:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from api import *
from constants import *
| ajibawa-2023/Python-Code-Large/train/row_84758 | 2 | 2 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84758:ImportFrom_L1_C0", "label": "from api import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "api", "arg_names": [], "import_names": ["*"], "rhs_call_name":... | [] |
from django.contrib.messages import constants
from django.contrib.messages.storage import default_storage
from django.utils.functional import lazy, memoize
__all__ = (
'add_message', 'get_messages',
'get_level', 'set_level',
'debug', 'info', 'success', 'warning', 'error',
)
class MessageFailure(Exception... | ajibawa-2023/Python-Code-Large/train/row_84759 | 49 | 114 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84759:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0088, 0.0088, 0, 0.66, 0.0, 698, 0, 1, 0, 0, 698, 0, 0], "semantic": {"name": "django.contrib.messages", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84759:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84759:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84759:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84759:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django import template
from django.conf import settings
from django.shortcuts import get_object_or_404, render_to_response
from django.contrib.auth.decorators import login_required, permission_required
from utils import next_redirect, confirmation_view
from django.contrib import comments
from django.contrib.commen... | ajibawa-2023/Python-Code-Large/train/row_84760 | 47 | 159 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84760:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["te... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84760:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84760:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84760:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84760:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
A few bits of helper functions for comment views.
"""
import urllib
import textwrap
from django.http import HttpResponseRedirect
from django.core import urlresolvers
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist
from... | ajibawa-2023/Python-Code-Large/train/row_84761 | 27 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84761:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0345, 0.0517, 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_84761:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84761:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84761:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84761:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django import http
from django.conf import settings
from utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.... | ajibawa-2023/Python-Code-Large/train/row_84762 | 58 | 135 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84762:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 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_84762:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84762:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84762:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84762:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import time
import datetime
from django import forms
from django.forms.util import ErrorDict
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from models import Comment
from django.utils.encoding import force_unicode
from django.utils.hashcompat import sha_constructor
from dj... | ajibawa-2023/Python-Code-Large/train/row_84763 | 97 | 190 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84763:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 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_84763:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84763:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84763:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84763:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import datetime
from django.contrib.auth.models import User
from django.contrib.comments.managers import CommentManager
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django.core im... | ajibawa-2023/Python-Code-Large/train/row_84764 | 103 | 191 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84764:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0052, 0.0052, 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_84764:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84764:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84764:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84764:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
A generic comment-moderation system which allows configuration of
moderation options on a per-model basis.
To use, do two things:
1. Create or import a subclass of ``CommentModerator`` defining the
options you want.
2. Import ``moderator`` from this module and register one or more
models, passing the model... | ajibawa-2023/Python-Code-Large/train/row_84765 | 95 | 353 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84765:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 55], "level": 0, "parent": null, "vector": [8, 0, 0.0793, 0.1558, 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_84765:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84765:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84765:ClassDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84765:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Signals relating to comments.
"""
from django.dispatch import Signal
# Sent just before a comment will be posted (after it's been approved and
# moderated; this can be used to modify the comment (in place) with posting
# details or other such actions. If any receiver returns False the comment will be
# discarded a... | ajibawa-2023/Python-Code-Large/train/row_84766 | 5 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84766:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0952, 0.1429, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
from django.utils.translation import ugettext as _
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def title(sel... | ajibawa-2023/Python-Code-Large/train/row_84767 | 28 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84767:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0263, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84767:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84767:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84767:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84767:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_unicode
class CommentManager(models.Manager):
def in_moderation(self):
"""
QuerySet for all comments currently in the moderation queue.
"""
return self.ge... | ajibawa-2023/Python-Code-Large/train/row_84768 | 14 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84768:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84768:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84768:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84768:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84768:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls.defaults import *
urlpatterns = patterns('django.contrib.comments.views',
url(r'^post/$', 'comments.post_comment', name='comments-post-comment'),
url(r'^posted/$', 'comments.comment_done', name='comments-comment-done'),
url(r'^flag/(\d+)/$', 'moderation.... | ajibawa-2023/Python-Code-Large/train/row_84769 | 2 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84769:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib import comments
from django.utils.encoding import smart_unicode
register = template.Library()
class BaseCommentNode(template.N... | ajibawa-2023/Python-Code-Large/train/row_84770 | 146 | 333 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84770:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.003, 0.003, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["temp... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84770:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84770:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84770:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84770:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib import admin
from django.contrib.comments.models import Comment
from django.utils.translation import ugettext_lazy as _, ungettext
from django.contrib.comments import get_model
from django.contrib.comments.views.moderation import perform_flag, perform_approve, perform_delete
class CommentsAdmin(adm... | ajibawa-2023/Python-Code-Large/train/row_84771 | 42 | 73 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84771:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0137, 0.0137, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84771:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84771:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84771:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84771:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django.conf import settings
from django.core import urlresolvers
from django.core.exceptions import ImproperlyConfigured
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
from django.utils.importlib import import_module
DEFAULT_COMMENTS_APP = 'django.contrib.... | ajibawa-2023/Python-Code-Large/train/row_84772 | 47 | 91 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84772:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.011, 0.011, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84772:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84772:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84772:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84772:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
Create a superuser from the command line. Deprecated; use manage.py
createsuperuser instead.
"""
if __name__ == "__main__":
from django.core.management import call_command
call_command("createsuperuser")
| ajibawa-2023/Python-Code-Large/train/row_84773 | 4 | 8 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84773:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.3125, 0.5, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84773:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84773:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84773:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84773:Expr_L8_C4"}] |
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site
from django.template import Context, loader
from django import forms
from django.utils.translation import ugett... | ajibawa-2023/Python-Code-Large/train/row_84774 | 132 | 214 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84774:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0047, 0.0047, 0, 0.66, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84774:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84774:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84774:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84774:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.core.context_processors import PermWrapper
from django.utils.functional import lazy, memoize, SimpleLazyObject
from django.contrib import messages
def auth(request):
"""
Returns context variables required by apps that use Django's authentication
system.
If there is no 'user' attribute in t... | ajibawa-2023/Python-Code-Large/train/row_84775 | 11 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84775:ImportFrom_L1_C0", "label": "from django.core.context_processors import PermWrapper", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 55, 0, 1, 0, 0, 55, 0, 0], "semantic": {"name": "django.core.context_p... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84775:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84775:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84775:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84775:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Co... |
from django.db import connection
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
supports_object_permissions = False
supports_anonymous_user = True
# TODO: Model, login attribute name and passwo... | ajibawa-2023/Python-Code-Large/train/row_84776 | 62 | 121 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84776:ImportFrom_L1_C0", "label": "from django.db import connection", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0083, 0.0083, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84776:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84776:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84776:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84776:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import datetime
import urllib
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.manager import EmptyManager
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import smart_str
from django.utils.h... | ajibawa-2023/Python-Code-Large/train/row_84777 | 276 | 474 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84777:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0021, 0.0021, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84777:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84777:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84777:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84777:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code... |
from mod_python import apache
import os
def authenhandler(req, **kwargs):
"""
Authentication handler that checks against Django's auth database.
"""
# mod_python fakes the environ, and thus doesn't process SetEnv. This fixes
# that so that the following import works
os.environ.update(req.subp... | ajibawa-2023/Python-Code-Large/train/row_84778 | 34 | 56 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84778:ImportFrom_L1_C0", "label": "from mod_python import apache", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0179, 0.0179, 0, 0.66, 0.0, 889, 0, 1, 0, 0, 889, 0, 0], "semantic": {"name": "mod_python", "arg_names": [], "import_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84778:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84778:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84778:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84778:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib... | ajibawa-2023/Python-Code-Large/train/row_84779 | 197 | 276 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84779:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 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_84779:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84779:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84779:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84779:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
from django.test import TestCase
class UserCreationFormTest(TestCase):
fixtures = ['authtestdata.json']
def test_use... | ajibawa-2023/Python-Code-Large/train/row_84780 | 127 | 252 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84780:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.004, 0.004, 0, 0.66, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "ar... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84780:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84780:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84780:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84780:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf import settings
from django.test import TestCase
from django.contrib.auth.models import User, SiteProfileNotAvailable
class ProfileTestCase(TestCase):
fixtures = ['authtestdata.json']
def setUp(self):
"""Backs up the AUTH_PROFILE_MODULE"""
self.old_AUTH_PROFILE_MODULE = getattr... | ajibawa-2023/Python-Code-Large/train/row_84781 | 21 | 35 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84781:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0286, 0.0286, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84781:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84781:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84781:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84781:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.test import TestCase
from django.contrib.auth.models import User, AnonymousUser
from django.core.management import call_command
from StringIO import StringIO
class BasicTestCase(TestCase):
def test_user(self):
"Check that users can be created and can set their password"
u = User.objects... | ajibawa-2023/Python-Code-Large/train/row_84782 | 61 | 92 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84782:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0109, 0.0109, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84782:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84782:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84782:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84782:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls.defaults import patterns
from django.contrib.auth.urls import urlpatterns
from django.http import HttpResponse
from django.template import Template, RequestContext
def remote_user_auth_view(request):
"Dummy view for remote user tests"
t = Template("Username is {{ user }}.")
c = Reques... | ajibawa-2023/Python-Code-Large/train/row_84783 | 10 | 18 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84783:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import patterns", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84783:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84783:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84783:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84783:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from datetime import datetime
from django.conf import settings
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.models import User
from django.test import TestCase
class RemoteUserTest(TestCase):
urls = 'django.contrib.auth.tests.urls'
middleware = 'django.contrib.auth.mid... | ajibawa-2023/Python-Code-Large/train/row_84784 | 100 | 170 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84784:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0059, 0.0059, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84784:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84784:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84784:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84784:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from unittest import TestCase
from django.contrib.auth.decorators import login_required
class LoginRequiredTestCase(TestCase):
"""
Tests the login_required decorators
"""
def testCallable(self):
"""
Check that login_required is assignable to callable objects.
"""
class... | ajibawa-2023/Python-Code-Large/train/row_84785 | 13 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84785:ImportFrom_L1_C0", "label": "from unittest import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.04, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["Test... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84785:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84785:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84785:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84785:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
class TokenGeneratorTest(TestCase):
def test_make_token(self):
"""
... | ajibawa-2023/Python-Code-Large/train/row_84786 | 40 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84786:ImportFrom_L1_C0", "label": "from datetime import date, timedelta", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0159, 0.0159, 0, 0.66, 0.0, 426, 0, 2, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84786:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84786:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84786:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84786:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Cod... |
import os
import re
import urllib
from django.conf import settings
from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import User
from django.test import Test... | ajibawa-2023/Python-Code-Large/train/row_84787 | 179 | 295 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84787:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0034, 0.0034, 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_84787:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84787:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84787:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84787:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest, NoBackendsTest
from django.contrib.auth.tests.basic import BasicTestCase
from django.contrib.auth.tests.decorators import LoginRequiredTestCase
from django.contrib.auth.tests.forms... | ajibawa-2023/Python-Code-Large/train/row_84788 | 8 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84788:ImportFrom_L1_C0", "label": "from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0833, 0, 0.66, 0.0, 769, 0, ... | [] |
# These URLs are normally mapped to /admin/urls.py. This URLs file is
# provided as a convenience to those who want to deploy these URLs elsewhere.
# This file is also used to provide a reliable view deployment for test purposes.
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^login/$', 'dj... | ajibawa-2023/Python-Code-Large/train/row_84789 | 2 | 17 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84789:ImportFrom_L5_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2941, 0.0588, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [] |
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
class LazyUser(object):
def __get__(self, request, obj_type=None):
if not hasattr(request, '_cached_user'):
from django.contrib.auth import get_user
request._cached_user = get_user(request)
... | ajibawa-2023/Python-Code-Large/train/row_84790 | 34 | 81 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84790:ImportFrom_L1_C0", "label": "from django.contrib import auth", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0123, 0.0123, 0, 0.66, 0.0, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84790:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84790:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84790:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_84790:If_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
try:
from functools import update_wrapper, wraps
except ImportError:
from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
from django.utils.decorators import available_attrs
from django... | ajibawa-2023/Python-Code-Large/train/row_84791 | 30 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84791:Try_L1_C0", "label": "try", "type": "try", "loc": [1, 4], "level": 0, "parent": null, "vector": [7, 0, 0.0481, 0.0769, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "sni... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84791:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84791:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84791:Try_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84791:ImportFrom_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.db import transaction
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AdminPasswordChangeForm
from django.contrib.auth.models import User, Group
from django.contrib import messages
from django.core.exceptions import Pe... | ajibawa-2023/Python-Code-Large/train/row_84792 | 81 | 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_84792:ImportFrom_L1_C0", "label": "from django.db import transaction", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0065, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84792:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84792:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84792:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84792:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Management utility to create superusers.
"""
import getpass
import re
import sys
from optparse import make_option
from django.contrib.auth.models import User
from django.core import exceptions
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
RE_V... | ajibawa-2023/Python-Code-Large/train/row_84793 | 72 | 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_84793:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0147, 0.0221, 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_84793:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84793:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84793:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84793:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
import getpass
class Command(BaseCommand):
help = "Change a user's password for django.contrib.auth."
requires_model_validation = False
def _get_pass(self, prompt="Password: "):
p = getpa... | ajibawa-2023/Python-Code-Large/train/row_84794 | 31 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84794:ImportFrom_L1_C0", "label": "from django.core.management.base import BaseCommand, CommandError", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 0, 0.66, 0.0, 931, 0, 2, 0, 0, 931, 0, 0], "semantic": {"name": "django.c... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84794:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84794:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84794:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84794:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
"""
Creates permissions for all installed apps that need permissions.
"""
from django.db.models import get_models, signals
from django.contrib.auth import models as auth_app
def _get_permission_codename(action, opts):
return u'%s_%s' % (action, opts.object_name.lower())
def _get_all_permissions(opts):
"Retur... | ajibawa-2023/Python-Code-Large/train/row_84795 | 36 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84795:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.06, 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_84795:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84795:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84795:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84795:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from datetime import date
from django.conf import settings
from django.utils.http import int_to_base36, base36_to_int
class PasswordResetTokenGenerator(object):
"""
Strategy object used to generate and check tokens for the password
reset mechanism.
"""
def make_token(self, user):
"""
... | ajibawa-2023/Python-Code-Large/train/row_84796 | 31 | 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_84796:ImportFrom_L1_C0", "label": "from datetime import date", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0152, 0.0152, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["da... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84796:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84796:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84796:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84796:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
import re
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
# Avoid shadowing the login() view below.
from django.contrib.auth import login as auth_login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.cont... | ajibawa-2023/Python-Code-Large/train/row_84797 | 111 | 188 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84797:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84797:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84797:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84797:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84797:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class Redirect(models.Model):
site = models.ForeignKey(Site)
old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,
help_text=_("This should be an ab... | ajibawa-2023/Python-Code-Large/train/row_84799 | 15 | 20 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_84799:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["mode... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_84799:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84799:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_84799:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_84799:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.