id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,300 | edit.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/edit.py | from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.views.generic.base import TemplateResponseMixin, View
from django.views.generic.detail import (SingleObjectMixin,
SingleObjectTemplateRe... | 7,457 | Python | .py | 194 | 30.221649 | 76 | 0.635759 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,301 | dates.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/dates.py | import time
import datetime
from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext as _
from django.views.generic.base import View
from django.views.generic.detail ... | 19,804 | Python | .py | 492 | 31.473577 | 126 | 0.61522 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,302 | date_based.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/date_based.py | import datetime
import time
from django.template import loader, RequestContext
from django.core.exceptions import ObjectDoesNotExist
from django.core.xheaders import populate_xheaders
from django.db.models.fields import DateTimeField
from django.http import Http404, HttpResponse
import warnings
warnings.warn(
'Fu... | 14,025 | Python | .py | 338 | 34.224852 | 156 | 0.641319 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,303 | simple.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/simple.py | from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
from django.utils.log import getLogger
import warnings
warnings.warn(
'Function-based generic views have been deprecated; use class-based views instead.',
... | 2,319 | Python | .py | 52 | 37.519231 | 107 | 0.662971 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,304 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/__init__.py | from django.views.generic.base import View, TemplateView, RedirectView
from django.views.generic.dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView,
WeekArchiveView, DayArchiveView, TodayArchiveView,
DateDetailView)
from django.vie... | 571 | Python | .py | 10 | 47.7 | 92 | 0.731664 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,305 | base.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/base.py | from django import http
from django.core.exceptions import ImproperlyConfigured
from django.template import RequestContext, loader
from django.template.response import TemplateResponse
from django.utils.functional import update_wrapper
from django.utils.log import getLogger
from django.utils.decorators import classonly... | 5,621 | Python | .py | 141 | 30.028369 | 89 | 0.600403 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,306 | detail.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/detail.py | import re
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import Http404
from django.utils.encoding import smart_str
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, View
class SingleObjectMixin(object):
"... | 5,498 | Python | .py | 127 | 32.456693 | 91 | 0.595176 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,307 | list_detail.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/list_detail.py | from django.template import loader, RequestContext
from django.http import Http404, HttpResponse
from django.core.xheaders import populate_xheaders
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ObjectDoesNotExist
import warnings
warnings.warn(
'Function-based generic v... | 5,577 | Python | .py | 145 | 29.468966 | 113 | 0.614931 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,308 | list.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/list.py | import re
from django.core.paginator import Paginator, InvalidPage
from django.core.exceptions import ImproperlyConfigured
from django.http import Http404
from django.utils.encoding import smart_str
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateResponseMixin, View
c... | 5,863 | Python | .py | 136 | 33.227941 | 119 | 0.610897 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,309 | create_update.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/generic/create_update.py | from django.forms.models import ModelFormMetaclass, ModelForm
from django.template import RequestContext, loader
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.core.xheaders import populate_xheaders
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.... | 8,935 | Python | .py | 196 | 38.066327 | 114 | 0.665366 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,310 | gzip.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/decorators/gzip.py | from django.utils.decorators import decorator_from_middleware
from django.middleware.gzip import GZipMiddleware
gzip_page = decorator_from_middleware(GZipMiddleware)
gzip_page.__doc__ = "Decorator for views that gzips pages if the client supports it."
| 253 | Python | .py | 4 | 62 | 85 | 0.830645 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,311 | cache.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/decorators/cache.py | try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cach... | 3,639 | Python | .py | 72 | 44.291667 | 151 | 0.695249 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,312 | csrf.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/decorators/csrf.py | from django.middleware.csrf import CsrfViewMiddleware
from django.utils.decorators import decorator_from_middleware, available_attrs
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
csrf_protect = decorator_from_middleware(CsrfViewMiddlewar... | 2,240 | Python | .py | 54 | 37.555556 | 78 | 0.73989 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,313 | vary.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/decorators/vary.py | try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.cache import patch_vary_headers
from django.utils.decorators import available_attrs
def vary_on_headers(*headers):
"""
A view decorator that adds the specified heade... | 1,285 | Python | .py | 35 | 30.142857 | 78 | 0.666399 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,314 | http.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/views/decorators/http.py | """
Decorators for views based on HTTP headers.
"""
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from calendar import timegm
from datetime import timedelta
from django.utils.decorators import decorator_from_middleware, available_attrs
... | 7,044 | Python | .py | 141 | 36.836879 | 94 | 0.593196 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,315 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/shortcuts/__init__.py | """
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
from django.template import loader, RequestContext
from django.http import HttpResponse, Http404
from django.http import HttpRespon... | 4,642 | Python | .py | 108 | 36.861111 | 90 | 0.692154 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,316 | formats.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/formats.py | import decimal
import datetime
from django.conf import settings
from django.utils.translation import get_language, to_locale, check_for_language
from django.utils.importlib import import_module
from django.utils.encoding import smart_str
from django.utils import dateformat, numberformat, datetime_safe
from django.util... | 6,835 | Python | .py | 162 | 34.95679 | 96 | 0.669121 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,317 | regex_helper.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/regex_helper.py | """
Functions for reversing a regular expression (used in reverse URL resolving).
Used internally by Django and not intended for external use.
This is not, and is not intended to be, a complete reg-exp decompiler. It
should be good enough for a large class of URLS, however.
"""
# Mapping of an escape character to a r... | 12,079 | Python | .py | 305 | 28.442623 | 92 | 0.544379 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,318 | numberformat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/numberformat.py | from django.conf import settings
from django.utils.safestring import mark_safe
def format(number, decimal_sep, decimal_pos, grouping=0, thousand_sep=''):
"""
Gets a number (as a number or string), and returns it as a string,
using formats definied as arguments:
* decimal_sep: Decimal separator symbol... | 1,632 | Python | .py | 43 | 31.162791 | 77 | 0.623106 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,319 | datastructures.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/datastructures.py | from types import GeneratorType
from django.utils.copycompat import copy, deepcopy
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of the given d... | 15,522 | Python | .py | 415 | 28.253012 | 131 | 0.565486 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,320 | _threading_local.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/_threading_local.py | """Thread-local objects
(Note that this module provides a Python version of thread
threading.local class. Depending on the version of Python you're
using, there may be a faster one available. You should always import
the local class from threading.)
Thread-local objects support the management of thread-local dat... | 6,655 | Python | .py | 186 | 29.430108 | 73 | 0.601247 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,321 | tree.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/tree.py | """
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
from django.utils.copycompat import deepcopy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
... | 5,778 | Python | .py | 135 | 33.666667 | 79 | 0.618667 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,322 | dictconfig.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/dictconfig.py | # This is a copy of the Python logging.config.dictconfig module,
# reproduced with permission. It is provided here for backwards
# compatibility for Python versions prior to 2.7.
#
# Copyright 2009-2010 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# docu... | 22,939 | Python | .py | 510 | 30.892157 | 105 | 0.537881 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,323 | datetime_safe.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/datetime_safe.py | # Python's datetime strftime doesn't handle dates before 1900.
# These classes override date and datetime to support the formatting of a date
# through its full "proleptic Gregorian" date range.
#
# Based on code submitted to comp.lang.python by Andrew Dalke
#
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was... | 2,685 | Python | .py | 74 | 31.243243 | 111 | 0.649076 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,324 | _os.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/_os.py | import os
import stat
from os.path import join, normcase, normpath, abspath, isabs, sep
from django.utils.encoding import force_unicode
# Define our own abspath function that can handle joining
# unicode paths to a current working directory that has non-ASCII
# characters in it. This isn't necessary on Windows since... | 2,736 | Python | .py | 62 | 38.741935 | 79 | 0.698764 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,325 | dates.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/dates.py | "Commonly-used date structures"
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
WEEKDAYS = {
0:_('Monday'), 1:_('Tuesday'), 2:_('Wednesday'), 3:_('Thursday'), 4:_('Friday'),
5:_('Saturday'), 6:_('Sunday')
}
WEEKDAYS_ABBR = {
0:_('Mon'), 1:_('Tue'), 2:_('Wed'), 3:_('Thu'), 4:_('Fri')... | 2,237 | Python | .py | 55 | 36.945455 | 89 | 0.563761 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,326 | itercompat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/itercompat.py | """
Providing iterator functions that are not in all version of Python we support.
Where possible, we try to use the system-native version and only fall back to
these implementations if necessary.
"""
import itertools
# Fallback for Python 2.4, Python 2.5
def product(*args, **kwds):
"""
Taken from http://docs... | 1,169 | Python | .py | 39 | 24.923077 | 78 | 0.661032 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,327 | autoreload.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/autoreload.py | # Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | 4,623 | Python | .py | 117 | 33.871795 | 107 | 0.678245 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,328 | encoding.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/encoding.py | import types
import urllib
import locale
import datetime
import codecs
from decimal import Decimal
from django.utils.functional import Promise
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
self.obj = obj
UnicodeDecodeError.__init__(self, *args)
def __str_... | 7,294 | Python | .py | 164 | 36.469512 | 79 | 0.628921 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,329 | copycompat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/copycompat.py | """
Fixes Python 2.4's failure to deepcopy unbound functions.
"""
import copy
import types
# Monkeypatch copy's deepcopy registry to handle functions correctly.
if (hasattr(copy, '_deepcopy_dispatch') and types.FunctionType not in copy._deepcopy_dispatch):
copy._deepcopy_dispatch[types.FunctionType] = copy._deepc... | 398 | Python | .py | 11 | 34.545455 | 95 | 0.789063 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,330 | daemonize.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/daemonize.py | import os
import sys
if os.name == 'posix':
def become_daemon(our_home_dir='.', out_log='/dev/null',
err_log='/dev/null', umask=022):
"Robustly turn into a UNIX daemon, running in our_home_dir."
# First fork
try:
if os.fork() > 0:
sys.exit(0... | 1,907 | Python | .py | 54 | 25.685185 | 81 | 0.530016 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,331 | feedgenerator.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/feedgenerator.py | """
Syndication feed generation library -- used for generating RSS, etc.
Sample usage:
>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
... title=u"Poynter E-Media Tidbits",
... link=u"http://www.poynter.org/column.asp?id=31",
... description=u"A group Weblog by the shar... | 15,436 | Python | .py | 339 | 36.746313 | 123 | 0.616131 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,332 | cache.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/cache.py | """
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see:
http... | 9,483 | Python | .py | 203 | 40.852217 | 88 | 0.689331 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,333 | text.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/text.py | import re
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.translation import ugettext_lazy, ugettext as _
from htmlentitydefs import name2codepoint
# Capitalizes the first letter of a string.
capfirst = lambda x: x and force_unicode(x)[0].upper() + force... | 9,946 | Python | .py | 261 | 31.256705 | 132 | 0.581203 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,334 | html.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/html.py | """HTML utilities suitable for global use."""
import re
import string
from django.utils.safestring import SafeData, mark_safe
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
from django.utils.http import urlquote
# Configuration for urlize() function.
LEADING_PUNCTUATIO... | 8,105 | Python | .py | 171 | 40.853801 | 150 | 0.600657 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,335 | log.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/log.py | import logging
import sys
from django.core import mail
# Make sure a NullHandler is available
# This was added in Python 2.7/3.2
try:
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
# Make sure that dictConfig is availabl... | 3,494 | Python | .py | 87 | 30.436782 | 104 | 0.607427 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,336 | xmlutils.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/xmlutils.py | """
Utilities for XML generation/parsing.
"""
from xml.sax.saxutils import XMLGenerator
class SimplerXMLGenerator(XMLGenerator):
def addQuickElement(self, name, contents=None, attrs=None):
"Convenience method for adding an element with no children"
if attrs is None: attrs = {}
self.startEl... | 440 | Python | .py | 12 | 30.833333 | 67 | 0.70892 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,337 | checksums.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/checksums.py | """
Common checksum routines (used in multiple localflavor/ cases, for example).
"""
__all__ = ['luhn',]
LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) # sum_of_digits(index * 2)
def luhn(candidate):
"""
Checks a candidate number for validity according to the Luhn
algorithm (used in validation of, for ... | 748 | Python | .py | 19 | 34.421053 | 76 | 0.641873 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,338 | stopwords.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/stopwords.py | # Performance note: I benchmarked this code using a set instead of
# a list for the stopwords and was surprised to find that the list
# performed /better/ than the set - maybe because it's only a small
# list.
stopwords = '''
i
a
an
are
as
at
be
by
for
from
how
in
is
it
of
on
or
that
the
this
to
was
what
when
where
''... | 593 | Python | .py | 39 | 13.102564 | 67 | 0.736842 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,339 | timesince.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/timesince.py | import datetime
import time
from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ungettext, ugettext
def timesince(d, now=None):
"""
Takes two datetime objects and returns the time between d and now
as a nicely formatted string, e.g. "10 minutes". If d occurs after now,
... | 2,698 | Python | .py | 62 | 36.919355 | 94 | 0.620008 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,340 | tzinfo.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/tzinfo.py | "Implementation of tzinfo classes for use with datetime.datetime."
import time
from datetime import timedelta, tzinfo
from django.utils.encoding import smart_unicode, smart_str, DEFAULT_LOCALE_ENCODING
class FixedOffset(tzinfo):
"Fixed offset in minutes east from UTC."
def __init__(self, offset):
if i... | 2,511 | Python | .py | 64 | 29.828125 | 92 | 0.578061 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,341 | safestring.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/safestring.py | """
Functions for working with "safe strings": strings that can be displayed safely
without further escaping in HTML. Marking something as a "safe string" means
that the producer of the string has already turned characters that should not
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
"""
f... | 3,812 | Python | .py | 104 | 29.932692 | 79 | 0.657702 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,342 | hashcompat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/hashcompat.py | """
The md5 and sha modules are deprecated since Python 2.5, replaced by the
hashlib module containing both hash algorithms. Here, we provide a common
interface to the md5 and sha constructors, depending on system version.
"""
import sys
if sys.version_info >= (2, 5):
import hashlib
md5_constructor = hashlib.m... | 554 | Python | .py | 19 | 25.789474 | 73 | 0.73221 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,343 | version.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/version.py | import django
import os.path
import re
def get_svn_revision(path=None):
"""
Returns the SVN revision in the form SVN-XXXX,
where XXXX is the revision number.
Returns SVN-unknown if anything goes wrong, such as an unexpected
format of internal SVN files.
If path is provided, it should be a dir... | 1,361 | Python | .py | 37 | 29.594595 | 81 | 0.626232 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,344 | synch.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/synch.py | """
Synchronization primitives:
- reader-writer lock (preference to writers)
(Contributed to Django by eugene@lazutkin.com)
"""
try:
import threading
except ImportError:
import dummy_threading as threading
class RWLock:
"""
Classic implementation of reader-writer lock with preference to writers.... | 2,549 | Python | .py | 77 | 22.779221 | 99 | 0.553209 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,345 | importlib.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/importlib.py | # Taken from Python 2.7 with permission from/by the original author.
import sys
def _resolve_name(name, package, level):
"""Return the absolute name of the module to be imported."""
if not hasattr(package, 'rindex'):
raise ValueError("'package' not set to a string")
dot = len(package)
for x in ... | 1,229 | Python | .py | 31 | 31.580645 | 78 | 0.620285 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,346 | functional.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/functional.py | # License for code in this file that was taken from Python 2.5.
# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# --------------------------------------------
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF"), and the Individual or Organization ("Licensee") accessing and
# otherwise usin... | 14,218 | Python | .py | 317 | 36.675079 | 130 | 0.626886 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,347 | decorators.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/decorators.py | "Functions that help with dynamically creating decorators for views."
try:
from functools import wraps, update_wrapper, WRAPPER_ASSIGNMENTS
except ImportError:
from django.utils.functional import wraps, update_wrapper, WRAPPER_ASSIGNMENTS # Python 2.4 fallback.
class classonlymethod(classmethod):
def __g... | 4,290 | Python | .py | 93 | 35.763441 | 106 | 0.623715 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,348 | module_loading.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/module_loading.py | import imp
import os
import sys
def module_has_submodule(package, module_name):
"""See if 'module' is in 'package'."""
name = ".".join([package.__name__, module_name])
try:
# None indicates a cached miss; see mark_miss() in Python/import.c.
return sys.modules[name] is not None
except K... | 2,306 | Python | .py | 61 | 22.868852 | 77 | 0.477486 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,349 | crypto.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/crypto.py | """
Django's standard crypto functions and utilities.
"""
import hmac
from django.conf import settings
from django.utils.hashcompat import sha_constructor, sha_hmac
def salted_hmac(key_salt, value, secret=None):
"""
Returns the HMAC-SHA1 of 'value', using a key generated from key_salt and a
secret (which... | 1,443 | Python | .py | 34 | 37.705882 | 80 | 0.701001 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,350 | termcolors.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/termcolors.py | """
termcolors.py
"""
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
RESET = '0'
opt_dict = {'bold': '1', 'underscore': '4', 'blink': '5', 'rever... | 6,885 | Python | .py | 170 | 32.323529 | 89 | 0.540601 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,351 | http.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/http.py | import calendar
import datetime
import re
import sys
import urllib
import urlparse
from email.Utils import formatdate
from django.utils.encoding import smart_str, force_unicode
from django.utils.functional import allow_lazy
ETAG_MATCH = re.compile(r'(?:W/)?"((?:\\.|[^"])*)"')
MONTHS = 'jan feb mar apr may jun jul au... | 7,060 | Python | .py | 183 | 32.989071 | 85 | 0.642544 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,352 | dateformat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/dateformat.py | """
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print df.format('jS F Y H:i')
7th October 2003 11:39
>>>
"""
import re
import time
import calendar
from django.utils.dates import MONTHS, MONTHS_3, ... | 8,956 | Python | .py | 242 | 28.603306 | 102 | 0.569698 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,353 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/translation/__init__.py | """
Internationalization support.
"""
import warnings
from os import path
from django.utils.encoding import force_unicode
from django.utils.functional import lazy
from django.utils.importlib import import_module
__all__ = ['gettext', 'gettext_noop', 'gettext_lazy', 'ngettext',
'ngettext_lazy', 'string_concat... | 5,136 | Python | .py | 114 | 38.815789 | 79 | 0.69986 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,354 | trans_null.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/translation/trans_null.py | # These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
import warnings
from django.conf import settings
from django.utils.encoding import force_uni... | 2,648 | Python | .py | 64 | 37.46875 | 79 | 0.749805 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,355 | trans_real.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/translation/trans_real.py | """Translation helper functions."""
import locale
import os
import re
import sys
import warnings
import gettext as gettext_module
from cStringIO import StringIO
from threading import local
from django.utils.importlib import import_module
from django.utils.safestring import mark_safe, SafeData
# Translations are cac... | 22,508 | Python | .py | 530 | 33.424528 | 143 | 0.614219 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,356 | decoder.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/simplejson/decoder.py | """Implementation of JSONDecoder
"""
import re
import sys
import struct
from django.utils.simplejson.scanner import make_scanner
c_scanstring = None
__all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconstants():
_BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
if sys... | 11,952 | Python | .py | 297 | 31.094276 | 108 | 0.537361 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,357 | tool.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/simplejson/tool.py | r"""Using simplejson from the shell to validate and
pretty-print::
$ echo '{"json":"obj"}' | python -msimplejson.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -msimplejson.tool
Expecting property name: line 1 column 2 (char 2)
"""
from django.utils import simplejson
def main():
i... | 926 | Python | .py | 31 | 24.225806 | 66 | 0.589226 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,358 | encoder.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/simplejson/encoder.py | """Implementation of JSONEncoder
"""
import re
c_encode_basestring_ascii = None
c_make_encoder = None
ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {
'\\': '\\\\',
'"': '\\"',
'\b': '\\b',
'\f': '\\f',
... | 15,620 | Python | .py | 382 | 29.659686 | 136 | 0.538644 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,359 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/simplejson/__init__.py | r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | 14,306 | Python | .py | 284 | 42.426056 | 84 | 0.625564 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,360 | scanner.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/simplejson/scanner.py | """JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | 2,227 | Python | .py | 57 | 30.912281 | 93 | 0.577243 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,361 | compatibility.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/compatibility.py | import os
import sys
try:
from functools import wraps
except ImportError:
# only needed for Python 2.4
def wraps(_):
def _wraps(func):
return func
return _wraps
__unittest = True
def _relpath_nt(path, start=os.path.curdir):
"""Return a relative version of a path"""
if... | 2,096 | Python | .py | 53 | 31.622642 | 80 | 0.608268 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,362 | signals.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/signals.py | import signal
import weakref
from django.utils.unittest.compatibility import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
installed_handler ... | 1,684 | Python | .py | 45 | 29.755556 | 75 | 0.667486 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,363 | result.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/result.py | """Test result object"""
import sys
import traceback
import unittest
from StringIO import StringIO
from django.utils.unittest import util
from django.utils.unittest.compatibility import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'fail... | 6,105 | Python | .py | 151 | 30.801325 | 79 | 0.602499 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,364 | __main__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/__main__.py | """Main entry point"""
import sys
if sys.argv[0].endswith("__main__.py"):
sys.argv[0] = "unittest2"
__unittest = True
from django.utils.unittest.main import main_
main_()
| 178 | Python | .py | 7 | 23.428571 | 44 | 0.696429 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,365 | util.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/util.py | """Various utility functions."""
__unittest = True
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(result) < _MAX_LENGTH:
return result
return result[:_MAX_LENGTH] + ' [truncated]...'... | 2,821 | Python | .py | 89 | 21.146067 | 76 | 0.519471 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,366 | loader.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/loader.py | """Loading unittests."""
import os
import re
import sys
import traceback
import types
import unittest
from fnmatch import fnmatch
from django.utils.unittest import case, suite
try:
from os.path import relpath
except ImportError:
from django.utils.unittest.compatibility import relpath
__unittest = True
de... | 13,437 | Python | .py | 273 | 37.278388 | 123 | 0.609607 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,367 | runner.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/runner.py | """Running tests"""
import sys
import time
import unittest
from django.utils.unittest import result
try:
from django.utils.unittest.signals import registerResult
except ImportError:
def registerResult(_):
pass
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like obj... | 6,761 | Python | .py | 175 | 28.885714 | 80 | 0.605339 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,368 | collector.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/collector.py | import os
import sys
from django.utils.unittest.loader import defaultTestLoader
def collector():
# import __main__ triggers code re-execution
__main__ = sys.modules['__main__']
setupDir = os.path.abspath(os.path.dirname(__main__.__file__))
return defaultTestLoader.discover(setupDir)
| 301 | Python | .py | 8 | 34.5 | 66 | 0.729452 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,369 | case.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/case.py | """Test case implementation"""
import sys
import difflib
import pprint
import re
import unittest
import warnings
from django.utils.unittest import result
from django.utils.unittest.util import\
safe_repr, safe_str, strclass,\
unorderable_list_difference
from django.utils.unittest.compatibility import wraps
... | 42,686 | Python | .py | 902 | 35.159645 | 113 | 0.58801 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,370 | suite.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/suite.py | """TestSuite"""
import sys
import unittest
from django.utils.unittest import case, util
__unittest = True
class BaseTestSuite(unittest.TestSuite):
"""A simple test suite that doesn't provide class or module shared fixtures.
"""
def __init__(self, tests=()):
self._tests = []
self.addTests... | 9,293 | Python | .py | 233 | 29.652361 | 80 | 0.60493 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,371 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/__init__.py | """
unittest2
unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7. It is tested to run on Python 2.4 - 2.6.
To use unittest2 instead of unittest simply replace ``import unittest`` with
``import unittest2``.
Copyright (c) 1999-2003 Steve Purcell
Copyright (c) 2003-2010 P... | 3,069 | Python | .py | 62 | 42.193548 | 83 | 0.707929 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,372 | main.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/utils/unittest/main.py | """Unittest main program"""
import sys
import os
import types
from django.utils.unittest import loader, runner
try:
from django.utils.unittest.signals import installHandler
except ImportError:
installHandler = None
__unittest = True
FAILFAST = " -f, --failfast Stop on first failure\n"
CATCHBREAK = ... | 9,388 | Python | .py | 209 | 33.483254 | 97 | 0.56729 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,373 | multipartparser.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/http/multipartparser.py | """
Multi-part parsing for file uploads.
Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
file upload handlers for processing.
"""
import cgi
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.utils.datastructures import MultiValueDict
fro... | 22,588 | Python | .py | 536 | 30.104478 | 109 | 0.563098 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,374 | utils.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/http/utils.py | """
Functions that modify an HTTP request or response in some way.
"""
# This group of functions are run as part of the response handling, after
# everything else, including all response middleware. Think of them as
# "compulsory response middleware". Be careful about what goes here, because
# it's a little fiddly to ... | 3,268 | Python | .py | 73 | 38.136986 | 79 | 0.677247 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,375 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/http/__init__.py | import datetime
import os
import re
import time
from pprint import pformat
from urllib import urlencode, quote
from urlparse import urljoin
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
# The mod_python version is more efficient, so try importing it first.
fr... | 25,875 | Python | .py | 579 | 34.658031 | 134 | 0.603439 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,376 | gzip.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/middleware/gzip.py | import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
re_accepts_gzip = re.compile(r'\bgzip\b')
class GZipMiddleware(object):
"""
This middleware compresses content if the browser allows gzip compression.
It sets the Vary header accordingly, so that cac... | 1,455 | Python | .py | 30 | 40.433333 | 79 | 0.673959 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,377 | transaction.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/middleware/transaction.py | from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
exc... | 1,090 | Python | .py | 24 | 37.625 | 78 | 0.693321 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,378 | cache.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/middleware/cache.py | """
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCa... | 9,078 | Python | .py | 173 | 44.179191 | 301 | 0.688719 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,379 | csrf.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/middleware/csrf.py | """
Cross Site Request Forgery Middleware.
This module provides a middleware that implements protection
against request forgeries from other sites.
"""
import itertools
import re
import random
from django.conf import settings
from django.core.urlresolvers import get_callable
from django.utils.cache import patch_vary... | 14,242 | Python | .py | 275 | 39.985455 | 150 | 0.612963 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,380 | locale.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/middleware/locale.py | "this is the locale selecting middleware that will look at accept headers"
from django.utils.cache import patch_vary_headers
from django.utils import translation
class LocaleMiddleware(object):
"""
This is a very simple middleware that parses a request
and decides what translation object to install in the... | 978 | Python | .py | 21 | 40.428571 | 74 | 0.734523 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,381 | doc.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/middleware/doc.py | from django.conf import settings
from django import http
class XViewMiddleware(object):
"""
Adds an X-View header to internal HEAD requests -- used by the documentation system.
"""
def process_view(self, request, view_func, view_args, view_kwargs):
"""
If the request method is HEAD and ... | 930 | Python | .py | 18 | 42.333333 | 100 | 0.642151 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,382 | common.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/middleware/common.py | import re
from django.conf import settings
from django import http
from django.core.mail import mail_managers
from django.utils.http import urlquote
from django.core import urlresolvers
from django.utils.hashcompat import md5_constructor
from django.utils.log import getLogger
logger = getLogger('django.request')
cl... | 6,658 | Python | .py | 136 | 37.088235 | 125 | 0.593385 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,383 | http.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/middleware/http.py | from django.core.exceptions import MiddlewareNotUsed
from django.utils.http import http_date, parse_http_date_safe
class ConditionalGetMiddleware(object):
"""
Handles conditional GET operations. If the response has a ETag or
Last-Modified header, and the request has If-None-Match or
If-Modified-Since, ... | 1,696 | Python | .py | 31 | 43.483871 | 84 | 0.643373 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,384 | models.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/forms/models.py | """
Helper functions for creating Form classes from Django models
and database field objects.
"""
from django.utils.encoding import smart_unicode, force_unicode
from django.utils.datastructures import SortedDict
from django.utils.text import get_text_list, capfirst
from django.utils.translation import ugettext_lazy as... | 42,947 | Python | .py | 902 | 36.81929 | 121 | 0.605992 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,385 | util.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/forms/util.py | from django.utils.html import conditional_escape
from django.utils.encoding import StrAndUnicode, force_unicode
from django.utils.safestring import mark_safe
# Import ValidationError so that it can be imported from this
# module to maintain backwards compatibility.
from django.core.exceptions import ValidationError
d... | 1,983 | Python | .py | 43 | 39.837209 | 126 | 0.643857 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,386 | formsets.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/forms/formsets.py | from forms import Form
from django.core.exceptions import ValidationError
from django.utils.encoding import StrAndUnicode
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from fields import IntegerField, BooleanField
from widgets import Media, HiddenInput
from util import... | 14,871 | Python | .py | 327 | 35.859327 | 115 | 0.614033 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,387 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/forms/__init__.py | """
Django validation and HTML form handling.
TODO:
Default value for field
Field labels
Nestable Forms
FatalValidationError -- short-circuits all other validators on a form
ValidationWarning
"This form field requires foo.js" and form.js_includes()
"""
from django.core.exceptions import Valida... | 414 | Python | .py | 15 | 24.866667 | 73 | 0.780856 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,388 | widgets.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/forms/widgets.py | """
HTML Widget classes
"""
import datetime
from itertools import chain
import time
from urlparse import urljoin
from util import flatatt
import django.utils.copycompat as copy
from django.conf import settings
from django.utils.datastructures import MultiValueDict, MergeDict
from django.utils.html import escape, condi... | 33,059 | Python | .py | 731 | 35.946648 | 117 | 0.613538 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,389 | fields.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/forms/fields.py | """
Field classes.
"""
import datetime
import os
import re
import time
import urlparse
import warnings
from decimal import Decimal, DecimalException
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.core.exceptions import ValidationError
from django.core import ... | 38,484 | Python | .py | 842 | 36.11639 | 134 | 0.624257 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,390 | forms.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/forms/forms.py | """
Form classes
"""
from django.core.exceptions import ValidationError
from django.utils.copycompat import deepcopy
from django.utils.datastructures import SortedDict
from django.utils.html import conditional_escape
from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode
from django.utils.safest... | 21,754 | Python | .py | 473 | 35.475687 | 130 | 0.598237 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,391 | widgets.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/forms/extras/widgets.py | """
Extra HTML Widget classes
"""
import time
import datetime
import re
from django.forms.widgets import Widget, Select
from django.utils import datetime_safe
from django.utils.dates import MONTHS
from django.utils.safestring import mark_safe
from django.utils.formats import get_format
from django.conf import setting... | 5,157 | Python | .py | 128 | 29.5 | 90 | 0.55004 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,392 | feeds.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/contrib/syndication/feeds.py | from django.contrib.syndication import views
from django.core.exceptions import ObjectDoesNotExist
import warnings
# This is part of the deprecated API
from django.contrib.syndication.views import FeedDoesNotExist, add_domain
class Feed(views.Feed):
"""Provided for backwards compatibility."""
def __init__(sel... | 1,367 | Python | .py | 32 | 34.15625 | 101 | 0.653875 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,393 | views.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/contrib/syndication/views.py | from django.conf import settings
from django.contrib.sites.models import get_current_site
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import HttpResponse, Http404
from django.template import loader, TemplateDoesNotExist, RequestContext
from django.utils import feedgenera... | 9,070 | Python | .py | 199 | 34.758794 | 167 | 0.602307 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,394 | tests.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/contrib/markup/tests.py | # Quick tests for the markup templatetags (django.contrib.markup)
import re
from django.template import Template, Context, add_to_builtins
from django.utils import unittest
from django.utils.html import escape
add_to_builtins('django.contrib.markup.templatetags.markup')
try:
import textile
except ImportError:
... | 3,155 | Python | .py | 68 | 40.588235 | 99 | 0.680157 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,395 | markup.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/contrib/markup/templatetags/markup.py | """
Set of "markup" template filters for Django. These filters transform plain text
markup syntaxes to HTML; currently there is support for:
* Textile, which requires the PyTextile library available at
http://loopcore.com/python-textile/
* Markdown, which requires the Python-markdown library from
... | 3,522 | Python | .py | 76 | 39.144737 | 134 | 0.693675 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,396 | models.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/contrib/redirects/models.py | 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... | 889 | Python | .py | 17 | 45.941176 | 111 | 0.65896 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,397 | admin.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/contrib/redirects/admin.py |
from django.contrib import admin
from django.contrib.redirects.models import Redirect
class RedirectAdmin(admin.ModelAdmin):
list_display = ('old_path', 'new_path')
list_filter = ('site',)
search_fields = ('old_path', 'new_path')
radio_fields = {'site': admin.VERTICAL}
admin.site.register(Redirect, R... | 333 | Python | .py | 8 | 38.375 | 52 | 0.736842 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,398 | middleware.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/contrib/redirects/middleware.py | from django.contrib.redirects.models import Redirect
from django import http
from django.conf import settings
class RedirectFallbackMiddleware(object):
def process_response(self, request, response):
if response.status_code != 404:
return response # No need to check for a redirect for non-404 re... | 1,105 | Python | .py | 25 | 33.84 | 85 | 0.623377 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
2,399 | models.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.3/django/contrib/formtools/models.py | """ models.py (even empty) currently required by the runtests.py to enable unit tests """
| 90 | Python | .py | 1 | 89 | 89 | 0.741573 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |