code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
"""
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 ... | [
[
8,
0,
0.0465,
0.0698,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1163,
0.0233,
0,
0.66,
0.2,
910,
0,
2,
0,
0,
910,
0,
0
],
[
1,
0,
0.1395,
0.0233,
0,
0.66,
... | [
"\"\"\"\nSlovak-specific form helpers\n\"\"\"",
"from django.forms.fields import Select, RegexField",
"from django.utils.translation import ugettext_lazy as _",
"class SKRegionSelect(Select):\n \"\"\"\n A select widget widget with list of Slovak regions as choices.\n \"\"\"\n def __init__(self, at... |
"""
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... | [
[
8,
0,
0.023,
0.0345,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0575,
0.0115,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5402,
0.931,
0,
0.66,
... | [
"\"\"\"\nSlovak districts according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska\n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"DISTRICT_CHOICES = (\n ('BB', _('Banska Bystrica')),\n ('BS', _('Banska Stiavnica')),\n ('BJ', _('Bardejov')),\n ('BN... |
"""
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', _('... | [
[
8,
0,
0.125,
0.1875,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3125,
0.0625,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.7188,
0.625,
0,
0.66,
... | [
"\"\"\"\nSlovak regions according to http://sk.wikipedia.org/wiki/Administrat%C3%ADvne_%C4%8Dlenenie_Slovenska\n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"REGION_CHOICES = (\n ('BB', _('Banska Bystrica region')),\n ('BA', _('Bratislava region')),\n ('KE', _('Kosice region')),\... |
"""
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... | [
[
8,
0,
0.1429,
0.2143,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3571,
0.0714,
0,
0.66,
0.5,
910,
0,
1,
0,
0,
910,
0,
0
],
[
3,
0,
0.7143,
0.5,
0,
0.66,
... | [
"\"\"\"\nMexican-specific form helpers.\n\"\"\"",
"from django.forms.fields import Select",
"class MXStateSelect(Select):\n \"\"\"\n A Select widget that uses a list of Mexican states as its choices.\n \"\"\"\n def __init__(self, attrs=None):\n from mx_states import STATE_CHOICES\n sup... |
# -*- 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')),
... | [
[
8,
0,
0.1,
0.1333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2,
0.0222,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.6111,
0.7556,
0,
0.66,
1,... | [
"\"\"\"\nA list of Mexican states for use as `choices` in a formfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"STATE_CHOICES = (\n ('AGU', _(u'Aguascalientes')),\n ('BCN', _... |
# -*- 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):
... | [
[
8,
0,
0.0162,
0.0162,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0324,
0.0054,
0,
0.66,
0.0833,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0378,
0.0054,
0,
0.66... | [
"\"\"\"\nSpanish-specific Form helpers\n\"\"\"",
"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(RegexFiel... |
# -*- 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... | [
[
1,
0,
0.087,
0.0435,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5652,
0.8261,
0,
0.66,
1,
868,
0,
0,
0,
0,
0,
8,
17
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"REGION_CHOICES = (\n ('AN', _('Andalusia')),\n ('AR', _('Aragon')),\n ('O', _('Principality of Asturias')),\n ('IB', _('Balearic Islands')),\n ('PV', _('Basque Country')),\n ('CN', _('Canary Islands')),\n ('S', _('Cantabria')),"
] |
# -*- 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... | [
[
1,
0,
0.0345,
0.0172,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5259,
0.931,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
52
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"PROVINCE_CHOICES = (\n ('01', _('Arava')),\n ('02', _('Albacete')),\n ('03', _('Alacant')),\n ('04', _('Almeria')),\n ('05', _('Avila')),\n ('06', _('Badajoz')),\n ('07', _('Illes Balears')),"
] |
"""
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... | [
[
8,
0,
0.0308,
0.0462,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0615,
0.0154,
0,
0.66,
0.125,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0923,
0.0154,
0,
0.66,... | [
"\"\"\"\nIsraeli-specific form helpers\n\"\"\"",
"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 _",
"id_number_re = re.... |
"""
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_... | [
[
8,
0,
0.0392,
0.0588,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.098,
0.0196,
0,
0.66,
0.1,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.1176,
0.0196,
0,
0.66,
... | [
"\"\"\"\nFR-specific Form helpers\n\"\"\"",
"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 ... |
# -*- 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... | [
[
14,
0,
0.5136,
0.9818,
0,
0.66,
0,
807,
0,
0,
0,
0,
0,
8,
0
]
] | [
"DEPARTMENT_ASCII_CHOICES = (\n ('01', '01 - Ain'),\n ('02', '02 - Aisne'),\n ('03', '03 - Allier'),\n ('04', '04 - Alpes-de-Haute-Provence'),\n ('05', '05 - Hautes-Alpes'),\n ('06', '06 - Alpes-Maritimes'),\n ('07', '07 - Ardeche'),"
] |
"""
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
... | [
[
8,
0,
0.0333,
0.05,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0167,
0,
0.66,
0.1,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.1,
0.0167,
0,
0.66,
0.... | [
"\"\"\"\nSouth Africa-specific Form helpers\n\"\"\"",
"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 _",
"impor... |
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')),... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.6154,
0.8462,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
9
]
] | [
"from django.utils.translation import gettext_lazy as _",
"PROVINCE_CHOICES = (\n ('EC', _('Eastern Cape')),\n ('FS', _('Free State')),\n ('GP', _('Gauteng')),\n ('KN', _('KwaZulu-Natal')),\n ('LP', _('Limpopo')),\n ('MP', _('Mpumalanga')),\n ('NC', _('Northern Cape')),"
] |
"""
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 ... | [
[
8,
0,
0.0282,
0.0423,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0563,
0.0141,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0845,
0.0141,
0,
0.66... | [
"\"\"\"\nBelgium-specific Form helpers\n\"\"\"",
"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(RegexFiel... |
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... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.625,
0.8125,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
11
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"PROVINCE_CHOICES = (\n ('VAN', _('Antwerp')),\n ('BRU', _('Brussels')),\n ('VOV', _('East Flanders')),\n ('VBR', _('Flemish Brabant')),\n ('WHT', _('Hainaut')),\n ('WLG', _('Liege')),\n ('VLI', _('Limburg')),"
] |
from django.utils.translation import ugettext_lazy as _
# ISO codes
REGION_CHOICES = (
('BRU', _('Brussels Capital Region')),
('VLG', _('Flemish Region')),
('WAL', _('Wallonia'))
)
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.75,
0.625,
0,
0.66,
1,
868,
0,
0,
0,
0,
0,
8,
3
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"REGION_CHOICES = (\n ('BRU', _('Brussels Capital Region')),\n ('VLG', _('Flemish Region')),\n ('WAL', _('Wallonia'))\n)"
] |
"""
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... | [
[
8,
0,
0.0377,
0.0566,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0943,
0.0189,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1321,
0.0189,
0,
0.66... | [
"\"\"\"\nUK-specific Form helpers\n\"\"\"",
"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):\n \"\"\"\n A form field that validates its input is ... |
"""
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... | [
[
8,
0,
0.0412,
0.0722,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0825,
0.0103,
0,
0.66,
0.1429,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.3196,
0.4433,
0,
0.6... | [
"\"\"\"\nSources:\n English regions: http://www.statistics.gov.uk/geography/downloads/31_10_01_REGION_names_and_codes_12_00.xls\n Northern Ireland regions: http://en.wikipedia.org/wiki/List_of_Irish_counties_by_area\n Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales\n Scottish reg... |
# -*- 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... | [
[
8,
0,
0.0142,
0.0198,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5142,
0.9745,
0,
0.66,
1,
881,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nAn alphabetical list of Finnish municipalities for use as `choices` in a\nformfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"MUNICIPALITY_CHOICES = (\n ('akaa', u\"Akaa\"),\n ('alajarvi', u\"Alajärvi\"),\n ('alavieska', u\... |
"""
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 ... | [
[
8,
0,
0.0392,
0.0588,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.098,
0.0196,
0,
0.66,
0.125,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1176,
0.0196,
0,
0.66,
... | [
"\"\"\"\nFI-specific Form helpers\n\"\"\"",
"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... |
"""
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... | [
[
8,
0,
0.0317,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0635,
0.0159,
0,
0.66,
0.125,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0794,
0.0159,
0,
0.66,... | [
"\"\"\"\nKuwait-specific Form helpers\n\"\"\"",
"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... |
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', ... | [
[
1,
0,
0.0208,
0.0208,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.125,
0.1458,
0,
0.66,
0.2,
243,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.3333,
0.2292,
0,
0.66... | [
"from django import forms",
"DEFAULT_DATE_INPUT_FORMATS = (\n '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'\n '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'\n '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'\n '%B %d %Y', '%B %d, %... |
"""
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... | [
[
8,
0,
0.1538,
0.2308,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3846,
0.0769,
0,
0.66,
0.5,
910,
0,
1,
0,
0,
910,
0,
0
],
[
3,
0,
0.7692,
0.5385,
0,
0.66,
... | [
"\"\"\"\nUK-specific Form helpers\n\"\"\"",
"from django.forms.fields import Select",
"class IECountySelect(Select):\n \"\"\"\n A Select widget that uses a list of Irish Counties as its choices.\n \"\"\"\n def __init__(self, attrs=None):\n from ie_counties import IE_COUNTY_CHOICES\n su... |
"""
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')),... | [
[
8,
0,
0.0625,
0.1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.125,
0.025,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5875,
0.85,
0,
0.66,
1,
... | [
"\"\"\"\nSources:\n Irish Counties: http://en.wikipedia.org/wiki/Counties_of_Ireland \n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"IE_COUNTY_CHOICES = (\n ('antrim', _('Antrim')),\n ('armagh', _('Armagh')),\n ('carlow', _('Carlow')),\n ('cavan', _('Cavan')),\n ('cla... |
# -*- 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... | [
[
8,
0,
0.015,
0.015,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.03,
0.005,
0,
0.66,
0.0909,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.04,
0.005,
0,
0.66,
0.... | [
"\"\"\"\nRomanian specific form helpers.\n\"\"\"",
"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):\n \"\"\"\n A Romanian fi... |
# -*- 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'... | [
[
8,
0,
0.0865,
0.1154,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5865,
0.8462,
0,
0.66,
1,
801,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nA list of Romanian counties as `choices` in a formfield.\n\nThis exists as a standalone file so that it's only imported into memory when\nexplicitly needed.\n\"\"\"",
"COUNTIES_CHOICES = (\n ('AB', u'Alba'),\n ('AR', u'Arad'),\n ('AG', u'Argeş'),\n ('BC', u'Bacău'),\n ('BH', u'Bihor'),\n ... |
"""
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... | [
[
8,
0,
0.0131,
0.0196,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0327,
0.0065,
0,
0.66,
0.1,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0458,
0.0065,
0,
0.66,
... | [
"\"\"\"\nPolish-specific form helpers\n\"\"\"",
"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):\n \"\"\"\n A select widget with list of Polish ad... |
"""
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... | [
[
8,
0,
0.0833,
0.125,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2083,
0.0417,
0,
0.66,
0.5,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.6458,
0.75,
0,
0.66,
... | [
"\"\"\"\nPolish voivodeship as in http://en.wikipedia.org/wiki/Poland#Administrative_division\n\"\"\"",
"from django.utils.translation import ugettext_lazy as _",
"VOIVODESHIP_CHOICES = (\n ('lower_silesia', _('Lower Silesia')),\n ('kuyavia-pomerania', _('Kuyavia-Pomerania')),\n ('lublin', _('Lublin'))... |
# -*- 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... | [
[
8,
0,
0.0078,
0.0078,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5078,
0.9818,
0,
0.66,
1,
261,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nPolish administrative units as in http://pl.wikipedia.org/wiki/Podzia%C5%82_administracyjny_Polski\n\"\"\"",
"ADMINISTRATIVE_UNIT_CHOICES = (\n ('wroclaw', u'Wrocław'),\n ('jeleniagora', u'Jelenia Góra'),\n ('legnica', u'Legnica'),\n ('boleslawiecki', u'bolesławiecki'),\n ('dzierzoniowski'... |
# -*- 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... | [
[
8,
0,
0.05,
0.05,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0167,
0,
0.66,
0.125,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1167,
0.0167,
0,
0.66,
... | [
"\"\"\"\nUY-specific form helpers.\n\"\"\"",
"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.ut... |
# -*- 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'),
... | [
[
8,
0,
0.0833,
0.0417,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5833,
0.875,
0,
0.66,
1,
167,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"A list of Urguayan departaments as `choices` in a formfield.\"\"\"",
"DEPARTAMENT_CHOICES = (\n ('G', u'Artigas'),\n ('A', u'Canelones'),\n ('E', u'Cerro Largo'),\n ('L', u'Colonia'),\n ('Q', u'Durazno'),\n ('N', u'Flores'),\n ('O', u'Florida'),"
] |
# -*- 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) %... | [
[
2,
0,
0.625,
0.8333,
0,
0.66,
0,
198,
0,
1,
1,
0,
0,
0,
4
],
[
8,
1,
0.3333,
0.0833,
1,
0.22,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.4167,
0.0833,
1,
0.22,
0... | [
"def get_validation_digit(number):\n \"\"\" Calculates the validation digit for the given number. \"\"\"\n sum = 0\n dvs = [4, 3, 6, 7, 8, 9, 2]\n number = str(number)\n\n for i in range(0, len(number)):\n sum = (int(number[-1 - i]) * dvs[i] + sum) % 10",
" \"\"\" Calculates the validatio... |
# -*- 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):
"""
... | [
[
8,
0,
0.0417,
0.0417,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0139,
0,
0.66,
0.1429,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0972,
0.0139,
0,
0.66... | [
"\"\"\"\nPE-specific Form helpers.\n\"\"\"",
"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):\n \"\"\"... |
# -*- 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'),
... | [
[
8,
0,
0.1286,
0.1714,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6286,
0.7714,
0,
0.66,
1,
868,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nA list of Peru regions as `choices` in a formfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"REGION_CHOICES = (\n ('AMA', u'Amazonas'),\n ('ANC', u'Ancash'),\n ('APU', u'Apurímac'),\n ('ARE', u'Arequipa'),\n ('AYA', u... |
"""
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... | [
[
8,
0,
0.0177,
0.0265,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0442,
0.0088,
0,
0.66,
0.0769,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0531,
0.0088,
0,
0.66... | [
"\"\"\"\nUSA-specific Form helpers\n\"\"\"",
"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 ugett... |
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... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0741,
0.037,
0,
0.66,
0.2,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.1111,
0.037,
0,
0.66,
... | [
"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):\n\n description = _(\"U.S. state (two uppercase letters)\")\... |
"""
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... | [
[
8,
0,
0.0171,
0.0299,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1603,
0.2479,
0,
0.66,
0.5,
633,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.6453,
0.7137,
0,
0.66,
... | [
"\"\"\"\nA mapping of state misspellings/abbreviations to normalized abbreviations, and\nan alphabetical list of states for use as `choices` in a formfield.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"STATE_CHOICES = (\n ('AL', 'Alabama'),\n... |
"""
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... | [
[
8,
0,
0.0095,
0.0142,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0237,
0.0047,
0,
0.66,
0.0588,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0284,
0.0047,
0,
0.66... | [
"\"\"\"\nID-specific Form helpers\n\"\"\"",
"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 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 ... | [
[
1,
0,
0.0093,
0.0093,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0187,
0.0093,
0,
0.66,
0.25,
389,
0,
1,
0,
0,
389,
0,
0
],
[
8,
0,
0.0981,
0.0374,
0,
0.... | [
"import warnings",
"from django.utils.translation import ugettext_lazy as _",
"warnings.warn(\n 'There have been recent changes to the ID localflavor. See the release notes for details',\n RuntimeWarning\n)",
"PROVINCE_CHOICES = (\n ('ACE', _('Aceh')),\n ('BLI', _('Bali')),\n ('BTN', _('Banten'... |
"""
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... | [
[
8,
0,
0.0149,
0.0224,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0373,
0.0075,
0,
0.66,
0.0769,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0448,
0.0075,
0,
0.66... | [
"\"\"\"\nCanada-specific Form helpers\n\"\"\"",
"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... |
"""
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... | [
[
8,
0,
0.0932,
0.1695,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.322,
0.2542,
0,
0.66,
0.5,
540,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.7373,
0.5424,
0,
0.66,
... | [
"\"\"\" \nAn alphabetical list of provinces and territories for use as `choices` \nin a formfield., and a mapping of province misspellings/abbreviations to \nnormalized abbreviations\n\nSource: http://www.canada.gc.ca/othergov/prov_e.html \n\nThis exists in this standalone file so that it's only imported into memor... |
"""
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... | [
[
8,
0,
0.0168,
0.0252,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.042,
0.0084,
0,
0.66,
0.0833,
899,
0,
1,
0,
0,
899,
0,
0
],
[
1,
0,
0.0504,
0.0084,
0,
0.66,... | [
"\"\"\"\nSwiss-specific Form helpers\n\"\"\"",
"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 ... |
# -*- 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'... | [
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.5645,
0.9032,
0,
0.66,
1,
633,
0,
0,
0,
0,
0,
8,
26
]
] | [
"from django.utils.translation import ugettext_lazy as _",
"STATE_CHOICES = (\n ('AG', _('Aargau')),\n ('AI', _('Appenzell Innerrhoden')),\n ('AR', _('Appenzell Ausserrhoden')),\n ('BS', _('Basel-Stadt')),\n ('BL', _('Basel-Land')),\n ('BE', _('Berne')),\n ('FR', _('Fribourg')),"
] |
"""
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... | [
[
8,
0,
0.0244,
0.0366,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.061,
0.0122,
0,
0.66,
0.125,
540,
0,
2,
0,
0,
540,
0,
0
],
[
1,
0,
0.0732,
0.0122,
0,
0.66,
... | [
"\"\"\"\nNorwegian-specific Form helpers\n\"\"\"",
"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 NOZipCod... |
# -*- 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... | [
[
8,
0,
0.1562,
0.2188,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6562,
0.7188,
0,
0.66,
1,
881,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nAn alphabetical list of Norwegian municipalities (fylker) fro use as `choices`\nin a formfield.\n\nThis exists in this standalone file so that it's on ly imported into memory\nwhen explicitly needed.\n\"\"\"",
"MUNICIPALITY_CHOICES = (\n ('akershus', u'Akershus'),\n ('austagder', u'Aust-Agder'),\n ... |
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):
"""
... | [
[
1,
0,
0.0116,
0.0116,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0233,
0.0116,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0349,
0.0116,
0,
... | [
"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(FileSystemS... |
from django.conf import settings
def staticfiles(request):
return {
'STATICFILES_URL': settings.STATICFILES_URL,
}
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
2,
0,
0.75,
0.6667,
0,
0.66,
1,
419,
0,
1,
1,
0,
0,
0,
0
],
[
13,
1,
0.8333,
0.5,
1,
0.14,
0... | [
"from django.conf import settings",
"def staticfiles(request):\n return {\n 'STATICFILES_URL': settings.STATICFILES_URL,\n }",
" return {\n 'STATICFILES_URL': settings.STATICFILES_URL,\n }"
] |
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... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
... | [
"import re",
"from django.conf import settings",
"from django.conf.urls.defaults import patterns, url, include",
"from django.core.exceptions import ImproperlyConfigured",
"urlpatterns = []",
"if settings.DEBUG:\n urlpatterns += patterns('',\n url(r'^(?P<path>.*)$', 'django.contrib.staticfiles.v... |
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... | [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0465,
0.0233,
0,
0.66,
0.25,
96,
0,
1,
0,
0,
96,
0,
0
],
[
14,
0,
0.093,
0.0233,
0,
0.66... | [
"from django import template",
"from django.utils.encoding import iri_to_uri",
"register = template.Library()",
"class StaticFilesPrefixNode(template.Node):\n\n def __init__(self, varname=None):\n self.varname = varname\n\n def render(self, context):\n try:\n from django.conf im... |
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.
"""
... | [
[
1,
0,
0.0222,
0.0222,
0,
0.66,
0,
626,
0,
1,
0,
0,
626,
0,
0
],
[
1,
0,
0.0444,
0.0222,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0667,
0.0222,
0,
0.... | [
"import fnmatch",
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"def get_files(storage, ignore_patterns=[], location=''):\n \"\"\"\n Recursively walk the storage directories gathering a complete list of files\n that should be copied, returning this lis... |
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 = ... | [
[
1,
0,
0.0385,
0.0385,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0769,
0.0385,
0,
0.66,
0.25,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.1154,
0.0385,
0,
0.... | [
"import os",
"from optparse import make_option",
"from django.core.management.base import LabelCommand",
"from django.contrib.staticfiles import finders",
"class Command(LabelCommand):\n help = \"Finds the absolute paths for the given static file(s).\"\n args = \"[file ...]\"\n label = 'static file... |
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):
... | [
[
1,
0,
0.0053,
0.0053,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0107,
0.0053,
0,
0.66,
0.125,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.016,
0.0053,
0,
0.... | [
"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",
"cla... |
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 + (
... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.1111,
0.037,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1481,
0.037,
0,
0.66,
... | [
"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):\n option_list = BaseRunserverCommand.option_lis... |
"""
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... | [
[
8,
0,
0.0186,
0.0311,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0373,
0.0062,
0,
0.66,
0.0588,
583,
0,
1,
0,
0,
583,
0,
0
],
[
1,
0,
0.0435,
0.0062,
0,
0.66... | [
"\"\"\"\nViews and functions for serving static files. These are only to be used during\ndevelopment, and SHOULD NOT be used in a production setting.\n\n\"\"\"",
"import mimetypes",
"import os",
"import posixpath",
"import re",
"import stat",
"import urllib",
"from email.Utils import parsedate_tz, mkt... |
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... | [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
574,
0,
3,
0,
0,
574,
0,
0
],
[
1,
0,
0.2857,
0.1429,
0,
0.66,
0.3333,
456,
0,
3,
0,
0,
456,
0,
0
],
[
1,
0,
0.5714,
0.1429,
0,
... | [
"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.c... |
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... | [
[
1,
0,
0.0385,
0.0385,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0769,
0.0385,
0,
0.66,
0.3333,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.1154,
0.0385,
0,
0.... | [
"from django.db import models",
"from django.contrib.sites.models import Site",
"from django.utils.translation import ugettext_lazy as _",
"class FlatPage(models.Model):\n url = models.CharField(_('URL'), max_length=100, db_index=True)\n title = models.CharField(_('title'), max_length=200)\n content ... |
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... | [
[
1,
0,
0.0075,
0.0075,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0149,
0.0075,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0224,
0.0075,
0,
0.6... | [
"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):\n fixtures = ['sample_flatpages']\n urls... |
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... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
454,
0,
1,
0,
0,
454,
0,
0
],
[
1,
0,
0.0909,
0.0455,
0,
0.66,
0.5,
944,
0,
1,
0,
0,
944,
0,
0
],
[
3,
0,
0.5909,
0.8636,
0,
0.6... | [
"from django.contrib.flatpages.admin import FlatpageForm",
"from django.test import TestCase",
"class FlatpageAdminFormTests(TestCase):\n def setUp(self):\n self.form_data = {\n 'title': \"A test page\",\n 'content': \"This is a test\",\n 'sites': [1],\n }",
"... |
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')),
)
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.6875,
0.5,
0,
0.66,
1,
990,
3,
3,
0,
0,
75,
10,
3
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('',\n (r'^flatpage_root', include('django.contrib.flatpages.urls')),\n (r'^accounts/', include('django.contrib.auth.urls')),\n)"
] |
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... | [
[
1,
0,
0.0143,
0.0143,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0286,
0.0143,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0429,
0.0143,
0,
0.... | [
"import os",
"from django.conf import settings",
"from django.contrib.auth.models import User",
"from django.test import TestCase",
"class FlatpageMiddlewareTests(TestCase):\n fixtures = ['sample_flatpages']\n urls = 'django.contrib.flatpages.tests.urls'\n\n def setUp(self):\n self.old_MIDDL... |
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... | [
[
1,
0,
0.0127,
0.0127,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0253,
0.0127,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.038,
0.0127,
0,
0.6... | [
"import os",
"from django.conf import settings",
"from django.contrib.auth.models import User",
"from django.test import TestCase, Client",
"class FlatpageCSRFTests(TestCase):\n fixtures = ['sample_flatpages']\n urls = 'django.contrib.flatpages.tests.urls'\n\n def setUp(self):\n self.client ... |
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... | [
[
1,
0,
0.0133,
0.0133,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0267,
0.0133,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.04,
0.0133,
0,
0.66,... | [
"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):\n fixtures = ['sample_flatpages']\n urls = 'django.contrib.flatpages.tests.u... |
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 *
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
500,
0,
1,
0,
0,
500,
0,
0
],
[
1,
0,
0.4,
0.2,
0,
0.66,
0.25,
351,
0,
1,
0,
0,
351,
0,
0
],
[
1,
0,
0.6,
0.2,
0,
0.66,
0.5,
4... | [
"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 *"
] |
from django.conf.urls.defaults import *
urlpatterns = patterns('django.contrib.flatpages.views',
(r'^(?P<url>.*)$', 'flatpage'),
)
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.8,
0.6,
0,
0.66,
1,
990,
3,
2,
0,
0,
75,
10,
1
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('django.contrib.flatpages.views',\n (r'^(?P<url>.*)$', 'flatpage'),\n)"
] |
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 ... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
240,
0,
1,
0,
0,
240,
0,
0
],
[
1,
0,
0.1111,
0.0556,
0,
0.66,
0.3333,
779,
0,
1,
0,
0,
779,
0,
0
],
[
1,
0,
0.1667,
0.0556,
0,
... | [
"from django.contrib.flatpages.views import flatpage",
"from django.http import Http404",
"from django.conf import settings",
"class FlatpageFallbackMiddleware(object):\n def process_response(self, request, response):\n if response.status_code != 404:\n return response # No need to check ... |
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_... | [
[
1,
0,
0.0102,
0.0102,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0204,
0.0102,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0306,
0.0102,
0,
... | [
"from django import template",
"from django.conf import settings",
"from django.contrib.flatpages.models import FlatPage",
"register = template.Library()",
"class FlatpageNode(template.Node):\n def __init__(self, context_name, starts_with=None, user=None):\n self.context_name = context_name\n ... |
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... | [
[
1,
0,
0.0357,
0.0357,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0714,
0.0357,
0,
0.66,
0.1667,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.1071,
0.0357,
0,
... | [
"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):\n url = forms.RegexField(label=_(\"URL\"), max_length=100, regex=r'^[-\\w/\\.~]+$',\n ... |
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... | [
[
1,
0,
0.0156,
0.0156,
0,
0.66,
0,
268,
0,
1,
0,
0,
268,
0,
0
],
[
1,
0,
0.0312,
0.0156,
0,
0.66,
0.1,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0469,
0.0156,
0,
0.6... | [
"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_xhead... |
# This file intentionally left blank | [] | [] |
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... | [
[
1,
0,
0.0079,
0.0079,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0159,
0.0079,
0,
0.66,
0.1,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0238,
0.0079,
0,
0.6... | [
"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 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... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.125,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
0... | [
"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):\n changefreq = \"never\"\n priority = 0.5\n location = '/location... |
from django.contrib.sitemaps.tests.basic import *
| [
[
1,
0,
1,
1,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
]
] | [
"from django.contrib.sitemaps.tests.basic import *"
] |
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]... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
931,
0,
1,
0,
0,
931,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.5,
890,
0,
1,
0,
0,
890,
0,
0
],
[
3,
0,
0.6429,
0.6429,
0,
0.6... | [
"from django.core.management.base import BaseCommand",
"from django.contrib.sitemaps import ping_google",
"class Command(BaseCommand):\n help = \"Ping google with an updated sitemap, pass optional url of sitemap\"\n\n def execute(self, *args, **options):\n if len(args) == 1:\n sitemap_ur... |
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):
... | [
[
1,
0,
0.0213,
0.0213,
0,
0.66,
0,
779,
0,
2,
0,
0,
779,
0,
0
],
[
1,
0,
0.0426,
0.0213,
0,
0.66,
0.1429,
213,
0,
1,
0,
0,
213,
0,
0
],
[
1,
0,
0.0638,
0.0213,
0,
... | [
"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 ... |
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... | [
[
1,
0,
0.0092,
0.0092,
0,
0.66,
0,
890,
0,
2,
0,
0,
890,
0,
0
],
[
1,
0,
0.0183,
0.0092,
0,
0.66,
0.1111,
913,
0,
2,
0,
0,
913,
0,
0
],
[
1,
0,
0.0275,
0.0092,
0,
... | [
"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):\n pass",
"d... |
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
... | [
[
1,
0,
0.0185,
0.0185,
0,
0.66,
0,
63,
0,
1,
0,
0,
63,
0,
0
],
[
1,
0,
0.037,
0.0185,
0,
0.66,
0.3333,
589,
0,
1,
0,
0,
589,
0,
0
],
[
1,
0,
0.0556,
0.0185,
0,
0.6... | [
"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):\n \"\"\"\n Tries to store all messages in the first backend, stor... |
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'), ... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
63,
0,
1,
0,
0,
63,
0,
0
],
[
3,
0,
0.5606,
0.9091,
0,
0.66,
1,
254,
0,
3,
0,
0,
775,
0,
5
],
[
8,
1,
0.1818,
0.0909,
1,
0.67,
... | [
"from django.contrib.messages.storage.base import BaseStorage",
"class SessionStorage(BaseStorage):\n \"\"\"\n Stores messages in the session (that is, django.contrib.sessions).\n \"\"\"\n session_key = '_messages'\n\n def __init__(self, request, *args, **kwargs):\n assert hasattr(request, '... |
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... | [
[
1,
0,
0.0067,
0.0067,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0133,
0.0067,
0,
0.66,
0.125,
698,
0,
1,
0,
0,
698,
0,
0
],
[
1,
0,
0.02,
0.0067,
0,
0.6... | [
"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_c... |
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... | [
[
1,
0,
0.0055,
0.0055,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.011,
0.0055,
0,
0.66,
0.2,
96,
0,
2,
0,
0,
96,
0,
0
],
[
1,
0,
0.0166,
0.0055,
0,
0.66,
... | [
"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):\n \"\"\"\n Represents an actual message that can be stored in any of the s... |
"""
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
... | [
[
8,
0,
0.0391,
0.0625,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0781,
0.0156,
0,
0.66,
0.1667,
698,
0,
1,
0,
0,
698,
0,
0
],
[
1,
0,
0.0938,
0.0156,
0,
0.66... | [
"\"\"\"\nStorages used to assist in the deprecation of contrib.auth User messages.\n\n\"\"\"",
"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.fallba... |
from django.contrib.messages.api import get_messages
def messages(request):
"""
Returns a lazy 'messages' context variable.
"""
return {'messages': get_messages(request)}
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
488,
0,
1,
0,
0,
488,
0,
0
],
[
2,
0,
0.75,
0.625,
0,
0.66,
1,
312,
0,
1,
1,
0,
0,
0,
1
],
[
8,
1,
0.75,
0.375,
1,
0.75,
0,
... | [
"from django.contrib.messages.api import get_messages",
"def messages(request):\n \"\"\"\n Returns a lazy 'messages' context variable.\n \"\"\"\n return {'messages': get_messages(request)}",
" \"\"\"\n Returns a lazy 'messages' context variable.\n \"\"\"",
" return {'messages': get_mes... |
# Models module required so tests are discovered.
| [] | [] |
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... | [
[
1,
0,
0.0057,
0.0057,
0,
0.66,
0,
698,
0,
1,
0,
0,
698,
0,
0
],
[
1,
0,
0.0143,
0.0114,
0,
0.66,
0.2,
495,
0,
2,
0,
0,
495,
0,
0
],
[
1,
0,
0.0229,
0.0057,
0,
0.6... | [
"from django.contrib.messages import constants",
"from django.contrib.messages.storage.fallback import FallbackStorage, \\\n CookieStorage",
"from django.contrib.messages.tests.base import BaseTest",
"from django.contrib.messages.tests.cookie import set_cookie_data, \\\n stored_cookie_messages_count",
... |
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... | [
[
1,
0,
0.0263,
0.0263,
0,
0.66,
0,
377,
0,
1,
0,
0,
377,
0,
0
],
[
1,
0,
0.0526,
0.0263,
0,
0.66,
0.25,
281,
0,
1,
0,
0,
281,
0,
0
],
[
2,
0,
0.2237,
0.2105,
0,
0.... | [
"from django.contrib.messages.tests.base import BaseTest",
"from django.contrib.messages.storage.session import SessionStorage",
"def set_session_data(storage, messages):\n \"\"\"\n Sets the messages into the backend request's session and remove the\n backend's loaded data cache.\n \"\"\"\n stora... |
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... | [
[
1,
0,
0.0094,
0.0094,
0,
0.66,
0,
698,
0,
1,
0,
0,
698,
0,
0
],
[
1,
0,
0.0189,
0.0094,
0,
0.66,
0.1429,
377,
0,
1,
0,
0,
377,
0,
0
],
[
1,
0,
0.033,
0.0189,
0,
0... | [
"from django.contrib.messages import constants",
"from django.contrib.messages.tests.base import BaseTest",
"from django.contrib.messages.storage.cookie import CookieStorage, \\\n MessageEncoder, MessageDecoder",
"from django.contrib.messages.storage.base import Mess... |
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... | [
[
1,
0,
0.0256,
0.0256,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0513,
0.0256,
0,
0.66,
0.125,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0769,
0.0256,
0,
0... | [
"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 ... |
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... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1111,
0.0556,
0,
0.66,
0.3333,
706,
0,
1,
0,
0,
706,
0,
0
],
[
1,
0,
0.1667,
0.0556,
0,
... | [
"from django import http",
"from django.contrib.messages.middleware import MessageMiddleware",
"from django.utils import unittest",
"class MiddlewareTest(unittest.TestCase):\n\n def setUp(self):\n self.middleware = MessageMiddleware()\n\n def test_response_without_messages(self):\n \"\"\"\... |
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... | [
[
1,
0,
0.0024,
0.0024,
0,
0.66,
0,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0072,
0.0024,
0,
0.66,
0.0714,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0096,
0.0024,
0,
... | [
"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 dj... |
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... | [
[
1,
0,
0.0143,
0.0143,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0286,
0.0143,
0,
0.66,
0.1,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.05,
0.0286,
0,
0.66,... | [
"from django import http",
"from django.contrib.auth.models import User",
"from django.contrib.messages.storage.user_messages import UserMessagesStorage,\\\n LegacyFallbackStorage",
"from django.contrib.messages.tests.base import skipUnlessAuthIsInstalled",
"from django.contrib.messages.tests.cookie impo... |
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 \
... | [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
410,
0,
1,
0,
0,
410,
0,
0
],
[
1,
0,
0.3333,
0.1667,
0,
0.66,
0.25,
249,
0,
1,
0,
0,
249,
0,
0
],
[
1,
0,
0.5,
0.1667,
0,
0.66,... | [
"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_m... |
DEBUG = 10
INFO = 20
SUCCESS = 25
WARNING = 30
ERROR = 40
DEFAULT_TAGS = {
DEBUG: 'debug',
INFO: 'info',
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'error',
}
| [
[
14,
0,
0.0769,
0.0769,
0,
0.66,
0,
309,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.1538,
0.0769,
0,
0.66,
0.2,
948,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.2308,
0.0769,
0,
0.66... | [
"DEBUG = 10",
"INFO = 20",
"SUCCESS = 25",
"WARNING = 30",
"ERROR = 40",
"DEFAULT_TAGS = {\n DEBUG: 'debug',\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n}"
] |
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... | [
[
1,
0,
0.0385,
0.0385,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0769,
0.0385,
0,
0.66,
0.5,
512,
0,
1,
0,
0,
512,
0,
0
],
[
3,
0,
0.5962,
0.8462,
0,
0.6... | [
"from django.conf import settings",
"from django.contrib.messages.storage import default_storage",
"class MessageMiddleware(object):\n \"\"\"\n Middleware that handles temporary messages.\n \"\"\"\n\n def process_request(self, request):\n request._messages = default_storage(request)",
" ... |
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
| [
[
1,
0,
0.0909,
0.0909,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0.5,
698,
0,
1,
0,
0,
698,
0,
0
],
[
2,
0,
0.7273,
0.6364,
0,
0.6... | [
"from django.conf import settings",
"from django.contrib.messages import constants",
"def get_level_tags():\n \"\"\"\n Returns the message level tags.\n \"\"\"\n level_tags = constants.DEFAULT_TAGS.copy()\n level_tags.update(getattr(settings, 'MESSAGE_TAGS', {}))\n return level_tags",
" \... |
from api import *
from constants import *
| [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
976,
0,
1,
0,
0,
976,
0,
0
],
[
1,
0,
1,
0.5,
0,
0.66,
1,
208,
0,
1,
0,
0,
208,
0,
0
]
] | [
"from api import *",
"from constants import *"
] |
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... | [
[
1,
0,
0.0088,
0.0088,
0,
0.66,
0,
698,
0,
1,
0,
0,
698,
0,
0
],
[
1,
0,
0.0175,
0.0088,
0,
0.66,
0.0769,
512,
0,
1,
0,
0,
512,
0,
0
],
[
1,
0,
0.0263,
0.0088,
0,
... | [
"from django.contrib.messages import constants",
"from django.contrib.messages.storage import default_storage",
"from django.utils.functional import lazy, memoize",
"__all__ = (\n 'add_message', 'get_messages',\n 'get_level', 'set_level',\n 'debug', 'info', 'success', 'warning', 'error',\n)",
"clas... |
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.... | [
[
1,
0,
0.0063,
0.0063,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0126,
0.0063,
0,
0.66,
0.0625,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0189,
0.0063,
0,
... | [
"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 comme... |
"""
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... | [
[
8,
0,
0.0345,
0.0517,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0862,
0.0172,
0,
0.66,
0.1,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.1034,
0.0172,
0,
0.66,
... | [
"\"\"\"\nA few bits of helper functions for comment views.\n\"\"\"",
"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... |
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... | [
[
1,
0,
0.0074,
0.0074,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0148,
0.0074,
0,
0.66,
0.0667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0222,
0.0074,
0,
... | [
"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 R... |
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... | [
[
1,
0,
0.0049,
0.0049,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0097,
0.0049,
0,
0.66,
0.0667,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0194,
0.0049,
0,
... | [
"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",... |
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.... | [
[
1,
0,
0.0052,
0.0052,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0105,
0.0052,
0,
0.66,
0.0769,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0157,
0.0052,
0,
... | [
"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.d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.