hash
stringlengths
64
64
content
stringlengths
0
1.51M
882f736072a984c6929e5b8165f62f1f5915e5a0f2977c9cb2a563c4ea2a7ce6
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'd F Y' TIME_FORMAT = 'H:i' # DATETIME_FORMAT = # YEAR_MONTH_FORMAT = MONTH_DAY_FORMAT = 'j F' SHORT...
69275dabb7e194e71edf304b753343400e4bfe07c086c98a442bb243c3b94f26
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' TIME_FORMAT = 'g:i A' # DATETIME_FORMAT = # YEAR_MONTH_FORMAT = MONTH_DAY_FORMAT = 'j F' SHO...
4b611c2c83cc6d5c51b969d1cd6a7647b57321505a6b8b7a5ea9624c82f03382
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'Y년 n월 j일' TIME_FORMAT = 'A g:i' DATETIME_FORMAT = 'Y년 n월 j일 g:i A' YEAR_MONTH_FORMAT = 'Y년 n월' MONT...
7dc6ce68d9a84165393bced8b2f885b2a435497691674a29b02be0ca00a496a1
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = 'j F Y H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMAT...
bc11ac3ed31990964dd2055c5f77820d5137287b23249f78116dbff6d093d16e
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' TIME_FORMAT = 'G:i' DATETIME_FORMAT = 'j F Y, G:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORMA...
36877396bb40ebfd24edb982b3a6bdf938e102b88665c4d3d76335f9a37e8fee
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = r'Y. \g\a\d\a j. F' TIME_FORMAT = 'H:i' DATETIME_FORMAT = r'Y. \g\a\d\a j. F, H:i' YEAR_MONTH_FORMAT...
8eab84ead2e3f673b1706b47ff7dbac39eec1fd04a84fe012ad3f3e9e0a2e24f
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j. F Y' TIME_FORMAT = 'H:i' DATETIME_FORMAT = 'j. F Y H:i' YEAR_MONTH_FORMAT = 'F Y' MONTH_DAY_FORM...
74163426f5a29c678d883cb866b9ebb4f69941dc14ec9ba09331c4db60be3340
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j F Y' TIME_FORMAT = 'g:i A' # DATETIME_FORMAT = # YEAR_MONTH_FORMAT = MONTH_DAY_FORMAT = 'j F' SHO...
c0ce3bfa097a3765db927308500bcd9aac4dcaca3a6cd9f0535d51ce82cadd13
# This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j E Y г.' TIME_FORMAT = 'G:i' DATETIME_FORMAT = 'j E Y г. G:i' YEAR_MONTH_FORMAT = 'F Y г.' MONTH_D...
8e84622a5fc44c894b78a46c77fe09a645f41269643bf2e5eb355324362be694
"""Translation helper functions.""" import functools import gettext as gettext_module import os import re import sys import warnings from threading import local from django.apps import apps from django.conf import settings from django.conf.locale import LANG_INFO from django.core.exceptions import AppRegistryNotReady ...
1667e10fee84f3381d1b0ecdad82c57d8dc2ee15dc678ce06a9a6da7cf771e5d
""" Internationalization support. """ import re import warnings from contextlib import ContextDecorator from decimal import ROUND_UP, Decimal from django.utils.autoreload import autoreload_started, file_changed from django.utils.deprecation import RemovedInDjango40Warning from django.utils.functional import lazy __al...
fdd786f73b8593990f6797314ef6fbde174ccc596f41ef821875cce49fa8dcd6
import threading from pathlib import Path from django.apps import apps def watch_for_translation_changes(sender, **kwargs): """Register file watchers for .mo files in potential locale paths.""" from django.conf import settings if settings.USE_I18N: directories = [Path('locale')] director...
54d851117515df835e4895f05ef419c2f0bb68cd21aa46552c40124fe36df9cc
""" Wrapper class that takes a list of template loaders as an argument and attempts to load templates from them in order, caching the result. """ import hashlib from django.template import TemplateDoesNotExist from django.template.backends.django import copy_exception from .base import Loader as BaseLoader class L...
34e4455a4fedcf522c5fa58d6633fb233e40cfa5fca543f476605f342e2fa1d9
from django.middleware.csrf import get_token from django.utils.functional import lazy from django.utils.html import format_html from django.utils.safestring import SafeString def csrf_input(request): return format_html( '<input type="hidden" name="csrfmiddlewaretoken" value="{}">', get_token(reque...
7d4f59cc50e48aa3151d1fe3e1f9f3168196ec56b01ebfd0240fe4662b585909
from django.apps.registry import apps as global_apps from django.db import migrations, router from .exceptions import InvalidMigrationPlan from .loader import MigrationLoader from .recorder import MigrationRecorder from .state import ProjectState class MigrationExecutor: """ End-to-end migration execution - ...
0a04b4ba21b4b2167851de1668632349dc12bd3f18d105b66b3a7485473874c4
import copy from contextlib import contextmanager from django.apps import AppConfig from django.apps.registry import Apps, apps as global_apps from django.conf import settings from django.db import models from django.db.models.fields.proxy import OrderWrt from django.db.models.fields.related import RECURSIVE_RELATIONS...
4f3f85e92ec82eb7fad01f285ca7f52f4954b7fdaa7739c2ea5ae99215cc3e49
import pkgutil import sys from importlib import import_module, reload from django.apps import apps from django.conf import settings from django.db.migrations.graph import MigrationGraph from django.db.migrations.recorder import MigrationRecorder from .exceptions import ( AmbiguityError, BadMigrationError, Inconsi...
e90b1243a8ce48f06331db8f584b0bce26e2e3f0abdd177cc18ed37425a23515
import os import re from importlib import import_module from django import get_version from django.apps import apps # SettingsReference imported for backwards compatibility in Django 2.2. from django.conf import SettingsReference # NOQA from django.db import migrations from django.db.migrations.loader import Migrati...
f708dedef6a8711e2330a4cb2d54705c408c0fb15949d25b87ea38fbe48abc0d
import datetime import importlib import os import sys from django.apps import apps from django.db.models.fields import NOT_PROVIDED from django.utils import timezone from .loader import MigrationLoader class MigrationQuestioner: """ Give the autodetector responses to questions it might have. This base c...
aa1a3776a91b9bc43269179b19050141616fd5343eef4012f1a5ad3a6c3722eb
from functools import total_ordering from django.db.migrations.state import ProjectState from .exceptions import CircularDependencyError, NodeNotFoundError @total_ordering class Node: """ A single node in the migration graph. Contains direct links to adjacent nodes in either direction. """ def _...
d58eb8efa632df509d82e3e119fee89ca1d5328438af6dc3993117b2af415980
import functools import re from itertools import chain from django.conf import settings from django.db import models from django.db.migrations import operations from django.db.migrations.migration import Migration from django.db.migrations.operations.models import AlterModelOptions from django.db.migrations.optimizer ...
56194386cb6b3daf36fe50bd9c58b253aefdb53179351cf62fc233de472830bc
from django.apps.registry import Apps from django.db import models from django.db.utils import DatabaseError from django.utils.decorators import classproperty from django.utils.timezone import now from .exceptions import MigrationSchemaMissing class MigrationRecorder: """ Deal with storing migration records ...
fd298b8a91a82789da29c1583df3156f358357d76c30a229538473d8837be0c9
class MigrationOptimizer: """ Power the optimization process, where you provide a list of Operations and you are returned a list of equal or shorter length - operations are merged into one if possible. For example, a CreateModel and an AddField can be optimized into a new CreateModel, and Creat...
1e1cc54c8886178bb259cbd3ab7022606a0a28f4f34e5fcad11be018ca0b675b
import builtins import collections.abc import datetime import decimal import enum import functools import math import re import types import uuid from django.conf import SettingsReference from django.db import models from django.db.migrations.operations.base import Operation from django.db.migrations.utils import COMP...
6f7dde0a113c523ea70c8439a87264ff522f858a45aa9aa32f30d2192e36204a
""" Classes to represent the definitions of aggregate functions. """ from django.core.exceptions import FieldError from django.db.models.expressions import Case, Func, Star, When from django.db.models.fields import IntegerField from django.db.models.functions.mixins import ( FixDurationInputMixin, NumericOutputFiel...
4d34fcc9f30e857600cd366dde2f6cda69685a4a2df5ed956aae0d9282dd9fe9
from django.db.backends.utils import names_digest, split_identifier from django.db.models.query_utils import Q from django.db.models.sql import Query __all__ = ['Index'] class Index: suffix = 'idx' # The max length of the name of the index (restricted to 30 for # cross-database compatibility with Oracle)...
b624a91649bddfc3b60dfb77dea748d8a3a67d56671cfbc68486f024c4a71c1b
""" The main QuerySet implementation. This provides the public API for the ORM. """ import copy import operator import warnings from collections import namedtuple from functools import lru_cache from itertools import chain from django.conf import settings from django.core import exceptions from django.db import ( ...
e1708f0f415f882b5f10140131a1832e5c617d3820e4a0a102b2c453e036944d
from django.core.exceptions import ObjectDoesNotExist from django.db.models import signals from django.db.models.aggregates import * # NOQA from django.db.models.aggregates import __all__ as aggregates_all from django.db.models.constraints import * # NOQA from django.db.models.constraints import __all__ as constraint...
92393b1732e038909c96e1ed5cf3a81da16b15ceb21fb0eb418e520ff03ac038
import copy import inspect from bisect import bisect from collections import defaultdict from django.apps import apps from django.conf import settings from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured from django.db import connections from django.db.models import Manager from django.db.models....
c93c4f3a47cdae918adc71e9ee6744abeb9b1c16ffdd4b2c948d98d1b54ad43e
import copy import inspect import warnings from functools import partialmethod from itertools import chain from django.apps import apps from django.conf import settings from django.core import checks from django.core.exceptions import ( NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned, ...
bd70fc8befe92fb76dcda0d6e351431558ee2366e80574048eb734bc0c28c87f
""" 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 copy import functools import inspect from collections import namedtu...
d0032de48a1a172483dcfbeffdf60d4fafcccbc00067db73258447ce449ad805
import copy import datetime import inspect from decimal import Decimal from django.core.exceptions import EmptyResultSet, FieldError from django.db import connection from django.db.models import fields from django.db.models.query_utils import Q from django.db.utils import NotSupportedError from django.utils.deconstruc...
54f7fe9c7212c64bbf85bb10a9210cfebf3bec5a8baba453e521b8b8d35a0e41
from collections import Counter from itertools import chain from operator import attrgetter from django.db import IntegrityError, connections, transaction from django.db.models import signals, sql class ProtectedError(IntegrityError): def __init__(self, msg, protected_objects): self.protected_objects = p...
2f6099d7ed00066e2f4acc707f235585d2753a4904e54c7de4dba56208806088
import itertools import math from copy import copy from django.core.exceptions import EmptyResultSet from django.db.models.expressions import Func, Value from django.db.models.fields import DateTimeField, Field, IntegerField from django.db.models.query_utils import RegisterLookupMixin from django.utils.datastructures ...
243ebaba007553de7b09872b18bc4a32aef75e55130b5632f4d6926514d901d6
from django.db.models.query_utils import Q from django.db.models.sql.query import Query __all__ = ['CheckConstraint', 'UniqueConstraint'] class BaseConstraint: def __init__(self, name): self.name = name def constraint_sql(self, model, schema_editor): raise NotImplementedError('This method mu...
6f24f791d03138ccbbbaa221fc3d82831c800416f668da0f29c1897ccf20384a
""" Helpers to manipulate deferred DDL statements that might need to be adjusted or discarded within when executing a migration. """ class Reference: """Base class that defines the reference interface.""" def references_table(self, table): """ Return whether or not this instance references th...
f91451904e8110cd62294638cef8d9f22b6cc1f1e1c5ac4755dd3b6aef5c0ebd
import datetime import decimal import functools import hashlib import logging import time from contextlib import contextmanager from django.conf import settings from django.db.utils import NotSupportedError from django.utils.timezone import utc logger = logging.getLogger('django.db.backends') class CursorWrapper: ...
e3c56858d997795752aa732a97ec1d5951a6bfc056a5f14bcf6a47dc8e510c26
from .fields import AddField, AlterField, RemoveField, RenameField from .models import ( AddConstraint, AddIndex, AlterIndexTogether, AlterModelManagers, AlterModelOptions, AlterModelTable, AlterOrderWithRespectTo, AlterUniqueTogether, CreateModel, DeleteModel, RemoveConstraint, RemoveIndex, RenameModel...
78deb3bd5d2b492021625d219d8c9e5745209614932d0b67eacd37dcd4cc7af7
from django.db import models from django.db.migrations.operations.base import Operation from django.db.migrations.state import ModelState from django.db.models.options import normalize_together from django.utils.functional import cached_property from .fields import ( AddField, AlterField, FieldOperation, RemoveFie...
130686e8a82786396f22b15794517e58151a427f325f37e95b45449c9637f004
from django.db import router from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT class Operation: """ Base class for migration operations. It's responsible for both mutating the in-memory model state (see db/migrations/state.py) to represent what it performs, as well as ac...
cbcdce156b93ac58182f1032ef7ccd70963b5445c98e4241933e4b507116ca6d
from django.core.exceptions import FieldDoesNotExist from django.db.models.fields import NOT_PROVIDED from django.utils.functional import cached_property from .base import Operation from .utils import ( ModelTuple, field_references_model, is_referenced_by_foreign_key, ) class FieldOperation(Operation): def _...
f9da57d9e209613c5eca359e75741af0706c35a0f0fd81b0ea345de735443faa
from collections import namedtuple from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT def is_referenced_by_foreign_key(state, model_name_lower, field, field_name): for state_app_label, state_model in state.models: for _, f in state.models[state_app_label, state_model].fields: ...
c9df81b5beeaddc41aa57a26b670d47770b3d7fcea459ac72fc28335d40b9146
import collections.abc import copy import datetime import decimal import operator import uuid import warnings from base64 import b64decode, b64encode from functools import partialmethod, total_ordering from django import forms from django.apps import apps from django.conf import settings from django.core import checks...
2f276a2cd4f32427b242a1676647e526037a21d32c5dbd27cd5cdfd9de53bf18
import functools import inspect from functools import partial from django import forms from django.apps import apps from django.conf import SettingsReference from django.core import checks, exceptions from django.db import connection, router from django.db.backends import utils from django.db.models import Q from djan...
cedf6597d27e52e1e9147f7171c89dff388d8cccd26a2d5c29796123d43f2fa5
import datetime import posixpath from django import forms from django.core import checks from django.core.files.base import File from django.core.files.images import ImageFile from django.core.files.storage import default_storage from django.db.models import signals from django.db.models.fields import Field from djang...
36860cbf89b478cce3817e5200e1b503f14f24aa6e873edd6599f9fa92511bfc
""" Accessors for related objects. When a field defines a relation between two models, each model class provides an attribute to access related instances of the other model class (unless the reverse accessor has been disabled with related_name='+'). Accessors are implemented as descriptors in order to customize acces...
eaf27bc6dcabe0b3d51ea4e3e5658e6dab43de53c11e1e35f814221ff16805f8
""" "Rel objects" for related fields. "Rel objects" (for lack of a better name) carry information about the relation modeled by a related field and provide some utility functions. They're stored in the ``remote_field`` attribute of the field. They also act as reverse fields for the purposes of the Meta API because th...
d4cbe712fd63ded585aae0fac6e6146f81c00b4afb8a73b0998653f2c977abdb
from django.db.models.expressions import Func, Value from django.db.models.fields import IntegerField from django.db.models.functions import Coalesce from django.db.models.lookups import Transform from django.db.utils import NotSupportedError class BytesToCharFieldConversionMixin: """ Convert CharField result...
a2e47c5c0006380b0791c530221e91ad270d702af2f3fe9247ff613b71422e83
"""Database functions that do comparisons or type conversions.""" from django.db.models.expressions import Func, Value class Cast(Func): """Coerce an expression to a new field type.""" function = 'CAST' template = '%(function)s(%(expressions)s AS %(db_type)s)' def __init__(self, expression, output_fi...
c01bfcd5f11d078487ea6616073331bf92f6975d8432cc32f23dedb3b2784b54
from .comparison import Cast, Coalesce, Greatest, Least, NullIf from .datetime import ( Extract, ExtractDay, ExtractHour, ExtractIsoYear, ExtractMinute, ExtractMonth, ExtractQuarter, ExtractSecond, ExtractWeek, ExtractWeekDay, ExtractYear, Now, Trunc, TruncDate, TruncDay, TruncHour, TruncMinute, TruncMo...
c8bd3b06586ed56b9dc4731b21f440d9b0485eec1979cf302cf6d6e8de5e3b27
from django.db.models.expressions import Func from django.db.models.fields import FloatField, IntegerField __all__ = [ 'CumeDist', 'DenseRank', 'FirstValue', 'Lag', 'LastValue', 'Lead', 'NthValue', 'Ntile', 'PercentRank', 'Rank', 'RowNumber', ] class CumeDist(Func): function = 'CUME_DIST' output_fiel...
47faef199c6a47d18486e014517b7ba09d9b72094ec821fab4fce53a0fbb0cda
import math from django.db.models.expressions import Func from django.db.models.fields import FloatField, IntegerField from django.db.models.functions import Cast from django.db.models.functions.mixins import ( FixDecimalInputMixin, NumericOutputFieldMixin, ) from django.db.models.lookups import Transform class ...
1d8cf2f53c53d29ae5a02aaf63d43c89c853e06727f63d3d05d413b12d2b801b
from datetime import datetime from django.conf import settings from django.db.models.expressions import Func from django.db.models.fields import ( DateField, DateTimeField, DurationField, Field, IntegerField, TimeField, ) from django.db.models.lookups import ( Transform, YearExact, YearGt, YearGte, YearLt, Yea...
2ec9cb1c716b22fe7f85910137b89340c16e6bf810946e270ce441f039d5792c
import sys from django.db.models.fields import DecimalField, FloatField, IntegerField from django.db.models.functions import Cast class FixDecimalInputMixin: def as_postgresql(self, compiler, connection, **extra_context): # Cast FloatField to DecimalField as PostgreSQL doesn't support the # foll...
c650a22763e510c9dadf8fd95ed801f95a9bb533070f5a0fa3db91bdb67e40b8
""" 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 ...
8346b2e8d5b645a0ceb5fff3e4e0271e0f53573902b6e9cdc951d91bb9b86f3b
import collections import re import warnings from itertools import chain from django.core.exceptions import EmptyResultSet, FieldError from django.db.models.constants import LOOKUP_SEP from django.db.models.expressions import OrderBy, Random, RawSQL, Ref, Value from django.db.models.functions import Cast from django.d...
f7499f0b42819d084bccbe4baca398a658d66d4696a3bae5955ab08db562d8ee
""" Code to manage the creation and SQL rendering of 'where' constraints. """ from django.core.exceptions import EmptyResultSet from django.utils import tree from django.utils.functional import cached_property # Connection types AND = 'AND' OR = 'OR' class WhereNode(tree.Node): """ An SQL WHERE clause. ...
cee7adb94f401a3d4c76359832dcc4af1647d95958f5d1a9f914067425ddeae3
from django.core.exceptions import EmptyResultSet from django.db.models.sql.query import * # NOQA from django.db.models.sql.query import Query from django.db.models.sql.subqueries import * # NOQA from django.db.models.sql.where import AND, OR __all__ = ['Query', 'AND', 'OR', 'EmptyResultSet']
d485e639249aaa7bbf77701bda2ca9f7b9eb570d25ff0a452c4a2c6807cb8873
""" Useful auxiliary data structures for query construction. Not useful outside the SQL domain. """ # for backwards-compatibility in Django 1.11 from django.core.exceptions import EmptyResultSet # NOQA: F401 from django.db.models.sql.constants import INNER, LOUTER class MultiJoin(Exception): """ Used by join...
986bf4b33615fcbdcc43ad9dfec001aa950eb10537bd0660c42502915a2fe0ce
""" 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.query_utils import Q from django.db.models.sql.constants import ( CURSOR, GET_ITERATOR_CHUNK_SIZE, NO_RESULTS, ) from django...
26361877867205b50300895d3554442a4715503258df4d5168cd269a80aad5ce
from django.db.backends.base.features import BaseDatabaseFeatures from django.db.utils import InterfaceError class DatabaseFeatures(BaseDatabaseFeatures): interprets_empty_strings_as_nulls = True has_select_for_update = True has_select_for_update_nowait = True has_select_for_update_skip_locked = True ...
821246dc3e7655a80e6599d72188c22bfdc82256e1b77ecaac9b8e74c7308500
from collections import namedtuple import cx_Oracle from django.db import models from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) FieldInfo = namedtuple('FieldInfo', BaseFieldInfo._fields + ('is_autofield',)) class DatabaseIntrospection(Bas...
0157e93b315d3ac37c1be78aee650ef0f93af8a61445a1c49434786b22b90d19
""" Oracle database backend for Django. Requires cx_Oracle: https://oracle.github.io/python-cx_Oracle/ """ import datetime import decimal import os import platform from contextlib import contextmanager from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import utils...
d62da08b55650eb09d1cb073d8e00e55a4ca163497f99c8ebde3c1969b4f52a6
import datetime import re import uuid from functools import lru_cache from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.db.backends.utils import strip_quotes, truncate_name from django.db.utils import DatabaseError from django.utils import timezone from ...
8057b0c6b458a7f2ba27404771aacdd0d88d29ad43f65765f70b133b5b4c0907
import copy import datetime import re from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.utils import DatabaseError class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_column = "ALTER TABLE %(table)s ADD %(column)s %(definition)s" sql_alter_column_type = "MODIFY ...
25860139902bf35e22122d96384393eed7027c972593c80c80fc7366ee1207c7
import shutil import subprocess from django.db.backends.base.client import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): executable_name = 'sqlplus' wrapper_name = 'rlwrap' def runshell(self): conn_string = self.connection._connect_string() args = [self.executable_name, "-...
42b96e6b4cee98e6d133a6a45ad5f256fc5c29f551394a73ac3837ceb640bca6
import datetime from .base import Database class InsertIdVar: """ A late-binding cursor variable that can be passed to Cursor.execute as a parameter, in order to receive the id of the row created by an insert statement. """ def bind_parameter(self, cursor): param = cursor.cursor.var(i...
1603548f790c68ae66de1fd68dcc3ba4400cab133ab6df3b1ff76df363a098c1
import sys from django.conf import settings from django.db.backends.base.creation import BaseDatabaseCreation from django.db.utils import DatabaseError from django.utils.crypto import get_random_string from django.utils.functional import cached_property TEST_DATABASE_PREFIX = 'test_' class DatabaseCreation(BaseData...
6fb831f1badfdfa5ffcf3b94da378ee2212849c1dc04190927a84139857875fd
from django.db.utils import ProgrammingError from django.utils.functional import cached_property class BaseDatabaseFeatures: gis_enabled = False allows_group_by_pk = False allows_group_by_selected_pks = False empty_fetchmany_value = [] update_can_self_select = True # Does the backend distingu...
c7ec77da304c4864af06719bffd10580a5a4d124d86ce8acf58a05e1ccc49b49
from collections import namedtuple # Structure returned by DatabaseIntrospection.get_table_list() TableInfo = namedtuple('TableInfo', ['name', 'type']) # Structure returned by the DB-API cursor.description interface (PEP 249) FieldInfo = namedtuple('FieldInfo', 'name type_code display_size internal_size precision sca...
9e45cced229cdf5f498041b3d1ba33ff18e2d8471a4a33de622ec64dbfbcebe3
import copy import threading import time import warnings from collections import deque from contextlib import contextmanager import _thread import pytz from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import DEFAULT_DB_ALIAS from django.db.backends import utils f...
6ab54e37fc2e1909fe9d63ef8b738a988771f66b102f609e1749a54ff82eac47
import datetime import decimal from importlib import import_module import sqlparse from django.conf import settings from django.db import NotSupportedError, transaction from django.db.backends import utils from django.utils import timezone from django.utils.encoding import force_str class BaseDatabaseOperations: ...
ea6cafec4045a4fc405827f6fe93370a29cd7a5e966289851dffd96b9896e1f4
import logging from datetime import datetime from django.db.backends.ddl_references import ( Columns, ForeignKeyName, IndexName, Statement, Table, ) from django.db.backends.utils import names_digest, split_identifier from django.db.models import Index from django.db.transaction import TransactionManagementError, a...
ebff0820a758b88df023ecd4b416d31d46baa70389c988af8d5ef654489ec36f
import os import sys from io import StringIO from django.apps import apps from django.conf import settings from django.core import serializers from django.db import router # The prefix to put on the default database name when creating # the test database. TEST_DATABASE_PREFIX = 'test_' class BaseDatabaseCreation: ...
d17c0e6f2fc7ce06ce92b068df385ad6af6212d9fd6daab3911baaac7cea59a7
import operator from django.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () update_can_self_select = False allows_group_by_pk = True related_fields_match_type = True ...
ae689391c088c39fb7b42eda8e6332f36cc7a649349da422a624b554b53d5700
from collections import namedtuple from MySQLdb.constants import FIELD_TYPE from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.db.models.indexes import Index from django.utils.datastructures import OrderedSet FieldInfo = namedtuple(...
2586e11aa9d8f341145577b609a2697bd9903658e67f3df2fe7f85adb032194b
""" MySQL database backend for Django. Requires mysqlclient: https://pypi.org/project/mysqlclient/ """ import re from django.core.exceptions import ImproperlyConfigured from django.db import utils from django.db.backends import utils as backend_utils from django.db.backends.base.base import BaseDatabaseWrapper from d...
6acfeca07ffd42a0d955375d85b4dcaa168ca9a6ecde4c69d706f577a3a2e6cd
import uuid from django.conf import settings from django.db.backends.base.operations import BaseDatabaseOperations from django.utils import timezone from django.utils.duration import duration_microseconds from django.utils.encoding import force_str class DatabaseOperations(BaseDatabaseOperations): compiler_modul...
0018735d4d66a393776e097b6ea3f0870cd947bb2ec2e3fb62cf11a1b9e06cac
from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.models import NOT_PROVIDED class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s" sql_alter_column_null = "MODIFY %(column)s %(type)s NULL" sql_alter_column_...
a67deeb501c584f5fddd3f20d59f24f3f5374c352cb3a7c321e52068836da1b7
import subprocess import sys from django.db.backends.base.creation import BaseDatabaseCreation from .client import DatabaseClient class DatabaseCreation(BaseDatabaseCreation): def sql_table_creation_suffix(self): suffix = [] test_settings = self.connection.settings_dict['TEST'] if test_...
3e0f3f8cd0fe6a8268993681057537849123ce907eacbb3a570a682a4398b908
from django.db.backends.base.features import BaseDatabaseFeatures class DummyDatabaseFeatures(BaseDatabaseFeatures): supports_transactions = False uses_savepoints = False
312d164f7bd36aea37935e0c40c2ea839fec04f71ac7b4cdcaf10a06a0136f42
import operator from django.db.backends.base.features import BaseDatabaseFeatures from django.db.utils import InterfaceError from django.utils.functional import cached_property class DatabaseFeatures(BaseDatabaseFeatures): allows_group_by_selected_pks = True can_return_columns_from_insert = True can_retu...
db844c2980cabbfa778efedfd04a2c2bd1d71d4051f68d706985a573a75d7648
from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo, TableInfo, ) from django.db.models.indexes import Index class DatabaseIntrospection(BaseDatabaseIntrospection): # Maps type codes to Django Field types. data_types_reverse = { 16: 'BooleanField', 17: ...
3c640b4402e61cc793d2ecc3866298f0a84cf772b8c63723bf2fb33ead794b50
""" PostgreSQL database backend for Django. Requires psycopg 2: http://initd.org/projects/psycopg2 """ import threading import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import connections from django.db.backends.base.base import BaseDatabaseWrapp...
b500e4805177a86fe609592daf8cf27e2950714a9d691222cd333b9342d5a890
from psycopg2.extras import Inet from django.conf import settings from django.db import NotSupportedError from django.db.backends.base.operations import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): cast_char_field_without_max_length = 'varchar' explain_prefix = 'EXPLAIN' cast_...
6a65c7c66ebaf8ff34f635798a0a87289309a2347ea1280fd407b34034e53b05
import psycopg2 from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.ddl_references import IndexColumns class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_sequence = "CREATE SEQUENCE %(sequence)s" sql_delete_sequence = "DROP SEQUENCE IF EXISTS %(sequence)...
939a5a6c53c0b2e2eb47cfb33f5ece1ffb56f48a87fada026f71492fee8871c1
import os import signal import subprocess from django.db.backends.base.client import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): executable_name = 'psql' @classmethod def runshell_db(cls, conn_params): args = [cls.executable_name] host = conn_params.get('host', '') ...
6b5d29fb1327215cb2d72d2f00593d33a0b12ea52285c76c5cd4c02467517af3
import sys from psycopg2 import errorcodes from django.db.backends.base.creation import BaseDatabaseCreation from django.db.backends.utils import strip_quotes class DatabaseCreation(BaseDatabaseCreation): def _quote_name(self, name): return self.connection.ops.quote_name(name) def _get_database_cr...
e56b00a713390ca52881b97819f439b386e1e1ab01777a7452a744b3c886976b
from django.db.backends.base.features import BaseDatabaseFeatures from .base import Database class DatabaseFeatures(BaseDatabaseFeatures): # SQLite can read from a cursor since SQLite 3.6.5, subject to the caveat # that statements within a connection aren't isolated from each other. See # https://sqlite....
b0ed1e67aa0a44b521dce7082face09760dcb56edc2ff0e05adbb285f81544dd
import re from collections import namedtuple import sqlparse from django.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo as BaseFieldInfo, TableInfo, ) from django.db.models.indexes import Index FieldInfo = namedtuple('FieldInfo', BaseFieldInfo._fields + ('pk',)) field_size_re = re....
29a01a8c61ae767eb32ef9e20600900e6d3d6affc89071aacdf549a048cfd4fc
""" SQLite backend for the sqlite3 module in the standard library. """ import datetime import decimal import functools import hashlib import math import operator import re import statistics import warnings from itertools import chain from sqlite3 import dbapi2 as Database import pytz from django.core.exceptions impor...
b6721e9be464e1eca00ae09bc0297be1f05980179aad3d12f82c42f9c6ac29c9
import datetime import decimal import uuid from functools import lru_cache from itertools import chain from django.conf import settings from django.core.exceptions import FieldError from django.db import utils from django.db.backends.base.operations import BaseDatabaseOperations from django.db.models import aggregates...
8bc17835ac2bf21b892bf49036bf250376f09cff6b98e9a046c733b0ebb5fe21
import copy from decimal import Decimal from django.apps.registry import Apps from django.db.backends.base.schema import BaseDatabaseSchemaEditor from django.db.backends.ddl_references import Statement from django.db.models import UniqueConstraint from django.db.transaction import atomic from django.db.utils import No...
89ea719dc1f92e7f8e3ed8a064e7276d388af652d5b2801220e0b6216bb3840b
import os import shutil import sys from django.db.backends.base.creation import BaseDatabaseCreation class DatabaseCreation(BaseDatabaseCreation): @staticmethod def is_in_memory_db(database_name): return database_name == ':memory:' or 'mode=memory' in database_name def _get_test_db_name(self): ...
81ec42f49c41aa84662c8be22958b0adc2b316c7a18f35b461c2cbbd4e2cb63b
""" HTTP server that implements the Python WSGI protocol (PEP 333, rev 1.21). Based on wsgiref.simple_server which is part of the standard library since 2.5. This is a simple server for use in testing or debugging Django apps. It hasn't been reviewed for security issues. DON'T USE IT FOR PRODUCTION USE! """ import l...
cb2d727b66ee294d8f07cf388ca9b3a7c8c11883db3e109ade77e55ee95569f4
""" The temp module provides a NamedTemporaryFile that can be reopened in the same process on any platform. Most platforms use the standard Python tempfile.NamedTemporaryFile class, but Windows users are given a custom class. This is needed because the Python implementation of NamedTemporaryFile uses the O_TEMPORARY f...
8ec62c1376cda4081a41c52f4c4f26d544e3e875579077786e1f98dfc26617ce
import os from io import BytesIO, StringIO, UnsupportedOperation from django.core.files.utils import FileProxyMixin from django.utils.functional import cached_property class File(FileProxyMixin): DEFAULT_CHUNK_SIZE = 64 * 2 ** 10 def __init__(self, file, name=None): self.file = file if name ...
ff8c469ba842574e57e78558d009048d815a35c37ce71de169b943d89f63c92e
""" Move a file in the safest way possible:: >>> from django.core.files.move import file_move_safe >>> file_move_safe("/tmp/old_file", "/tmp/new_file") """ import errno import os from shutil import copystat from django.core.files import locks __all__ = ['file_move_safe'] def _samefile(src, dst): # Mac...
8e6176f454354476754a2a3a84d8c9e85615022cf92504e4032a97eea5920050
""" Utility functions for handling images. Requires Pillow as you might imagine. """ import struct import zlib from django.core.files import File class ImageFile(File): """ A mixin for use alongside django.core.files.base.File, which provides additional features for dealing with images. """ @pro...
a403777e94d2ea85beb3e897a8e07681f9b6738b291eca321e33afe398fbd750
import os from datetime import datetime from urllib.parse import urljoin from django.conf import settings from django.core.exceptions import SuspiciousFileOperation from django.core.files import File, locks from django.core.files.move import file_move_safe from django.core.signals import setting_changed from django.ut...