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 |
|---|---|---|---|---|---|---|---|
"""
Slovak-specific form helpers
"""
from django.forms.fields import Select, RegexField
from django.utils.translation import ugettext_lazy as _
class SKRegionSelect(Select):
"""
A select widget widget with list of Slovak regions as choices.
"""
def __init__(self, attrs=None):
from ... | ajibawa-2023/Python-Code-Large/train/row_98486 | 22 | 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_98486:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0465, 0.0698, 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_98486:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98486:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98486:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98486:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Slovak districts according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
DISTRICT_CHOICES = (
('BB', _('Banska Bystrica')),
('BS', _('Banska Stiavnica')),
('BJ', _('Bardejov')),
('BN', _('Banovce n... | ajibawa-2023/Python-Code-Large/train/row_98487 | 3 | 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_98487: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... | [] |
"""
Slovak regions according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska
"""
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('BB', _('Banska Bystrica region')),
('BA', _('Bratislava region')),
('KE', _('Kosice region')),
('NR', _('... | ajibawa-2023/Python-Code-Large/train/row_98488 | 3 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98488: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... | [] |
"""
Mexican-specific form helpers.
"""
from django.forms.fields import Select
class MXStateSelect(Select):
"""
A Select widget that uses a list of Mexican states as its choices.
"""
def __init__(self, attrs=None):
from mx_states import STATE_CHOICES
super(MXStateSelect, sel... | ajibawa-2023/Python-Code-Large/train/row_98489 | 7 | 14 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98489:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2143, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98489:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98489:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98489:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98489:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*-
"""
A list of Mexican states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('AGU', _(u'Aguascalientes')),
... | ajibawa-2023/Python-Code-Large/train/row_98490 | 3 | 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_98490:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1, 0.1333, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [] |
# -*- coding: utf-8 -*-
"""
Spanish-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
import re
class ESPostalCodeField(RegexField):
... | ajibawa-2023/Python-Code-Large/train/row_98491 | 76 | 185 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98491:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0162, 0.0162, 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_98491:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98491:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98491:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98491:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
REGION_CHOICES = (
('AN', _('Andalusia')),
('AR', _('Aragon')),
('O', _('Principality of Asturias')),
('IB', _('Balearic Islands')),
('PV', _('Basque Country')),
('CN', _('Canary Islands')),
('S', _('C... | ajibawa-2023/Python-Code-Large/train/row_98492 | 2 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98492:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0435, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_name... | [] |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
PROVINCE_CHOICES = (
('01', _('Arava')),
('02', _('Albacete')),
('03', _('Alacant')),
('04', _('Almeria')),
('05', _('Avila')),
('06', _('Badajoz')),
('07', _('Illes Balears')),
('08', _('Barcelon... | ajibawa-2023/Python-Code-Large/train/row_98493 | 2 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98493:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0172, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Israeli-specific form helpers
"""
import re
from django.core.exceptions import ValidationError
from django.forms.fields import RegexField, Field, EMPTY_VALUES
from django.utils.checksums import luhn
from django.utils.translation import ugettext_lazy as _
# Israeli ID numbers consist of up to 8 digits fo... | ajibawa-2023/Python-Code-Large/train/row_98494 | 28 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98494:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0308, 0.0462, 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_98494:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98494:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98494:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98494:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
FR-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_... | ajibawa-2023/Python-Code-Large/train/row_98495 | 28 | 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_98495:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0392, 0.0588, 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_98495:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98495:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98495:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98495:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
DEPARTMENT_ASCII_CHOICES = (
('01', '01 - Ain'),
('02', '02 - Aisne'),
('03', '03 - Allier'),
('04', '04 - Alpes-de-Haute-Provence'),
('05', '05 - Hautes-Alpes'),
('06', '06 - Alpes-Maritimes'),
('07', '07 - Ardeche'),
('08', '08 - Ardennes'),
('09... | ajibawa-2023/Python-Code-Large/train/row_98496 | 1 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98496:Assign_L3_C0", "label": "DEPARTMENT_ASCII_CHOICES =", "type": "assigned_variable", "loc": [3, 110], "level": 0, "parent": null, "vector": [14, 0, 0.5136, 0.9818, 0, 0.66, 0.0, 807, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "DEPARTMENT_ASCII_CHOICES", "arg_names":... | [] |
"""
South Africa-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.checksums import luhn
from django.utils.translation import gettext as _
import re
from datetime import date
... | ajibawa-2023/Python-Code-Large/train/row_98497 | 28 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98497:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0333, 0.05, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98497:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98497:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98497:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98497:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import gettext_lazy as _
PROVINCE_CHOICES = (
('EC', _('Eastern Cape')),
('FS', _('Free State')),
('GP', _('Gauteng')),
('KN', _('KwaZulu-Natal')),
('LP', _('Limpopo')),
('MP', _('Mpumalanga')),
('NC', _('Northern Cape')),
('NW', _('North West')),... | ajibawa-2023/Python-Code-Large/train/row_98498 | 2 | 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_98498:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Belgium-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
class BEPostalCodeField(RegexField):
"""
A form field ... | ajibawa-2023/Python-Code-Large/train/row_98499 | 26 | 71 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98499:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0282, 0.0423, 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_98499:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98499:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98499:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98499:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.utils.translation import ugettext_lazy as _
# ISO codes
PROVINCE_CHOICES = (
('VAN', _('Antwerp')),
('BRU', _('Brussels')),
('VOV', _('East Flanders')),
('VBR', _('Flemish Brabant')),
('WHT', _('Hainaut')),
('WLG', _('Liege')),
('VLI', _('Limburg')),
('WLX', _('Lu... | ajibawa-2023/Python-Code-Large/train/row_98500 | 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_98500:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
from django.utils.translation import ugettext_lazy as _
# ISO codes
REGION_CHOICES = (
('BRU', _('Brussels Capital Region')),
('VLG', _('Flemish Region')),
('WAL', _('Wallonia'))
)
| ajibawa-2023/Python-Code-Large/train/row_98501 | 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_98501:ImportFrom_L1_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names... | [] |
"""
UK-specific Form helpers
"""
import re
from django.forms.fields import CharField, Select
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
class UKPostcodeField(CharField):
"""
A form field that validates its input is a UK postcode.
The re... | ajibawa-2023/Python-Code-Large/train/row_98502 | 30 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98502:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0377, 0.0566, 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_98502:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98502:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98502:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98502:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
Sources:
English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls
Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area
Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales
Scottish regions: ht... | ajibawa-2023/Python-Code-Large/train/row_98503 | 8 | 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_98503:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0412, 0.0722, 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 -*-
"""
An alphabetical list of Finnish municipalities for use as `choices` in a
formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
MUNICIPALITY_CHOICES = (
('akaa', u"Akaa"),
('alajarvi', u"Alajärvi"),
('alavie... | ajibawa-2023/Python-Code-Large/train/row_98504 | 2 | 353 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98504:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0142, 0.0198, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
FI-specific Form helpers
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class FIZipCodeField(RegexField):
default_error_messages ... | ajibawa-2023/Python-Code-Large/train/row_98505 | 28 | 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_98505:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0392, 0.0588, 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_98505:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98505:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98505:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98505:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Cod... |
"""
Kuwait-specific Form helpers
"""
import re
from datetime import date
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.translation import gettext as _
id_re = re.compile(r'^(?P<initial>\d{1})(?P<y... | ajibawa-2023/Python-Code-Large/train/row_98506 | 32 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98506:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0317, 0.0476, 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_98506:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98506:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98506:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98506:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django import forms
DEFAULT_DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y', ... | ajibawa-2023/Python-Code-Large/train/row_98507 | 18 | 48 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98507:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0208, 0.0208, 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_98507:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98507:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98507:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98507:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-... |
"""
UK-specific Form helpers
"""
from django.forms.fields import Select
class IECountySelect(Select):
"""
A Select widget that uses a list of Irish Counties as its choices.
"""
def __init__(self, attrs=None):
from ie_counties import IE_COUNTY_CHOICES
super(IECountySelect, s... | ajibawa-2023/Python-Code-Large/train/row_98508 | 7 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98508:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.1538, 0.2308, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98508:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98508:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98508:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98508:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""
Sources:
Irish Counties: http://en.wikipedia.org/wiki/Counties_of_Ireland
"""
from django.utils.translation import ugettext_lazy as _
IE_COUNTY_CHOICES = (
('antrim', _('Antrim')),
('armagh', _('Armagh')),
('carlow', _('Carlow')),
('cavan', _('Cavan')),
('clare', _('Clare')),... | ajibawa-2023/Python-Code-Large/train/row_98509 | 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_98509:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0625, 0.1, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [] |
# -*- coding: utf-8 -*-
"""
Romanian specific form helpers.
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError, Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class ROCIFField(RegexField):
"""
A Romanian fisca... | ajibawa-2023/Python-Code-Large/train/row_98510 | 106 | 200 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98510:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.015, 0.015, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98510:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98510:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98510:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98510:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# -*- coding: utf-8 -*-
"""
A list of Romanian counties as `choices` in a formfield.
This exists as a standalone file so that it's only imported into memory when
explicitly needed.
"""
COUNTIES_CHOICES = (
('AB', u'Alba'),
('AR', u'Arad'),
('AG', u'Argeş'),
('BC', u'Bacău'),
('BH', u'... | ajibawa-2023/Python-Code-Large/train/row_98511 | 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_98511:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0865, 0.1154, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
Polish-specific form helpers
"""
import re
from django.forms import ValidationError
from django.forms.fields import Select, RegexField
from django.utils.translation import ugettext_lazy as _
class PLProvinceSelect(Select):
"""
A select widget with list of Polish administrative provinces as ch... | ajibawa-2023/Python-Code-Large/train/row_98512 | 71 | 153 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98512:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0131, 0.0196, 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_98512:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98512:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98512:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98512:FunctionDef_L15_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... | ajibawa-2023/Python-Code-Large/train/row_98513 | 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_98513: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'),
('d... | ajibawa-2023/Python-Code-Large/train/row_98514 | 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_98514:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0078, 0.0078, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
# -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.localflavor.uy.util impor... | ajibawa-2023/Python-Code-Large/train/row_98515 | 28 | 60 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98515:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.05, 0.05, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98515:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98515:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98515:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98515:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""A list of Urguayan departaments as `choices` in a formfield."""
DEPARTAMENT_CHOICES = (
('G', u'Artigas'),
('A', u'Canelones'),
('E', u'Cerro Largo'),
('L', u'Colonia'),
('Q', u'Durazno'),
('N', u'Flores'),
('O', u'Florida'),
('P', u'Lavalleja'),
... | ajibawa-2023/Python-Code-Large/train/row_98516 | 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_98516: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) %... | ajibawa-2023/Python-Code-Large/train/row_98517 | 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_98517: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_98517:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98517:Expr_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98517:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98517:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# -*- coding: utf-8 -*-
"""
PE-specific Form helpers.
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, CharField, Select
from django.utils.translation import ugettext_lazy as _
class PERegionSelect(Select):
"""
... | ajibawa-2023/Python-Code-Large/train/row_98518 | 36 | 72 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98518:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98518:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98518:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98518:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98518:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: utf-8 -*-
"""
A list of Peru regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
REGION_CHOICES = (
('AMA', u'Amazonas'),
('ANC', u'Ancash'),
('APU', u'Apurímac'),
('ARE', u'Arequipa'),
... | ajibawa-2023/Python-Code-Large/train/row_98519 | 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_98519:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1286, 0.1714, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
USA-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
p... | ajibawa-2023/Python-Code-Large/train/row_98520 | 53 | 113 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98520:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0177, 0.0265, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98520:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98520:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98520:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98520:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from django.contrib.localflavor.us.us_states import STATE_CHOICES
class USStateField(CharField):
description = _("U.S. state (two uppercase letters)")
def __init__(s... | ajibawa-2023/Python-Code-Large/train/row_98521 | 20 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98521:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98521:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98521:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98521:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98521:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""
A mapping of state misspellings/abbreviations to normalized abbreviations, and
an alphabetical list of states for use as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
STATE_CHOICES = (
('AL', 'Alabama'),
('AK', 'A... | ajibawa-2023/Python-Code-Large/train/row_98522 | 3 | 234 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98522:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0171, 0.0299, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [] |
"""
ID-specific Form helpers
"""
import re
import time
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
postcode_r... | ajibawa-2023/Python-Code-Large/train/row_98523 | 96 | 211 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98523:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0095, 0.0142, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98523:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98523:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98523:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98523:Assign_L27_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 ... | ajibawa-2023/Python-Code-Large/train/row_98524 | 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_98524: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 django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_dig... | ajibawa-2023/Python-Code-Large/train/row_98525 | 69 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98525:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0149, 0.0224, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98525:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98525:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98525:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98525:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
"""
An alphabetical list of provinces and territories for use as `choices`
in a formfield., and a mapping of province misspellings/abbreviations to
normalized abbreviations
Source: http://www.canada.gc.ca/othergov/prov_e.html
This exists in this standalone file so that it's only imported into memory
when... | ajibawa-2023/Python-Code-Large/train/row_98526 | 3 | 59 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98526:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0932, 0.1695, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [] |
"""
Swiss-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
id_re = re... | ajibawa-2023/Python-Code-Large/train/row_98527 | 67 | 119 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98527:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0168, 0.0252, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98527:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98527:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98527:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98527:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*
from django.utils.translation import ugettext_lazy as _
STATE_CHOICES = (
('AG', _('Aargau')),
('AI', _('Appenzell Innerrhoden')),
('AR', _('Appenzell Ausserrhoden')),
('BS', _('Basel-Stadt')),
('BL', _('Basel-Land')),
('BE', _('Berne')),
('FR', _('Fribourg'... | ajibawa-2023/Python-Code-Large/train/row_98528 | 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_98528:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0323, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_nam... | [] |
"""
Norwegian-specific Form helpers
"""
import re, datetime
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class NOZipCodeField(RegexField):
defaul... | ajibawa-2023/Python-Code-Large/train/row_98529 | 49 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98529:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0244, 0.0366, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98529:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98529:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98529:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98529:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Norwegian municipalities (fylker) fro use as `choices`
in a formfield.
This exists in this standalone file so that it's on ly imported into memory
when explicitly needed.
"""
MUNICIPALITY_CHOICES = (
('akershus', u'Akershus'),
('austagder', u'Aust... | ajibawa-2023/Python-Code-Large/train/row_98530 | 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_98530: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... | [] |
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import FileSystemStorage
from django.utils.importlib import import_module
from django.contrib.staticfiles import utils
class StaticFilesStorage(FileSystemStorage):
"""
... | ajibawa-2023/Python-Code-Large/train/row_98531 | 48 | 86 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98531:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0116, 0.0116, 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_98531:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98531:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98531:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98531:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.conf import settings
def staticfiles(request):
return {
'STATICFILES_URL': settings.STATICFILES_URL,
}
| ajibawa-2023/Python-Code-Large/train/row_98533 | 3 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98533:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 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_98533:FunctionDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98533:Return_L4_C4"}] |
import re
from django.conf import settings
from django.conf.urls.defaults import patterns, url, include
from django.core.exceptions import ImproperlyConfigured
urlpatterns = []
# only serve non-fqdn URLs
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^(?P<path>.*)$', 'django.contrib.static... | ajibawa-2023/Python-Code-Large/train/row_98535 | 17 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98535:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98535:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98535:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98535:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98535:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django import template
from django.utils.encoding import iri_to_uri
register = template.Library()
class StaticFilesPrefixNode(template.Node):
def __init__(self, varname=None):
self.varname = varname
def render(self, context):
try:
from django.conf import settings... | ajibawa-2023/Python-Code-Large/train/row_98536 | 20 | 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_98536:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 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_98536:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98536:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98536:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98536:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code... |
import fnmatch
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def get_files(storage, ignore_patterns=[], location=''):
"""
Recursively walk the storage directories gathering a complete list of files
that should be copied, returning this list.
"""
... | ajibawa-2023/Python-Code-Large/train/row_98537 | 23 | 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_98537:Import_L1_C0", "label": "fnmatch import fnmatch", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0222, 0.0222, 0, 0.66, 0.0, 626, 0, 1, 0, 0, 626, 0, 0], "semantic": {"name": "fnmatch", "arg_names": [], "import_names": ["fnmatch"],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98537:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98537:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98537:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98537:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Co... |
import os
from optparse import make_option
from django.core.management.base import LabelCommand
from django.contrib.staticfiles import finders
class Command(LabelCommand):
help = "Finds the absolute paths for the given static file(s)."
args = "[file ...]"
label = 'static file'
option_list = ... | ajibawa-2023/Python-Code-Large/train/row_98538 | 19 | 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_98538:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0385, 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_98538:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98538:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98538:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98538:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
import os
import sys
import shutil
from optparse import make_option
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.core.management.base import CommandError, NoArgsCommand
from django.contrib.staticfiles import finders
class Command(NoArgsCommand):
... | ajibawa-2023/Python-Code-Large/train/row_98539 | 103 | 187 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98539:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 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_98539:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98539:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98539:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98539:Assign_L17_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 + (
... | ajibawa-2023/Python-Code-Large/train/row_98540 | 15 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98540:ImportFrom_L1_C0", "label": "from optparse import make_option", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 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_98540:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98540:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98540:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98540: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 mimetypes
import os
import posixpath
import re
import stat
import urllib
from email.Utils import parsedate_tz, mktime_tz
from django.conf import setti... | ajibawa-2023/Python-Code-Large/train/row_98541 | 72 | 161 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98541:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0186, 0.0311, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98541:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98541:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98541:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98541:If_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django.middleware.csrf import CsrfMiddleware, CsrfViewMiddleware, CsrfResponseMiddleware
from django.views.decorators.csrf import csrf_exempt, csrf_view_exempt, csrf_response_exempt
import warnings
warnings.warn("This import for CSRF functionality is deprecated. Please use django.middleware.csrf for the midd... | ajibawa-2023/Python-Code-Large/train/row_98542 | 4 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98542:ImportFrom_L1_C0", "label": "from django.middleware.csrf import CsrfMiddleware, CsrfViewMiddleware, CsrfResponseMiddleware", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 0, 0.66, 0.0, 574, 0, 3, 0, 0, 574, 0, 0], "s... | [] |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class FlatPage(models.Model):
url = models.CharField(_('URL'), max_length=100, db_index=True)
title = models.CharField(_('title'), max_length=200)
content = models.Text... | ajibawa-2023/Python-Code-Large/train/row_98543 | 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_98543: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_98543:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98543:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98543:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98543: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.flat... | ajibawa-2023/Python-Code-Large/train/row_98544 | 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_98544: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_98544:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98544:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98544:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98544:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.contrib.flatpages.admin import FlatpageForm
from django.test import TestCase
class FlatpageAdminFormTests(TestCase):
def setUp(self):
self.form_data = {
'title': "A test page",
'content': "This is a test",
'sites': [1],
}
def test_flat... | ajibawa-2023/Python-Code-Large/train/row_98545 | 15 | 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_98545:ImportFrom_L1_C0", "label": "from django.contrib.flatpages.admin import FlatpageForm", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 454, 0, 1, 0, 0, 454, 0, 0], "semantic": {"name": "django.contrib.fla... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98545:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98545:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98545:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98545:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code... |
from django.conf.urls.defaults import *
# special urls for flatpage test cases
urlpatterns = patterns('',
(r'^flatpage_root', include('django.contrib.flatpages.urls')),
(r'^accounts/', include('django.contrib.auth.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_98546 | 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_98546:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.125, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_nam... | [] |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
class FlatpageMiddlewareTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.old_MIDDLEWARE_CLASSES = set... | ajibawa-2023/Python-Code-Large/train/row_98547 | 55 | 70 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98547:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0143, 0.0143, 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_98547:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98547:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98547:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98547: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.test import TestCase, Client
class FlatpageCSRFTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.client = Client(enforce_cs... | ajibawa-2023/Python-Code-Large/train/row_98548 | 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_98548: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_98548:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98548:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98548:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98548: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(s... | ajibawa-2023/Python-Code-Large/train/row_98549 | 54 | 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_98549:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0133, 0.0133, 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_98549:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98549:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98549:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98549: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_98550 | 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_98550: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.defaults import *
urlpatterns = patterns('django.contrib.flatpages.views',
(r'^(?P<url>.*)$', 'flatpage'),
)
| ajibawa-2023/Python-Code-Large/train/row_98551 | 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_98551:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names":... | [] |
from django.contrib.flatpages.views import flatpage
from django.http import Http404
from django.conf import settings
class FlatpageFallbackMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a flatpage ... | ajibawa-2023/Python-Code-Large/train/row_98552 | 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_98552: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_98552:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98552:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98552:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98552: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_... | ajibawa-2023/Python-Code-Large/train/row_98553 | 40 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98553:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0102, 0.0102, 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_98553:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98553:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98553:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98553:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-C... |
from django import forms
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$',
help_text = _("E... | ajibawa-2023/Python-Code-Large/train/row_98554 | 15 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98554:ImportFrom_L1_C0", "label": "from django import forms", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98554:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98554:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98554:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98554:ClassDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
from django.contrib.flatpages.models import FlatPage
from django.template import loader, RequestContext
from django.shortcuts import get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.core.xheaders import populate_xheaders
from django.utils.sa... | ajibawa-2023/Python-Code-Large/train/row_98555 | 31 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98555:ImportFrom_L1_C0", "label": "from django.contrib.flatpages.models import FlatPage", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0156, 0.0156, 0, 0.66, 0.0, 268, 0, 1, 0, 0, 268, 0, 0], "semantic": {"name": "django.contrib.flatpa... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98555:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98555:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98555:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98555:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
# This file intentionally left blank | ajibawa-2023/Python-Code-Large/train/row_98556 | 0 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [] | [] |
from datetime import date
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sitemaps import Sitemap
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils.unittest impor... | ajibawa-2023/Python-Code-Large/train/row_98557 | 62 | 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_98557: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_98557:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98557:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98557:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98557:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from datetime import datetime
from django.conf.urls.defaults import *
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap
from django.contrib.auth.models import User
class SimpleSitemap(Sitemap):
changefreq = "never"
priority = 0.5
location = '/location/'
lastmod = dat... | ajibawa-2023/Python-Code-Large/train/row_98558 | 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_98558:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98558:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98558:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98558:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98558:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
from django.contrib.sitemaps.tests.basic import *
| ajibawa-2023/Python-Code-Large/train/row_98559 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98559:ImportFrom_L1_C0", "label": "from django.contrib.sitemaps.tests.basic import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 1.0, 1.0, 0, 0.66, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "django.contrib.sitemaps.tests.ba... | [] |
from django.core.management.base import BaseCommand
from django.contrib.sitemaps import ping_google
class Command(BaseCommand):
help = "Ping google with an updated sitemap, pass optional url of sitemap"
def execute(self, *args, **options):
if len(args) == 1:
sitemap_url = args[0]... | ajibawa-2023/Python-Code-Large/train/row_98560 | 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_98560: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_98560:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98560:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98560:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98560:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.utils.encoding import smart_str
from django.core.paginator import EmptyPage, PageNotAnInteger
def index(request, sitemaps):
... | ajibawa-2023/Python-Code-Large/train/row_98561 | 37 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98561:ImportFrom_L1_C0", "label": "from django.http import HttpResponse, Http404", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98561:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98561:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98561:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98561:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
from django.contrib.sites.models import Site, get_current_site
from django.core import urlresolvers, paginator
from django.core.exceptions import ImproperlyConfigured
import urllib
PING_URL = "http://www.google.com/webmasters/tools/ping"
class SitemapNotFound(Exception):
pass
def ping_google(sitemap_ur... | ajibawa-2023/Python-Code-Large/train/row_98562 | 68 | 109 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98562:ImportFrom_L1_C0", "label": "from django.contrib.sites.models import Site, get_current_site", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0092, 0, 0.66, 0.0, 890, 0, 2, 0, 0, 890, 0, 0], "semantic": {"name": "django.cont... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98562:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98562:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98562:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98562: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
... | ajibawa-2023/Python-Code-Large/train/row_98563 | 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_98563: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_98563:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98563:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98563:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98563: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'), ... | ajibawa-2023/Python-Code-Large/train/row_98564 | 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_98564: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_98564:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98564:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98564:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98564:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/tra... |
from django.conf import settings
from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import CompatCookie
from django.utils import simplejson as json
from django.utils.crypto import salted_hmac, constant_time_compare
class Message... | ajibawa-2023/Python-Code-Large/train/row_98565 | 84 | 150 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98565:ImportFrom_L1_C0", "label": "from django.conf import settings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0067, 0.0067, 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_98565:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98565:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98565:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98565:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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
st... | ajibawa-2023/Python-Code-Large/train/row_98566 | 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_98566: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_98566:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98566:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98566:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98566:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""
Storages used to assist in the deprecation of contrib.auth User messages.
"""
from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.contrib.auth.models import User
from django.contrib.messages.storage.fallback import FallbackStorage
... | ajibawa-2023/Python-Code-Large/train/row_98567 | 32 | 64 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98567:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0391, 0.0625, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98567:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98567:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98567:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98567:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
from django.contrib.messages.api import get_messages
def messages(request):
"""
Returns a lazy 'messages' context variable.
"""
return {'messages': get_messages(request)}
| ajibawa-2023/Python-Code-Large/train/row_98569 | 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_98569: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_98569:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98569:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98569:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98569:Return_L8_C4"}] |
# Models module required so tests are discovered.
| ajibawa-2023/Python-Code-Large/train/row_98570 | 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.m... | ajibawa-2023/Python-Code-Large/train/row_98571 | 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_98571: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_98571:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98571:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98571:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98571: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.sess... | ajibawa-2023/Python-Code-Large/train/row_98572 | 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_98572: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_98572:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98572:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98572:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98572: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.u... | ajibawa-2023/Python-Code-Large/train/row_98573 | 57 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98573:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 698, 0, 1, 0, 0, 698, 0, 0], "semantic": {"name": "django.contrib.messages", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98573:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98573:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98573:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98573:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
from django.conf.urls.defaults import *
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext, Template
def add(request, message_type... | ajibawa-2023/Python-Code-Large/train/row_98574 | 18 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98574:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98574:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98574:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98574:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98574:For_L13_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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 s... | ajibawa-2023/Python-Code-Large/train/row_98575 | 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_98575: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_98575:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98575:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98575:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98575:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code... |
import warnings
from django import http
from django.test import TestCase
from django.conf import settings
from django.utils.translation import ugettext_lazy
from django.utils.unittest import skipIf
from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api impor... | ajibawa-2023/Python-Code-Large/train/row_98576 | 254 | 416 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98576:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0024, 0.0024, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98576:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98576:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98576:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98576:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django import http
from django.contrib.auth.models import User
from django.contrib.messages.storage.user_messages import UserMessagesStorage,\
LegacyFallbackStorage
from django.contrib.messages.tests.base import skipUnlessAuthIsInstalled
from django.contrib.messages.tests.cookie import set_cookie_data
fr... | ajibawa-2023/Python-Code-Large/train/row_98577 | 48 | 70 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98577:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0143, 0.0143, 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_98577:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98577:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98577:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_98577:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-... |
from django.contrib.messages.tests.cookie import CookieTest
from django.contrib.messages.tests.fallback import FallbackTest
from django.contrib.messages.tests.middleware import MiddlewareTest
from django.contrib.messages.tests.session import SessionTest
from django.contrib.messages.tests.user_messages import \
... | ajibawa-2023/Python-Code-Large/train/row_98578 | 5 | 6 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98578:ImportFrom_L1_C0", "label": "from django.contrib.messages.tests.cookie import CookieTest", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.1667, 0, 0.66, 0.0, 410, 0, 1, 0, 0, 410, 0, 0], "semantic": {"name": "django.contrib... | [] |
DEBUG = 10
INFO = 20
SUCCESS = 25
WARNING = 30
ERROR = 40
DEFAULT_TAGS = {
DEBUG: 'debug',
INFO: 'info',
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'error',
}
| ajibawa-2023/Python-Code-Large/train/row_98579 | 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_98579: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_respo... | ajibawa-2023/Python-Code-Large/train/row_98580 | 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_98580: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_98580:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98580:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98580:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98580: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_98581 | 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_98581: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_98581:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98581:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98581:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98581:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from api import *
from constants import *
| ajibawa-2023/Python-Code-Large/train/row_98582 | 2 | 2 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98582:ImportFrom_L1_C0", "label": "from api import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.5, 0, 0.66, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "api", "arg_names": [], "import_names": ["*"], "rhs_call_name":... | [] |
from django.contrib.messages import constants
from django.contrib.messages.storage import default_storage
from django.utils.functional import lazy, memoize
__all__ = (
'add_message', 'get_messages',
'get_level', 'set_level',
'debug', 'info', 'success', 'warning', 'error',
)
class MessageFailur... | ajibawa-2023/Python-Code-Large/train/row_98583 | 49 | 114 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98583:ImportFrom_L1_C0", "label": "from django.contrib.messages import constants", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0088, 0.0088, 0, 0.66, 0.0, 698, 0, 1, 0, 0, 698, 0, 0], "semantic": {"name": "django.contrib.messages", "a... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98583:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98583:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98583:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98583:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
from django import template
from django.conf import settings
from django.shortcuts import get_object_or_404, render_to_response
from django.contrib.auth.decorators import login_required, permission_required
from utils import next_redirect, confirmation_view
from django.contrib import comments
from django.contrib.... | ajibawa-2023/Python-Code-Large/train/row_98584 | 47 | 159 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98584:ImportFrom_L1_C0", "label": "from django import template", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0063, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["te... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98584:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98584:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98584:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98584:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
A few bits of helper functions for comment views.
"""
import urllib
import textwrap
from django.http import HttpResponseRedirect
from django.core import urlresolvers
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNot... | ajibawa-2023/Python-Code-Large/train/row_98585 | 27 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98585:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0345, 0.0517, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98585:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98585:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98585:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98585:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
from django import http
from django.conf import settings
from utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.te... | ajibawa-2023/Python-Code-Large/train/row_98586 | 58 | 135 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98586:ImportFrom_L1_C0", "label": "from django import http", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"]... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98586:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98586:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98586:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98586:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-... |
import time
import datetime
from django import forms
from django.forms.util import ErrorDict
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from models import Comment
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.encoding impo... | ajibawa-2023/Python-Code-Large/train/row_98587 | 106 | 206 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_98587:Import_L1_C0", "label": "time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0049, 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_98587:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98587:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98587:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98587:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
import datetime
from django.contrib.auth.models import User
from django.contrib.comments.managers import CommentManager
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django.... | ajibawa-2023/Python-Code-Large/train/row_98588 | 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_98588:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0052, 0.0052, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_98588:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98588:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_98588:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_98588:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.