code stringlengths 0 21.5M | repo_name stringlengths 4 92 | path stringlengths 1 189 | language stringlengths 0 26 | license stringclasses 11
values | size int64 0 21.5M |
|---|---|---|---|---|---|
# This file is distributed under the same license as the Django package.
#
# Translators:
# Machaku <bmachaku@gmail.com>, 2013-2014
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-23 18:54+0000\n"
"Last-Translator: Jann... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/sw/LC_MESSAGES/django.po | po | mit | 901 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jan... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/ta/LC_MESSAGES/django.po | po | mit | 939 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translator: Jan... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/te/LC_MESSAGES/django.po | po | mit | 912 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Surush Sufiew <siriusproger@gmail.com>, 2020
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2020-05-15 00:35+0000\n"
"Last-Translator:... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/tg/LC_MESSAGES/django.po | po | mit | 1,026 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Kowit Charoenratchatabhan <kowit.s.c@gmail.com>, 2013,2018
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/th/LC_MESSAGES/django.po | po | mit | 1,077 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Resulkary <resulsaparov@gmail.com>, 2020
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2020-07-06 11:50+0000\n"
"Last-Translator: Res... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/tk/LC_MESSAGES/django.po | po | mit | 917 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Ahmet Emre Aladağ <emre.aladag@isik.edu.tr>, 2014
# BouRock, 2014
# Caner Başaran <basaran.caner@protonmail.com>, 2013
# Jannis Leidel <jannis@leidel.info>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bu... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/tr/LC_MESSAGES/django.po | po | mit | 1,043 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Azat Khasanshin <lordofbazuks@gmail.com>, 2011
# v_ildar <v_ildar@bk.ru>, 2014
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/tt/LC_MESSAGES/django.po | po | mit | 930 |
# This file is distributed under the same license as the Django package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2014-10-05 20:13+0000\n"
"Last-Translator: Jannis Leidel <jannis@leidel.info>\n"
"Languag... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/udm/LC_MESSAGES/django.po | po | mit | 767 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Oleksandr Chernihov <o.chernihov@gmail.com>, 2014
# Jannis Leidel <jannis@leidel.info>, 2011
# Alex Bolotov <oleksandr.bolotov@gmail.com>, 2013
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Cr... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/uk/LC_MESSAGES/django.po | po | mit | 1,341 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Mansoorulhaq Mansoor <mnsrknp@gmail.com>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-19 16:40+0000\n"
"Last-Translato... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/ur/LC_MESSAGES/django.po | po | mit | 885 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Nuruddin Iminokhunov <nuruddin.iminohunov@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: 2017-09-23 01:18+0000\n"
"La... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/uz/LC_MESSAGES/django.po | po | mit | 935 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Thanh Le Viet <lethanhx2k@gmail.com>, 2013
# Tran <hongdiepkien@gmail.com>, 2011
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/vi/LC_MESSAGES/django.po | po | mit | 989 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Jannis Leidel <jannis@leidel.info>, 2011
# Ronald White <ouyanghongyu@gmail.com>, 2014
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-17 11:07+0100\n"
"PO-Revision-Date: ... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/zh_Hans/LC_MESSAGES/django.po | po | mit | 946 |
# This file is distributed under the same license as the Django package.
#
# Translators:
# Chen Chun-Chia <ccc.larc@gmail.com>, 2015
# Jannis Leidel <jannis@leidel.info>, 2011
# mail6543210 <mail6543210@yahoo.com.tw>, 2013
# Tzu-ping Chung <uranusjr@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"R... | castiel248/Convert | Lib/site-packages/django/contrib/sites/locale/zh_Hant/LC_MESSAGES/django.po | po | mit | 1,046 |
"""
Creates the default Site object.
"""
from django.apps import apps as global_apps
from django.conf import settings
from django.core.management.color import no_style
from django.db import DEFAULT_DB_ALIAS, connections, router
def create_default_site(
app_config,
verbosity=2,
interactive=True,
using... | castiel248/Convert | Lib/site-packages/django/contrib/sites/management.py | Python | mit | 1,646 |
from django.conf import settings
from django.core import checks
from django.core.exceptions import FieldDoesNotExist
from django.db import models
class CurrentSiteManager(models.Manager):
"Use this to limit objects to those associated with the current site."
use_in_migrations = True
def __init__(self, f... | castiel248/Convert | Lib/site-packages/django/contrib/sites/managers.py | Python | mit | 1,994 |
from django.utils.deprecation import MiddlewareMixin
from .shortcuts import get_current_site
class CurrentSiteMiddleware(MiddlewareMixin):
"""
Middleware that sets `site` attribute to request object.
"""
def process_request(self, request):
request.site = get_current_site(request)
| castiel248/Convert | Lib/site-packages/django/contrib/sites/middleware.py | Python | mit | 309 |
import django.contrib.sites.models
from django.contrib.sites.models import _simple_domain_name_validator
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = []
operations = [
migrations.CreateModel(
name="Site",
fields=[
... | castiel248/Convert | Lib/site-packages/django/contrib/sites/migrations/0001_initial.py | Python | mit | 1,361 |
import django.contrib.sites.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("sites", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="site",
name="domain",
field=models.CharFie... | castiel248/Convert | Lib/site-packages/django/contrib/sites/migrations/0002_alter_domain_unique.py | Python | mit | 549 |
castiel248/Convert | Lib/site-packages/django/contrib/sites/migrations/__init__.py | Python | mit | 0 | |
import string
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.db.models.signals import pre_delete, pre_save
from django.http.request import split_domain_port
from django.utils.translation import gettext_lazy as _
SITE_CACHE = {}
def _simple_domain_na... | castiel248/Convert | Lib/site-packages/django/contrib/sites/models.py | Python | mit | 3,695 |
class RequestSite:
"""
A class that shares the primary interface of Site (i.e., it has ``domain``
and ``name`` attributes) but gets its data from an HttpRequest object
rather than from a database.
The save() and delete() methods raise NotImplementedError.
"""
def __init__(self, request):
... | castiel248/Convert | Lib/site-packages/django/contrib/sites/requests.py | Python | mit | 641 |
from django.apps import apps
from .requests import RequestSite
def get_current_site(request):
"""
Check if contrib.sites is installed and return either the current
``Site`` object or a ``RequestSite`` object based on the request.
"""
# Import is inside the function because its point is to avoid i... | castiel248/Convert | Lib/site-packages/django/contrib/sites/shortcuts.py | Python | mit | 573 |
castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/__init__.py | Python | mit | 0 | |
from django.apps import AppConfig
from django.contrib.staticfiles.checks import check_finders
from django.core import checks
from django.utils.translation import gettext_lazy as _
class StaticFilesConfig(AppConfig):
name = "django.contrib.staticfiles"
verbose_name = _("Static Files")
ignore_patterns = ["C... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/apps.py | Python | mit | 423 |
from django.contrib.staticfiles.finders import get_finders
def check_finders(app_configs=None, **kwargs):
"""Check all registered staticfiles finders."""
errors = []
for finder in get_finders():
try:
finder_errors = finder.check()
except NotImplementedError:
pass
... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/checks.py | Python | mit | 391 |
import functools
import os
from django.apps import apps
from django.conf import settings
from django.contrib.staticfiles import utils
from django.core.checks import Error, Warning
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import FileSystemStorage, Storage, default_storage
f... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/finders.py | Python | mit | 11,008 |
from urllib.parse import urlparse
from urllib.request import url2pathname
from asgiref.sync import sync_to_async
from django.conf import settings
from django.contrib.staticfiles import utils
from django.contrib.staticfiles.views import serve
from django.core.handlers.asgi import ASGIHandler
from django.core.handlers.... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/handlers.py | Python | mit | 4,029 |
castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/management/__init__.py | Python | mit | 0 | |
castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/management/commands/__init__.py | Python | mit | 0 | |
import os
from django.apps import apps
from django.contrib.staticfiles.finders import get_finders
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.checks import Tags
from django.core.files.storage import FileSystemStorage
from django.core.management.base import BaseCommand, CommandEr... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py | Python | mit | 15,137 |
import os
from django.contrib.staticfiles import finders
from django.core.management.base import LabelCommand
class Command(LabelCommand):
help = "Finds the absolute paths for the given static file(s)."
label = "staticfile"
def add_arguments(self, parser):
super().add_arguments(parser)
p... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/management/commands/findstatic.py | Python | mit | 1,638 |
from django.conf import settings
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.core.management.commands.runserver import Command as RunserverCommand
class Command(RunserverCommand):
help = (
"Starts a lightweight web server for development and also serves static files."
... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/management/commands/runserver.py | Python | mit | 1,373 |
import json
import os
import posixpath
import re
from urllib.parse import unquote, urldefrag, urlsplit, urlunsplit
from django.conf import STATICFILES_STORAGE_ALIAS, settings
from django.contrib.staticfiles.utils import check_settings, matches_patterns
from django.core.exceptions import ImproperlyConfigured
from djang... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/storage.py | Python | mit | 20,892 |
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.test import LiveServerTestCase
class StaticLiveServerTestCase(LiveServerTestCase):
"""
Extend django.test.LiveServerTestCase to transparently overlay at test
execution-time the assets provided by the staticfiles app finders. Th... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/testing.py | Python | mit | 463 |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.views import serve
urlpatterns = []
def staticfiles_urlpatterns(prefix=None):
"""
Helper function to return a URL pattern for serving static files.
"""
if prefix is None:
prefix = setti... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/urls.py | Python | mit | 498 |
import fnmatch
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
def matches_patterns(path, patterns):
"""
Return True or False depending on whether the ``path`` should be
ignored (if it matches any pattern in ``ignore_patterns``).
"""
return any(f... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/utils.py | Python | mit | 2,279 |
"""
Views and functions for serving static files. These are only to be used during
development, and SHOULD NOT be used in a production setting.
"""
import os
import posixpath
from django.conf import settings
from django.contrib.staticfiles import finders
from django.http import Http404
from django.views import static... | castiel248/Convert | Lib/site-packages/django/contrib/staticfiles/views.py | Python | mit | 1,261 |
castiel248/Convert | Lib/site-packages/django/contrib/syndication/__init__.py | Python | mit | 0 | |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class SyndicationConfig(AppConfig):
name = "django.contrib.syndication"
verbose_name = _("Syndication")
| castiel248/Convert | Lib/site-packages/django/contrib/syndication/apps.py | Python | mit | 203 |
from inspect import getattr_static, unwrap
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.http import Http404, HttpResponse
from django.template import TemplateDoesNotExist, loader
from django.utils import feedgenerato... | castiel248/Convert | Lib/site-packages/django/contrib/syndication/views.py | Python | mit | 9,309 |
castiel248/Convert | Lib/site-packages/django/core/__init__.py | Python | mit | 0 | |
import django
from django.core.handlers.asgi import ASGIHandler
def get_asgi_application():
"""
The public interface to Django's ASGI support. Return an ASGI 3 callable.
Avoids making django.core.handlers.ASGIHandler a public API, in case the
internal implementation changes or moves in the future.
... | castiel248/Convert | Lib/site-packages/django/core/asgi.py | Python | mit | 386 |
"""
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... | castiel248/Convert | Lib/site-packages/django/core/cache/__init__.py | Python | mit | 1,928 |
castiel248/Convert | Lib/site-packages/django/core/cache/backends/__init__.py | Python | mit | 0 | |
"Base Cache class."
import time
import warnings
from asgiref.sync import sync_to_async
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import import_string
class InvalidCacheBackendError(ImproperlyConfigured):
pass
class CacheKeyWarning(RuntimeWarning):
pass
clas... | castiel248/Convert | Lib/site-packages/django/core/cache/backends/base.py | Python | mit | 14,227 |
"Database cache backend."
import base64
import pickle
from datetime import datetime, timezone
from django.conf import settings
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
from django.db import DatabaseError, connections, models, router, transaction
from django.utils.timezone import now as tz... | castiel248/Convert | Lib/site-packages/django/core/cache/backends/db.py | Python | mit | 11,372 |
"Dummy cache backend"
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
class DummyCache(BaseCache):
def __init__(self, host, *args, **kwargs):
super().__init__(*args, **kwargs)
def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None):
self.make_and_validate_key(... | castiel248/Convert | Lib/site-packages/django/core/cache/backends/dummy.py | Python | mit | 1,043 |
"File-based cache backend"
import glob
import os
import pickle
import random
import tempfile
import time
import zlib
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
from django.core.files import locks
from django.core.files.move import file_move_safe
from django.utils.crypto import md5
class F... | castiel248/Convert | Lib/site-packages/django/core/cache/backends/filebased.py | Python | mit | 5,800 |
"Thread-safe in-memory cache backend."
import pickle
import time
from collections import OrderedDict
from threading import Lock
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
# Global in-memory store of cache data. Keyed by name, to provide
# multiple named local memory caches.
_caches = {}
_e... | castiel248/Convert | Lib/site-packages/django/core/cache/backends/locmem.py | Python | mit | 4,035 |
"Memcached cache backend"
import re
import time
from django.core.cache.backends.base import (
DEFAULT_TIMEOUT,
BaseCache,
InvalidCacheKey,
memcache_key_warnings,
)
from django.utils.functional import cached_property
class BaseMemcachedCache(BaseCache):
def __init__(self, server, params, library,... | castiel248/Convert | Lib/site-packages/django/core/cache/backends/memcached.py | Python | mit | 6,800 |
"""Redis cache backend."""
import pickle
import random
import re
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
class RedisSerializer:
def __init__(self, protocol=None):
self... | castiel248/Convert | Lib/site-packages/django/core/cache/backends/redis.py | Python | mit | 7,924 |
from django.utils.crypto import md5
TEMPLATE_FRAGMENT_KEY_TEMPLATE = "template.cache.%s.%s"
def make_template_fragment_key(fragment_name, vary_on=None):
hasher = md5(usedforsecurity=False)
if vary_on is not None:
for arg in vary_on:
hasher.update(str(arg).encode())
hasher.upda... | castiel248/Convert | Lib/site-packages/django/core/cache/utils.py | Python | mit | 409 |
from .messages import (
CRITICAL,
DEBUG,
ERROR,
INFO,
WARNING,
CheckMessage,
Critical,
Debug,
Error,
Info,
Warning,
)
from .registry import Tags, register, run_checks, tag_exists
# Import these to force registration of checks
import django.core.checks.async_checks # NOQA is... | castiel248/Convert | Lib/site-packages/django/core/checks/__init__.py | Python | mit | 1,195 |
import os
from . import Error, Tags, register
E001 = Error(
"You should not set the DJANGO_ALLOW_ASYNC_UNSAFE environment variable in "
"deployment. This disables async safety protection.",
id="async.E001",
)
@register(Tags.async_support, deploy=True)
def check_async_unsafe(app_configs, **kwargs):
i... | castiel248/Convert | Lib/site-packages/django/core/checks/async_checks.py | Python | mit | 403 |
import pathlib
from django.conf import settings
from django.core.cache import DEFAULT_CACHE_ALIAS, caches
from django.core.cache.backends.filebased import FileBasedCache
from . import Error, Tags, Warning, register
E001 = Error(
"You must define a '%s' cache in your CACHES setting." % DEFAULT_CACHE_ALIAS,
id... | castiel248/Convert | Lib/site-packages/django/core/checks/caches.py | Python | mit | 2,643 |
castiel248/Convert | Lib/site-packages/django/core/checks/compatibility/__init__.py | Python | mit | 0 | |
from django.conf import settings
from .. import Error, Tags, register
@register(Tags.compatibility)
def check_csrf_trusted_origins(app_configs, **kwargs):
errors = []
for origin in settings.CSRF_TRUSTED_ORIGINS:
if "://" not in origin:
errors.append(
Error(
... | castiel248/Convert | Lib/site-packages/django/core/checks/compatibility/django_4_0.py | Python | mit | 657 |
from django.db import connections
from . import Tags, register
@register(Tags.database)
def check_database_backends(databases=None, **kwargs):
if databases is None:
return []
issues = []
for alias in databases:
conn = connections[alias]
issues.extend(conn.validation.check(**kwargs... | castiel248/Convert | Lib/site-packages/django/core/checks/database.py | Python | mit | 341 |
from pathlib import Path
from django.conf import settings
from . import Error, Tags, register
@register(Tags.files)
def check_setting_file_upload_temp_dir(app_configs, **kwargs):
setting = getattr(settings, "FILE_UPLOAD_TEMP_DIR", None)
if setting and not Path(setting).is_dir():
return [
... | castiel248/Convert | Lib/site-packages/django/core/checks/files.py | Python | mit | 522 |
# Levels
DEBUG = 10
INFO = 20
WARNING = 30
ERROR = 40
CRITICAL = 50
class CheckMessage:
def __init__(self, level, msg, hint=None, obj=None, id=None):
if not isinstance(level, int):
raise TypeError("The first argument should be level.")
self.level = level
self.msg = msg
... | castiel248/Convert | Lib/site-packages/django/core/checks/messages.py | Python | mit | 2,241 |
import inspect
import types
from collections import defaultdict
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.core.checks import Error, Tags, Warning, register
@register(Tags.models)
def check_all_models(app_configs=None, **kwargs):
db_table_models = defaul... | castiel248/Convert | Lib/site-packages/django/core/checks/model_checks.py | Python | mit | 8,830 |
from itertools import chain
from django.utils.inspect import func_accepts_kwargs
from django.utils.itercompat import is_iterable
class Tags:
"""
Built-in tags for internal checks.
"""
admin = "admin"
async_support = "async_support"
caches = "caches"
compatibility = "compatibility"
da... | castiel248/Convert | Lib/site-packages/django/core/checks/registry.py | Python | mit | 3,458 |
castiel248/Convert | Lib/site-packages/django/core/checks/security/__init__.py | Python | mit | 0 | |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from .. import Error, Tags, Warning, register
CROSS_ORIGIN_OPENER_POLICY_VALUES = {
"same-origin",
"same-origin-allow-popups",
"unsafe-none",
}
REFERRER_POLICY_VALUES = {
"no-referrer",
"no-referrer-when-downg... | castiel248/Convert | Lib/site-packages/django/core/checks/security/base.py | Python | mit | 9,140 |
import inspect
from django.conf import settings
from .. import Error, Tags, Warning, register
W003 = Warning(
"You don't appear to be using Django's built-in "
"cross-site request forgery protection via the middleware "
"('django.middleware.csrf.CsrfViewMiddleware' is not in your "
"MIDDLEWARE). Enab... | castiel248/Convert | Lib/site-packages/django/core/checks/security/csrf.py | Python | mit | 2,055 |
from django.conf import settings
from .. import Tags, Warning, register
def add_session_cookie_message(message):
return message + (
" Using a secure-only session cookie makes it more difficult for "
"network traffic sniffers to hijack user sessions."
)
W010 = Warning(
add_session_cookie... | castiel248/Convert | Lib/site-packages/django/core/checks/security/sessions.py | Python | mit | 2,554 |
import copy
from collections import defaultdict
from django.conf import settings
from django.template.backends.django import get_template_tag_modules
from . import Error, Tags, Warning, register
E001 = Error(
"You have 'APP_DIRS': True in your TEMPLATES but also specify 'loaders' "
"in OPTIONS. Either remove... | castiel248/Convert | Lib/site-packages/django/core/checks/templates.py | Python | mit | 2,257 |
from django.conf import settings
from django.utils.translation import get_supported_language_variant
from django.utils.translation.trans_real import language_code_re
from . import Error, Tags, register
E001 = Error(
"You have provided an invalid value for the LANGUAGE_CODE setting: {!r}.",
id="translation.E00... | castiel248/Convert | Lib/site-packages/django/core/checks/translation.py | Python | mit | 1,990 |
from collections import Counter
from django.conf import settings
from . import Error, Tags, Warning, register
@register(Tags.urls)
def check_url_config(app_configs, **kwargs):
if getattr(settings, "ROOT_URLCONF", None):
from django.urls import get_resolver
resolver = get_resolver()
retu... | castiel248/Convert | Lib/site-packages/django/core/checks/urls.py | Python | mit | 3,328 |
"""
Global Django exception and warning classes.
"""
import operator
from django.utils.hashable import make_hashable
class FieldDoesNotExist(Exception):
"""The requested model field does not exist"""
pass
class AppRegistryNotReady(Exception):
"""The django.apps registry is not populated yet"""
pa... | castiel248/Convert | Lib/site-packages/django/core/exceptions.py | Python | mit | 6,576 |
from django.core.files.base import File
__all__ = ["File"]
| castiel248/Convert | Lib/site-packages/django/core/files/__init__.py | Python | mit | 60 |
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 is... | castiel248/Convert | Lib/site-packages/django/core/files/base.py | Python | mit | 4,811 |
"""
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.
"""
@pr... | castiel248/Convert | Lib/site-packages/django/core/files/images.py | Python | mit | 2,643 |
"""
Portable file locking utilities.
Based partially on an example by Jonathan Feignberg in the Python
Cookbook [1] (licensed under the Python Software License) and a ctypes port by
Anatoly Techtonik for Roundup [2] (license [3]).
[1] https://code.activestate.com/recipes/65203/
[2] https://sourceforge.net/p/roundup/c... | castiel248/Convert | Lib/site-packages/django/core/files/locks.py | Python | mit | 3,613 |
"""
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 os
from shutil import copymode, copystat
from django.core.files import locks
__all__ = ["file_move_safe"]
def _samefile(src, dst):
# Macint... | castiel248/Convert | Lib/site-packages/django/core/files/move.py | Python | mit | 3,250 |
import warnings
from django.conf import DEFAULT_STORAGE_ALIAS, settings
from django.utils.deprecation import RemovedInDjango51Warning
from django.utils.functional import LazyObject
from django.utils.module_loading import import_string
from .base import Storage
from .filesystem import FileSystemStorage
from .handler i... | castiel248/Convert | Lib/site-packages/django/core/files/storage/__init__.py | Python | mit | 1,147 |
import os
import pathlib
from django.core.exceptions import SuspiciousFileOperation
from django.core.files import File
from django.core.files.utils import validate_file_name
from django.utils.crypto import get_random_string
from django.utils.text import get_valid_filename
class Storage:
"""
A base storage cl... | castiel248/Convert | Lib/site-packages/django/core/files/storage/base.py | Python | mit | 7,424 |
import os
from datetime import datetime, timezone
from urllib.parse import urljoin
from django.conf import settings
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.utils._os import safe_join
from django.utils.decons... | castiel248/Convert | Lib/site-packages/django/core/files/storage/filesystem.py | Python | mit | 7,792 |
from django.conf import DEFAULT_STORAGE_ALIAS, STATICFILES_STORAGE_ALIAS, settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import cached_property
from django.utils.module_loading import import_string
class InvalidStorageError(ImproperlyConfigured):
pass
class Storage... | castiel248/Convert | Lib/site-packages/django/core/files/storage/handler.py | Python | mit | 1,999 |
"""
Based on dj-inmemorystorage (BSD) by Cody Soyland, Seán Hayes, Tore Birkeland,
and Nick Presta.
"""
import errno
import io
import os
import pathlib
from urllib.parse import urljoin
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.signals import setting_changed
from ... | castiel248/Convert | Lib/site-packages/django/core/files/storage/memory.py | Python | mit | 9,745 |
class StorageSettingsMixin:
def _clear_cached_properties(self, setting, **kwargs):
"""Reset setting based property values."""
if setting == "MEDIA_ROOT":
self.__dict__.pop("base_location", None)
self.__dict__.pop("location", None)
elif setting == "MEDIA_URL":
... | castiel248/Convert | Lib/site-packages/django/core/files/storage/mixins.py | Python | mit | 700 |
"""
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... | castiel248/Convert | Lib/site-packages/django/core/files/temp.py | Python | mit | 2,503 |
"""
Classes representing uploaded files.
"""
import os
from io import BytesIO
from django.conf import settings
from django.core.files import temp as tempfile
from django.core.files.base import File
from django.core.files.utils import validate_file_name
__all__ = (
"UploadedFile",
"TemporaryUploadedFile",
... | castiel248/Convert | Lib/site-packages/django/core/files/uploadedfile.py | Python | mit | 4,189 |
"""
Base file upload handler classes, and the built-in concrete subclasses
"""
import os
from io import BytesIO
from django.conf import settings
from django.core.files.uploadedfile import InMemoryUploadedFile, TemporaryUploadedFile
from django.utils.module_loading import import_string
__all__ = [
"UploadFileExcep... | castiel248/Convert | Lib/site-packages/django/core/files/uploadhandler.py | Python | mit | 7,179 |
import os
import pathlib
from django.core.exceptions import SuspiciousFileOperation
def validate_file_name(name, allow_relative_path=False):
# Remove potentially dangerous names
if os.path.basename(name) in {"", ".", ".."}:
raise SuspiciousFileOperation("Could not derive file name from '%s'" % name)
... | castiel248/Convert | Lib/site-packages/django/core/files/utils.py | Python | mit | 2,659 |
castiel248/Convert | Lib/site-packages/django/core/handlers/__init__.py | Python | mit | 0 | |
import logging
import sys
import tempfile
import traceback
from asgiref.sync import ThreadSensitiveContext, sync_to_async
from django.conf import settings
from django.core import signals
from django.core.exceptions import RequestAborted, RequestDataTooBig
from django.core.handlers import base
from django.http import ... | castiel248/Convert | Lib/site-packages/django/core/handlers/asgi.py | Python | mit | 12,067 |
import asyncio
import logging
import types
from asgiref.sync import async_to_sync, iscoroutinefunction, sync_to_async
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, MiddlewareNotUsed
from django.core.signals import request_finished
from django.db import connections, transact... | castiel248/Convert | Lib/site-packages/django/core/handlers/base.py | Python | mit | 14,813 |
import logging
import sys
from functools import wraps
from asgiref.sync import iscoroutinefunction, sync_to_async
from django.conf import settings
from django.core import signals
from django.core.exceptions import (
BadRequest,
PermissionDenied,
RequestDataTooBig,
SuspiciousOperation,
TooManyField... | castiel248/Convert | Lib/site-packages/django/core/handlers/exception.py | Python | mit | 5,922 |
from io import IOBase
from django.conf import settings
from django.core import signals
from django.core.handlers import base
from django.http import HttpRequest, QueryDict, parse_cookie
from django.urls import set_script_prefix
from django.utils.encoding import repercent_broken_unicode
from django.utils.functional imp... | castiel248/Convert | Lib/site-packages/django/core/handlers/wsgi.py | Python | mit | 7,339 |
"""
Tools for sending email.
"""
from django.conf import settings
# Imported for backwards compatibility and for the sake
# of a cleaner namespace. These symbols used to be in
# django/core/mail.py before the introduction of email
# backends and the subsequent reorganization (See #10355)
from django.core.mail.message ... | castiel248/Convert | Lib/site-packages/django/core/mail/__init__.py | Python | mit | 4,958 |
# Mail backends shipped with Django.
| castiel248/Convert | Lib/site-packages/django/core/mail/backends/__init__.py | Python | mit | 37 |
"""Base email backend class."""
class BaseEmailBackend:
"""
Base class for email backend implementations.
Subclasses must at least overwrite send_messages().
open() and close() can be called indirectly by using a backend object as a
context manager:
with backend as connection:
... | castiel248/Convert | Lib/site-packages/django/core/mail/backends/base.py | Python | mit | 1,683 |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.pop("stream", sys.stdout)
self._lo... | castiel248/Convert | Lib/site-packages/django/core/mail/backends/console.py | Python | mit | 1,426 |
"""
Dummy email backend that does nothing.
"""
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def send_messages(self, email_messages):
return len(list(email_messages))
| castiel248/Convert | Lib/site-packages/django/core/mail/backends/dummy.py | Python | mit | 234 |
"""Email backend that writes messages to a file."""
import datetime
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail.backends.console import EmailBackend as ConsoleEmailBackend
class EmailBackend(ConsoleEmailBackend):
def __init__(self, *ar... | castiel248/Convert | Lib/site-packages/django/core/mail/backends/filebased.py | Python | mit | 2,353 |
"""
Backend for test environment.
"""
from django.core import mail
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
"""
An email backend for use during test sessions.
The test connection stores email messages in a dummy outbox,
rather than sending the... | castiel248/Convert | Lib/site-packages/django/core/mail/backends/locmem.py | Python | mit | 885 |
"""SMTP email backend class."""
import smtplib
import ssl
import threading
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail.message import sanitize_address
from django.core.mail.utils import DNS_NAME
from django.utils.functional import cached_property
... | castiel248/Convert | Lib/site-packages/django/core/mail/backends/smtp.py | Python | mit | 5,740 |