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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,400 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/dispatch/__init__.py | """Multi-consumer multi-producer dispatching mechanism
Originally based on pydispatch (BSD) http://pypi.python.org/pypi/PyDispatcher/2.0.1
See license.txt for original license.
Heavily modified for Django's purposes.
"""
from django.dispatch.dispatcher import Signal | 269 | Python | .py | 6 | 43.5 | 83 | 0.827586 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,401 | dispatcher.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/dispatch/dispatcher.py | import weakref
import threading
from django.dispatch import saferef
WEAKREF_TYPES = (weakref.ReferenceType, saferef.BoundMethodWeakref)
def _make_id(target):
if hasattr(target, 'im_func'):
return (id(target.im_self), id(target.im_func))
return id(target)
class Signal(object):
"""
Base class ... | 8,905 | Python | .py | 205 | 30.24878 | 83 | 0.579499 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,402 | i18n.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/templatetags/i18n.py | import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.utils.encoding import force_unicode
register = Library()... | 9,958 | Python | .py | 227 | 34.819383 | 124 | 0.625361 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,403 | cache.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/templatetags/cache.py | from django.template import Library, Node, TemplateSyntaxError, Variable, VariableDoesNotExist
from django.template import resolve_variable
from django.core.cache import cache
from django.utils.encoding import force_unicode
from django.utils.http import urlquote
from django.utils.hashcompat import md5_constructor
regi... | 2,406 | Python | .py | 53 | 38.169811 | 109 | 0.664106 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,404 | transaction.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/transaction.py | """
This module implements a transaction manager that can be used to define
transaction handling in a request or view function. It is used by transaction
control middleware and decorators.
The transaction manager can be in managed or in auto state. Auto state means the
system is using a commit-on-save strategy (actual... | 12,689 | Python | .py | 320 | 33.04375 | 104 | 0.679446 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,405 | utils.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/utils.py | import inspect
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
DEFAULT_DB_ALIAS = 'default'
# Define some exceptions that mirror the PEP249 interface.
# We will rethrow any backend-specific errors using these
# commo... | 6,136 | Python | .py | 147 | 30 | 128 | 0.572578 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,406 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/__init__.py | from django.conf import settings
from django.core import signals
from django.core.exceptions import ImproperlyConfigured
from django.db.utils import ConnectionHandler, ConnectionRouter, load_backend, DEFAULT_DB_ALIAS, \
DatabaseError, IntegrityError
from django.utils.functional import curry
... | 4,272 | Python | .py | 90 | 40.455556 | 98 | 0.698009 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,407 | signals.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/signals.py | from django.dispatch import Signal
class_prepared = Signal(providing_args=["class"])
pre_init = Signal(providing_args=["instance", "args", "kwargs"])
post_init = Signal(providing_args=["instance"])
pre_save = Signal(providing_args=["instance", "raw"])
post_save = Signal(providing_args=["instance", "raw", "created"])... | 613 | Python | .py | 10 | 59.7 | 99 | 0.721943 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,408 | related.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/related.py | class BoundRelatedObject(object):
def __init__(self, related_object, field_mapping, original):
self.relation = related_object
self.field_mappings = field_mapping[related_object.name]
def template_name(self):
raise NotImplementedError
def __repr__(self):
return repr(self.__d... | 2,269 | Python | .py | 41 | 46.512195 | 103 | 0.662911 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,409 | expressions.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/expressions.py | from datetime import datetime
from django.utils import tree
from django.utils.copycompat import deepcopy
class ExpressionNode(tree.Node):
"""
Base class for all query expressions.
"""
# Arithmetic connectors
ADD = '+'
SUB = '-'
MUL = '*'
DIV = '/'
MOD = '%%' # This is a quoted % o... | 3,283 | Python | .py | 85 | 31.411765 | 76 | 0.609779 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,410 | options.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/options.py | import re
from bisect import bisect
from django.conf import settings
from django.db.models.related import RelatedObject
from django.db.models.fields.related import ManyToManyRel
from django.db.models.fields import AutoField, FieldDoesNotExist
from django.db.models.fields.proxy import OrderWrt
from django.db.models.loa... | 19,583 | Python | .py | 438 | 34.006849 | 122 | 0.595632 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,411 | query_utils.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/query_utils.py | """
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
import weakref
from django.utils.copycompat import deepcopy
from django.u... | 9,400 | Python | .py | 235 | 32.029787 | 81 | 0.63451 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,412 | manager.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/manager.py | from django.utils import copycompat as copy
from django.conf import settings
from django.db import router
from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet
from django.db.models import signals
from django.db.models.fields import FieldDoesNotExist
def ensure_default_manager(sender, ... | 7,872 | Python | .py | 170 | 38.188235 | 125 | 0.636755 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,413 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/__init__.py | from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.db import connection
from django.db.models.loading import get_apps, get_app, get_models, get_model, register_models
from django.db.models.query import Q
from django.db.models.expressions import F
fro... | 1,330 | Python | .py | 30 | 40.966667 | 128 | 0.77872 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,414 | base.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/base.py | import types
import sys
from itertools import izip
import django.db.models.manager # Imported to register signal handler.
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS
from django.core import validators
from django.db.models.fields imp... | 44,352 | Python | .py | 872 | 37.766055 | 166 | 0.574441 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,415 | aggregates.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/aggregates.py | """
Classes to represent the definitions of aggregate functions.
"""
class Aggregate(object):
"""
Default Aggregate definition.
"""
def __init__(self, lookup, **extra):
"""Instantiate a new aggregate.
* lookup is the field on which the aggregate operates.
* extra is a diction... | 2,101 | Python | .py | 53 | 32.509434 | 82 | 0.663717 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,416 | query.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/query.py | """
The main QuerySet implementation. This provides the public API for the ORM.
"""
from itertools import izip
from django.db import connections, router, transaction, IntegrityError
from django.db.models.aggregates import Aggregate
from django.db.models.fields import DateField
from django.db.models.query_utils import... | 57,758 | Python | .py | 1,339 | 32.21658 | 140 | 0.582388 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,417 | loading.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/loading.py | "Utilities for loading models and the modules that contain them."
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule
im... | 8,745 | Python | .py | 202 | 33.09901 | 97 | 0.605893 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,418 | related.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/fields/related.py | from django.conf import settings
from django.db import connection, router, transaction
from django.db.backends import util
from django.db.models import signals, get_model
from django.db.models.fields import (AutoField, Field, IntegerField,
PositiveIntegerField, PositiveSmallIntegerField, FieldDoesNotExist)
from dja... | 55,568 | Python | .py | 1,033 | 42.157793 | 222 | 0.614802 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,419 | proxy.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/fields/proxy.py | """
Field-like classes that aren't really fields. It's easier to use objects that
have the same attributes as fields sometimes (avoids a lot of special casing).
"""
from django.db.models import fields
class OrderWrt(fields.IntegerField):
"""
A proxy for the _order database field that is used when
Meta.ord... | 528 | Python | .py | 14 | 33.357143 | 78 | 0.682975 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,420 | subclassing.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/fields/subclassing.py | """
Convenience routines for creating non-trivial Field subclasses, as well as
backwards compatibility utilities.
Add SubfieldBase as the __metaclass__ for your Field subclass, implement
to_python() and the other necessary methods and everything will work seamlessly.
"""
from inspect import getargspec
from warnings i... | 4,384 | Python | .py | 103 | 34.786408 | 93 | 0.646121 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,421 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/fields/__init__.py | import datetime
import decimal
import re
import time
import math
from itertools import tee
import django.utils.copycompat as copy
from django.db import connection
from django.db.models.fields.subclassing import LegacyConnection
from django.db.models.query_utils import QueryWrapper
from django.conf import settings
fro... | 43,384 | Python | .py | 970 | 35.394845 | 166 | 0.622257 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,422 | files.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/fields/files.py | import datetime
import os
import django.utils.copycompat as copy
from django.conf import settings
from django.db.models.fields import Field
from django.core.files.base import File, ContentFile
from django.core.files.storage import default_storage
from django.core.files.images import ImageFile, get_image_dimensions
fr... | 15,724 | Python | .py | 318 | 41.025157 | 107 | 0.662189 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,423 | datastructures.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/datastructures.py | """
Useful auxilliary data structures for query construction. Not useful outside
the SQL domain.
"""
class EmptyResultSet(Exception):
pass
class FullResultSet(Exception):
pass
class MultiJoin(Exception):
"""
Used by join construction code to indicate the point at which a
multi-valued join was att... | 1,157 | Python | .py | 38 | 24.710526 | 76 | 0.632763 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,424 | expressions.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/expressions.py | from django.core.exceptions import FieldError
from django.db.models.fields import FieldDoesNotExist
from django.db.models.sql.constants import LOOKUP_SEP
class SQLEvaluator(object):
def __init__(self, expression, query, allow_joins=True):
self.expression = expression
self.opts = query.get_meta()
... | 3,373 | Python | .py | 71 | 35.816901 | 96 | 0.538649 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,425 | compiler.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/compiler.py | from django.core.exceptions import FieldError
from django.db import connections
from django.db.backends.util import truncate_name
from django.db.models.sql.constants import *
from django.db.models.sql.datastructures import EmptyResultSet
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.sq... | 42,907 | Python | .py | 895 | 34.24581 | 108 | 0.558982 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,426 | subqueries.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/subqueries.py | """
Query subclasses which provide extra functionality beyond simple data retrieval.
"""
from django.core.exceptions import FieldError
from django.db import connections
from django.db.models.sql.constants import *
from django.db.models.sql.datastructures import Date
from django.db.models.sql.expressions import SQLEval... | 7,688 | Python | .py | 180 | 33.911111 | 121 | 0.624933 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,427 | constants.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/constants.py | import re
# Valid query types (a dictionary is used for speedy lookups).
QUERY_TERMS = dict([(x, None) for x in (
'exact', 'iexact', 'contains', 'icontains', 'gt', 'gte', 'lt', 'lte', 'in',
'startswith', 'istartswith', 'endswith', 'iendswith', 'range', 'year',
'month', 'day', 'week_day', 'isnull', 'search'... | 1,043 | Python | .py | 29 | 33.862069 | 79 | 0.672962 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,428 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/__init__.py | from query import *
from subqueries import *
from where import AND, OR
from datastructures import EmptyResultSet
__all__ = ['Query', 'AND', 'OR', 'EmptyResultSet']
| 166 | Python | .py | 5 | 31.8 | 50 | 0.754717 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,429 | aggregates.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/aggregates.py | """
Classes to represent the default SQL aggregate functions
"""
class AggregateField(object):
"""An internal field mockup used to identify aggregates in the
data-conversion parts of the database backend.
"""
def __init__(self, internal_type):
self.internal_type = internal_type
def get_int... | 4,176 | Python | .py | 101 | 33.267327 | 90 | 0.632411 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,430 | query.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/query.py | """
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... | 81,062 | Python | .py | 1,702 | 35.20564 | 133 | 0.582032 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,431 | where.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/models/sql/where.py | """
Code to manage the creation and SQL rendering of 'where' constraints.
"""
import datetime
from itertools import repeat
from django.utils import tree
from django.db.models.fields import Field
from django.db.models.query_utils import QueryWrapper
from datastructures import EmptyResultSet, FullResultSet
# Connection... | 13,163 | Python | .py | 303 | 32.006601 | 91 | 0.573724 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,432 | util.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/util.py | import datetime
import decimal
from time import time
from django.utils.hashcompat import md5_constructor
class CursorDebugWrapper(object):
def __init__(self, cursor, db):
self.cursor = cursor
self.db = db # Instance of a BaseDatabaseWrapper subclass
def execute(self, sql, params=()):
... | 4,052 | Python | .py | 109 | 30.458716 | 103 | 0.573394 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,433 | creation.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/creation.py | import sys
import time
from django.conf import settings
from django.core.management import call_command
# The prefix to put on the default database name when creating
# the test database.
TEST_DATABASE_PREFIX = 'test_'
class BaseDatabaseCreation(object):
"""
This class encapsulates all backend-specific diffe... | 21,647 | Python | .py | 428 | 38.609813 | 148 | 0.597883 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,434 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/__init__.py | import decimal
from threading import local
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import util
from django.utils import datetime_safe
from django.utils.importlib import import_module
class BaseDatabaseWrapper(local):
"""
Represents a database connection.
"""
ops = None
def ... | 21,154 | Python | .py | 498 | 33.682731 | 102 | 0.641134 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,435 | client.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/postgresql/client.py | import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'psql'
def runshell(self):
settings_dict = self.connection.settings_dict
args = [self.executable_name]
if settings_dict['USER']:
args += ["-U"... | 709 | Python | .py | 19 | 29.157895 | 59 | 0.597668 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,436 | creation.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/postgresql/creation.py | from django.db.backends.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated PostgreSQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__... | 3,650 | Python | .py | 69 | 40.217391 | 146 | 0.551888 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,437 | introspection.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/postgresql/introspection.py | from django.db.backends import BaseDatabaseIntrospection
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type codes to Django Field types.
data_types_reverse = {
16: 'BooleanField',
20: 'BigIntegerField',
21: 'SmallIntegerField',
23: 'IntegerField',
25: 'T... | 3,725 | Python | .py | 82 | 34.439024 | 95 | 0.587765 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,438 | base.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/postgresql/base.py | """
PostgreSQL database backend for Django.
Requires psycopg 1: http://initd.org/projects/psycopg1
"""
import sys
from django.db import utils
from django.db.backends import *
from django.db.backends.signals import connection_created
from django.db.backends.postgresql.client import DatabaseClient
from django.db.backe... | 7,307 | Python | .py | 157 | 38.318471 | 140 | 0.656987 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,439 | operations.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/postgresql/operations.py | import re
from django.db.backends import BaseDatabaseOperations
# This DatabaseOperations class lives in here instead of base.py because it's
# used by both the 'postgresql' and 'postgresql_psycopg2' backends.
class DatabaseOperations(BaseDatabaseOperations):
def __init__(self, connection):
super(Databas... | 8,118 | Python | .py | 149 | 41.503356 | 188 | 0.579796 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,440 | version.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/postgresql/version.py | """
Extracts the version of the PostgreSQL server.
"""
import re
# This reg-exp is intentionally fairly flexible here.
# Needs to be able to handle stuff like:
# PostgreSQL 8.3.6
# EnterpriseDB 8.3
# PostgreSQL 8.3 beta4
# PostgreSQL 8.4beta1
VERSION_RE = re.compile(r'\S+ (\d+)\.(\d+)\.?(\d+)?')
def _parse_v... | 1,018 | Python | .py | 27 | 34.185185 | 76 | 0.685917 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,441 | introspection.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/postgresql_psycopg2/introspection.py | from django.db.backends.postgresql.introspection import DatabaseIntrospection as PostgresDatabaseIntrospection
class DatabaseIntrospection(PostgresDatabaseIntrospection):
def get_relations(self, cursor, table_name):
"""
Returns a dictionary of {field_index: (field_index_other_table, other_table)}
... | 959 | Python | .py | 19 | 40.105263 | 110 | 0.627932 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,442 | base.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/postgresql_psycopg2/base.py | """
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import sys
from django.db import utils
from django.db.backends import *
from django.db.backends.signals import connection_created
from django.db.backends.postgresql.operations import DatabaseOperations as Postgresq... | 8,198 | Python | .py | 175 | 37.325714 | 124 | 0.646 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,443 | client.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/mysql/client.py | import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'mysql'
def runshell(self):
settings_dict = self.connection.settings_dict
args = [self.executable_name]
db = settings_dict['OPTIONS'].get('db', settings_d... | 1,380 | Python | .py | 34 | 31.058824 | 82 | 0.554478 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,444 | compiler.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/mysql/compiler.py | from django.db.models.sql import compiler
class SQLCompiler(compiler.SQLCompiler):
def resolve_columns(self, row, fields=()):
values = []
index_extra_select = len(self.query.extra_select.keys())
for value, field in map(None, row[index_extra_select:], fields):
if (field and field... | 926 | Python | .py | 21 | 37.47619 | 95 | 0.719689 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,445 | creation.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/mysql/creation.py | from django.db.backends.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated MySQL column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dict_... | 3,019 | Python | .py | 60 | 40.766667 | 99 | 0.599526 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,446 | introspection.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/mysql/introspection.py | from django.db.backends import BaseDatabaseIntrospection
from MySQLdb import ProgrammingError, OperationalError
from MySQLdb.constants import FIELD_TYPE
import re
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
class DatabaseIntrospection(BaseDatabaseI... | 4,329 | Python | .py | 88 | 38.75 | 113 | 0.619003 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,447 | validation.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/mysql/validation.py | from django.db.backends import BaseDatabaseValidation
class DatabaseValidation(BaseDatabaseValidation):
def validate_field(self, errors, opts, f):
"""
There are some field length restrictions for MySQL:
- Prior to version 5.0.3, character fields could not exceed 255
characters in... | 1,309 | Python | .py | 23 | 46.043478 | 169 | 0.612627 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,448 | base.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/mysql/base.py | """
MySQL database backend for Django.
Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""
import re
import sys
try:
import MySQLdb as Database
except ImportError, e:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
... | 12,665 | Python | .py | 272 | 37.966912 | 127 | 0.63886 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,449 | client.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/oracle/client.py | import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'sqlplus'
def runshell(self):
conn_string = self.connection._connect_string()
args = [self.executable_name, "-L", conn_string]
if os.name == 'nt':
... | 426 | Python | .py | 12 | 28.833333 | 56 | 0.660976 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,450 | compiler.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/oracle/compiler.py | from django.db.models.sql import compiler
class SQLCompiler(compiler.SQLCompiler):
def resolve_columns(self, row, fields=()):
# If this query has limit/offset information, then we expect the
# first column to be an extra "_RN" column that we need to throw
# away.
if self.query.high... | 2,732 | Python | .py | 53 | 41.113208 | 146 | 0.63841 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,451 | creation.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/oracle/creation.py | import sys, time
from django.db.backends.creation import BaseDatabaseCreation
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated Oracle column
# types, as strings. Column-type strings can contain fo... | 11,628 | Python | .py | 239 | 36.585774 | 149 | 0.563243 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,452 | introspection.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/oracle/introspection.py | from django.db.backends import BaseDatabaseIntrospection
import cx_Oracle
import re
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type objects to Django Field types.
data_types_re... | 5,058 | Python | .py | 109 | 38.229358 | 113 | 0.64047 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,453 | base.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/oracle/base.py | """
Oracle database backend for Django.
Requires cx_Oracle: http://cx-oracle.sourceforge.net/
"""
import datetime
import sys
import time
from decimal import Decimal
def _setup_environment(environ):
import platform
# Cygwin requires some special voodoo to set the environment variables
# properly so that... | 30,653 | Python | .py | 644 | 36.89441 | 126 | 0.604729 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,454 | base.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/dummy/base.py | """
Dummy database backend for Django.
Django uses this if the database ENGINE setting is empty (None or empty string).
Each of these API functions, except connection.close(), raises
ImproperlyConfigured.
"""
from django.core.exceptions import ImproperlyConfigured
from django.db.backends import *
from django.db.back... | 1,511 | Python | .py | 42 | 31.404762 | 82 | 0.752577 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,455 | client.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/sqlite3/client.py | import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'sqlite3'
def runshell(self):
args = [self.executable_name,
self.connection.settings_dict['NAME']]
if os.name == 'nt':
sys.exit(os.sys... | 406 | Python | .py | 12 | 26.5 | 54 | 0.648718 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,456 | creation.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/sqlite3/creation.py | import os
import sys
from django.db.backends.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
# SQLite doesn't actually support most of these types, but it "does the right
# thing" given more verbose field definitions, so leave them as is so that
# schema inspection is mor... | 3,259 | Python | .py | 65 | 39.061538 | 152 | 0.532455 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,457 | introspection.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/sqlite3/introspection.py | import re
from django.db.backends import BaseDatabaseIntrospection
# This light wrapper "fakes" a dictionary interface, because some SQLite data
# types include variables in them -- e.g. "varchar(30)" -- and can't be matched
# as a simple dictionary lookup.
class FlexibleFieldLookupDict:
# Maps SQL types to Django... | 5,857 | Python | .py | 122 | 37.155738 | 112 | 0.589398 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,458 | base.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/db/backends/sqlite3/base.py | """
SQLite3 backend for django.
Python 2.4 requires pysqlite2 (http://pysqlite.org/).
Python 2.5 and later can use a pysqlite2 module or the sqlite3 module in the
standard library.
"""
import re
import sys
from django.db import utils
from django.db.backends import *
from django.db.backends.signals import connection... | 10,000 | Python | .py | 215 | 39.004651 | 129 | 0.661745 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,459 | i18n.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/views/i18n.py | import os
import gettext as gettext_module
from django import http
from django.conf import settings
from django.utils import importlib
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
from django.utils.encoding import smart_unicod... | 8,933 | Python | .py | 236 | 31.194915 | 124 | 0.624308 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,460 | csrf.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/views/csrf.py | from django.http import HttpResponseForbidden
from django.template import Context, Template
from django.conf import settings
# We include the template inline since we need to be able to reliably display
# this error message, especially for the sake of developers, and there isn't any
# other way of making it available ... | 3,834 | Python | .py | 91 | 38.307692 | 133 | 0.693462 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,461 | defaults.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/views/defaults.py | from django import http
from django.views.decorators.csrf import requires_csrf_token
from django.template import Context, RequestContext, loader
# This can be called when CsrfViewMiddleware.process_view has not run, therefore
# need @requires_csrf_token in case the template needs {% csrf_token %}.
@requires_csrf_toke... | 1,663 | Python | .py | 35 | 43.085714 | 103 | 0.73642 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,462 | debug.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/views/debug.py | import datetime
import os
import re
import sys
import types
from django.conf import settings
from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound
from django.template import (Template, Context, TemplateDoesNotExist,
TemplateSyntaxError)
from django.utils.html import escape
from djang... | 31,718 | Python | .py | 807 | 31.604709 | 240 | 0.583576 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,463 | static.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/views/static.py | """
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
import mimetypes
import os
import posixpath
import re
import stat
import urllib
from email.Utils import parsedate_tz, mktime_tz
from django.template import loader
from dj... | 5,176 | Python | .py | 130 | 33.292308 | 121 | 0.648718 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,464 | date_based.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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
def archive_index(request, queryset, d... | 13,871 | Python | .py | 333 | 34.321321 | 156 | 0.639488 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,465 | simple.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/views/generic/simple.py | from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
"""
Render a given template with any extra URL parameters in the... | 1,634 | Python | .py | 35 | 40.485714 | 107 | 0.679222 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,466 | list_detail.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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
def object_list(request, queryset, paginate_by=None, page=No... | 5,423 | Python | .py | 140 | 29.528571 | 113 | 0.609511 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,467 | create_update.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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,794 | Python | .py | 191 | 38.335079 | 114 | 0.662892 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,468 | gzip.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,469 | cache.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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,467 | Python | .py | 71 | 42.56338 | 126 | 0.691967 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,470 | csrf.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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,233 | Python | .py | 54 | 37.425926 | 78 | 0.739511 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,471 | vary.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,472 | http.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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 email.Utils import formatdate
from django.utils.decorators import decorato... | 5,999 | Python | .py | 119 | 39.159664 | 90 | 0.627732 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,473 | __init__.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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
from django.http import HttpResponse, Http404
from django.http import HttpResponseRedirect, Http... | 3,691 | Python | .py | 87 | 36.425287 | 90 | 0.702794 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,474 | formats.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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... | 5,627 | Python | .py | 146 | 31.232877 | 85 | 0.660388 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,475 | regex_helper.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,476 | numberformat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,477 | datastructures.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/utils/datastructures.py | from types import GeneratorType
from django.utils.copycompat import 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 diction... | 14,876 | Python | .py | 397 | 28.347607 | 131 | 0.569048 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,478 | _threading_local.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,479 | tree.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,480 | datetime_safe.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,481 | _os.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/utils/_os.py | import os
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 the
# Wind... | 1,975 | Python | .py | 43 | 40.418605 | 79 | 0.708139 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,482 | dates.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/utils/dates.py | "Commonly-used date structures"
from django.utils.translation import ugettext_lazy as _
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'),
5:_('Sat'... | 1,193 | Python | .py | 31 | 35.483871 | 95 | 0.480172 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,483 | itercompat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,484 | autoreload.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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,279 | Python | .py | 105 | 35.2 | 107 | 0.682452 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,485 | thread_support.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/django/utils/thread_support.py | """
Code used in a couple of places to work with the current thread's environment.
Current users include i18n and request prefix handling.
"""
try:
import threading
currentThread = threading.currentThread
except ImportError:
def currentThread():
return "no threading"
| 290 | Python | .py | 10 | 25.8 | 78 | 0.766187 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,486 | encoding.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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,087 | Python | .py | 159 | 36.496855 | 79 | 0.62719 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,487 | copycompat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,488 | daemonize.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,489 | feedgenerator.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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... | 14,820 | Python | .py | 328 | 36.243902 | 123 | 0.614176 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,490 | cache.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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,146 | Python | .py | 199 | 40.120603 | 81 | 0.688383 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,491 | text.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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
from htmlentitydefs import name2codepoint
# Capitalizes the first letter of a string.
capfirst = lambda x: x and force_unicode(x)[0].upper() + force_unicode(x)[1:]... | 9,831 | Python | .py | 258 | 31.27907 | 132 | 0.580899 | gabrielfalcao/lettuce | 1,274 | 325 | 102 | GPL-3.0 | 9/5/2024, 5:08:58 PM (Europe/Amsterdam) |
3,492 | html.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,493 | xmlutils.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,494 | checksums.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,495 | stopwords.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,496 | timesince.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,497 | tzinfo.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,498 | safestring.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |
3,499 | hashcompat.py | gabrielfalcao_lettuce/tests/integration/lib/Django-1.2.5/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) |