code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
"""
Sources:
Irish Counties: http://en.wikipedia.org/wiki/Counties_of_Ireland
"""
from django.utils.translation import ugettext_lazy as _
IE_COUNTY_CHOICES = (
('antrim', _('Antrim')),
('armagh', _('Armagh')),
('carlow', _('Carlow')),
('cavan', _('Cavan')),
('clare', _('Clare')),
('cork... | [
[
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... |
"""
Slovenian specific form helpers.
"""
from __future__ import absolute_import
import datetime
import re
from django.contrib.localflavor.si.si_postalcodes import SI_POSTALCODES_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import CharField,... | [
[
8,
0,
0.0121,
0.0182,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0303,
0.0061,
0,
0.66,
0.0769,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0424,
0.0061,
0,
0.66... | [
"\"\"\"\nSlovenian specific form helpers.\n\"\"\"",
"from __future__ import absolute_import",
"import datetime",
"import re",
"from django.contrib.localflavor.si.si_postalcodes import SI_POSTALCODES_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
... |
# *-* coding: utf-8 *-*
SI_POSTALCODES = [
(1000, u'Ljubljana'),
(1215, u'Medvode'),
(1216, u'Smlednik'),
(1217, u'Vodice'),
(1218, u'Komenda'),
(1219, u'Laze v Tuhinju'),
(1221, u'Motnik'),
(1222, u'Trojane'),
(1223, u'Blagovica'),
(1225, u'Lukovica'),
(1230, u'Dom\u017eale... | [
[
14,
0,
0.5011,
0.9915,
0,
0.66,
0,
500,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
1,
0.0021,
0,
0.66,
1,
187,
3,
2,
0,
0,
134,
10,
1
]
] | [
"SI_POSTALCODES = [\n (1000, u'Ljubljana'),\n (1215, u'Medvode'),\n (1216, u'Smlednik'),\n (1217, u'Vodice'),\n (1218, u'Komenda'),\n (1219, u'Laze v Tuhinju'),\n (1221, u'Motnik'),",
"SI_POSTALCODES_CHOICES = sorted(SI_POSTALCODES, key=lambda k: k[1])"
] |
# -*- coding: utf-8 -*-
"""
Romanian specific form helpers.
"""
from __future__ import absolute_import
from django.contrib.localflavor.ro.ro_counties import COUNTIES_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError, Field, RegexField, Select
from django.utils.translation... | [
[
8,
0,
0.0146,
0.0146,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0244,
0.0049,
0,
0.66,
0.0833,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0341,
0.0049,
0,
0.66... | [
"\"\"\"\nRomanian specific form helpers.\n\"\"\"",
"from __future__ import absolute_import",
"from django.contrib.localflavor.ro.ro_counties import COUNTIES_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError, Field, RegexField, Select",
"from django.util... |
# -*- coding: utf-8 -*-
"""
A list of Romanian counties as `choices` in a formfield.
This exists as a standalone file so that it's only imported into memory when
explicitly needed.
"""
COUNTIES_CHOICES = (
('AB', u'Alba'),
('AR', u'Arad'),
('AG', u'Argeş'),
('BC', u'Bacău'),
('BH', u'Bihor'),
... | [
[
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
"""
from __future__ import absolute_import
import re
from django.contrib.localflavor.pl.pl_administrativeunits import ADMINISTRATIVE_UNIT_CHOICES
from django.contrib.localflavor.pl.pl_voivodeships import VOIVODESHIP_CHOICES
from django.core.validators import EMPTY_VALUES
from django.... | [
[
8,
0,
0.0092,
0.0138,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0229,
0.0046,
0,
0.66,
0.0667,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0321,
0.0046,
0,
0.66... | [
"\"\"\"\nPolish-specific form helpers\n\"\"\"",
"from __future__ import absolute_import",
"import re",
"from django.contrib.localflavor.pl.pl_administrativeunits import ADMINISTRATIVE_UNIT_CHOICES",
"from django.contrib.localflavor.pl.pl_voivodeships import VOIVODESHIP_CHOICES",
"from django.core.validato... |
"""
Polish voivodeship as in http://en.wikipedia.org/wiki/Poland#Administrative_division
"""
from django.utils.translation import ugettext_lazy as _
VOIVODESHIP_CHOICES = (
('lower_silesia', _('Lower Silesia')),
('kuyavia-pomerania', _('Kuyavia-Pomerania')),
('lublin', _('Lublin')),
('lubusz', _('Lubu... | [
[
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'),
('dzierzoniows... | [
[
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'... |
"""
PY-specific Form helpers.
"""
from __future__ import absolute_import
from django.contrib.localflavor.py.py_department import DEPARTMENT_CHOICES, DEPARTMENT_ROMAN_CHOICES
from django.forms.fields import Select
class PyDepartmentSelect(Select):
"""
A Select widget with a list of Paraguayan departments as ... | [
[
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.2,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.2917,
0.0417,
0,
0.66,
... | [
"\"\"\"\nPY-specific Form helpers.\n\"\"\"",
"from __future__ import absolute_import",
"from django.contrib.localflavor.py.py_department import DEPARTMENT_CHOICES, DEPARTMENT_ROMAN_CHOICES",
"from django.forms.fields import Select",
"class PyDepartmentSelect(Select):\n \"\"\"\n A Select widget with a ... |
# -*- coding: utf-8 -*-
# http://www.statoids.com/upy.html
DEPARTMENT_CHOICES = (
('AG', u'Alto Paraguay'),
('AA', u'Alto Paraná'),
('AM', u'Amambay'),
('AS', u'Asunción'),
('BQ', u'Boquerón'),
('CG', u'Caaguazú'),
('CZ', u'Caazapá'),
('CY', u'Canindeyú'),
('CE', u'Central'),
(... | [
[
14,
0,
0.3222,
0.4444,
0,
0.66,
0,
545,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.7889,
0.4444,
0,
0.66,
1,
30,
0,
0,
0,
0,
0,
8,
0
]
] | [
"DEPARTMENT_CHOICES = (\n ('AG', u'Alto Paraguay'),\n ('AA', u'Alto Paraná'),\n ('AM', u'Amambay'),\n ('AS', u'Asunción'),\n ('BQ', u'Boquerón'),\n ('CG', u'Caaguazú'),\n ('CZ', u'Caazapá'),",
"DEPARTMENT_ROMAN_CHOICES = (\n ('CN', u'I Concepción'),\n ('SP', u'II San Pedro'),\n ('CR'... |
# -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
from __future__ import absolute_import
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.local... | [
[
8,
0,
0.0492,
0.0492,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0984,
0.0164,
0,
0.66,
0.125,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1311,
0.0164,
0,
0.66,... | [
"\"\"\"\nUY-specific form helpers.\n\"\"\"",
"from __future__ import absolute_import",
"from django.core.validators import EMPTY_VALUES",
"from django.forms.fields import Select, RegexField",
"from django.forms import ValidationError",
"from django.utils.translation import ugettext_lazy as _",
"from dja... |
# -*- coding: utf-8 -*-
"""A list of Urguayan departaments as `choices` in a formfield."""
DEPARTAMENT_CHOICES = (
('G', u'Artigas'),
('A', u'Canelones'),
('E', u'Cerro Largo'),
('L', u'Colonia'),
('Q', u'Durazno'),
('N', u'Flores'),
('O', u'Florida'),
('P', u'Lavalleja'),
('B', u'M... | [
[
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) % 10
| [
[
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.17,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.4167,
0.0833,
1,
0.17,
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 __future__ import absolute_import
from django.contrib.localflavor.pe.pe_region import REGION_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, CharField, Select
fro... | [
[
8,
0,
0.04,
0.04,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.08,
0.0133,
0,
0.66,
0.1111,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.1067,
0.0133,
0,
0.66,
... | [
"\"\"\"\nPE-specific Form helpers.\n\"\"\"",
"from __future__ import absolute_import",
"from django.contrib.localflavor.pe.pe_region import REGION_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import RegexField, CharField... |
# -*- coding: utf-8 -*-
"""
A list of Peru regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
REGION_CHOICES = (
('AMA', u'Amazonas'),
('ANC', u'Ancash'),
('APU', u'Apurímac'),
('ARE', u'Arequipa'),
('AYA', u'... | [
[
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 __future__ import absolute_import
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.utils.encoding import smart_unicode
from django.utils.translatio... | [
[
8,
0,
0.0159,
0.0238,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0397,
0.0079,
0,
0.66,
0.0667,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0556,
0.0079,
0,
0.66... | [
"\"\"\"\nUSA-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import",
"import re",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, RegexField, Select, CharField",
"from django.utils.encoding import sm... |
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from django.contrib.localflavor.us.us_states import STATE_CHOICES
from django.contrib.localflavor.us.us_states import USPS_CHOICES
class USStateField(CharField):
description = _("U.S. state (two uppercase letters... | [
[
1,
0,
0.0278,
0.0278,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0556,
0.0278,
0,
0.66,
0.1667,
5,
0,
1,
0,
0,
5,
0,
0
],
[
1,
0,
0.0833,
0.0278,
0,
0.66... | [
"from django.utils.translation import ugettext_lazy as _",
"from django.db.models.fields import CharField",
"from django.contrib.localflavor.us.us_states import STATE_CHOICES",
"from django.contrib.localflavor.us.us_states import USPS_CHOICES",
"class USStateField(CharField):\n\n description = _(\"U.S. s... |
"""
A mapping of state misspellings/abbreviations to normalized
abbreviations, and alphabetical lists of US states, territories,
military mail regions and non-US states to which the US provides
postal service.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
# The... | [
[
8,
0,
0.0153,
0.0276,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1135,
0.1564,
0,
0.66,
0.1111,
526,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.2791,
0.1626,
0,
0.66... | [
"\"\"\"\nA mapping of state misspellings/abbreviations to normalized\nabbreviations, and alphabetical lists of US states, territories,\nmilitary mail regions and non-US states to which the US provides\npostal service.\n\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly nee... |
"""
ID-specific Form helpers
"""
from __future__ import absolute_import
import re
import time
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding impor... | [
[
8,
0,
0.0092,
0.0138,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.023,
0.0046,
0,
0.66,
0.0556,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0323,
0.0046,
0,
0.66,... | [
"\"\"\"\nID-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import",
"import re",
"import time",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, Select",
"from django.utils.translation import ugette... |
import warnings
from django.utils.translation import ugettext_lazy as _
# Reference: http://id.wikipedia.org/wiki/Daftar_provinsi_Indonesia
# Indonesia does not have an official Province code standard.
# I decided to use unambiguous and consistent (some are common) 3-letter codes.
warnings.warn(
'There have been... | [
[
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 __future__ import absolute_import
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ... | [
[
8,
0,
0.0135,
0.0203,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0338,
0.0068,
0,
0.66,
0.0714,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0473,
0.0068,
0,
0.66... | [
"\"\"\"\nCanada-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import",
"import re",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field, CharField, Select",
"from django.utils.encoding import smart_unico... |
"""
An alphabetical list of provinces and territories for use as `choices`
in a formfield., and a mapping of province misspellings/abbreviations to
normalized abbreviations
Source: http://www.canada.gc.ca/othergov/prov_e.html
This exists in this standalone file so that it's only imported into memory
when explici... | [
[
8,
0,
0.0821,
0.1493,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1642,
0.0149,
0,
0.66,
0.25,
358,
0,
1,
0,
0,
358,
0,
0
],
[
8,
0,
0.2015,
0.0597,
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 __future__ import absolute_import
import re
from django.contrib.localflavor.ch.ch_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.e... | [
[
8,
0,
0.0164,
0.0246,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.041,
0.0082,
0,
0.66,
0.0714,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0574,
0.0082,
0,
0.66,... | [
"\"\"\"\nSwiss-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import",
"import re",
"from django.contrib.localflavor.ch.ch_states import STATE_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Field... |
# -*- 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
"""
from __future__ import absolute_import
import re
import datetime
from django.contrib.localflavor.no.no_municipalities import MUNICIPALITY_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Reg... | [
[
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.0909,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0805,
0.0115,
0,
0.66,... | [
"\"\"\"\nNorwegian-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import",
"import re",
"import datetime",
"from django.contrib.localflavor.no.no_municipalities import MUNICIPALITY_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of Norwegian municipalities (fylker) fro use as `choices`
in a formfield.
This exists in this standalone file so that it's on ly imported into memory
when explicitly needed.
"""
MUNICIPALITY_CHOICES = (
('akershus', u'Akershus'),
('austagder', u'Aust-Agder'),
... | [
[
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 ... |
"""
Colombian-specific form helpers.
"""
from __future__ import absolute_import
from django.contrib.localflavor.co.co_departments import DEPARTMENT_CHOICES
from django.forms.fields import Select
class CODepartmentSelect(Select):
"""
A Select widget that uses a list of Colombian states as its choices.
""... | [
[
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.25,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.4375,
0.0625,
0,
0.66,
... | [
"\"\"\"\nColombian-specific form helpers.\n\"\"\"",
"from __future__ import absolute_import",
"from django.contrib.localflavor.co.co_departments import DEPARTMENT_CHOICES",
"from django.forms.fields import Select",
"class CODepartmentSelect(Select):\n \"\"\"\n A Select widget that uses a list of Colom... |
# -*- coding: utf-8 -*-
"""
A list of Colombian departaments as `choices` in a
formfield.
This exists in this standalone file so that it's only
imported into memory when explicitly needed.
"""
DEPARTMENT_CHOICES = (
('AMA', u'Amazonas'),
('ANT', u'Antioquia'),
('ARA', u'Arauca'),
('ATL', u'Atlántico')... | [
[
8,
0,
0.1136,
0.1591,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6136,
0.7955,
0,
0.66,
1,
545,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nA list of Colombian departaments as `choices` in a\nformfield.\n\nThis exists in this standalone file so that it's only\nimported into memory when explicitly needed.\n\"\"\"",
"DEPARTMENT_CHOICES = (\n ('AMA', u'Amazonas'),\n ('ANT', u'Antioquia'),\n ('ARA', u'Arauca'),\n ('ATL', u'Atlántico'... |
"""
TR-specific Form helpers
"""
from __future__ import absolute_import
import re
from django.contrib.localflavor.tr.tr_provinces import PROVINCE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from ... | [
[
8,
0,
0.0211,
0.0316,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0526,
0.0105,
0,
0.66,
0.0769,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0737,
0.0105,
0,
0.66... | [
"\"\"\"\nTR-specific Form helpers\n\"\"\"",
"from __future__ import absolute_import",
"import re",
"from django.contrib.localflavor.tr.tr_provinces import PROVINCE_CHOICES",
"from django.core.validators import EMPTY_VALUES",
"from django.forms import ValidationError",
"from django.forms.fields import Fi... |
# -*- coding: utf-8 -*-
"""
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
PROVINCE_CHOICES = (
('01', ('Adana')),
('02', ('Adıyaman')),
('03', ('Afyonkarahisar')),
('04', ('Ağrı')),
('68', ('Aksaray')),
('05', ('Amasya')),
('06', ('An... | [
[
8,
0,
0.0393,
0.0449,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5393,
0.9326,
0,
0.66,
1,
540,
0,
0,
0,
0,
0,
8,
0
]
] | [
"\"\"\"\nThis exists in this standalone file so that it's only imported into memory\nwhen explicitly needed.\n\"\"\"",
"PROVINCE_CHOICES = (\n ('01', ('Adana')),\n ('02', ('Adıyaman')),\n ('03', ('Afyonkarahisar')),\n ('04', ('Ağrı')),\n ('68', ('Aksaray')),\n ('05', ('Amasya')),\n ('06', ('A... |
from __future__ import with_statement
import hashlib
import os
import posixpath
import re
from urllib import unquote
from urlparse import urlsplit, urlunsplit, urldefrag
from django.conf import settings
from django.core.cache import (get_cache, InvalidCacheBackendError,
cache as default_... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0071,
0.0036,
0,
0.66,
0.0455,
154,
0,
1,
0,
0,
154,
0,
0
],
[
1,
0,
0.0107,
0.0036,
0,
... | [
"from __future__ import with_statement",
"import hashlib",
"import os",
"import posixpath",
"import re",
"from urllib import unquote",
"from urlparse import urlsplit, urlunsplit, urldefrag",
"from django.conf import settings",
"from django.core.cache import (get_cache, InvalidCacheBackendError,\n ... |
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = []
def staticfiles_urlpatterns(prefix=None):
"""
Helper function to return a URL pattern for serving static files.
"""
if prefix is None:
prefix = settings.STATIC_URL
return static(prefix, view='djang... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.25,
937,
0,
1,
0,
0,
937,
0,
0
],
[
14,
0,
0.25,
0.0625,
0,
0.66... | [
"from django.conf import settings",
"from django.conf.urls.static import static",
"urlpatterns = []",
"def staticfiles_urlpatterns(prefix=None):\n \"\"\"\n Helper function to return a URL pattern for serving static files.\n \"\"\"\n if prefix is None:\n prefix = settings.STATIC_URL\n ret... |
from django import template
from django.contrib.staticfiles.storage import staticfiles_storage
register = template.Library()
@register.simple_tag
def static(path):
"""
A template tag that returns the URL to a file
using staticfiles' storage backend
"""
return staticfiles_storage.url(path)
| [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1538,
0.0769,
0,
0.66,
0.3333,
281,
0,
1,
0,
0,
281,
0,
0
],
[
14,
0,
0.3077,
0.0769,
0,
... | [
"from django import template",
"from django.contrib.staticfiles.storage import staticfiles_storage",
"register = template.Library()",
"def static(path):\n \"\"\"\n A template tag that returns the URL to a file\n using staticfiles' storage backend\n \"\"\"\n return staticfiles_storage.url(path)"... |
import os
import fnmatch
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def matches_patterns(path, patterns=None):
"""
Return True or False depending on whether the ``path`` should be
ignored (if it matches any pattern in ``ignore_patterns``).
"""
if patter... | [
[
1,
0,
0.0175,
0.0175,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0351,
0.0175,
0,
0.66,
0.1667,
626,
0,
1,
0,
0,
626,
0,
0
],
[
1,
0,
0.0526,
0.0175,
0,
... | [
"import os",
"import fnmatch",
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",
"def matches_patterns(path, patterns=None):\n \"\"\"\n Return True or False depending on whether the ``path`` should be\n ignored (if it matches any pattern in ``ignore_patt... |
import os
from optparse import make_option
from django.core.management.base import LabelCommand
from django.utils.encoding import smart_str, smart_unicode
from django.contrib.staticfiles import finders
class Command(LabelCommand):
help = "Finds the absolute paths for the given static file(s)."
args = "[file .... | [
[
1,
0,
0.0323,
0.0323,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0.2,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.0968,
0.0323,
0,
0.6... | [
"import os",
"from optparse import make_option",
"from django.core.management.base import LabelCommand",
"from django.utils.encoding import smart_str, smart_unicode",
"from django.contrib.staticfiles import finders",
"class Command(LabelCommand):\n help = \"Finds the absolute paths for the given static... |
from __future__ import with_statement
import os
import sys
from optparse import make_option
from django.core.files.storage import FileSystemStorage
from django.core.management.base import CommandError, NoArgsCommand
from django.utils.encoding import smart_str, smart_unicode
from django.utils.datastructures import Sor... | [
[
1,
0,
0.0033,
0.0033,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0098,
0.0033,
0,
0.66,
0.1111,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0131,
0.0033,
0,
... | [
"from __future__ import with_statement",
"import os",
"import sys",
"from optparse import make_option",
"from django.core.files.storage import FileSystemStorage",
"from django.core.management.base import CommandError, NoArgsCommand",
"from django.utils.encoding import smart_str, smart_unicode",
"from ... |
from optparse import make_option
from django.conf import settings
from django.core.management.commands.runserver import BaseRunserverCommand
from django.contrib.staticfiles.handlers import StaticFilesHandler
class Command(BaseRunserverCommand):
option_list = BaseRunserverCommand.option_list + (
make_opti... | [
[
1,
0,
0.0345,
0.0345,
0,
0.66,
0,
323,
0,
1,
0,
0,
323,
0,
0
],
[
1,
0,
0.1034,
0.0345,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1379,
0.0345,
0,
0.... | [
"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 os
import posixpath
import urllib
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from dja... | [
[
8,
0,
0.0732,
0.122,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1463,
0.0244,
0,
0.66,
0.1111,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1707,
0.0244,
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 os",
"import posixpath",
"import urllib",
"from django.conf import settings",
"from django.core.exceptions import ImproperlyConfigured",... |
from django import forms
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext, ugettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$',
help_text = _("... | [
[
1,
0,
0.0244,
0.0244,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0488,
0.0244,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0732,
0.0244,
0,
0.... | [
"from django import forms",
"from django.conf import settings",
"from django.contrib.flatpages.models import FlatPage",
"from django.utils.translation import ugettext, ugettext_lazy as _",
"class FlatpageForm(forms.ModelForm):\n url = forms.RegexField(label=_(\"URL\"), max_length=100, regex=r'^[-\\w/\\.~... |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class FlatPage(models.Model):
url = models.CharField(_('URL'), max_length=100, db_index=True)
title = models.CharField(_('title'), max_length=200)
content = models.TextField(_(... | [
[
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.flatpages.te... | [
[
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 __future__ import with_statement
from django.conf import settings
from django.contrib.flatpages.forms import FlatpageForm
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import translation
class FlatpageAdminF... | [
[
1,
0,
0.0122,
0.0122,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0366,
0.0122,
0,
0.66,
0.1429,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0488,
0.0122,
0,
... | [
"from __future__ import with_statement",
"from django.conf import settings",
"from django.contrib.flatpages.forms import FlatpageForm",
"from django.contrib.flatpages.models import FlatPage",
"from django.test import TestCase",
"from django.test.utils import override_settings",
"from django.utils import... |
from django.conf.urls import patterns, include
# special urls for flatpage test cases
urlpatterns = patterns('',
(r'^flatpage_root', include('django.contrib.flatpages.urls')),
(r'^accounts/', include('django.contrib.auth.urls')),
)
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
528,
0,
2,
0,
0,
528,
0,
0
],
[
14,
0,
0.6875,
0.5,
0,
0.66,
1,
990,
3,
3,
0,
0,
75,
10,
3
]
] | [
"from django.conf.urls import patterns, include",
"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.contrib.flatpages.models import FlatPage
from django.test import TestCase
class FlatpageMiddlewareTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self)... | [
[
1,
0,
0.0061,
0.0061,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0121,
0.0061,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0182,
0.0061,
0,
... | [
"import os",
"from django.conf import settings",
"from django.contrib.auth.models import User",
"from django.contrib.flatpages.models import FlatPage",
"from django.test import TestCase",
"class FlatpageMiddlewareTests(TestCase):\n fixtures = ['sample_flatpages']\n urls = 'django.contrib.flatpages.t... |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase, Client
class FlatpageCSRFTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.client = Client(enforce_csrf_checks=... | [
[
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(self):
... | [
[
1,
0,
0.0073,
0.0073,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0146,
0.0073,
0,
0.66,
0.1667,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0219,
0.0073,
0,
... | [
"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 import patterns
urlpatterns = patterns('django.contrib.flatpages.views',
(r'^(?P<url>.*)$', 'flatpage'),
)
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
528,
0,
1,
0,
0,
528,
0,
0
],
[
14,
0,
0.8,
0.6,
0,
0.66,
1,
990,
3,
2,
0,
0,
75,
10,
1
]
] | [
"from django.conf.urls import patterns",
"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 for non... | [
[
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_with:
... | [
[
1,
0,
0.0103,
0.0103,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0206,
0.0103,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0309,
0.0103,
0,
0.6... | [
"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.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext_lazy as _
from django.contrib.flatpages.forms import FlatpageForm
class FlatPageAdmin(admin.ModelAdmin):
form = FlatpageForm
fieldsets = (
(None, {'fields': ('url', 'title... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.2,
268,
0,
1,
0,
0,
268,
0,
0
],
[
1,
0,
0.1875,
0.0625,
0,
0.66... | [
"from django.contrib import admin",
"from django.contrib.flatpages.models import FlatPage",
"from django.utils.translation import ugettext_lazy as _",
"from django.contrib.flatpages.forms import FlatpageForm",
"class FlatPageAdmin(admin.ModelAdmin):\n form = FlatpageForm\n fieldsets = (\n (None... |
from django.contrib.flatpages.models import FlatPage
from django.template import loader, RequestContext
from django.shortcuts import get_object_or_404
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
from django.conf import settings
from django.core.xheaders import populate_xheaders
from dja... | [
[
1,
0,
0.0139,
0.0139,
0,
0.66,
0,
268,
0,
1,
0,
0,
268,
0,
0
],
[
1,
0,
0.0278,
0.0139,
0,
0.66,
0.1,
213,
0,
2,
0,
0,
213,
0,
0
],
[
1,
0,
0.0417,
0.0139,
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 Http404, HttpResponse, HttpResponsePermanentRedirect",
"from django.conf import settings",
"from django.core.xheaders imp... |
# 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, GenericSitemap
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.utils.unittest import skipUnless
from django... | [
[
1,
0,
0.0079,
0.0079,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0157,
0.0079,
0,
0.66,
0.1,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0236,
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, GenericSitemap",
"from django.contrib.sites.models import Site",
"from django.core.exceptions import ImproperlyConfigured",
"from django.utils.uni... |
from datetime import date
from django.test.utils import override_settings
from .base import SitemapTestsBase
class HTTPSSitemapTests(SitemapTestsBase):
protocol = 'https'
urls = 'django.contrib.sitemaps.tests.urls.https'
def test_secure_sitemap_index(self):
"A secure sitemap index can be rendere... | [
[
1,
0,
0.0196,
0.0196,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0588,
0.0196,
0,
0.66,
0.2,
768,
0,
1,
0,
0,
768,
0,
0
],
[
1,
0,
0.098,
0.0196,
0,
0.66... | [
"from datetime import date",
"from django.test.utils import override_settings",
"from .base import SitemapTestsBase",
"class HTTPSSitemapTests(SitemapTestsBase):\n protocol = 'https'\n urls = 'django.contrib.sitemaps.tests.urls.https'\n\n def test_secure_sitemap_index(self):\n \"A secure sitem... |
from django.contrib.auth.models import User
from .base import SitemapTestsBase
class GenericViewsSitemapTests(SitemapTestsBase):
def test_generic_sitemap(self):
"A minimal generic sitemap can be rendered"
response = self.client.get('/generic/sitemap.xml')
expected = ''
for usernam... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.1765,
0.0588,
0,
0.66,
0.5,
47,
0,
1,
0,
0,
47,
0,
0
],
[
3,
0,
0.6471,
0.7647,
0,
0.66,... | [
"from django.contrib.auth.models import User",
"from .base import SitemapTestsBase",
"class GenericViewsSitemapTests(SitemapTestsBase):\n\n def test_generic_sitemap(self):\n \"A minimal generic sitemap can be rendered\"\n response = self.client.get('/generic/sitemap.xml')\n expected = ''... |
from datetime import datetime
from django.conf.urls import patterns, url
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap, views
from django.contrib.auth.models import User
from django.views.decorators.cache import cache_page
class SimpleSitemap(Sitemap):
changefreq = "never"
priori... | [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0465,
0.0233,
0,
0.66,
0.1111,
528,
0,
2,
0,
0,
528,
0,
0
],
[
1,
0,
0.0698,
0.0233,
0,
... | [
"from datetime import datetime",
"from django.conf.urls import patterns, url",
"from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap, views",
"from django.contrib.auth.models import User",
"from django.views.decorators.cache import cache_page",
"class SimpleSitemap(Sitemap):\n c... |
from django.conf.urls import patterns
from .http import SimpleSitemap
class HTTPSSitemap(SimpleSitemap):
protocol = 'https'
secure_sitemaps = {
'simple': HTTPSSitemap,
}
urlpatterns = patterns('django.contrib.sitemaps.views',
(r'^secure/index\.xml$', 'index', {'sitemaps': secure_sitemaps}),
(r'^secu... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
528,
0,
1,
0,
0,
528,
0,
0
],
[
1,
0,
0.1875,
0.0625,
0,
0.66,
0.25,
415,
0,
1,
0,
0,
415,
0,
0
],
[
3,
0,
0.3438,
0.125,
0,
0.6... | [
"from django.conf.urls import patterns",
"from .http import SimpleSitemap",
"class HTTPSSitemap(SimpleSitemap):\n protocol = 'https'",
" protocol = 'https'",
"secure_sitemaps = {\n 'simple': HTTPSSitemap,\n}",
"urlpatterns = patterns('django.contrib.sitemaps.views',\n (r'^secure/index\\.xml$',... |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.test import TestCase
class SitemapTestsBase(TestCase):
protocol = 'http'
domain = 'example.com' if Site._meta.installed else 'testserver'
urls = 'django.contrib.... | [
[
1,
0,
0.0357,
0.0357,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1071,
0.0357,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1429,
0.0357,
0,
0.6... | [
"import os",
"from django.conf import settings",
"from django.contrib.auth.models import User",
"from django.contrib.sites.models import Site",
"from django.test import TestCase",
"class SitemapTestsBase(TestCase):\n protocol = 'http'\n domain = 'example.com' if Site._meta.installed else 'testserver... |
from .flatpages import FlatpagesSitemapTests
from .generic import GenericViewsSitemapTests
from .http import HTTPSitemapTests
from .https import HTTPSSitemapTests, HTTPSDetectionSitemapTests
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
564,
0,
1,
0,
0,
564,
0,
0
],
[
1,
0,
0.5,
0.25,
0,
0.66,
0.3333,
416,
0,
1,
0,
0,
416,
0,
0
],
[
1,
0,
0.75,
0.25,
0,
0.66,
0.6... | [
"from .flatpages import FlatpagesSitemapTests",
"from .generic import GenericViewsSitemapTests",
"from .http import HTTPSitemapTests",
"from .https import HTTPSSitemapTests, HTTPSDetectionSitemapTests"
] |
from django.conf import settings
from django.utils.unittest import skipUnless
from .base import SitemapTestsBase
class FlatpagesSitemapTests(SitemapTestsBase):
@skipUnless("django.contrib.flatpages" in settings.INSTALLED_APPS,
"django.contrib.flatpages app not installed.")
def test_flatpage_s... | [
[
1,
0,
0.027,
0.027,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0541,
0.027,
0,
0.66,
0.3333,
270,
0,
1,
0,
0,
270,
0,
0
],
[
1,
0,
0.1081,
0.027,
0,
0.66... | [
"from django.conf import settings",
"from django.utils.unittest import skipUnless",
"from .base import SitemapTestsBase",
"class FlatpagesSitemapTests(SitemapTestsBase):\n\n @skipUnless(\"django.contrib.flatpages\" in settings.INSTALLED_APPS,\n \"django.contrib.flatpages app not installed.\"... |
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.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.http import Http404
from django.template.response import TemplateResponse
def index(request, sitemaps,
template_name='sitemap_index.xml', mim... | [
[
1,
0,
0.0189,
0.0189,
0,
0.66,
0,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0377,
0.0189,
0,
0.66,
0.1667,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.0566,
0.0189,
0,
... | [
"from django.contrib.sites.models import get_current_site",
"from django.core import urlresolvers",
"from django.core.paginator import EmptyPage, PageNotAnInteger",
"from django.http import Http404",
"from django.template.response import TemplateResponse",
"def index(request, sitemaps,\n template... |
from django.contrib.sites.models import Site
from django.core import urlresolvers, paginator
from django.core.exceptions import ImproperlyConfigured
import urllib
PING_URL = "http://www.google.com/webmasters/tools/ping"
class SitemapNotFound(Exception):
pass
def ping_google(sitemap_url=None, ping_url=PING_URL):
... | [
[
1,
0,
0.0083,
0.0083,
0,
0.66,
0,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0167,
0.0083,
0,
0.66,
0.1111,
913,
0,
2,
0,
0,
913,
0,
0
],
[
1,
0,
0.025,
0.0083,
0,
0... | [
"from django.contrib.sites.models import Site",
"from django.core import urlresolvers, paginator",
"from django.core.exceptions import ImproperlyConfigured",
"import urllib",
"PING_URL = \"http://www.google.com/webmasters/tools/ping\"",
"class SitemapNotFound(Exception):\n pass",
"def ping_google(sit... |
from django.contrib.messages.storage.base import BaseStorage
from django.contrib.messages.storage.cookie import CookieStorage
from django.contrib.messages.storage.session import SessionStorage
class FallbackStorage(BaseStorage):
"""
Tries to store all messages in the first backend, storing any unstored
mes... | [
[
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'), "The sessi... | [
[
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.56,
... | [
"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.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils import simplejson as json
from django.utils.crypto import salted_hmac, constant_time_compare
class MessageEncoder(json.JSONEncoder):
"""
Compactly seria... | [
[
1,
0,
0.0066,
0.0066,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0132,
0.0066,
0,
0.66,
0.1429,
63,
0,
2,
0,
0,
63,
0,
0
],
[
1,
0,
0.0199,
0.0066,
0,
0.... | [
"from django.conf import settings",
"from django.contrib.messages.storage.base import BaseStorage, Message",
"from django.http import SimpleCookie",
"from django.utils import simplejson as json",
"from django.utils.crypto import salted_hmac, constant_time_compare",
"class MessageEncoder(json.JSONEncoder):... |
from django.conf import settings
from django.utils.encoding import force_unicode, StrAndUnicode
from django.contrib.messages import constants, utils
LEVEL_TAGS = utils.get_level_tags()
class Message(StrAndUnicode):
"""
Represents an actual message that can be stored in any of the supported
storage class... | [
[
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... |
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.13,
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.message... | [
[
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.session[stora... | [
[
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.test.utils import override_settings
from djang... | [
[
1,
0,
0.0074,
0.0074,
0,
0.66,
0,
698,
0,
1,
0,
0,
698,
0,
0
],
[
1,
0,
0.0148,
0.0074,
0,
0.66,
0.1111,
377,
0,
1,
0,
0,
377,
0,
0
],
[
1,
0,
0.0259,
0.0148,
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 Message",
"from django.test.utils import ov... |
from django.conf.urls import patterns
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext, Template
from django.template.response import TemplateResponse
from django.views.decorators.cache ... | [
[
1,
0,
0.0175,
0.0175,
0,
0.66,
0,
528,
0,
1,
0,
0,
528,
0,
0
],
[
1,
0,
0.0351,
0.0175,
0,
0.66,
0.0833,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0526,
0.0175,
0,
... | [
"from django.conf.urls import patterns",
"from django.contrib import messages",
"from django.core.urlresolvers import reverse",
"from django.http import HttpResponseRedirect, HttpResponse",
"from django.template import RequestContext, Template",
"from django.template.response import TemplateResponse",
"... |
from django import http
from django.contrib.messages.middleware import MessageMiddleware
from django.utils import unittest
class MiddlewareTest(unittest.TestCase):
def setUp(self):
self.middleware = MessageMiddleware()
def test_response_without_messages(self):
"""
Makes sure that the... | [
[
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 \"\"\"\... |
from django import http
from django.conf import settings
from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.storage import default_storage, base
from django.contrib.messages.storage.base import Message
from djang... | [
[
1,
0,
0.0027,
0.0027,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0054,
0.0027,
0,
0.66,
0.0714,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0082,
0.0027,
0,
... | [
"from django import http",
"from django.conf import settings",
"from django.contrib.messages import constants, utils, get_level, set_level",
"from django.contrib.messages.api import MessageFailure",
"from django.contrib.messages.storage import default_storage, base",
"from django.contrib.messages.storage.... |
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
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
410,
0,
1,
0,
0,
410,
0,
0
],
[
1,
0,
0.5,
0.25,
0,
0.66,
0.3333,
249,
0,
1,
0,
0,
249,
0,
0
],
[
1,
0,
0.75,
0.25,
0,
0.66,
0.6... | [
"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"
] |
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_response(self, re... | [
[
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 __future__ import absolute_import
from django.contrib.messages.api import *
from django.contrib.messages.constants import *
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.75,
0.25,
0,
0.66,
0.5,
488,
0,
1,
0,
0,
488,
0,
0
],
[
1,
0,
1,
0.25,
0,
0.66,
1,
8... | [
"from __future__ import absolute_import",
"from django.contrib.messages.api import *",
"from django.contrib.messages.constants import *"
] |
from django.contrib.messages import constants
from django.contrib.messages.storage import default_storage
__all__ = (
'add_message', 'get_messages',
'get_level', 'set_level',
'debug', 'info', 'success', 'warning', 'error',
)
class MessageFailure(Exception):
pass
def add_message(request, level, mess... | [
[
1,
0,
0.0098,
0.0098,
0,
0.66,
0,
698,
0,
1,
0,
0,
698,
0,
0
],
[
1,
0,
0.0196,
0.0098,
0,
0.66,
0.0833,
512,
0,
1,
0,
0,
512,
0,
0
],
[
14,
0,
0.0588,
0.049,
0,
... | [
"from django.contrib.messages import constants",
"from django.contrib.messages.storage import default_storage",
"__all__ = (\n 'add_message', 'get_messages',\n 'get_level', 'set_level',\n 'debug', 'info', 'success', 'warning', 'error',\n)",
"class MessageFailure(Exception):\n pass",
"def add_mes... |
from __future__ import absolute_import
from django import template
from django.conf import settings
from django.contrib import comments
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirec... | [
[
1,
0,
0.0062,
0.0062,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0185,
0.0062,
0,
0.66,
0.0588,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0247,
0.0062,
0,
... | [
"from __future__ import absolute_import",
"from django import template",
"from django.conf import settings",
"from django.contrib import comments",
"from django.contrib.auth.decorators import login_required, permission_required",
"from django.contrib.comments import signals",
"from django.contrib.commen... |
"""
A few bits of helper functions for comment views.
"""
import urllib
import textwrap
from django.core import urlresolvers
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist
from... | [
[
8,
0,
0.0299,
0.0448,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0746,
0.0149,
0,
0.66,
0.0909,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0896,
0.0149,
0,
0.66... | [
"\"\"\"\nA few bits of helper functions for comment views.\n\"\"\"",
"import urllib",
"import textwrap",
"from django.core import urlresolvers",
"from django.http import HttpResponseRedirect",
"from django.shortcuts import render_to_response",
"from django.template import RequestContext",
"from django... |
from __future__ import absolute_import
from django import http
from django.conf import settings
from django.contrib import comments
from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist, Validat... | [
[
1,
0,
0.0074,
0.0074,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0221,
0.0074,
0,
0.66,
0.0625,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0294,
0.0074,
0,
... | [
"from __future__ import absolute_import",
"from django import http",
"from django.conf import settings",
"from django.contrib import comments",
"from django.contrib.comments import signals",
"from django.contrib.comments.views.utils import next_redirect, confirmation_view",
"from django.core.exceptions ... |
import time
from django import forms
from django.forms.util import ErrorDict
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.comments.models import Comment
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.encoding import... | [
[
1,
0,
0.0052,
0.0052,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0103,
0.0052,
0,
0.66,
0.0714,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0155,
0.0052,
0,
... | [
"import time",
"from django import forms",
"from django.forms.util import ErrorDict",
"from django.conf import settings",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib.comments.models import Comment",
"from django.utils.crypto import salted_hmac, constant_time_compar... |
from django.contrib.auth.models import User
from django.contrib.comments.managers import CommentManager
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django.core import urlresolver... | [
[
1,
0,
0.0052,
0.0052,
0,
0.66,
0,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0105,
0.0052,
0,
0.66,
0.0769,
87,
0,
1,
0,
0,
87,
0,
0
],
[
1,
0,
0.0157,
0.0052,
0,
0.... | [
"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",
"... |
"""
A generic comment-moderation system which allows configuration of
moderation options on a per-model basis.
To use, do two things:
1. Create or import a subclass of ``CommentModerator`` defining the
options you want.
2. Import ``moderator`` from this module and register one or more
models, passing the model... | [
[
8,
0,
0.0787,
0.1545,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1601,
0.0028,
0,
0.66,
0.0714,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.1657,
0.0028,
0,
0.66... | [
"\"\"\"\nA generic comment-moderation system which allows configuration of\nmoderation options on a per-model basis.\n\nTo use, do two things:\n\n1. Create or import a subclass of ``CommentModerator`` defining the\n options you want.",
"import datetime",
"from django.conf import settings",
"from django.core... |
"""
Signals relating to comments.
"""
from django.dispatch import Signal
# Sent just before a comment will be posted (after it's been approved and
# moderated; this can be used to modify the comment (in place) with posting
# details or other such actions. If any receiver returns False the comment will be
# discarded a... | [
[
8,
0,
0.0952,
0.1429,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1905,
0.0476,
0,
0.66,
0.25,
548,
0,
1,
0,
0,
548,
0,
0
],
[
14,
0,
0.5714,
0.0476,
0,
0.66,... | [
"\"\"\"\nSignals relating to comments.\n\"\"\"",
"from django.dispatch import Signal",
"comment_will_be_posted = Signal(providing_args=[\"comment\", \"request\"])",
"comment_was_posted = Signal(providing_args=[\"comment\", \"request\"])",
"comment_was_flagged = Signal(providing_args=[\"comment\", \"flag\", ... |
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
from django.utils.translation import ugettext as _
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def title(sel... | [
[
1,
0,
0.0294,
0.0294,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0588,
0.0294,
0,
0.66,
0.2,
264,
0,
1,
0,
0,
264,
0,
0
],
[
1,
0,
0.0882,
0.0294,
0,
0.6... | [
"from django.conf import settings",
"from django.contrib.syndication.views import Feed",
"from django.contrib.sites.models import Site",
"from django.contrib import comments",
"from django.utils.translation import ugettext as _",
"class LatestCommentFeed(Feed):\n \"\"\"Feed of latest comments on the cu... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_unicode
class CommentManager(models.Manager):
def in_moderation(self):
"""
QuerySet for all comments currently in the moderation queue.
"""
return self.ge... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0909,
0.0455,
0,
0.66,
0.3333,
469,
0,
1,
0,
0,
469,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.... | [
"from django.db import models",
"from django.contrib.contenttypes.models import ContentType",
"from django.utils.encoding import force_unicode",
"class CommentManager(models.Manager):\n\n def in_moderation(self):\n \"\"\"\n QuerySet for all comments currently in the moderation queue.\n ... |
from django.conf.urls import patterns, url
urlpatterns = patterns('django.contrib.comments.views',
url(r'^post/$', 'comments.post_comment', name='comments-post-comment'),
url(r'^posted/$', 'comments.comment_done', name='comments-comment-done'),
url(r'^flag/(\d+)/$', 'moderati... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
528,
0,
2,
0,
0,
528,
0,
0
],
[
14,
0,
0.4688,
0.625,
0,
0.66,
1,
990,
3,
9,
0,
0,
75,
10,
9
]
] | [
"from django.conf.urls import patterns, url",
"urlpatterns = patterns('django.contrib.comments.views',\n url(r'^post/$', 'comments.post_comment', name='comments-post-comment'),\n url(r'^posted/$', 'comments.comment_done', name='comments-comment-done'),\n url(r'^flag/(\\d+)/$',... |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib import comments
from django.utils.encoding import smart_unicode
register = template.Library()
class BaseCommentNode(template.N... | [
[
1,
0,
0.003,
0.003,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.006,
0.003,
0,
0.66,
0.0526,
970,
0,
1,
0,
0,
970,
0,
0
],
[
1,
0,
0.009,
0.003,
0,
0.66,
... | [
"from django import template",
"from django.template.loader import render_to_string",
"from django.conf import settings",
"from django.contrib.contenttypes.models import ContentType",
"from django.contrib import comments",
"from django.utils.encoding import smart_unicode",
"register = template.Library()... |
from django.contrib import admin
from django.contrib.comments.models import Comment
from django.utils.translation import ugettext_lazy as _, ungettext
from django.contrib.comments import get_model
from django.contrib.comments.views.moderation import perform_flag, perform_approve, perform_delete
class CommentsAdmin(adm... | [
[
1,
0,
0.0137,
0.0137,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0274,
0.0137,
0,
0.66,
0.1667,
418,
0,
1,
0,
0,
418,
0,
0
],
[
1,
0,
0.0411,
0.0137,
0,
... | [
"from django.contrib import admin",
"from django.contrib.comments.models import Comment",
"from django.utils.translation import ugettext_lazy as _, ungettext",
"from django.contrib.comments import get_model",
"from django.contrib.comments.views.moderation import perform_flag, perform_approve, perform_delete... |
from django.conf import settings
from django.core import urlresolvers
from django.core.exceptions import ImproperlyConfigured
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
from django.utils.importlib import import_module
DEFAULT_COMMENTS_APP = 'django.contrib.... | [
[
1,
0,
0.011,
0.011,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.022,
0.011,
0,
0.66,
0.0714,
913,
0,
1,
0,
0,
913,
0,
0
],
[
1,
0,
0.033,
0.011,
0,
0.66,
... | [
"from django.conf import settings",
"from django.core import urlresolvers",
"from django.core.exceptions import ImproperlyConfigured",
"from django.contrib.comments.models import Comment",
"from django.contrib.comments.forms import CommentForm",
"from django.utils.importlib import import_module",
"DEFAU... |
"""
Create a superuser from the command line. Deprecated; use manage.py
createsuperuser instead.
"""
if __name__ == "__main__":
from django.core.management import call_command
call_command("createsuperuser")
| [
[
8,
0,
0.3125,
0.5,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
4,
0,
0.875,
0.375,
0,
0.66,
1,
0,
0,
0,
0,
0,
0,
0,
1
],
[
1,
1,
0.875,
0.125,
1,
0.86,
0,
879... | [
"\"\"\"\nCreate a superuser from the command line. Deprecated; use manage.py\ncreatesuperuser instead.\n\"\"\"",
"if __name__ == \"__main__\":\n from django.core.management import call_command\n call_command(\"createsuperuser\")",
" from django.core.management import call_command",
" call_command(... |
from django import forms
from django.forms.util import flatatt
from django.template import loader
from django.utils.encoding import smart_str
from django.utils.http import int_to_base36
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext, ugettext_lazy as _
from django.contrib.a... | [
[
1,
0,
0.003,
0.003,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.006,
0.003,
0,
0.66,
0.0435,
332,
0,
1,
0,
0,
332,
0,
0
],
[
1,
0,
0.009,
0.003,
0,
0.66,
... | [
"from django import forms",
"from django.forms.util import flatatt",
"from django.template import loader",
"from django.utils.encoding import smart_str",
"from django.utils.http import int_to_base36",
"from django.utils.safestring import mark_safe",
"from django.utils.translation import ugettext, ugette... |
# PermWrapper and PermLookupDict proxy the permissions system into objects that
# the template system can understand.
class PermLookupDict(object):
def __init__(self, user, module_name):
self.user, self.module_name = user, module_name
def __repr__(self):
return str(self.user.get_all_permission... | [
[
3,
0,
0.2353,
0.3333,
0,
0.66,
0,
495,
0,
5,
0,
0,
186,
0,
5
],
[
2,
1,
0.1078,
0.0392,
1,
0.17,
0,
555,
0,
3,
0,
0,
0,
0,
0
],
[
14,
2,
0.1176,
0.0196,
2,
0.62,
... | [
"class PermLookupDict(object):\n def __init__(self, user, module_name):\n self.user, self.module_name = user, module_name\n\n def __repr__(self):\n return str(self.user.get_all_permissions())\n\n def __getitem__(self, perm_name):",
" def __init__(self, user, module_name):\n self.u... |
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
supports_inactive_user = True
# TODO: Model, login attribute name and password attribute name should be
# configurable.
def authenticate(self,... | [
[
1,
0,
0.008,
0.008,
0,
0.66,
0,
808,
0,
2,
0,
0,
808,
0,
0
],
[
3,
0,
0.272,
0.488,
0,
0.66,
0.5,
392,
0,
6,
0,
0,
186,
0,
21
],
[
8,
1,
0.048,
0.024,
1,
0.96,
... | [
"from django.contrib.auth.models import User, Permission",
"class ModelBackend(object):\n \"\"\"\n Authenticates against django.contrib.auth.models.User.\n \"\"\"\n supports_inactive_user = True\n\n # TODO: Model, login attribute name and password attribute name should be\n # configurable.",
"... |
import urllib
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import send_mail
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.crypto import get_random_string
from django.utils.encoding import smart_str
from django.utils.translation import ... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0063,
0.0021,
0,
0.66,
0.04,
160,
0,
1,
0,
0,
160,
0,
0
],
[
1,
0,
0.0084,
0.0021,
0,
0.... | [
"import urllib",
"from django.core.exceptions import ImproperlyConfigured",
"from django.core.mail import send_mail",
"from django.db import models",
"from django.db.models.manager import EmptyManager",
"from django.utils.crypto import get_random_string",
"from django.utils.encoding import smart_str",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.