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 |
|---|---|---|---|---|---|---|---|
"""
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_86151 | 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_86151: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... | [] |
"""
Slovenian specific form helpers.
"""
from __future__ import absolute_import
import datetime
import re
from django.contrib.localflavor.si.si_postalcodes import SI_POSTALCODES_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import CharField,... | ajibawa-2023/Python-Code-Large/train/row_86152 | 76 | 165 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86152:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0121, 0.0182, 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_86152:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86152:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86152:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86152:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# *-* coding: utf-8 *-*
SI_POSTALCODES = [
(1000, u'Ljubljana'),
(1215, u'Medvode'),
(1216, u'Smlednik'),
(1217, u'Vodice'),
(1218, u'Komenda'),
(1219, u'Laze v Tuhinju'),
(1221, u'Motnik'),
(1222, u'Trojane'),
(1223, u'Blagovica'),
(1225, u'Lukovica'),
(1230, u'Dom\u017eale... | ajibawa-2023/Python-Code-Large/train/row_86153 | 2 | 469 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86153:Assign_L3_C0", "label": "SI_POSTALCODES =", "type": "assigned_variable", "loc": [3, 467], "level": 0, "parent": null, "vector": [14, 0, 0.5011, 0.9915, 0, 0.66, 0.0, 500, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "SI_POSTALCODES", "arg_names": [], "import_names":... | [] |
# -*- coding: utf-8 -*-
"""
Romanian specific form helpers.
"""
from __future__ import absolute_import
from django.contrib.localflavor.ro.ro_counties import COUNTIES_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError, Field, RegexField, Select
from django.utils.translation... | ajibawa-2023/Python-Code-Large/train/row_86154 | 111 | 205 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86154: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_86154:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86154:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86154:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86154:Assign_L19_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_86155 | 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_86155: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
"""
from __future__ import absolute_import
import re
from django.contrib.localflavor.pl.pl_administrativeunits import ADMINISTRATIVE_UNIT_CHOICES
from django.contrib.localflavor.pl.pl_voivodeships import VOIVODESHIP_CHOICES
from django.core.validators import EMPTY_VALUES
from django.... | ajibawa-2023/Python-Code-Large/train/row_86156 | 99 | 218 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86156:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0092, 0.0138, 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_86156:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86156:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86156:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86156:FunctionDef_L21_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_86157 | 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_86157: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_86158 | 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_86158: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... | [] |
"""
PY-specific Form helpers.
"""
from __future__ import absolute_import
from django.contrib.localflavor.py.py_department import DEPARTMENT_CHOICES, DEPARTMENT_ROMAN_CHOICES
from django.forms.fields import Select
class PyDepartmentSelect(Select):
"""
A Select widget with a list of Paraguayan departments as ... | ajibawa-2023/Python-Code-Large/train/row_86159 | 12 | 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_86159:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0833, 0.125, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86159:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86159:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86159:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86159:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
# http://www.statoids.com/upy.html
DEPARTMENT_CHOICES = (
('AG', u'Alto Paraguay'),
('AA', u'Alto Paraná'),
('AM', u'Amambay'),
('AS', u'Asunción'),
('BQ', u'Boquerón'),
('CG', u'Caaguazú'),
('CZ', u'Caazapá'),
('CY', u'Canindeyú'),
('CE', u'Central'),
(... | ajibawa-2023/Python-Code-Large/train/row_86160 | 2 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86160:Assign_L5_C0", "label": "DEPARTMENT_CHOICES =", "type": "assigned_variable", "loc": [5, 24], "level": 0, "parent": null, "vector": [14, 0, 0.3222, 0.4444, 0, 0.66, 0.0, 545, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "DEPARTMENT_CHOICES", "arg_names": [], "import_... | [] |
# -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
from __future__ import absolute_import
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.local... | ajibawa-2023/Python-Code-Large/train/row_86161 | 28 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86161:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0492, 0.0492, 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_86161:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86161:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86161:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86161:FunctionDef_L19_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_86162 | 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_86162: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_86163 | 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_86163: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_86163:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86163:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86163:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86163:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*-
"""
PE-specific Form helpers.
"""
from __future__ import absolute_import
from django.contrib.localflavor.pe.pe_region import REGION_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, CharField, Select
fro... | ajibawa-2023/Python-Code-Large/train/row_86164 | 37 | 75 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86164:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.04, 0.04, 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_86164:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86164:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86164:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86164:FunctionDef_L19_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_86165 | 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_86165: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 __future__ import absolute_import
import re
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.translatio... | ajibawa-2023/Python-Code-Large/train/row_86166 | 59 | 126 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86166:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0159, 0.0238, 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_86166:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86166:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86166:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86166:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Cod... |
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
from django.contrib.localflavor.us.us_states import USPS_CHOICES
class USStateField(CharField):
description = _("U.S. state (two uppercase letters... | ajibawa-2023/Python-Code-Large/train/row_86167 | 26 | 36 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86167:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0278, 0.0278, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86167:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86167:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86167:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86167:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
A mapping of state misspellings/abbreviations to normalized
abbreviations, and alphabetical lists of US states, territories,
military mail regions and non-US states to which the US provides
postal service.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
# The... | ajibawa-2023/Python-Code-Large/train/row_86168 | 10 | 326 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86168:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0153, 0.0276, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
ID-specific Form helpers
"""
from __future__ import absolute_import
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 impor... | ajibawa-2023/Python-Code-Large/train/row_86169 | 97 | 217 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86169:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0092, 0.0138, 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_86169:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86169:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86169:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86169:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import warnings
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.
warnings.warn(
'There have been... | ajibawa-2023/Python-Code-Large/train/row_86170 | 5 | 107 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86170:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0093, 0.0093, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [] |
"""
Canada-specific Form helpers
"""
from __future__ import absolute_import
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ... | ajibawa-2023/Python-Code-Large/train/row_86171 | 77 | 148 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86171:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0135, 0.0203, 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_86171:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86171:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86171:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86171:Assign_L28_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_86172 | 5 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86172:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0821, 0.1493, 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 __future__ import absolute_import
import re
from django.contrib.localflavor.ch.ch_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.e... | ajibawa-2023/Python-Code-Large/train/row_86173 | 68 | 122 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86173:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0164, 0.0246, 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_86173:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86173:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86173:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86173:FunctionDef_L25_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_86174 | 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_86174: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
"""
from __future__ import absolute_import
import re
import datetime
from django.contrib.localflavor.no.no_municipalities import MUNICIPALITY_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Reg... | ajibawa-2023/Python-Code-Large/train/row_86175 | 51 | 87 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86175:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.023, 0.0345, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86175:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86175:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86175:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86175:FunctionDef_L22_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_86176 | 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_86176: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... | [] |
"""
Colombian-specific form helpers.
"""
from __future__ import absolute_import
from django.contrib.localflavor.co.co_departments import DEPARTMENT_CHOICES
from django.forms.fields import Select
class CODepartmentSelect(Select):
"""
A Select widget that uses a list of Colombian states as its choices.
""... | ajibawa-2023/Python-Code-Large/train/row_86177 | 8 | 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_86177:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.125, 0.1875, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86177:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86177:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86177:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86177:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Colombian departaments as `choices` in a
formfield.
This exists in this standalone file so that it's only
imported into memory when explicitly needed.
"""
DEPARTMENT_CHOICES = (
('AMA', u'Amazonas'),
('ANT', u'Antioquia'),
('ARA', u'Arauca'),
('ATL', u'Atlántico')... | ajibawa-2023/Python-Code-Large/train/row_86178 | 2 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86178:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 8], "level": 0, "parent": null, "vector": [8, 0, 0.1136, 0.1591, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
TR-specific Form helpers
"""
from __future__ import absolute_import
import re
from django.contrib.localflavor.tr.tr_provinces import PROVINCE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from ... | ajibawa-2023/Python-Code-Large/train/row_86179 | 49 | 95 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86179:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0211, 0.0316, 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_86179:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86179:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86179:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86179:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
PROVINCE_CHOICES = (
('01', ('Adana')),
('02', ('Adıyaman')),
('03', ('Afyonkarahisar')),
('04', ('Ağrı')),
('68', ('Aksaray')),
('05', ('Amasya')),
('06', ('An... | ajibawa-2023/Python-Code-Large/train/row_86180 | 2 | 89 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86180:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0393, 0.0449, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
from __future__ import with_statement
import hashlib
import os
import posixpath
import re
from urllib import unquote
from urlparse import urlsplit, urlunsplit, urldefrag
from django.conf import settings
from django.core.cache import (get_cache, InvalidCacheBackendError,
cache as default_... | ajibawa-2023/Python-Code-Large/train/row_86181 | 158 | 281 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86181:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0036, 0.0036, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86181:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86181:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86181:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86181:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = []
def staticfiles_urlpatterns(prefix=None):
"""
Helper function to return a URL pattern for serving static files.
"""
if prefix is None:
prefix = settings.STATIC_URL
return static(prefix, view='djang... | ajibawa-2023/Python-Code-Large/train/row_86184 | 9 | 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_86184:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 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_86184:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86184:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86184:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86184:If_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from django import template
from django.contrib.staticfiles.storage import staticfiles_storage
register = template.Library()
@register.simple_tag
def static(path):
"""
A template tag that returns the URL to a file
using staticfiles' storage backend
"""
return staticfiles_storage.url(path)
| ajibawa-2023/Python-Code-Large/train/row_86185 | 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_86185:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 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_86185:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86185:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86185:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86185:Return_L13_C4"}] |
import os
import fnmatch
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def matches_patterns(path, patterns=None):
"""
Return True or False depending on whether the ``path`` should be
ignored (if it matches any pattern in ``ignore_patterns``).
"""
if patter... | ajibawa-2023/Python-Code-Large/train/row_86186 | 35 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86186:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 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_86186:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86186:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86186:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86186:If_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
import os
from optparse import make_option
from django.core.management.base import LabelCommand
from django.utils.encoding import smart_str, smart_unicode
from django.contrib.staticfiles import finders
class Command(LabelCommand):
help = "Finds the absolute paths for the given static file(s)."
args = "[file .... | ajibawa-2023/Python-Code-Large/train/row_86187 | 21 | 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_86187:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0323, 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_86187:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86187:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86187:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86187:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
from __future__ import with_statement
import os
import sys
from optparse import make_option
from django.core.files.storage import FileSystemStorage
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.encoding import smart_str, smart_unicode
from django.utils.datastructures import Sor... | ajibawa-2023/Python-Code-Large/train/row_86188 | 157 | 305 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86188:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0033, 0.0033, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86188:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86188:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86188:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86188:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from optparse import make_option
from django.conf import settings
from django.core.management.commands.runserver import BaseRunserverCommand
from django.contrib.staticfiles.handlers import StaticFilesHandler
class Command(BaseRunserverCommand):
option_list = BaseRunserverCommand.option_list + (
make_opti... | ajibawa-2023/Python-Code-Large/train/row_86189 | 15 | 29 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86189:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0345, 0, 0.66, 0.0, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86189:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86189:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86189:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86189:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/... |
"""
Views and functions for serving static files. These are only to be used during
development, and SHOULD NOT be used in a production setting.
"""
import os
import posixpath
import urllib
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from dja... | ajibawa-2023/Python-Code-Large/train/row_86190 | 18 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86190:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0732, 0.122, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotati... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86190:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86190:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86190:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86190:If_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django import forms
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext, ugettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$',
help_text = _("... | ajibawa-2023/Python-Code-Large/train/row_86191 | 23 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86191:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 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_86191:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86191:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86191:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86191:ClassDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
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_86192 | 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_86192: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_86192:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86192:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86192:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86192:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from django.template import Template, Context, TemplateSyntaxError
from django.test import TestCase
class FlatpageTemplateTagTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.te... | ajibawa-2023/Python-Code-Large/train/row_86193 | 56 | 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_86193:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0075, 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_86193:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86193:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86193:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86193:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from __future__ import with_statement
from django.conf import settings
from django.contrib.flatpages.forms import FlatpageForm
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import translation
class FlatpageAdminF... | ajibawa-2023/Python-Code-Large/train/row_86194 | 47 | 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_86194:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0122, 0.0122, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86194:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86194:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86194:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86194:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-... |
from django.conf.urls import patterns, include
# 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_86195 | 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_86195:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, include", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names... | [] |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
class FlatpageMiddlewareTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self)... | ajibawa-2023/Python-Code-Large/train/row_86196 | 110 | 165 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86196:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0061, 0.0061, 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_86196:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86196:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86196:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86196:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
from django.conf import settings
from django.contrib.auth.models import User
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=... | ajibawa-2023/Python-Code-Large/train/row_86197 | 61 | 79 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86197:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0127, 0.0127, 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_86197:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86197:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86197:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86197:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
class FlatpageViewTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
... | ajibawa-2023/Python-Code-Large/train/row_86198 | 95 | 137 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86198:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0073, 0.0073, 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_86198:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86198:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86198:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86198:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.contrib.flatpages.tests.csrf import *
from django.contrib.flatpages.tests.forms import *
from django.contrib.flatpages.tests.middleware import *
from django.contrib.flatpages.tests.templatetags import *
from django.contrib.flatpages.tests.views import *
| ajibawa-2023/Python-Code-Large/train/row_86199 | 5 | 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_86199:ImportFrom_L1_C0", "label": "from django.contrib.flatpages.tests.csrf import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 500, 0, 1, 0, 0, 500, 0, 0], "semantic": {"name": "django.contrib.flatpages.tests... | [] |
from django.conf.urls import patterns
urlpatterns = patterns('django.contrib.flatpages.views',
(r'^(?P<url>.*)$', 'flatpage'),
)
| ajibawa-2023/Python-Code-Large/train/row_86200 | 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_86200:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 528, 0, 1, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names": [], "impor... | [] |
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_86201 | 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_86201: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_86201:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86201:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86201:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86201:If_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django import template
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
register = template.Library()
class FlatpageNode(template.Node):
def __init__(self, context_name, starts_with=None, user=None):
self.context_name = context_name
if starts_with:
... | ajibawa-2023/Python-Code-Large/train/row_86202 | 39 | 97 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86202:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0103, 0.0103, 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_86202:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86202:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86202:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86202:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext_lazy as _
from django.contrib.flatpages.forms import FlatpageForm
class FlatPageAdmin(admin.ModelAdmin):
form = FlatpageForm
fieldsets = (
(None, {'fields': ('url', 'title... | ajibawa-2023/Python-Code-Large/train/row_86203 | 11 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86203:ImportFrom_L1_C0", "label": "from django.contrib import admin", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 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_86203:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86203:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86203:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86203:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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 Http404, HttpResponse, HttpResponsePermanentRedirect
from django.conf import settings
from django.core.xheaders import populate_xheaders
from dja... | ajibawa-2023/Python-Code-Large/train/row_86204 | 33 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86204:ImportFrom_L1_C0", "label": "from django.contrib.flatpages.models import FlatPage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0139, 0.0139, 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_86204:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86204:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86204:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86204:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# This file intentionally left blank | ajibawa-2023/Python-Code-Large/train/row_86205 | 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, GenericSitemap
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.utils.unittest import skipUnless
from django... | ajibawa-2023/Python-Code-Large/train/row_86206 | 63 | 127 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86206:ImportFrom_L1_C0", "label": "from datetime import date", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0079, 0.0079, 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_86206:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86206:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86206:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86206:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Co... |
from datetime import date
from django.test.utils import override_settings
from .base import SitemapTestsBase
class HTTPSSitemapTests(SitemapTestsBase):
protocol = 'https'
urls = 'django.contrib.sitemaps.tests.urls.https'
def test_secure_sitemap_index(self):
"A secure sitemap index can be rendere... | ajibawa-2023/Python-Code-Large/train/row_86207 | 25 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86207:ImportFrom_L1_C0", "label": "from datetime import date", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 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_86207:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86207:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86207:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86207:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.contrib.auth.models import User
from .base import SitemapTestsBase
class GenericViewsSitemapTests(SitemapTestsBase):
def test_generic_sitemap(self):
"A minimal generic sitemap can be rendered"
response = self.client.get('/generic/sitemap.xml')
expected = ''
for usernam... | ajibawa-2023/Python-Code-Large/train/row_86208 | 9 | 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_86208:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 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_86208:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86208:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86208:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86208:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from datetime import datetime
from django.conf.urls import patterns, url
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap, views
from django.contrib.auth.models import User
from django.views.decorators.cache import cache_page
class SimpleSitemap(Sitemap):
changefreq = "never"
priori... | ajibawa-2023/Python-Code-Large/train/row_86209 | 16 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86209:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 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_86209:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86209:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86209:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86209:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.conf.urls import patterns
from .http import SimpleSitemap
class HTTPSSitemap(SimpleSitemap):
protocol = 'https'
secure_sitemaps = {
'simple': HTTPSSitemap,
}
urlpatterns = patterns('django.contrib.sitemaps.views',
(r'^secure/index\.xml$', 'index', {'sitemaps': secure_sitemaps}),
(r'^secu... | ajibawa-2023/Python-Code-Large/train/row_86210 | 6 | 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_86210:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 528, 0, 1, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names": [], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86210:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86210:Assign_L6_C4"}] |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.test import TestCase
class SitemapTestsBase(TestCase):
protocol = 'http'
domain = 'example.com' if Site._meta.installed else 'testserver'
urls = 'django.contrib.... | ajibawa-2023/Python-Code-Large/train/row_86211 | 20 | 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_86211:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 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_86211:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86211:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86211:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86211:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from .flatpages import FlatpagesSitemapTests
from .generic import GenericViewsSitemapTests
from .http import HTTPSitemapTests
from .https import HTTPSSitemapTests, HTTPSDetectionSitemapTests
| ajibawa-2023/Python-Code-Large/train/row_86212 | 4 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86212:ImportFrom_L1_C0", "label": "from flatpages import FlatpagesSitemapTests", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 564, 0, 1, 0, 0, 564, 0, 0], "semantic": {"name": "flatpages", "arg_names": [], "impo... | [] |
from django.conf import settings
from django.utils.unittest import skipUnless
from .base import SitemapTestsBase
class FlatpagesSitemapTests(SitemapTestsBase):
@skipUnless("django.contrib.flatpages" in settings.INSTALLED_APPS,
"django.contrib.flatpages app not installed.")
def test_flatpage_s... | ajibawa-2023/Python-Code-Large/train/row_86213 | 14 | 37 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86213:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.027, 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_86213:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86213:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86213:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86213:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
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_86214 | 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_86214: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_86214:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86214:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86214:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86214:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.http import Http404
from django.template.response import TemplateResponse
def index(request, sitemaps,
template_name='sitemap_index.xml', mim... | ajibawa-2023/Python-Code-Large/train/row_86215 | 34 | 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_86215:ImportFrom_L1_C0", "label": "from django.contrib.sites.models import get_current_site", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0189, 0.0189, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "django.contrib.si... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86215:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86215:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86215:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86215:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib.sites.models import 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, ping_url=PING_URL):
... | ajibawa-2023/Python-Code-Large/train/row_86216 | 72 | 120 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86216:ImportFrom_L1_C0", "label": "from django.contrib.sites.models import Site", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0083, 0.0083, 0, 0.66, 0.0, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "django.contrib.sites.models",... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86216:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86216:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86216:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86216: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_86217 | 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_86217: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_86217:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86217:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86217:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86217: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_86218 | 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_86218: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_86218:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86218:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86218:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86218:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils import simplejson as json
from django.utils.crypto import salted_hmac, constant_time_compare
class MessageEncoder(json.JSONEncoder):
"""
Compactly seria... | ajibawa-2023/Python-Code-Large/train/row_86219 | 83 | 151 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86219:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0066, 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_86219:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86219:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86219:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86219:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
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_86220 | 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_86220: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_86220:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86220:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86220:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86220:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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_86222 | 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_86222: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_86222:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86222:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86222:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86222:Return_L8_C4"}] |
# Models module required so tests are discovered.
| ajibawa-2023/Python-Code-Large/train/row_86223 | 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_86224 | 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_86224: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_86224:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86224:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86224:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86224: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_86225 | 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_86225: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_86225:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86225:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86225:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86225: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.test.utils import override_settings
from djang... | ajibawa-2023/Python-Code-Large/train/row_86226 | 76 | 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_86226:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 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_86226:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86226:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86226:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86226:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django.conf.urls import patterns
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext, Template
from django.template.response import TemplateResponse
from django.views.decorators.cache ... | ajibawa-2023/Python-Code-Large/train/row_86227 | 27 | 57 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86227:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 528, 0, 1, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names": [], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86227:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86227:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86227:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86227:For_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django import http
from django.contrib.messages.middleware import MessageMiddleware
from django.utils import unittest
class MiddlewareTest(unittest.TestCase):
def setUp(self):
self.middleware = MessageMiddleware()
def test_response_without_messages(self):
"""
Makes sure that the... | ajibawa-2023/Python-Code-Large/train/row_86228 | 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_86228:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 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_86228:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86228:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86228:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86228:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django import http
from django.conf import settings
from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.storage import default_storage, base
from django.contrib.messages.storage.base import Message
from djang... | ajibawa-2023/Python-Code-Large/train/row_86229 | 207 | 368 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86229:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0027, 0.0027, 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_86229:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86229:Return_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86229:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86229:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code... |
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
| ajibawa-2023/Python-Code-Large/train/row_86230 | 4 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86230: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.25, 0.25, 0, 0.66, 0.0, 410, 0, 1, 0, 0, 410, 0, 0], "semantic": {"name": "django.contrib.mes... | [] |
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_86231 | 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_86231: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_86232 | 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_86232: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_86232:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86232:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86232:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86232: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_86233 | 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_86233: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_86233:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86233:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86233:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86233:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import absolute_import
from django.contrib.messages.api import *
from django.contrib.messages.constants import *
| ajibawa-2023/Python-Code-Large/train/row_86234 | 3 | 4 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86234:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.25, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "import_n... | [] |
from django.contrib.messages import constants
from django.contrib.messages.storage import default_storage
__all__ = (
'add_message', 'get_messages',
'get_level', 'set_level',
'debug', 'info', 'success', 'warning', 'error',
)
class MessageFailure(Exception):
pass
def add_message(request, level, mess... | ajibawa-2023/Python-Code-Large/train/row_86235 | 41 | 102 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86235:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0098, 0.0098, 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_86235:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86235:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86235:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86235:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from __future__ import absolute_import
from django import template
from django.conf import settings
from django.contrib import comments
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirec... | ajibawa-2023/Python-Code-Large/train/row_86236 | 48 | 162 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86236:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0062, 0.0062, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86236:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86236:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86236:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86236:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
A few bits of helper functions for comment views.
"""
import urllib
import textwrap
from django.core import urlresolvers
from django.http import HttpResponseRedirect
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_86237 | 33 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86237:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0299, 0.0448, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86237:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86237:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86237:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86237:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code... |
from __future__ import absolute_import
from django import http
from django.conf import settings
from django.contrib import comments
from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist, Validat... | ajibawa-2023/Python-Code-Large/train/row_86238 | 58 | 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_86238:ImportFrom_L1_C0", "label": "from __future__ import absolute_import", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impo... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86238:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86238:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86238:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86238:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import time
from django import forms
from django.forms.util import ErrorDict
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.comments.models import Comment
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.encoding import... | ajibawa-2023/Python-Code-Large/train/row_86239 | 98 | 194 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86239:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0052, 0.0052, 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_86239:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86239:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86239:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86239:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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 import urlresolver... | ajibawa-2023/Python-Code-Large/train/row_86240 | 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_86240:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0052, 0.0052, 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_86240:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86240:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86240:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86240: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_86241 | 98 | 356 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86241:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 55], "level": 0, "parent": null, "vector": [8, 0, 0.0787, 0.1545, 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_86241:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86241:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86241:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86241:Expr_L77_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_86242 | 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_86242: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_86243 | 24 | 34 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86243:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0294, 0.0294, 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_86243:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86243:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86243:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86243: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_86244 | 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_86244: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_86244:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86244:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86244:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86244:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls import patterns, url
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+)/$', 'moderati... | ajibawa-2023/Python-Code-Large/train/row_86245 | 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_86245:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 528, 0, 2, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names":... | [] |
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_86246 | 142 | 332 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86246: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_86246:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86246:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86246:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86246: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_86247 | 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_86247: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_86247:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86247:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86247:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86247: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_86248 | 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_86248: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_86248:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86248:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86248:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86248: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_86249 | 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_86249: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_86249:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86249:ImportFrom_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86249:If_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86249:Expr_L8_C4"}] |
from django import forms
from django.forms.util import flatatt
from django.template import loader
from django.utils.encoding import smart_str
from django.utils.http import int_to_base36
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext, ugettext_lazy as _
from django.contrib.a... | ajibawa-2023/Python-Code-Large/train/row_86250 | 172 | 335 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86250:ImportFrom_L1_C0", "label": "from django import forms", "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": ["forms"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86250:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86250:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86250:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86250:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-... |
# PermWrapper and PermLookupDict proxy the permissions system into objects that
# the template system can understand.
class PermLookupDict(object):
def __init__(self, user, module_name):
self.user, self.module_name = user, module_name
def __repr__(self):
return str(self.user.get_all_permission... | ajibawa-2023/Python-Code-Large/train/row_86251 | 23 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86251:ClassDef_L4_C0", "label": "PermLookupDict", "type": "class", "loc": [4, 20], "level": 0, "parent": null, "vector": [3, 0, 0.2353, 0.3333, 0, 0.66, 0.0, 495, 0, 5, 0, 0, 186, 0, 5], "semantic": {"name": "PermLookupDict", "arg_names": [], "import_names": [], "rhs_ca... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86251:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86251:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86251:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_86251:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
supports_inactive_user = True
# TODO: Model, login attribute name and password attribute name should be
# configurable.
def authenticate(self,... | ajibawa-2023/Python-Code-Large/train/row_86252 | 66 | 125 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86252:ImportFrom_L1_C0", "label": "from django.contrib.auth.models import User, Permission", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.008, 0.008, 0, 0.66, 0.0, 808, 0, 2, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86252:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86252:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86252:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86252:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
import urllib
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import send_mail
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.crypto import get_random_string
from django.utils.encoding import smart_str
from django.utils.translation import ... | ajibawa-2023/Python-Code-Large/train/row_86253 | 247 | 476 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_86253:Import_L1_C0", "label": "urllib import urllib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0021, 0.0021, 0, 0.66, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_86253:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86253:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_86253:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_86253:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.