code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
"""
UK-specific Form helpers
"""
from django.forms.fields import Select
class IECountySelect(Select):
"""
A Select widget that uses a list of Irish Counties as its choices.
"""
def __init__(self, attrs=None):
from ie_counties import IE_COUNTY_CHOICES
super(IECountySelect, self).__init_... | [
[
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')),
('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... |
# -*- coding: utf-8 -*-
"""
Romanian specific form helpers.
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError, Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
class ROCIFField(RegexField):
"""
A Romanian fiscal identity co... | [
[
8,
0,
0.0146,
0.0146,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0291,
0.0049,
0,
0.66,
0.0909,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0388,
0.0049,
0,
0.66... | [
"\"\"\"\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'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
"""
import re
from django.forms import ValidationError
from django.forms.fields import Select, RegexField
from django.utils.translation import ugettext_lazy as _
from django.core.validators import EMPTY_VALUES
class PLProvinceSelect(Select):
"""
A select widget with list of P... | [
[
8,
0,
0.0125,
0.0187,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0312,
0.0063,
0,
0.66,
0.0909,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0437,
0.0063,
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 _",
"from django.core.validators import EMPTY_VALUES",
"class PLProvinceSelect(Select):\n ... |
"""
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'... |
# -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
import re
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.localflavor.uy.util import get_vali... | [
[
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'),
('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.03,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.4167,
0.0833,
1,
0.03,
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):
"""
A Select wi... | [
[
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'),
('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 django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits... | [
[
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__(self, *arg... | [
[
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', 'Alaska'),
... | [
[
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_re = re.compil... | [
[
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... |
from django.utils.translation import ugettext_lazy as _
# Reference: http://id.wikipedia.org/wiki/Daftar_provinsi_Indonesia
# Indonesia does not have an official Province code standard.
# I decided to use unambiguous and consistent (some are common) 3-letter codes.
PROVINCE_CHOICES = (
('BLI', _('Bali')),
('... | [
[
1,
0,
0.0099,
0.0099,
0,
0.66,
0,
389,
0,
1,
0,
0,
389,
0,
0
],
[
14,
0,
0.2475,
0.3465,
0,
0.66,
0.5,
540,
0,
0,
0,
0,
0,
8,
33
],
[
14,
0,
0.7178,
0.5743,
0,
0.... | [
"from django.utils.translation import ugettext_lazy as _",
"PROVINCE_CHOICES = (\n ('BLI', _('Bali')),\n ('BTN', _('Banten')),\n ('BKL', _('Bengkulu')),\n ('DIY', _('Yogyakarta')),\n ('JKT', _('Jakarta')),\n ('GOR', _('Gorontalo')),\n ('JMB', _('Jambi')),",
"LICENSE_PLATE_PREFIX_CHOICES = (... |
"""
Canada-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re... | [
[
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 explici... | [
[
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.compile(r"... | [
[
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):
default_error_mes... | [
[
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-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 ... |
from django.middleware.csrf import CsrfMiddleware, CsrfViewMiddleware, CsrfResponseMiddleware
from django.views.decorators.csrf import csrf_exempt, csrf_view_exempt, csrf_response_exempt
import warnings
warnings.warn("This import for CSRF functionality is deprecated. Please use django.middleware.csrf for the middlewa... | [
[
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.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 ... |
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.test import TestCase
class FlatpageMiddlewareTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES
flatpage_middleware_c... | [
[
1,
0,
0.0169,
0.0169,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0339,
0.0169,
0,
0.66,
0.3333,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0508,
0.0169,
0,
... | [
"import os",
"from django.conf import settings",
"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_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES\n ... |
import os
from django.conf import settings
from django.test import TestCase, Client
class FlatpageCSRFTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.client = Client(enforce_csrf_checks=True)
self.old_MIDDLEWARE_CLASSES = ... | [
[
1,
0,
0.0137,
0.0137,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0274,
0.0137,
0,
0.66,
0.3333,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0411,
0.0137,
0,
... | [
"import os",
"from django.conf import settings",
"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 = Client(enforce_csrf_checks=True)\n self.... |
import os
from django.conf import settings
from django.test import TestCase
class FlatpageViewTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES
flatpage_middleware_class =... | [
[
1,
0,
0.0189,
0.0189,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0377,
0.0189,
0,
0.66,
0.3333,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0566,
0.0189,
0,
... | [
"import os",
"from django.conf import settings",
"from django.test import TestCase",
"class FlatpageViewTests(TestCase):\n fixtures = ['sample_flatpages']\n urls = 'django.contrib.flatpages.tests.urls'\n\n def setUp(self):\n self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES\n fl... |
from django.contrib.flatpages.tests.csrf import *
from django.contrib.flatpages.tests.middleware import *
from django.contrib.flatpages.tests.views import *
| [
[
1,
0,
0.3333,
0.3333,
0,
0.66,
0,
500,
0,
1,
0,
0,
500,
0,
0
],
[
1,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
466,
0,
1,
0,
0,
466,
0,
0
],
[
1,
0,
1,
0.3333,
0,
0.66,
... | [
"from django.contrib.flatpages.tests.csrf import *",
"from django.contrib.flatpages.tests.middleware 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 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 forms
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/]+$',
help_text = _("Example: '/a... | [
[
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.safestri... | [
[
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.formats import locali... | [
[
1,
0,
0.0078,
0.0078,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0155,
0.0078,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0233,
0.0078,
0,
... | [
"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 = datetime.now... | [
[
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):
curr... | [
[
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_url=None, pi... | [
[
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
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.13,
... | [
"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, '... |
import hmac
from django.conf import settings
from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import CompatCookie
from django.utils import simplejson as json
from django.utils.hashcompat import sha_hmac
class MessageEncoder(json.JSON... | [
[
1,
0,
0.0066,
0.0066,
0,
0.66,
0,
993,
0,
1,
0,
0,
993,
0,
0
],
[
1,
0,
0.0197,
0.0066,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0263,
0.0066,
0,
... | [
"import hmac",
"from django.conf import settings",
"from django.contrib.messages import constants",
"from django.contrib.messages.storage.base import BaseStorage, Message",
"from django.http import CompatCookie",
"from django.utils import simplejson as json",
"from django.utils.hashcompat import sha_hma... |
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... |
"""
Storages used to assist in the deprecation of contrib.auth User messages.
"""
from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.contrib.auth.models import User
from django.contrib.messages.storage.fallback import FallbackStorage
class ... | [
[
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.9,
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.utils ... | [
[
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 ... |
import unittest
from django import http
from django.contrib.messages.middleware import MessageMiddleware
class MiddlewareTest(unittest.TestCase):
def setUp(self):
self.middleware = MessageMiddleware()
def test_response_without_messages(self):
"""
Makes sure that the response middlewa... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.1111,
0.0556,
0,
0.66,
0.3333,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.1667,
0.0556,
0,
0.... | [
"import unittest",
"from django import http",
"from django.contrib.messages.middleware import MessageMiddleware",
"class MiddlewareTest(unittest.TestCase):\n\n def setUp(self):\n self.middleware = MessageMiddleware()\n\n def test_response_without_messages(self):\n \"\"\"\n Makes sur... |
from django import http
from django.test import TestCase
from django.conf import settings
from django.utils.translation import ugettext_lazy
from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.storage import defau... | [
[
1,
0,
0.0025,
0.0025,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0049,
0.0025,
0,
0.66,
0.0909,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0074,
0.0025,
0,
... | [
"from django import http",
"from django.test import TestCase",
"from django.conf import settings",
"from django.utils.translation import ugettext_lazy",
"from django.contrib.messages import constants, utils, get_level, set_level",
"from django.contrib.messages.api import MessageFailure",
"from django.co... |
from django import http
from django.contrib.auth.models import User
from django.contrib.messages.storage.user_messages import UserMessagesStorage,\
LegacyFallbackStorage
from django.contrib.messages.tests.cookie import set_cookie_data
from django.contrib.messages.tests.fallback import FallbackTest
from django.test ... | [
[
1,
0,
0.0154,
0.0154,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
1,
0,
0.0308,
0.0154,
0,
0.66,
0.1429,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0538,
0.0308,
0,
... | [
"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.cookie import set_cookie_data",
"from django.contrib.messages.tests.fallback import Fal... |
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_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 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 MessageFailure(Exception... | [
[
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.commen... | [
[
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 ObjectDoesNotExist
from... | [
[
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.template.... | [
[
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.encoding import force_unicode
from django.utils.hashcompat import sha_constructor
from dj... | [
[
1,
0,
0.0053,
0.0053,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0105,
0.0053,
0,
0.66,
0.0714,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0211,
0.0053,
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.encoding import force_unicode",
"from django.uti... |
import datetime
from django.contrib.auth.models import User
from django.contrib.comments.managers import CommentManager
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.db import models
from django.core im... | [
[
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... |
"""
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.0793,
0.1558,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1615,
0.0028,
0,
0.66,
0.0769,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.1671,
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.0263,
0.0263,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0526,
0.0263,
0,
0.66,
0.2,
264,
0,
1,
0,
0,
264,
0,
0
],
[
1,
0,
0.0789,
0.0263,
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.defaults import *
urlpatterns = patterns('django.contrib.comments.views',
url(r'^post/$', 'comments.post_comment', name='comments-post-comment'),
url(r'^posted/$', 'comments.comment_done', name='comments-comment-done'),
url(r'^flag/(\d+)/$', 'moderation.... | [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.4688,
0.625,
0,
0.66,
1,
990,
3,
9,
0,
0,
75,
10,
9
]
] | [
"from django.conf.urls.defaults import *",
"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.0385,
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.82,
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.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site
from django.template import Context, loader
from django import forms
from django.utils.translation import ugett... | [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0093,
0.0047,
0,
0.66,
0.0667,
895,
0,
1,
0,
0,
895,
0,
0
],
[
1,
0,
0.014,
0.0047,
0,
0... | [
"from django.contrib.auth.models import User",
"from django.contrib.auth import authenticate",
"from django.contrib.auth.tokens import default_token_generator",
"from django.contrib.sites.models import get_current_site",
"from django.template import Context, loader",
"from django import forms",
"from dj... |
from django.core.context_processors import PermWrapper
from django.utils.functional import lazy, memoize, SimpleLazyObject
from django.contrib import messages
def auth(request):
"""
Returns context variables required by apps that use Django's authentication
system.
If there is no 'user' attribute in t... | [
[
1,
0,
0.0303,
0.0303,
0,
0.66,
0,
55,
0,
1,
0,
0,
55,
0,
0
],
[
1,
0,
0.0606,
0.0303,
0,
0.66,
0.3333,
375,
0,
3,
0,
0,
375,
0,
0
],
[
1,
0,
0.0909,
0.0303,
0,
0.... | [
"from django.core.context_processors import PermWrapper",
"from django.utils.functional import lazy, memoize, SimpleLazyObject",
"from django.contrib import messages",
"def auth(request):\n \"\"\"\n Returns context variables required by apps that use Django's authentication\n system.\n\n If there ... |
from django.db import connection
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
supports_object_permissions = False
supports_anonymous_user = True
# TODO: Model, login attribute name and passwo... | [
[
1,
0,
0.0083,
0.0083,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0165,
0.0083,
0,
0.66,
0.3333,
808,
0,
2,
0,
0,
808,
0,
0
],
[
3,
0,
0.2686,
0.4628,
0,
0.... | [
"from django.db import connection",
"from django.contrib.auth.models import User, Permission",
"class ModelBackend(object):\n \"\"\"\n Authenticates against django.contrib.auth.models.User.\n \"\"\"\n supports_object_permissions = False\n supports_anonymous_user = True\n\n # TODO: Model, login... |
import datetime
import urllib
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.manager import EmptyManager
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import smart_str
from django.utils.h... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0042,
0.0021,
0,
0.66,
0.0435,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0084,
0.0021,
0,
... | [
"import datetime",
"import urllib",
"from django.contrib import auth",
"from django.core.exceptions import ImproperlyConfigured",
"from django.db import models",
"from django.db.models.manager import EmptyManager",
"from django.contrib.contenttypes.models import ContentType",
"from django.utils.encodi... |
from mod_python import apache
import os
def authenhandler(req, **kwargs):
"""
Authentication handler that checks against Django's auth database.
"""
# mod_python fakes the environ, and thus doesn't process SetEnv. This fixes
# that so that the following import works
os.environ.update(req.subp... | [
[
1,
0,
0.0179,
0.0179,
0,
0.66,
0,
889,
0,
1,
0,
0,
889,
0,
0
],
[
1,
0,
0.0357,
0.0179,
0,
0.66,
0.5,
688,
0,
1,
0,
0,
688,
0,
0
],
[
2,
0,
0.5357,
0.9464,
0,
0.6... | [
"from mod_python import apache",
"import os",
"def authenhandler(req, **kwargs):\n \"\"\"\n Authentication handler that checks against Django's auth database.\n \"\"\"\n\n # mod_python fakes the environ, and thus doesn't process SetEnv. This fixes\n # that so that the following import works\n ... |
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib... | [
[
1,
0,
0.0036,
0.0036,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0072,
0.0036,
0,
0.66,
0.0769,
808,
0,
4,
0,
0,
808,
0,
0
],
[
1,
0,
0.0109,
0.0036,
0,
... | [
"from django.conf import settings",
"from django.contrib.auth.models import User, Group, Permission, AnonymousUser",
"from django.contrib.contenttypes.models import ContentType",
"from django.core.exceptions import ImproperlyConfigured",
"from django.test import TestCase",
"class BackendTest(TestCase):\n\... |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
from django.test import TestCase
class UserCreationFormTest(TestCase):
fixtures = ['authtestdata.json']
def test_use... | [
[
1,
0,
0.004,
0.004,
0,
0.66,
0,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0079,
0.004,
0,
0.66,
0.125,
579,
0,
6,
0,
0,
579,
0,
0
],
[
1,
0,
0.0119,
0.004,
0,
0.66,... | [
"from django.contrib.auth.models import User",
"from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm",
"from django.test import TestCase",
"class UserCreationFormTest(TestCase):\n\n fixtures = ['authtestdata.json... |
from django.conf import settings
from django.test import TestCase
from django.contrib.auth.models import User, SiteProfileNotAvailable
class ProfileTestCase(TestCase):
fixtures = ['authtestdata.json']
def setUp(self):
"""Backs up the AUTH_PROFILE_MODULE"""
self.old_AUTH_PROFILE_MODULE = getattr... | [
[
1,
0,
0.0286,
0.0286,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0571,
0.0286,
0,
0.66,
0.3333,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0857,
0.0286,
0,
... | [
"from django.conf import settings",
"from django.test import TestCase",
"from django.contrib.auth.models import User, SiteProfileNotAvailable",
"class ProfileTestCase(TestCase):\n fixtures = ['authtestdata.json']\n def setUp(self):\n \"\"\"Backs up the AUTH_PROFILE_MODULE\"\"\"\n self.old_... |
from django.test import TestCase
from django.contrib.auth.models import User, AnonymousUser
from django.core.management import call_command
from StringIO import StringIO
class BasicTestCase(TestCase):
def test_user(self):
"Check that users can be created and can set their password"
u = User.objects... | [
[
1,
0,
0.0109,
0.0109,
0,
0.66,
0,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0217,
0.0109,
0,
0.66,
0.25,
808,
0,
2,
0,
0,
808,
0,
0
],
[
1,
0,
0.0326,
0.0109,
0,
0.... | [
"from django.test import TestCase",
"from django.contrib.auth.models import User, AnonymousUser",
"from django.core.management import call_command",
"from StringIO import StringIO",
"class BasicTestCase(TestCase):\n def test_user(self):\n \"Check that users can be created and can set their passwor... |
from django.conf.urls.defaults import patterns
from django.contrib.auth.urls import urlpatterns
from django.http import HttpResponse
from django.template import Template, RequestContext
def remote_user_auth_view(request):
"Dummy view for remote user tests"
t = Template("Username is {{ user }}.")
c = Reques... | [
[
1,
0,
0.0556,
0.0556,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.1111,
0.0556,
0,
0.66,
0.2,
410,
0,
1,
0,
0,
410,
0,
0
],
[
1,
0,
0.1667,
0.0556,
0,
0.6... | [
"from django.conf.urls.defaults import patterns",
"from django.contrib.auth.urls import urlpatterns",
"from django.http import HttpResponse",
"from django.template import Template, RequestContext",
"def remote_user_auth_view(request):\n \"Dummy view for remote user tests\"\n t = Template(\"Username is... |
from datetime import datetime
from django.conf import settings
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.models import User
from django.test import TestCase
class RemoteUserTest(TestCase):
urls = 'django.contrib.auth.tests.urls'
middleware = 'django.contrib.auth.mid... | [
[
1,
0,
0.0059,
0.0059,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0176,
0.0059,
0,
0.66,
0.1111,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0235,
0.0059,
0,
... | [
"from datetime import datetime",
"from django.conf import settings",
"from django.contrib.auth.backends import RemoteUserBackend",
"from django.contrib.auth.models import User",
"from django.test import TestCase",
"class RemoteUserTest(TestCase):\n\n urls = 'django.contrib.auth.tests.urls'\n middlew... |
from unittest import TestCase
from django.contrib.auth.decorators import login_required
class LoginRequiredTestCase(TestCase):
"""
Tests the login_required decorators
"""
def testCallable(self):
"""
Check that login_required is assignable to callable objects.
"""
class... | [
[
1,
0,
0.04,
0.04,
0,
0.66,
0,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.12,
0.04,
0,
0.66,
0.5,
885,
0,
1,
0,
0,
885,
0,
0
],
[
3,
0,
0.62,
0.8,
0,
0.66,
1,
2... | [
"from unittest import TestCase",
"from django.contrib.auth.decorators import login_required",
"class LoginRequiredTestCase(TestCase):\n \"\"\"\n Tests the login_required decorators\n \"\"\"\n def testCallable(self):\n \"\"\"\n Check that login_required is assignable to callable objects... |
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
class TokenGeneratorTest(TestCase):
def test_make_token(self):
"""
... | [
[
1,
0,
0.0159,
0.0159,
0,
0.66,
0,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.66,
0.2,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0635,
0.0159,
0,
0.6... | [
"from datetime import date, timedelta",
"from django.conf import settings",
"from django.contrib.auth.models import User, AnonymousUser",
"from django.contrib.auth.tokens import PasswordResetTokenGenerator",
"from django.test import TestCase",
"class TokenGeneratorTest(TestCase):\n\n def test_make_toke... |
import os
import re
import urllib
from django.conf import settings
from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import User
from django.test import Test... | [
[
1,
0,
0.0034,
0.0034,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0068,
0.0034,
0,
0.66,
0.0667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0102,
0.0034,
0,
... | [
"import os",
"import re",
"import urllib",
"from django.conf import settings",
"from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME",
"from django.contrib.auth.forms import AuthenticationForm",
"from django.contrib.sites.models import Site, RequestSite",
"from django.contrib.auth.models i... |
from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest, NoBackendsTest
from django.contrib.auth.tests.basic import BasicTestCase
from django.contrib.auth.tests.decorators import LoginRequiredTestCase
from django.contrib.auth.tests.forms... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
769,
0,
5,
0,
0,
769,
0,
0
],
[
1,
0,
0.1667,
0.0833,
0,
0.66,
0.1429,
879,
0,
1,
0,
0,
879,
0,
0
],
[
1,
0,
0.25,
0.0833,
0,
0.... | [
"from django.contrib.auth.tests.auth_backends import BackendTest, RowlevelBackendTest, AnonymousUserBackendTest, NoAnonymousUserBackendTest, NoBackendsTest",
"from django.contrib.auth.tests.basic import BasicTestCase",
"from django.contrib.auth.tests.decorators import LoginRequiredTestCase",
"from django.cont... |
# These URLs are normally mapped to /admin/urls.py. This URLs file is
# provided as a convenience to those who want to deploy these URLs elsewhere.
# This file is also used to provide a reliable view deployment for test purposes.
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^login/$', 'dj... | [
[
1,
0,
0.2941,
0.0588,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.6765,
0.5882,
0,
0.66,
1,
990,
3,
9,
0,
0,
75,
10,
1
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('',\n (r'^login/$', 'django.contrib.auth.views.login'),\n (r'^logout/$', 'django.contrib.auth.views.logout'),\n (r'^password_change/$', 'django.contrib.auth.views.password_change'),\n (r'^password_change/done/$', 'django.contrib.auth.v... |
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
class LazyUser(object):
def __get__(self, request, obj_type=None):
if not hasattr(request, '_cached_user'):
from django.contrib.auth import get_user
request._cached_user = get_user(request)
... | [
[
1,
0,
0.0123,
0.0123,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.0247,
0.0123,
0,
0.66,
0.25,
160,
0,
1,
0,
0,
160,
0,
0
],
[
3,
0,
0.0926,
0.0741,
0,
0.... | [
"from django.contrib import auth",
"from django.core.exceptions import ImproperlyConfigured",
"class LazyUser(object):\n def __get__(self, request, obj_type=None):\n if not hasattr(request, '_cached_user'):\n from django.contrib.auth import get_user\n request._cached_user = get_u... |
try:
from functools import update_wrapper, wraps
except ImportError:
from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
from django.utils.decorators import available_attrs
from django... | [
[
7,
0,
0.0481,
0.0769,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.0385,
0.0192,
1,
0.46,
0,
711,
0,
2,
0,
0,
711,
0,
0
],
[
1,
1,
0.0769,
0.0192,
1,
0.46,
... | [
"try:\n from functools import update_wrapper, wraps\nexcept ImportError:\n from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.",
" from functools import update_wrapper, wraps",
" from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.",
"from... |
from django.db import transaction
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AdminPasswordChangeForm
from django.contrib.auth.models import User, Group
from django.contrib import messages
from django.core.exceptions import Pe... | [
[
1,
0,
0.0065,
0.0065,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.0131,
0.0065,
0,
0.66,
0.0556,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0196,
0.0065,
0,
0.... | [
"from django.db import transaction",
"from django.conf import settings",
"from django.contrib import admin",
"from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AdminPasswordChangeForm",
"from django.contrib.auth.models import User, Group",
"from django.contrib import messages",
"fr... |
"""
Management utility to create superusers.
"""
import getpass
import re
import sys
from optparse import make_option
from django.contrib.auth.models import User
from django.core import exceptions
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
RE_V... | [
[
8,
0,
0.0147,
0.0221,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0368,
0.0074,
0,
0.66,
0.0833,
784,
0,
1,
0,
0,
784,
0,
0
],
[
1,
0,
0.0441,
0.0074,
0,
0.66... | [
"\"\"\"\nManagement utility to create superusers.\n\"\"\"",
"import getpass",
"import re",
"import sys",
"from optparse import make_option",
"from django.contrib.auth.models import User",
"from django.core import exceptions",
"from django.core.management.base import BaseCommand, CommandError",
"from... |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
import getpass
class Command(BaseCommand):
help = "Change a user's password for django.contrib.auth."
requires_model_validation = False
def _get_pass(self, prompt="Password: "):
p = getpa... | [
[
1,
0,
0.0208,
0.0208,
0,
0.66,
0,
931,
0,
2,
0,
0,
931,
0,
0
],
[
1,
0,
0.0417,
0.0208,
0,
0.66,
0.3333,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0625,
0.0208,
0,
... | [
"from django.core.management.base import BaseCommand, CommandError",
"from django.contrib.auth.models import User",
"import getpass",
"class Command(BaseCommand):\n help = \"Change a user's password for django.contrib.auth.\"\n\n requires_model_validation = False\n\n def _get_pass(self, prompt=\"Pass... |
"""
Creates permissions for all installed apps that need permissions.
"""
from django.db.models import get_models, signals
from django.contrib.auth import models as auth_app
def _get_permission_codename(action, opts):
return u'%s_%s' % (action, opts.object_name.lower())
def _get_all_permissions(opts):
"Retur... | [
[
8,
0,
0.04,
0.06,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1,
0.02,
0,
0.66,
0.125,
680,
0,
2,
0,
0,
680,
0,
0
],
[
1,
0,
0.12,
0.02,
0,
0.66,
0.25,
... | [
"\"\"\"\nCreates permissions for all installed apps that need permissions.\n\"\"\"",
"from django.db.models import get_models, signals",
"from django.contrib.auth import models as auth_app",
"def _get_permission_codename(action, opts):\n return u'%s_%s' % (action, opts.object_name.lower())",
" return ... |
from datetime import date
from django.conf import settings
from django.utils.http import int_to_base36, base36_to_int
class PasswordResetTokenGenerator(object):
"""
Strategy object used to generate and check tokens for the password
reset mechanism.
"""
def make_token(self, user):
"""
... | [
[
1,
0,
0.0152,
0.0152,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0303,
0.0152,
0,
0.66,
0.25,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0455,
0.0152,
0,
0.... | [
"from datetime import date",
"from django.conf import settings",
"from django.utils.http import int_to_base36, base36_to_int",
"class PasswordResetTokenGenerator(object):\n \"\"\"\n Strategy object used to generate and check tokens for the password\n reset mechanism.\n \"\"\"\n def make_token(s... |
import re
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
# Avoid shadowing the login() view below.
from django.contrib.auth import login as auth_login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.cont... | [
[
1,
0,
0.0053,
0.0053,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0106,
0.0053,
0,
0.66,
0.037,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.016,
0.0053,
0,
0.... | [
"import re",
"from django.conf import settings",
"from django.contrib.auth import REDIRECT_FIELD_NAME",
"from django.contrib.auth import login as auth_login",
"from django.contrib.auth.decorators import login_required",
"from django.contrib.auth.forms import AuthenticationForm",
"from django.contrib.aut... |
from django.db import models
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
class Redirect(models.Model):
site = models.ForeignKey(Site)
old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,
help_text=_("This should be an ab... | [
[
1,
0,
0.05,
0.05,
0,
0.66,
0,
40,
0,
1,
0,
0,
40,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.3333,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.15,
0.05,
0,
0.66,
0.666... | [
"from django.db import models",
"from django.contrib.sites.models import Site",
"from django.utils.translation import ugettext_lazy as _",
"class Redirect(models.Model):\n site = models.ForeignKey(Site)\n old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,\n help_text=_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.