From a9f215bf6452c4278724b53db6822c1f3cf3c6ab Mon Sep 17 00:00:00 2001 From: Maxim Kurnikov Date: Sun, 29 Jul 2018 18:12:23 +0300 Subject: [PATCH] initial commit --- django/__init__.pyi | 1 + django/apps/config.pyi | 15 + django/apps/registry.pyi | 23 ++ django/conf/__init__.pyi | 27 ++ django/conf/urls/__init__.pyi | 17 + django/conf/urls/i18n.pyi | 16 + django/conf/urls/static.pyi | 8 + django/contrib/admin/__init__.pyi | 1 + django/contrib/admin/actions.pyi | 11 + django/contrib/admin/apps.pyi | 6 + django/contrib/admin/checks.pyi | 132 +++++++ django/contrib/admin/decorators.pyi | 4 + django/contrib/admin/filters.pyi | 159 +++++++++ django/contrib/admin/forms.pyi | 5 + django/contrib/admin/helpers.pyi | 75 ++++ django/contrib/admin/models.pyi | 22 ++ django/contrib/admin/options.pyi | 73 ++++ django/contrib/admin/sites.pyi | 77 ++++ .../contrib/admin/templatetags/admin_list.pyi | 109 ++++++ .../admin/templatetags/admin_modify.pyi | 37 ++ .../admin/templatetags/admin_static.pyi | 1 + .../contrib/admin/templatetags/admin_urls.pyi | 23 ++ django/contrib/admin/templatetags/base.pyi | 19 + django/contrib/admin/templatetags/log.pyi | 16 + django/contrib/admin/utils.pyi | 99 +++++ django/contrib/admin/views/autocomplete.pyi | 11 + django/contrib/admin/views/decorators.pyi | 8 + django/contrib/admin/views/main.pyi | 55 +++ django/contrib/admin/widgets.pyi | 149 ++++++++ django/contrib/admindocs/middleware.pyi | 19 + django/contrib/admindocs/utils.pyi | 10 + django/contrib/admindocs/views.pyi | 4 + django/contrib/auth/__init__.pyi | 70 ++++ django/contrib/auth/admin.pyi | 56 +++ django/contrib/auth/apps.pyi | 2 + django/contrib/auth/backends.pyi | 60 ++++ django/contrib/auth/base_user.pyi | 27 ++ django/contrib/auth/checks.pyi | 10 + django/contrib/auth/context_processors.pyi | 31 ++ django/contrib/auth/decorators.pyi | 27 ++ django/contrib/auth/forms.pyi | 93 +++++ django/contrib/auth/handlers/modwsgi.pyi | 10 + django/contrib/auth/hashers.pyi | 76 ++++ django/contrib/auth/management/__init__.pyi | 29 ++ .../management/commands/changepassword.pyi | 6 + .../management/commands/createsuperuser.pyi | 20 ++ django/contrib/auth/middleware.pyi | 22 ++ django/contrib/auth/mixins.pyi | 30 ++ django/contrib/auth/models.pyi | 98 +++++ django/contrib/auth/password_validation.pyi | 60 ++++ django/contrib/auth/tokens.pyi | 12 + django/contrib/auth/views.pyi | 107 ++++++ django/contrib/contenttypes/admin.pyi | 19 + django/contrib/contenttypes/apps.pyi | 2 + django/contrib/contenttypes/checks.pyi | 10 + django/contrib/contenttypes/fields.pyi | 103 ++++++ django/contrib/contenttypes/forms.pyi | 0 .../contenttypes/management/__init__.pyi | 55 +++ .../commands/remove_stale_contenttypes.pyi | 10 + django/contrib/contenttypes/models.pyi | 39 ++ django/contrib/contenttypes/views.pyi | 10 + django/contrib/flatpages/forms.pyi | 0 django/contrib/flatpages/middleware.pyi | 0 django/contrib/flatpages/models.pyi | 0 django/contrib/flatpages/sitemaps.pyi | 5 + .../flatpages/templatetags/flatpages.pyi | 0 django/contrib/flatpages/views.pyi | 0 .../humanize/templatetags/humanize.pyi | 26 ++ django/contrib/messages/api.pyi | 65 ++++ .../contrib/messages/context_processors.pyi | 11 + django/contrib/messages/middleware.pyi | 12 + django/contrib/messages/storage/__init__.pyi | 5 + django/contrib/messages/storage/base.pyi | 30 ++ django/contrib/messages/storage/cookie.pyi | 46 +++ django/contrib/messages/storage/fallback.pyi | 24 ++ django/contrib/messages/storage/session.pyi | 31 ++ django/contrib/messages/utils.pyi | 4 + django/contrib/redirects/middleware.pyi | 0 django/contrib/sessions/backends/base.pyi | 43 +++ django/contrib/sessions/backends/cache.pyi | 16 + .../contrib/sessions/backends/cached_db.pyi | 16 + django/contrib/sessions/backends/db.pyi | 29 ++ django/contrib/sessions/backends/file.pyi | 18 + .../sessions/backends/signed_cookies.pyi | 14 + django/contrib/sessions/base_session.pyi | 6 + .../management/commands/clearsessions.pyi | 2 + django/contrib/sessions/middleware.pyi | 16 + django/contrib/sessions/models.pyi | 7 + django/contrib/sessions/serializers.pyi | 11 + django/contrib/sitemaps/__init__.pyi | 49 +++ .../management/commands/ping_google.pyi | 2 + django/contrib/sitemaps/views.pyi | 31 ++ django/contrib/sites/apps.pyi | 2 + django/contrib/sites/management.pyi | 12 + django/contrib/sites/managers.pyi | 11 + django/contrib/sites/middleware.pyi | 5 + django/contrib/sites/models.pyi | 26 ++ django/contrib/sites/requests.pyi | 6 + django/contrib/sites/shortcuts.pyi | 12 + django/contrib/staticfiles/apps.pyi | 2 + django/contrib/staticfiles/checks.pyi | 7 + django/contrib/staticfiles/finders.pyi | 55 +++ django/contrib/staticfiles/handlers.pyi | 7 + .../management/commands/collectstatic.pyi | 42 +++ .../management/commands/findstatic.pyi | 6 + .../management/commands/runserver.pyi | 5 + django/contrib/staticfiles/storage.pyi | 82 +++++ .../staticfiles/templatetags/staticfiles.pyi | 11 + django/contrib/staticfiles/urls.pyi | 5 + django/contrib/staticfiles/utils.pyi | 24 ++ django/contrib/staticfiles/views.pyi | 10 + django/contrib/syndication/views.pyi | 47 +++ django/core/cache/__init__.pyi | 23 ++ django/core/cache/backends/base.pyi | 43 +++ django/core/cache/backends/db.pyi | 35 ++ django/core/cache/backends/dummy.pyi | 20 ++ django/core/cache/backends/filebased.pyi | 44 +++ django/core/cache/backends/locmem.pyi | 38 ++ django/core/cache/utils.pyi | 8 + django/core/checks/caches.pyi | 5 + django/core/checks/messages.pyi | 31 ++ django/core/checks/model_checks.pyi | 24 ++ django/core/checks/registry.pyi | 20 ++ django/core/checks/security/base.pyi | 35 ++ django/core/checks/security/csrf.pyi | 8 + django/core/checks/security/sessions.pyi | 13 + django/core/checks/templates.pyi | 11 + django/core/checks/urls.pyi | 38 ++ django/core/exceptions.pyi | 24 ++ django/core/files/base.pyi | 36 ++ django/core/files/locks.pyi | 11 + django/core/files/move.pyi | 9 + django/core/files/storage.pyi | 67 ++++ django/core/files/uploadedfile.pyi | 57 +++ django/core/files/uploadhandler.pyi | 57 +++ django/core/files/utils.pyi | 4 + django/core/handlers/base.pyi | 25 ++ django/core/handlers/exception.pyi | 22 ++ django/core/handlers/wsgi.pyi | 54 +++ django/core/mail/__init__.pyi | 54 +++ django/core/mail/backends/base.pyi | 6 + django/core/mail/backends/console.pyi | 17 + django/core/mail/backends/dummy.pyi | 6 + django/core/mail/backends/filebased.pyi | 9 + django/core/mail/backends/locmem.pyi | 16 + django/core/mail/backends/smtp.pyi | 30 ++ django/core/mail/message.pyi | 116 ++++++ django/core/mail/utils.pyi | 3 + django/core/management/__init__.pyi | 26 ++ django/core/management/base.pyi | 76 ++++ django/core/management/color.pyi | 7 + django/core/management/commands/check.pyi | 6 + .../management/commands/compilemessages.pyi | 17 + .../management/commands/createcachetable.pyi | 7 + django/core/management/commands/dumpdata.pyi | 6 + django/core/management/commands/flush.pyi | 6 + django/core/management/commands/inspectdb.pyi | 37 ++ django/core/management/commands/loaddata.pyi | 27 ++ .../core/management/commands/makemessages.pyi | 60 ++++ .../management/commands/makemigrations.pyi | 14 + django/core/management/commands/migrate.pyi | 14 + django/core/management/commands/runserver.pyi | 9 + .../management/commands/sendtestemail.pyi | 6 + django/core/management/commands/shell.pyi | 5 + .../management/commands/showmigrations.pyi | 20 ++ .../core/management/commands/sqlmigrate.pyi | 6 + .../management/commands/squashmigrations.pyi | 6 + django/core/management/commands/test.pyi | 2 + .../core/management/commands/testserver.pyi | 2 + django/core/management/sql.pyi | 18 + django/core/management/templates.pyi | 5 + django/core/management/utils.pyi | 23 ++ django/core/paginator.pyi | 46 +++ django/core/serializers/__init__.pyi | 59 +++ django/core/serializers/base.pyi | 86 +++++ django/core/serializers/json.pyi | 27 ++ django/core/serializers/python.pyi | 46 +++ django/core/serializers/xml_serializer.pyi | 74 ++++ django/core/servers/basehttp.pyi | 10 + django/core/signing.pyi | 63 ++++ django/core/validators.pyi | 125 +++++++ django/core/wsgi.pyi | 4 + django/db/__init__.pyi | 18 + django/db/backends/base/base.pyi | 82 +++++ django/db/backends/base/client.pyi | 5 + django/db/backends/base/creation.pyi | 31 ++ django/db/backends/base/features.pyi | 5 + django/db/backends/base/introspection.pyi | 26 ++ django/db/backends/base/operations.pyi | 82 +++++ django/db/backends/base/schema.pyi | 69 ++++ django/db/backends/base/validation.pyi | 11 + django/db/backends/ddl_references.pyi | 59 +++ django/db/backends/dummy/base.pyi | 4 + django/db/backends/mysql/client.pyi | 10 + django/db/backends/postgresql/client.pyi | 9 + django/db/backends/sqlite3/base.pyi | 82 +++++ django/db/backends/sqlite3/creation.pyi | 10 + django/db/backends/sqlite3/features.pyi | 3 + django/db/backends/sqlite3/introspection.pyi | 65 ++++ django/db/backends/sqlite3/operations.pyi | 114 ++++++ django/db/backends/sqlite3/schema.pyi | 62 ++++ django/db/backends/utils.pyi | 78 ++++ django/db/migrations/autodetector.pyi | 114 ++++++ django/db/migrations/exceptions.pyi | 16 + django/db/migrations/executor.pyi | 63 ++++ django/db/migrations/graph.pyi | 65 ++++ django/db/migrations/loader.pyi | 54 +++ django/db/migrations/migration.pyi | 43 +++ django/db/migrations/operations/base.pyi | 22 ++ django/db/migrations/operations/fields.pyi | 141 ++++++++ django/db/migrations/operations/models.pyi | 258 ++++++++++++++ django/db/migrations/operations/special.pyi | 89 +++++ django/db/migrations/operations/utils.pyi | 10 + django/db/migrations/optimizer.pyi | 9 + django/db/migrations/questioner.pyi | 40 +++ django/db/migrations/recorder.pyi | 24 ++ django/db/migrations/serializer.pyi | 103 ++++++ django/db/migrations/state.pyi | 35 ++ django/db/migrations/topological_sort.pyi | 10 + django/db/migrations/utils.pyi | 9 + django/db/migrations/writer.pyi | 41 +++ django/db/models/aggregates.pyi | 66 ++++ django/db/models/base.pyi | 18 + django/db/models/deletion.pyi | 94 +++++ django/db/models/expressions.pyi | 335 +++++++++++++++++ django/db/models/fields/__init__.pyi | 117 ++++++ django/db/models/fields/files.pyi | 92 +++++ django/db/models/fields/mixins.pyi | 9 + django/db/models/fields/proxy.pyi | 2 + django/db/models/fields/related.pyi | 101 ++++++ .../db/models/fields/related_descriptors.pyi | 61 ++++ django/db/models/fields/related_lookups.pyi | 63 ++++ django/db/models/fields/reverse_related.pyi | 122 +++++++ django/db/models/functions/comparison.pyi | 50 +++ django/db/models/functions/datetime.pyi | 102 ++++++ django/db/models/functions/text.pyi | 112 ++++++ django/db/models/functions/window.pyi | 5 + django/db/models/indexes.pyi | 28 ++ django/db/models/lookups.pyi | 217 +++++++++++ django/db/models/manager.pyi | 36 ++ django/db/models/options.pyi | 24 ++ django/db/models/query.pyi | 65 ++++ django/db/models/query_utils.pyi | 109 ++++++ django/db/models/signals.pyi | 32 ++ django/db/models/sql/compiler.pyi | 116 ++++++ django/db/models/sql/datastructures.pyi | 69 ++++ django/db/models/sql/query.pyi | 18 + django/db/models/sql/subqueries.pyi | 44 +++ django/db/models/sql/where.pyi | 99 +++++ django/db/models/utils.pyi | 7 + django/db/transaction.pyi | 39 ++ django/db/utils.pyi | 46 +++ django/dispatch/dispatcher.pyi | 35 ++ django/forms/boundfield.pyi | 70 ++++ django/forms/fields.pyi | 255 +++++++++++++ django/forms/forms.pyi | 61 ++++ django/forms/formsets.pyi | 11 + django/forms/models.pyi | 132 +++++++ django/forms/renderers.pyi | 21 ++ django/forms/utils.pyi | 52 +++ django/forms/widgets.pyi | 312 ++++++++++++++++ django/http/cookie.pyi | 4 + django/http/multipartparser.pyi | 82 +++++ django/http/request.pyi | 92 +++++ django/http/response.pyi | 113 ++++++ django/middleware/cache.pyi | 33 ++ django/middleware/clickjacking.pyi | 15 + django/middleware/common.pyi | 38 ++ django/middleware/csrf.pyi | 64 ++++ django/middleware/gzip.pyi | 10 + django/middleware/http.pyi | 11 + django/middleware/locale.pyi | 11 + django/middleware/security.pyi | 19 + django/shortcuts.pyi | 57 +++ django/template/backends/base.pyi | 14 + django/template/backends/django.pyi | 48 +++ django/template/backends/dummy.pyi | 19 + django/template/backends/utils.pyi | 5 + django/template/base.pyi | 186 ++++++++++ django/template/context.pyi | 102 ++++++ django/template/context_processors.pyi | 22 ++ django/template/defaultfilters.pyi | 199 +++++++++++ django/template/defaulttags.pyi | 337 ++++++++++++++++++ django/template/engine.pyi | 62 ++++ django/template/exceptions.pyi | 18 + django/template/library.pyi | 98 +++++ django/template/loader.pyi | 31 ++ django/template/loader_tags.pyi | 78 ++++ django/template/loaders/app_directories.pyi | 8 + django/template/loaders/base.pyi | 18 + django/template/loaders/cached.pyi | 29 ++ django/template/loaders/filesystem.pyi | 14 + django/template/loaders/locmem.pyi | 12 + django/template/response.pyi | 48 +++ django/template/smartif.pyi | 24 ++ django/template/utils.pyi | 22 ++ django/templatetags/cache.pyi | 27 ++ django/templatetags/i18n.pyi | 139 ++++++++ django/templatetags/l10n.pyi | 12 + django/templatetags/static.pyi | 60 ++++ django/templatetags/tz.pyi | 59 +++ django/test/client.pyi | 232 ++++++++++++ django/test/html.pyi | 51 +++ django/test/runner.pyi | 101 ++++++ django/test/selenium.pyi | 20 ++ django/test/signals.pyi | 43 +++ django/test/testcases.pyi | 85 +++++ django/test/utils.pyi | 169 +++++++++ django/urls/base.pyi | 41 +++ django/urls/conf.pyi | 23 ++ django/urls/converters.pyi | 24 ++ 311 files changed, 13433 insertions(+) create mode 100644 django/__init__.pyi create mode 100644 django/apps/config.pyi create mode 100644 django/apps/registry.pyi create mode 100644 django/conf/__init__.pyi create mode 100644 django/conf/urls/__init__.pyi create mode 100644 django/conf/urls/i18n.pyi create mode 100644 django/conf/urls/static.pyi create mode 100644 django/contrib/admin/__init__.pyi create mode 100644 django/contrib/admin/actions.pyi create mode 100644 django/contrib/admin/apps.pyi create mode 100644 django/contrib/admin/checks.pyi create mode 100644 django/contrib/admin/decorators.pyi create mode 100644 django/contrib/admin/filters.pyi create mode 100644 django/contrib/admin/forms.pyi create mode 100644 django/contrib/admin/helpers.pyi create mode 100644 django/contrib/admin/models.pyi create mode 100644 django/contrib/admin/options.pyi create mode 100644 django/contrib/admin/sites.pyi create mode 100644 django/contrib/admin/templatetags/admin_list.pyi create mode 100644 django/contrib/admin/templatetags/admin_modify.pyi create mode 100644 django/contrib/admin/templatetags/admin_static.pyi create mode 100644 django/contrib/admin/templatetags/admin_urls.pyi create mode 100644 django/contrib/admin/templatetags/base.pyi create mode 100644 django/contrib/admin/templatetags/log.pyi create mode 100644 django/contrib/admin/utils.pyi create mode 100644 django/contrib/admin/views/autocomplete.pyi create mode 100644 django/contrib/admin/views/decorators.pyi create mode 100644 django/contrib/admin/views/main.pyi create mode 100644 django/contrib/admin/widgets.pyi create mode 100644 django/contrib/admindocs/middleware.pyi create mode 100644 django/contrib/admindocs/utils.pyi create mode 100644 django/contrib/admindocs/views.pyi create mode 100644 django/contrib/auth/__init__.pyi create mode 100644 django/contrib/auth/admin.pyi create mode 100644 django/contrib/auth/apps.pyi create mode 100644 django/contrib/auth/backends.pyi create mode 100644 django/contrib/auth/base_user.pyi create mode 100644 django/contrib/auth/checks.pyi create mode 100644 django/contrib/auth/context_processors.pyi create mode 100644 django/contrib/auth/decorators.pyi create mode 100644 django/contrib/auth/forms.pyi create mode 100644 django/contrib/auth/handlers/modwsgi.pyi create mode 100644 django/contrib/auth/hashers.pyi create mode 100644 django/contrib/auth/management/__init__.pyi create mode 100644 django/contrib/auth/management/commands/changepassword.pyi create mode 100644 django/contrib/auth/management/commands/createsuperuser.pyi create mode 100644 django/contrib/auth/middleware.pyi create mode 100644 django/contrib/auth/mixins.pyi create mode 100644 django/contrib/auth/models.pyi create mode 100644 django/contrib/auth/password_validation.pyi create mode 100644 django/contrib/auth/tokens.pyi create mode 100644 django/contrib/auth/views.pyi create mode 100644 django/contrib/contenttypes/admin.pyi create mode 100644 django/contrib/contenttypes/apps.pyi create mode 100644 django/contrib/contenttypes/checks.pyi create mode 100644 django/contrib/contenttypes/fields.pyi create mode 100644 django/contrib/contenttypes/forms.pyi create mode 100644 django/contrib/contenttypes/management/__init__.pyi create mode 100644 django/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi create mode 100644 django/contrib/contenttypes/models.pyi create mode 100644 django/contrib/contenttypes/views.pyi create mode 100644 django/contrib/flatpages/forms.pyi create mode 100644 django/contrib/flatpages/middleware.pyi create mode 100644 django/contrib/flatpages/models.pyi create mode 100644 django/contrib/flatpages/sitemaps.pyi create mode 100644 django/contrib/flatpages/templatetags/flatpages.pyi create mode 100644 django/contrib/flatpages/views.pyi create mode 100644 django/contrib/humanize/templatetags/humanize.pyi create mode 100644 django/contrib/messages/api.pyi create mode 100644 django/contrib/messages/context_processors.pyi create mode 100644 django/contrib/messages/middleware.pyi create mode 100644 django/contrib/messages/storage/__init__.pyi create mode 100644 django/contrib/messages/storage/base.pyi create mode 100644 django/contrib/messages/storage/cookie.pyi create mode 100644 django/contrib/messages/storage/fallback.pyi create mode 100644 django/contrib/messages/storage/session.pyi create mode 100644 django/contrib/messages/utils.pyi create mode 100644 django/contrib/redirects/middleware.pyi create mode 100644 django/contrib/sessions/backends/base.pyi create mode 100644 django/contrib/sessions/backends/cache.pyi create mode 100644 django/contrib/sessions/backends/cached_db.pyi create mode 100644 django/contrib/sessions/backends/db.pyi create mode 100644 django/contrib/sessions/backends/file.pyi create mode 100644 django/contrib/sessions/backends/signed_cookies.pyi create mode 100644 django/contrib/sessions/base_session.pyi create mode 100644 django/contrib/sessions/management/commands/clearsessions.pyi create mode 100644 django/contrib/sessions/middleware.pyi create mode 100644 django/contrib/sessions/models.pyi create mode 100644 django/contrib/sessions/serializers.pyi create mode 100644 django/contrib/sitemaps/__init__.pyi create mode 100644 django/contrib/sitemaps/management/commands/ping_google.pyi create mode 100644 django/contrib/sitemaps/views.pyi create mode 100644 django/contrib/sites/apps.pyi create mode 100644 django/contrib/sites/management.pyi create mode 100644 django/contrib/sites/managers.pyi create mode 100644 django/contrib/sites/middleware.pyi create mode 100644 django/contrib/sites/models.pyi create mode 100644 django/contrib/sites/requests.pyi create mode 100644 django/contrib/sites/shortcuts.pyi create mode 100644 django/contrib/staticfiles/apps.pyi create mode 100644 django/contrib/staticfiles/checks.pyi create mode 100644 django/contrib/staticfiles/finders.pyi create mode 100644 django/contrib/staticfiles/handlers.pyi create mode 100644 django/contrib/staticfiles/management/commands/collectstatic.pyi create mode 100644 django/contrib/staticfiles/management/commands/findstatic.pyi create mode 100644 django/contrib/staticfiles/management/commands/runserver.pyi create mode 100644 django/contrib/staticfiles/storage.pyi create mode 100644 django/contrib/staticfiles/templatetags/staticfiles.pyi create mode 100644 django/contrib/staticfiles/urls.pyi create mode 100644 django/contrib/staticfiles/utils.pyi create mode 100644 django/contrib/staticfiles/views.pyi create mode 100644 django/contrib/syndication/views.pyi create mode 100644 django/core/cache/__init__.pyi create mode 100644 django/core/cache/backends/base.pyi create mode 100644 django/core/cache/backends/db.pyi create mode 100644 django/core/cache/backends/dummy.pyi create mode 100644 django/core/cache/backends/filebased.pyi create mode 100644 django/core/cache/backends/locmem.pyi create mode 100644 django/core/cache/utils.pyi create mode 100644 django/core/checks/caches.pyi create mode 100644 django/core/checks/messages.pyi create mode 100644 django/core/checks/model_checks.pyi create mode 100644 django/core/checks/registry.pyi create mode 100644 django/core/checks/security/base.pyi create mode 100644 django/core/checks/security/csrf.pyi create mode 100644 django/core/checks/security/sessions.pyi create mode 100644 django/core/checks/templates.pyi create mode 100644 django/core/checks/urls.pyi create mode 100644 django/core/exceptions.pyi create mode 100644 django/core/files/base.pyi create mode 100644 django/core/files/locks.pyi create mode 100644 django/core/files/move.pyi create mode 100644 django/core/files/storage.pyi create mode 100644 django/core/files/uploadedfile.pyi create mode 100644 django/core/files/uploadhandler.pyi create mode 100644 django/core/files/utils.pyi create mode 100644 django/core/handlers/base.pyi create mode 100644 django/core/handlers/exception.pyi create mode 100644 django/core/handlers/wsgi.pyi create mode 100644 django/core/mail/__init__.pyi create mode 100644 django/core/mail/backends/base.pyi create mode 100644 django/core/mail/backends/console.pyi create mode 100644 django/core/mail/backends/dummy.pyi create mode 100644 django/core/mail/backends/filebased.pyi create mode 100644 django/core/mail/backends/locmem.pyi create mode 100644 django/core/mail/backends/smtp.pyi create mode 100644 django/core/mail/message.pyi create mode 100644 django/core/mail/utils.pyi create mode 100644 django/core/management/__init__.pyi create mode 100644 django/core/management/base.pyi create mode 100644 django/core/management/color.pyi create mode 100644 django/core/management/commands/check.pyi create mode 100644 django/core/management/commands/compilemessages.pyi create mode 100644 django/core/management/commands/createcachetable.pyi create mode 100644 django/core/management/commands/dumpdata.pyi create mode 100644 django/core/management/commands/flush.pyi create mode 100644 django/core/management/commands/inspectdb.pyi create mode 100644 django/core/management/commands/loaddata.pyi create mode 100644 django/core/management/commands/makemessages.pyi create mode 100644 django/core/management/commands/makemigrations.pyi create mode 100644 django/core/management/commands/migrate.pyi create mode 100644 django/core/management/commands/runserver.pyi create mode 100644 django/core/management/commands/sendtestemail.pyi create mode 100644 django/core/management/commands/shell.pyi create mode 100644 django/core/management/commands/showmigrations.pyi create mode 100644 django/core/management/commands/sqlmigrate.pyi create mode 100644 django/core/management/commands/squashmigrations.pyi create mode 100644 django/core/management/commands/test.pyi create mode 100644 django/core/management/commands/testserver.pyi create mode 100644 django/core/management/sql.pyi create mode 100644 django/core/management/templates.pyi create mode 100644 django/core/management/utils.pyi create mode 100644 django/core/paginator.pyi create mode 100644 django/core/serializers/__init__.pyi create mode 100644 django/core/serializers/base.pyi create mode 100644 django/core/serializers/json.pyi create mode 100644 django/core/serializers/python.pyi create mode 100644 django/core/serializers/xml_serializer.pyi create mode 100644 django/core/servers/basehttp.pyi create mode 100644 django/core/signing.pyi create mode 100644 django/core/validators.pyi create mode 100644 django/core/wsgi.pyi create mode 100644 django/db/__init__.pyi create mode 100644 django/db/backends/base/base.pyi create mode 100644 django/db/backends/base/client.pyi create mode 100644 django/db/backends/base/creation.pyi create mode 100644 django/db/backends/base/features.pyi create mode 100644 django/db/backends/base/introspection.pyi create mode 100644 django/db/backends/base/operations.pyi create mode 100644 django/db/backends/base/schema.pyi create mode 100644 django/db/backends/base/validation.pyi create mode 100644 django/db/backends/ddl_references.pyi create mode 100644 django/db/backends/dummy/base.pyi create mode 100644 django/db/backends/mysql/client.pyi create mode 100644 django/db/backends/postgresql/client.pyi create mode 100644 django/db/backends/sqlite3/base.pyi create mode 100644 django/db/backends/sqlite3/creation.pyi create mode 100644 django/db/backends/sqlite3/features.pyi create mode 100644 django/db/backends/sqlite3/introspection.pyi create mode 100644 django/db/backends/sqlite3/operations.pyi create mode 100644 django/db/backends/sqlite3/schema.pyi create mode 100644 django/db/backends/utils.pyi create mode 100644 django/db/migrations/autodetector.pyi create mode 100644 django/db/migrations/exceptions.pyi create mode 100644 django/db/migrations/executor.pyi create mode 100644 django/db/migrations/graph.pyi create mode 100644 django/db/migrations/loader.pyi create mode 100644 django/db/migrations/migration.pyi create mode 100644 django/db/migrations/operations/base.pyi create mode 100644 django/db/migrations/operations/fields.pyi create mode 100644 django/db/migrations/operations/models.pyi create mode 100644 django/db/migrations/operations/special.pyi create mode 100644 django/db/migrations/operations/utils.pyi create mode 100644 django/db/migrations/optimizer.pyi create mode 100644 django/db/migrations/questioner.pyi create mode 100644 django/db/migrations/recorder.pyi create mode 100644 django/db/migrations/serializer.pyi create mode 100644 django/db/migrations/state.pyi create mode 100644 django/db/migrations/topological_sort.pyi create mode 100644 django/db/migrations/utils.pyi create mode 100644 django/db/migrations/writer.pyi create mode 100644 django/db/models/aggregates.pyi create mode 100644 django/db/models/base.pyi create mode 100644 django/db/models/deletion.pyi create mode 100644 django/db/models/expressions.pyi create mode 100644 django/db/models/fields/__init__.pyi create mode 100644 django/db/models/fields/files.pyi create mode 100644 django/db/models/fields/mixins.pyi create mode 100644 django/db/models/fields/proxy.pyi create mode 100644 django/db/models/fields/related.pyi create mode 100644 django/db/models/fields/related_descriptors.pyi create mode 100644 django/db/models/fields/related_lookups.pyi create mode 100644 django/db/models/fields/reverse_related.pyi create mode 100644 django/db/models/functions/comparison.pyi create mode 100644 django/db/models/functions/datetime.pyi create mode 100644 django/db/models/functions/text.pyi create mode 100644 django/db/models/functions/window.pyi create mode 100644 django/db/models/indexes.pyi create mode 100644 django/db/models/lookups.pyi create mode 100644 django/db/models/manager.pyi create mode 100644 django/db/models/options.pyi create mode 100644 django/db/models/query.pyi create mode 100644 django/db/models/query_utils.pyi create mode 100644 django/db/models/signals.pyi create mode 100644 django/db/models/sql/compiler.pyi create mode 100644 django/db/models/sql/datastructures.pyi create mode 100644 django/db/models/sql/query.pyi create mode 100644 django/db/models/sql/subqueries.pyi create mode 100644 django/db/models/sql/where.pyi create mode 100644 django/db/models/utils.pyi create mode 100644 django/db/transaction.pyi create mode 100644 django/db/utils.pyi create mode 100644 django/dispatch/dispatcher.pyi create mode 100644 django/forms/boundfield.pyi create mode 100644 django/forms/fields.pyi create mode 100644 django/forms/forms.pyi create mode 100644 django/forms/formsets.pyi create mode 100644 django/forms/models.pyi create mode 100644 django/forms/renderers.pyi create mode 100644 django/forms/utils.pyi create mode 100644 django/forms/widgets.pyi create mode 100644 django/http/cookie.pyi create mode 100644 django/http/multipartparser.pyi create mode 100644 django/http/request.pyi create mode 100644 django/http/response.pyi create mode 100644 django/middleware/cache.pyi create mode 100644 django/middleware/clickjacking.pyi create mode 100644 django/middleware/common.pyi create mode 100644 django/middleware/csrf.pyi create mode 100644 django/middleware/gzip.pyi create mode 100644 django/middleware/http.pyi create mode 100644 django/middleware/locale.pyi create mode 100644 django/middleware/security.pyi create mode 100644 django/shortcuts.pyi create mode 100644 django/template/backends/base.pyi create mode 100644 django/template/backends/django.pyi create mode 100644 django/template/backends/dummy.pyi create mode 100644 django/template/backends/utils.pyi create mode 100644 django/template/base.pyi create mode 100644 django/template/context.pyi create mode 100644 django/template/context_processors.pyi create mode 100644 django/template/defaultfilters.pyi create mode 100644 django/template/defaulttags.pyi create mode 100644 django/template/engine.pyi create mode 100644 django/template/exceptions.pyi create mode 100644 django/template/library.pyi create mode 100644 django/template/loader.pyi create mode 100644 django/template/loader_tags.pyi create mode 100644 django/template/loaders/app_directories.pyi create mode 100644 django/template/loaders/base.pyi create mode 100644 django/template/loaders/cached.pyi create mode 100644 django/template/loaders/filesystem.pyi create mode 100644 django/template/loaders/locmem.pyi create mode 100644 django/template/response.pyi create mode 100644 django/template/smartif.pyi create mode 100644 django/template/utils.pyi create mode 100644 django/templatetags/cache.pyi create mode 100644 django/templatetags/i18n.pyi create mode 100644 django/templatetags/l10n.pyi create mode 100644 django/templatetags/static.pyi create mode 100644 django/templatetags/tz.pyi create mode 100644 django/test/client.pyi create mode 100644 django/test/html.pyi create mode 100644 django/test/runner.pyi create mode 100644 django/test/selenium.pyi create mode 100644 django/test/signals.pyi create mode 100644 django/test/testcases.pyi create mode 100644 django/test/utils.pyi create mode 100644 django/urls/base.pyi create mode 100644 django/urls/conf.pyi create mode 100644 django/urls/converters.pyi diff --git a/django/__init__.pyi b/django/__init__.pyi new file mode 100644 index 0000000..14f47b0 --- /dev/null +++ b/django/__init__.pyi @@ -0,0 +1 @@ +def setup(set_prefix: bool = ...) -> None: ... \ No newline at end of file diff --git a/django/apps/config.pyi b/django/apps/config.pyi new file mode 100644 index 0000000..0434123 --- /dev/null +++ b/django/apps/config.pyi @@ -0,0 +1,15 @@ +from typing import ( + Any, + Iterator, +) + + +class AppConfig: + def __init__(self, app_name: str, app_module: Any) -> None: ... + def _path_from_module(self, module: Any) -> str: ... + @classmethod + def create(cls, entry: str) -> AppConfig: ... + def get_model(self, model_name: str, require_ready: bool = ...) -> Any: ... + def get_models(self, include_auto_created: bool = ..., include_swapped: bool = ...) -> Iterator[Any]: ... + def import_models(self) -> None: ... + def ready(self) -> None: ... \ No newline at end of file diff --git a/django/apps/registry.pyi b/django/apps/registry.pyi new file mode 100644 index 0000000..b545ff8 --- /dev/null +++ b/django/apps/registry.pyi @@ -0,0 +1,23 @@ +from django.apps.config import AppConfig +from django.db.migrations.state import AppConfigStub +from typing import ( + Any, + List, + Optional, + Tuple, + Union, +) + + +class Apps: + def __init__( + self, + installed_apps: Union[Tuple, List[AppConfigStub], List[str]] = ... + ) -> None: ... + def check_apps_ready(self) -> None: ... + def check_models_ready(self) -> None: ... + def clear_cache(self) -> None: ... + def do_pending_operations(self, model: Any) -> None: ... + def get_app_config(self, app_label: str) -> AppConfig: ... + def get_containing_app_config(self, object_name: str) -> Optional[AppConfig]: ... + def get_model(self, app_label: str, model_name: None = ..., require_ready: bool = ...) -> Any: ... \ No newline at end of file diff --git a/django/conf/__init__.pyi b/django/conf/__init__.pyi new file mode 100644 index 0000000..1447938 --- /dev/null +++ b/django/conf/__init__.pyi @@ -0,0 +1,27 @@ +from typing import ( + Any, + List, +) + + +class LazySettings: + def __delattr__(self, name: str) -> None: ... + def __getattr__(self, name: str) -> Any: ... + def __setattr__(self, name: str, value: object) -> None: ... + def _setup(self, name: None = ...): ... + def configure(self, default_settings: Any = ..., **options): ... + @property + def configured(self) -> bool: ... + + +class Settings: + def __init__(self, settings_module: str): ... + def is_overridden(self, setting: str) -> bool: ... + + +class UserSettingsHolder: + def __delattr__(self, name: str) -> None: ... + def __dir__(self) -> List[str]: ... + def __getattr__(self, name: str) -> Any: ... + def __init__(self, default_settings: Any) -> None: ... + def __setattr__(self, name: str, value: Any) -> None: ... \ No newline at end of file diff --git a/django/conf/urls/__init__.pyi b/django/conf/urls/__init__.pyi new file mode 100644 index 0000000..9b33458 --- /dev/null +++ b/django/conf/urls/__init__.pyi @@ -0,0 +1,17 @@ +from django.urls.resolvers import ( + URLPattern, + URLResolver, +) +from typing import ( + Any, + Optional, + Union, +) + + +def url( + regex: str, + view: Any, + kwargs: Any = ..., + name: Optional[str] = ... +) -> Union[URLResolver, URLPattern]: ... \ No newline at end of file diff --git a/django/conf/urls/i18n.pyi b/django/conf/urls/i18n.pyi new file mode 100644 index 0000000..cab06b7 --- /dev/null +++ b/django/conf/urls/i18n.pyi @@ -0,0 +1,16 @@ +from django.urls.resolvers import URLResolver +from typing import ( + Any, + List, + Tuple, + Union, +) + + +def i18n_patterns( + *urls, + prefix_default_language = ... +) -> Union[List[List[Any]], List[URLResolver]]: ... + + +def is_language_prefix_patterns_used(urlconf: str) -> Tuple[bool, bool]: ... \ No newline at end of file diff --git a/django/conf/urls/static.pyi b/django/conf/urls/static.pyi new file mode 100644 index 0000000..92ed887 --- /dev/null +++ b/django/conf/urls/static.pyi @@ -0,0 +1,8 @@ +from django.urls.resolvers import URLPattern +from typing import ( + Callable, + List, +) + + +def static(prefix: str, view: Callable = ..., **kwargs) -> List[URLPattern]: ... \ No newline at end of file diff --git a/django/contrib/admin/__init__.pyi b/django/contrib/admin/__init__.pyi new file mode 100644 index 0000000..67214b4 --- /dev/null +++ b/django/contrib/admin/__init__.pyi @@ -0,0 +1 @@ +def autodiscover() -> None: ... \ No newline at end of file diff --git a/django/contrib/admin/actions.pyi b/django/contrib/admin/actions.pyi new file mode 100644 index 0000000..4b6cdac --- /dev/null +++ b/django/contrib/admin/actions.pyi @@ -0,0 +1,11 @@ +from django.contrib.admin.options import ModelAdmin +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.query import QuerySet +from django.template.response import TemplateResponse + + +def delete_selected( + modeladmin: ModelAdmin, + request: WSGIRequest, + queryset: QuerySet +) -> TemplateResponse: ... \ No newline at end of file diff --git a/django/contrib/admin/apps.pyi b/django/contrib/admin/apps.pyi new file mode 100644 index 0000000..a1e57a1 --- /dev/null +++ b/django/contrib/admin/apps.pyi @@ -0,0 +1,6 @@ +class AdminConfig: + def ready(self) -> None: ... + + +class SimpleAdminConfig: + def ready(self) -> None: ... \ No newline at end of file diff --git a/django/contrib/admin/checks.pyi b/django/contrib/admin/checks.pyi new file mode 100644 index 0000000..2d81ba0 --- /dev/null +++ b/django/contrib/admin/checks.pyi @@ -0,0 +1,132 @@ +from django.contrib.admin.options import ( + BaseModelAdmin, + InlineModelAdmin, + ModelAdmin, + TabularInline, +) +from django.contrib.auth.models import ( + Group, + User, +) +from django.core.checks.messages import Error +from django.db.models.base import Model +from typing import ( + Any, + List, + Tuple, + Type, + Union, +) + + +class BaseModelAdminChecks: + def _check_autocomplete_fields(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_autocomplete_fields_item( + self, + obj: Union[ModelAdmin, InlineModelAdmin], + model: Type[Model], + field_name: str, + label: str + ) -> List[Any]: ... + def _check_exclude(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_field_spec( + self, + obj: BaseModelAdmin, + model: Any, + fields: Union[str, Tuple[str, str, str, str], Tuple[str, str]], + label: str + ) -> List[Any]: ... + def _check_field_spec_item( + self, + obj: BaseModelAdmin, + model: Any, + field_name: str, + label: str + ) -> List[Any]: ... + def _check_fields(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_fieldsets(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_fieldsets_item( + self, + obj: BaseModelAdmin, + model: Any, + fieldset: Any, + label: str, + seen_fields: List[str] + ) -> List[Any]: ... + def _check_filter_horizontal(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_filter_item( + self, + obj: ModelAdmin, + model: Type[Union[Group, User]], + field_name: str, + label: str + ) -> List[Any]: ... + def _check_filter_vertical(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_form(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_ordering(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_ordering_item( + self, + obj: ModelAdmin, + model: Any, + field_name: str, + label: str + ) -> List[Any]: ... + def _check_prepopulated_fields(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_prepopulated_fields_key( + self, + obj: Union[ModelAdmin, InlineModelAdmin], + model: Type[Model], + field_name: str, + label: str + ) -> List[Any]: ... + def _check_prepopulated_fields_value( + self, + obj: BaseModelAdmin, + model: Type[Model], + val: Union[Tuple[str], List[str]], + label: str + ) -> List[Any]: ... + def _check_prepopulated_fields_value_item( + self, + obj: Union[ModelAdmin, TabularInline], + model: Type[Model], + field_name: str, + label: str + ) -> List[Any]: ... + def _check_radio_fields(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_raw_id_fields(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_raw_id_fields_item( + self, + obj: ModelAdmin, + model: Type[Model], + field_name: str, + label: str + ) -> List[Any]: ... + def _check_readonly_fields(self, obj: BaseModelAdmin) -> List[Any]: ... + def _check_readonly_fields_item( + self, + obj: BaseModelAdmin, + model: Any, + field_name: str, + label: str + ) -> List[Any]: ... + def _check_view_on_site_url(self, obj: BaseModelAdmin) -> List[Any]: ... + def check( + self, + admin_obj: BaseModelAdmin, + **kwargs + ) -> List[Error]: ... + + +class InlineModelAdminChecks: + def _check_exclude_of_parent_model( + self, + obj: InlineModelAdmin, + parent_model: Any + ) -> List[Any]: ... + def _check_extra(self, obj: InlineModelAdmin) -> List[Any]: ... + def _check_formset(self, obj: InlineModelAdmin) -> List[Any]: ... + def _check_has_add_permission(self, obj: InlineModelAdmin) -> None: ... + def _check_max_num(self, obj: InlineModelAdmin) -> List[Any]: ... + def _check_min_num(self, obj: InlineModelAdmin) -> List[Any]: ... + def _check_relation(self, obj: InlineModelAdmin, parent_model: Any) -> List[Any]: ... \ No newline at end of file diff --git a/django/contrib/admin/decorators.pyi b/django/contrib/admin/decorators.pyi new file mode 100644 index 0000000..4a6ef4c --- /dev/null +++ b/django/contrib/admin/decorators.pyi @@ -0,0 +1,4 @@ +from typing import Callable + + +def register(*models, site = ...) -> Callable: ... \ No newline at end of file diff --git a/django/contrib/admin/filters.pyi b/django/contrib/admin/filters.pyi new file mode 100644 index 0000000..90ec1c4 --- /dev/null +++ b/django/contrib/admin/filters.pyi @@ -0,0 +1,159 @@ +from django.contrib.admin.options import ModelAdmin +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.base import Model +from django.db.models.fields import ( + BooleanField, + DateField, + Field, +) +from django.db.models.fields.related import ( + ForeignKey, + ManyToManyField, +) +from django.db.models.fields.reverse_related import ForeignObjectRel +from django.db.models.query import QuerySet +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +class AllValuesFieldListFilter: + def __init__( + self, + field: Field, + request: WSGIRequest, + params: Dict[str, str], + model: Type[Model], + model_admin: ModelAdmin, + field_path: str + ) -> None: ... + def expected_parameters(self) -> List[str]: ... + + +class BooleanFieldListFilter: + def __init__( + self, + field: BooleanField, + request: WSGIRequest, + params: Dict[str, str], + model: Type[Model], + model_admin: ModelAdmin, + field_path: str + ) -> None: ... + def expected_parameters(self) -> List[str]: ... + + +class ChoicesFieldListFilter: + def __init__( + self, + field: Field, + request: WSGIRequest, + params: Dict[str, str], + model: Type[Model], + model_admin: ModelAdmin, + field_path: str + ) -> None: ... + def expected_parameters(self) -> List[str]: ... + + +class DateFieldListFilter: + def __init__( + self, + field: DateField, + request: WSGIRequest, + params: Dict[str, str], + model: Type[Model], + model_admin: ModelAdmin, + field_path: str + ) -> None: ... + def expected_parameters(self) -> List[str]: ... + + +class FieldListFilter: + def __init__( + self, + field: Any, + request: WSGIRequest, + params: Dict[str, str], + model: Any, + model_admin: ModelAdmin, + field_path: str + ) -> None: ... + @classmethod + def create( + cls, + field: Any, + request: WSGIRequest, + params: Dict[str, str], + model: Any, + model_admin: ModelAdmin, + field_path: str + ) -> FieldListFilter: ... + def has_output(self) -> bool: ... + def queryset( + self, + request: WSGIRequest, + queryset: QuerySet + ) -> QuerySet: ... + @classmethod + def register(cls, test: Callable, list_filter_class: Any, take_priority: bool = ...) -> None: ... + + +class ListFilter: + def __init__( + self, + request: WSGIRequest, + params: Dict[str, str], + model: Any, + model_admin: ModelAdmin + ) -> None: ... + + +class RelatedFieldListFilter: + def __init__( + self, + field: Union[ForeignObjectRel, ManyToManyField, ForeignKey], + request: WSGIRequest, + params: Dict[str, str], + model: Any, + model_admin: ModelAdmin, + field_path: str + ) -> None: ... + def expected_parameters(self) -> List[str]: ... + def field_choices( + self, + field: Union[ForeignObjectRel, ManyToManyField, ForeignKey], + request: WSGIRequest, + model_admin: ModelAdmin + ) -> Union[List[Tuple[str, str]], List[Tuple[int, str]]]: ... + def has_output(self) -> bool: ... + @property + def include_empty_choice(self) -> bool: ... + + +class RelatedOnlyFieldListFilter: + def field_choices( + self, + field: Union[ManyToManyField, ForeignKey], + request: WSGIRequest, + model_admin: ModelAdmin + ) -> Union[List[Tuple[int, str]], List[Tuple[str, str]]]: ... + + +class SimpleListFilter: + def __init__( + self, + request: WSGIRequest, + params: Dict[str, str], + model: Type[Model], + model_admin: ModelAdmin + ) -> None: ... + def has_output(self) -> bool: ... + def value(self) -> Optional[str]: ... \ No newline at end of file diff --git a/django/contrib/admin/forms.pyi b/django/contrib/admin/forms.pyi new file mode 100644 index 0000000..42823a3 --- /dev/null +++ b/django/contrib/admin/forms.pyi @@ -0,0 +1,5 @@ +from django.contrib.auth.models import User + + +class AdminAuthenticationForm: + def confirm_login_allowed(self, user: User) -> None: ... \ No newline at end of file diff --git a/django/contrib/admin/helpers.pyi b/django/contrib/admin/helpers.pyi new file mode 100644 index 0000000..7802ff3 --- /dev/null +++ b/django/contrib/admin/helpers.pyi @@ -0,0 +1,75 @@ +from django.contrib.auth.forms import AdminPasswordChangeForm +from django.db.models.fields import AutoField +from django.forms.utils import ErrorDict +from django.forms.widgets import Media +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Tuple, + Union, +) + + +class AdminField: + def errors(self) -> SafeText: ... + def label_tag(self) -> SafeText: ... + + +class AdminForm: + def __init__( + self, + form: AdminPasswordChangeForm, + fieldsets: List[Tuple[None, Dict[str, List[str]]]], + prepopulated_fields: Dict[Any, Any], + readonly_fields: None = ..., + model_admin: None = ... + ) -> None: ... + def __iter__(self) -> Iterator[Fieldset]: ... + @property + def errors(self) -> ErrorDict: ... + @property + def media(self) -> Media: ... + @property + def non_field_errors(self) -> Callable: ... + + +class AdminReadonlyField: + def contents(self) -> SafeText: ... + def label_tag(self) -> SafeText: ... + + +class Fieldline: + def __iter__( + self + ) -> Iterator[Union[AdminField, AdminReadonlyField]]: ... + def errors(self) -> SafeText: ... + + +class Fieldset: + def __iter__(self) -> Iterator[Fieldline]: ... + @property + def media(self) -> Media: ... + + +class InlineAdminForm: + def __iter__(self) -> Iterator[InlineFieldset]: ... + def deletion_field(self) -> AdminField: ... + def fk_field(self) -> AdminField: ... + def needs_explicit_pk_field(self) -> Union[bool, AutoField]: ... + def pk_field(self) -> AdminField: ... + + +class InlineAdminFormSet: + def __iter__(self) -> Iterator[InlineAdminForm]: ... + def fields(self) -> Iterator[Dict[str, Any]]: ... + def inline_formset_data(self) -> str: ... + @property + def media(self) -> Media: ... + + +class InlineFieldset: + def __iter__(self) -> Iterator[Fieldline]: ... \ No newline at end of file diff --git a/django/contrib/admin/models.pyi b/django/contrib/admin/models.pyi new file mode 100644 index 0000000..beefee0 --- /dev/null +++ b/django/contrib/admin/models.pyi @@ -0,0 +1,22 @@ +from typing import Any + + +class LogEntry: + def __str__(self) -> str: ... + def get_admin_url(self) -> str: ... + def get_change_message(self) -> str: ... + def is_addition(self) -> bool: ... + def is_change(self) -> bool: ... + def is_deletion(self) -> bool: ... + + +class LogEntryManager: + def log_action( + self, + user_id: int, + content_type_id: int, + object_id: int, + object_repr: str, + action_flag: int, + change_message: Any = ... + ) -> LogEntry: ... \ No newline at end of file diff --git a/django/contrib/admin/options.pyi b/django/contrib/admin/options.pyi new file mode 100644 index 0000000..f03e484 --- /dev/null +++ b/django/contrib/admin/options.pyi @@ -0,0 +1,73 @@ +from django.core.checks.messages import Error +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.fields import Field +from django.db.models.fields.related import ( + ForeignKey, + ManyToManyField, +) +from django.db.models.query import QuerySet +from django.forms.fields import TypedChoiceField +from django.forms.models import ( + ModelChoiceField, + ModelMultipleChoiceField, +) +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) + + +class BaseModelAdmin: + def __init__(self) -> None: ... + def check(self, **kwargs) -> List[Error]: ... + def formfield_for_choice_field( + self, + db_field: Field, + request: object, + **kwargs + ) -> TypedChoiceField: ... + def formfield_for_dbfield(self, db_field: Field, request: object, **kwargs) -> Any: ... + def formfield_for_foreignkey( + self, + db_field: ForeignKey, + request: object, + **kwargs + ) -> Optional[ModelChoiceField]: ... + def formfield_for_manytomany( + self, + db_field: ManyToManyField, + request: WSGIRequest, + **kwargs + ) -> ModelMultipleChoiceField: ... + def get_autocomplete_fields(self, request: object) -> Tuple: ... + def get_empty_value_display(self) -> SafeText: ... + def get_exclude(self, request: object, obj: Any = ...) -> None: ... + def get_field_queryset( + self, + db: None, + db_field: Union[ManyToManyField, ForeignKey], + request: object + ) -> Optional[QuerySet]: ... + def get_fields(self, request: object, obj: Any = ...) -> Union[List[Union[str, Callable]], List[str]]: ... + def get_fieldsets(self, request: WSGIRequest, obj: Any = ...) -> Any: ... + def get_ordering(self, request: WSGIRequest) -> Union[List[str], Tuple]: ... + def get_prepopulated_fields( + self, + request: WSGIRequest, + obj: Any = ... + ) -> Dict[str, Tuple[str]]: ... + def get_queryset(self, request: object) -> QuerySet: ... + def get_readonly_fields(self, request: object, obj: Any = ...) -> Union[Tuple, List[str]]: ... + def get_sortable_by(self, request: WSGIRequest) -> Union[Tuple, List[str]]: ... + def get_view_on_site_url(self, obj: Any = ...) -> Optional[str]: ... + def has_add_permission(self, request: WSGIRequest) -> bool: ... + def has_change_permission(self, request: object, obj: Any = ...) -> bool: ... + def has_delete_permission(self, request: object, obj: Any = ...) -> bool: ... + def has_module_permission(self, request: object) -> bool: ... + def has_view_permission(self, request: WSGIRequest, obj: Any = ...) -> bool: ... \ No newline at end of file diff --git a/django/contrib/admin/sites.pyi b/django/contrib/admin/sites.pyi new file mode 100644 index 0000000..1b139a3 --- /dev/null +++ b/django/contrib/admin/sites.pyi @@ -0,0 +1,77 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import ( + HttpResponse, + HttpResponseRedirect, +) +from django.template.response import TemplateResponse +from django.urls.resolvers import ( + URLPattern, + URLResolver, +) +from typing import ( + Any, + Callable, + Dict, + List, + Tuple, + Union, +) + + +class AdminSite: + def __init__(self, name: str = ...) -> None: ... + def _build_app_dict(self, request: WSGIRequest, label: None = ...) -> Dict[Any, Any]: ... + def add_action(self, action: Callable, name: None = ...) -> None: ... + def admin_view(self, view: Callable, cacheable: bool = ...) -> Callable: ... + def app_index( + self, + request: WSGIRequest, + app_label: str, + extra_context: None = ... + ) -> TemplateResponse: ... + def check(self, app_configs: None) -> List[Any]: ... + def get_action(self, name: str) -> Callable: ... + def get_app_list(self, request: WSGIRequest) -> List[Any]: ... + def get_urls(self) -> List[Union[URLPattern, URLResolver]]: ... + def has_permission(self, request: WSGIRequest) -> bool: ... + def i18n_javascript( + self, + request: WSGIRequest, + extra_context: None = ... + ) -> HttpResponse: ... + def index( + self, + request: WSGIRequest, + extra_context: None = ... + ) -> TemplateResponse: ... + def is_registered(self, model: Any) -> bool: ... + def login( + self, + request: WSGIRequest, + extra_context: None = ... + ) -> Union[HttpResponseRedirect, TemplateResponse]: ... + def logout( + self, + request: WSGIRequest, + extra_context: None = ... + ) -> TemplateResponse: ... + def password_change( + self, + request: WSGIRequest, + extra_context: Dict[str, str] = ... + ) -> TemplateResponse: ... + def password_change_done( + self, + request: WSGIRequest, + extra_context: None = ... + ) -> TemplateResponse: ... + def register(self, model_or_iterable: Any, admin_class: Any = ..., **options) -> None: ... + def unregister(self, model_or_iterable: Any) -> None: ... + @property + def urls( + self + ) -> Union[Tuple[List[Union[URLPattern, URLResolver]], str, str], Tuple[List[URLPattern], str, str]]: ... + + +class DefaultAdminSite: + def _setup(self) -> None: ... \ No newline at end of file diff --git a/django/contrib/admin/templatetags/admin_list.pyi b/django/contrib/admin/templatetags/admin_list.pyi new file mode 100644 index 0000000..85d371e --- /dev/null +++ b/django/contrib/admin/templatetags/admin_list.pyi @@ -0,0 +1,109 @@ +from django.contrib.admin.filters import FieldListFilter +from django.contrib.admin.templatetags.base import InclusionAdminNode +from django.contrib.admin.views.main import ChangeList +from django.db.models.base import Model +from django.forms.boundfield import BoundField +from django.template.base import ( + Parser, + Token, +) +from django.template.context import RequestContext +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + Iterator, + Optional, + Union, +) + + +def _boolean_icon(field_val: Optional[bool]) -> SafeText: ... + + +def _coerce_field_name(field_name: Union[str, Callable], field_index: int) -> str: ... + + +def admin_actions(context: RequestContext) -> RequestContext: ... + + +def admin_actions_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... + + +def admin_list_filter( + cl: ChangeList, + spec: FieldListFilter +) -> SafeText: ... + + +def change_list_object_tools_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... + + +def date_hierarchy(cl: ChangeList) -> Any: ... + + +def date_hierarchy_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... + + +def items_for_result( + cl: ChangeList, + result: Model, + form: None +) -> Iterator[SafeText]: ... + + +def pagination(cl: ChangeList) -> Dict[str, Any]: ... + + +def pagination_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... + + +def paginator_number(cl: ChangeList, i: int) -> SafeText: ... + + +def result_headers(cl: ChangeList) -> Iterator[Dict[str, Union[None, int, str]]]: ... + + +def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ... + + +def result_list(cl: ChangeList) -> Dict[str, Any]: ... + + +def result_list_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... + + +def results( + cl: ChangeList +) -> Iterator[ResultList]: ... + + +def search_form( + cl: ChangeList +) -> Dict[str, Union[ChangeList, bool, str]]: ... + + +def search_form_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... + + +class ResultList: + def __init__(self, form: None, *items) -> None: ... \ No newline at end of file diff --git a/django/contrib/admin/templatetags/admin_modify.pyi b/django/contrib/admin/templatetags/admin_modify.pyi new file mode 100644 index 0000000..1545a4c --- /dev/null +++ b/django/contrib/admin/templatetags/admin_modify.pyi @@ -0,0 +1,37 @@ +from django.contrib.admin.helpers import InlineAdminForm +from django.contrib.admin.templatetags.base import InclusionAdminNode +from django.template.base import ( + Parser, + Token, +) +from django.template.context import ( + Context, + RequestContext, +) + + +def cell_count(inline_admin_form: InlineAdminForm) -> int: ... + + +def change_form_object_tools_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... + + +def prepopulated_fields_js(context: RequestContext) -> RequestContext: ... + + +def prepopulated_fields_js_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... + + +def submit_row(context: RequestContext) -> Context: ... + + +def submit_row_tag( + parser: Parser, + token: Token +) -> InclusionAdminNode: ... \ No newline at end of file diff --git a/django/contrib/admin/templatetags/admin_static.pyi b/django/contrib/admin/templatetags/admin_static.pyi new file mode 100644 index 0000000..994fbcb --- /dev/null +++ b/django/contrib/admin/templatetags/admin_static.pyi @@ -0,0 +1 @@ +def static(path: str) -> str: ... \ No newline at end of file diff --git a/django/contrib/admin/templatetags/admin_urls.pyi b/django/contrib/admin/templatetags/admin_urls.pyi new file mode 100644 index 0000000..959c7d6 --- /dev/null +++ b/django/contrib/admin/templatetags/admin_urls.pyi @@ -0,0 +1,23 @@ +from django.db.models.options import Options +from django.template.context import RequestContext +from django.utils.safestring import SafeText +from typing import ( + Dict, + Optional, + Union, +) +from uuid import UUID + + +def add_preserved_filters( + context: Union[Dict[str, Union[str, Options]], RequestContext], + url: str, + popup: bool = ..., + to_field: Optional[str] = ... +) -> str: ... + + +def admin_urlname(value: Options, arg: SafeText) -> str: ... + + +def admin_urlquote(value: Union[str, UUID, int]) -> Union[str, UUID, int]: ... \ No newline at end of file diff --git a/django/contrib/admin/templatetags/base.pyi b/django/contrib/admin/templatetags/base.pyi new file mode 100644 index 0000000..777317e --- /dev/null +++ b/django/contrib/admin/templatetags/base.pyi @@ -0,0 +1,19 @@ +from django.template.base import ( + Parser, + Token, +) +from django.template.context import Context +from django.utils.safestring import SafeText +from typing import Callable + + +class InclusionAdminNode: + def __init__( + self, + parser: Parser, + token: Token, + func: Callable, + template_name: str, + takes_context: bool = ... + ) -> None: ... + def render(self, context: Context) -> SafeText: ... \ No newline at end of file diff --git a/django/contrib/admin/templatetags/log.pyi b/django/contrib/admin/templatetags/log.pyi new file mode 100644 index 0000000..bdda5d7 --- /dev/null +++ b/django/contrib/admin/templatetags/log.pyi @@ -0,0 +1,16 @@ +from django.template.base import ( + Parser, + Token, +) +from django.template.context import Context + + +def get_admin_log( + parser: Parser, + token: Token +) -> AdminLogNode: ... + + +class AdminLogNode: + def __init__(self, limit: str, varname: str, user: str) -> None: ... + def render(self, context: Context) -> str: ... \ No newline at end of file diff --git a/django/contrib/admin/utils.pyi b/django/contrib/admin/utils.pyi new file mode 100644 index 0000000..d667889 --- /dev/null +++ b/django/contrib/admin/utils.pyi @@ -0,0 +1,99 @@ +from datetime import datetime +from django.contrib.admin.options import ( + ModelAdmin, + TabularInline, +) +from django.contrib.auth.forms import AdminPasswordChangeForm +from django.db.models.base import Model +from django.db.models.fields.reverse_related import ManyToOneRel +from django.db.models.options import Options +from django.db.models.query import QuerySet +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) +from uuid import UUID + + +def _get_non_gfk_field(opts: Options, name: Union[str, Callable]) -> Any: ... + + +def construct_change_message( + form: AdminPasswordChangeForm, + formsets: None, + add: bool +) -> List[Dict[str, Dict[str, List[str]]]]: ... + + +def display_for_field(value: Any, field: Any, empty_value_display: str) -> str: ... + + +def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ... + + +def flatten(fields: Union[Tuple, List[Union[str, Callable]], List[str]]) -> Union[List[Union[str, Callable]], List[str]]: ... + + +def flatten_fieldsets(fieldsets: Any) -> Union[List[Union[str, Callable]], List[str]]: ... + + +def get_fields_from_path(model: Any, path: str) -> Any: ... + + +def get_model_from_relation(field: Any) -> Any: ... + + +def help_text_for_field(name: str, model: Any) -> str: ... + + +def label_for_field( + name: Union[str, Callable], + model: Any, + model_admin: Optional[Union[ModelAdmin, TabularInline]] = ..., + return_attr: bool = ... +) -> Any: ... + + +def lookup_field( + name: Union[str, Callable], + obj: Model, + model_admin: Union[ModelAdmin, TabularInline] = ... +) -> Any: ... + + +def lookup_needs_distinct(opts: Options, lookup_path: str) -> bool: ... + + +def model_ngettext(obj: QuerySet, n: None = ...) -> str: ... + + +def prepare_lookup_value(key: str, value: Union[str, datetime]) -> Union[bool, datetime, str]: ... + + +def quote(s: Union[str, UUID, int]) -> Union[str, UUID, int]: ... + + +def reverse_field_path(model: Type[Model], path: str) -> Any: ... + + +def unquote(s: str) -> str: ... + + +class NestedObjects: + def __init__(self, *args, **kwargs) -> None: ... + def _nested(self, obj: Model, seen: Any, format_callback: Callable) -> Any: ... + def add_edge(self, source: Any, target: Model) -> None: ... + def can_fast_delete(self, *args, **kwargs) -> bool: ... + def collect(self, objs: Any, source: Any = ..., source_attr: Optional[str] = ..., **kwargs) -> None: ... + def nested(self, format_callback: Callable = ...) -> Any: ... + def related_objects( + self, + related: ManyToOneRel, + objs: Any + ) -> QuerySet: ... \ No newline at end of file diff --git a/django/contrib/admin/views/autocomplete.pyi b/django/contrib/admin/views/autocomplete.pyi new file mode 100644 index 0000000..a16db00 --- /dev/null +++ b/django/contrib/admin/views/autocomplete.pyi @@ -0,0 +1,11 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.core.paginator import Paginator +from django.db.models.query import QuerySet +from django.http.response import JsonResponse + + +class AutocompleteJsonView: + def get(self, request: WSGIRequest, *args, **kwargs) -> JsonResponse: ... + def get_paginator(self, *args, **kwargs) -> Paginator: ... + def get_queryset(self) -> QuerySet: ... + def has_perm(self, request: WSGIRequest, obj: None = ...) -> bool: ... \ No newline at end of file diff --git a/django/contrib/admin/views/decorators.pyi b/django/contrib/admin/views/decorators.pyi new file mode 100644 index 0000000..3f70fe6 --- /dev/null +++ b/django/contrib/admin/views/decorators.pyi @@ -0,0 +1,8 @@ +from typing import Callable + + +def staff_member_required( + view_func: None = ..., + redirect_field_name: str = ..., + login_url: str = ... +) -> Callable: ... \ No newline at end of file diff --git a/django/contrib/admin/views/main.pyi b/django/contrib/admin/views/main.pyi new file mode 100644 index 0000000..d3c4a48 --- /dev/null +++ b/django/contrib/admin/views/main.pyi @@ -0,0 +1,55 @@ +from collections import OrderedDict +from django.contrib.admin.filters import SimpleListFilter +from django.contrib.admin.options import ModelAdmin +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.base import Model +from django.db.models.expressions import CombinedExpression +from django.db.models.query import QuerySet +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +class ChangeList: + def __init__( + self, + request: WSGIRequest, + model: Any, + list_display: Union[Tuple[str, str, str, str], List[Union[str, Callable]], List[str]], + list_display_links: Union[Tuple[str, str], List[str]], + list_filter: Union[List[Type[SimpleListFilter]], Tuple, List[str]], + date_hierarchy: Optional[str], + search_fields: Union[List[str], Tuple], + list_select_related: bool, + list_per_page: int, + list_max_show_all: int, + list_editable: Union[List[str], Tuple], + model_admin: ModelAdmin, + sortable_by: Any + ) -> None: ... + def _get_default_ordering(self) -> Union[List[str], Tuple[str], Tuple[str, str]]: ... + def apply_select_related(self, qs: QuerySet) -> QuerySet: ... + def get_filters(self, request: WSGIRequest) -> Any: ... + def get_filters_params(self, params: None = ...) -> Dict[str, str]: ... + def get_ordering( + self, + request: WSGIRequest, + queryset: QuerySet + ) -> List[str]: ... + def get_ordering_field( + self, + field_name: Union[str, Callable] + ) -> Optional[Union[str, CombinedExpression]]: ... + def get_ordering_field_columns(self) -> OrderedDict: ... + def get_query_string(self, new_params: Any = ..., remove: Optional[List[str]] = ...) -> str: ... + def get_queryset(self, request: WSGIRequest) -> QuerySet: ... + def get_results(self, request: WSGIRequest) -> None: ... + def has_related_field_in_list_display(self) -> bool: ... + def url_for_result(self, result: Model) -> str: ... \ No newline at end of file diff --git a/django/contrib/admin/widgets.pyi b/django/contrib/admin/widgets.pyi new file mode 100644 index 0000000..0998b7f --- /dev/null +++ b/django/contrib/admin/widgets.pyi @@ -0,0 +1,149 @@ +from datetime import datetime +from django.contrib.admin.sites import AdminSite +from django.db.models.fields.reverse_related import ( + ForeignObjectRel, + ManyToOneRel, +) +from django.forms.widgets import ( + Media, + Select, +) +from django.http.request import QueryDict +from django.utils.datastructures import MultiValueDict +from typing import ( + Any, + Dict, + List, + Optional, + Set, + Tuple, + Union, +) + + +def url_params_from_lookup_dict(lookups: Dict[str, Union[str, int]]) -> Dict[str, str]: ... + + +class AdminDateWidget: + def __init__(self, attrs: None = ..., format: None = ...) -> None: ... + @property + def media(self) -> Media: ... + + +class AdminEmailInputWidget: + def __init__(self, attrs: None = ...) -> None: ... + + +class AdminIntegerFieldWidget: + def __init__(self, attrs: None = ...) -> None: ... + + +class AdminSplitDateTime: + def __init__(self, attrs: None = ...) -> None: ... + def get_context( + self, + name: str, + value: Optional[datetime], + attrs: Dict[str, Union[bool, str]] + ) -> Dict[str, Any]: ... + + +class AdminTextInputWidget: + def __init__(self, attrs: None = ...) -> None: ... + + +class AdminTextareaWidget: + def __init__(self, attrs: None = ...) -> None: ... + + +class AdminTimeWidget: + def __init__(self, attrs: None = ..., format: None = ...) -> None: ... + @property + def media(self) -> Media: ... + + +class AdminURLFieldWidget: + def __init__(self, attrs: None = ...) -> None: ... + def get_context( + self, + name: str, + value: None, + attrs: Dict[str, str] + ) -> Dict[str, Union[Dict[str, Union[str, bool, None, Dict[str, str]]], str]]: ... + + +class AutocompleteMixin: + def __init__( + self, + rel: ManyToOneRel, + admin_site: AdminSite, + attrs: None = ..., + choices: Tuple = ..., + using: None = ... + ) -> None: ... + def build_attrs(self, base_attrs: Dict[Any, Any], extra_attrs: Dict[str, str] = ...) -> Dict[str, str]: ... + def get_url(self) -> str: ... + @property + def media(self) -> Media: ... + def optgroups( + self, + name: str, + value: List[str], + attr: Dict[str, str] = ... + ) -> Union[List[Tuple[None, List[Dict[str, Union[str, int, Set[str], Dict[str, bool]]]], int]], List[Tuple[None, List[Dict[str, Union[bool, str]]], int]]]: ... + + +class FilteredSelectMultiple: + def __init__(self, verbose_name: str, is_stacked: bool, attrs: None = ..., choices: Tuple = ...) -> None: ... + @property + def media(self) -> Media: ... + + +class ForeignKeyRawIdWidget: + def __init__( + self, + rel: ManyToOneRel, + admin_site: AdminSite, + attrs: None = ..., + using: None = ... + ) -> None: ... + def base_url_parameters(self) -> Dict[str, str]: ... + def get_context( + self, + name: str, + value: None, + attrs: Dict[str, Union[bool, str]] + ) -> Dict[str, Union[Dict[str, Union[str, bool, None, Dict[str, Union[bool, str]]]], str]]: ... + def url_parameters(self) -> Dict[str, str]: ... + + +class RelatedFieldWidgetWrapper: + def __deepcopy__(self, memo: Dict[int, Any]) -> RelatedFieldWidgetWrapper: ... + def __init__( + self, + widget: Union[Select, AdminRadioSelect], + rel: ForeignObjectRel, + admin_site: AdminSite, + can_add_related: Optional[bool] = ..., + can_change_related: bool = ..., + can_delete_related: bool = ..., + can_view_related: bool = ... + ) -> None: ... + def get_context( + self, + name: str, + value: Optional[Union[str, int]], + attrs: Dict[str, str] + ) -> Dict[str, Union[bool, str]]: ... + def get_related_url(self, info: Tuple[str, str], action: str, *args) -> str: ... + def id_for_label(self, id_: str) -> str: ... + @property + def is_hidden(self) -> bool: ... + @property + def media(self) -> Media: ... + def value_from_datadict( + self, + data: QueryDict, + files: MultiValueDict, + name: str + ) -> Optional[str]: ... \ No newline at end of file diff --git a/django/contrib/admindocs/middleware.pyi b/django/contrib/admindocs/middleware.pyi new file mode 100644 index 0000000..925f9d3 --- /dev/null +++ b/django/contrib/admindocs/middleware.pyi @@ -0,0 +1,19 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import HttpResponse +from typing import ( + Any, + Callable, + Dict, + Optional, + Tuple, +) + + +class XViewMiddleware: + def process_view( + self, + request: WSGIRequest, + view_func: Callable, + view_args: Tuple, + view_kwargs: Dict[Any, Any] + ) -> Optional[HttpResponse]: ... \ No newline at end of file diff --git a/django/contrib/admindocs/utils.pyi b/django/contrib/admindocs/utils.pyi new file mode 100644 index 0000000..acf6eae --- /dev/null +++ b/django/contrib/admindocs/utils.pyi @@ -0,0 +1,10 @@ +from typing import Callable + + +def get_view_name(view_func: Callable) -> str: ... + + +def replace_named_groups(pattern: str) -> str: ... + + +def replace_unnamed_groups(pattern: str) -> str: ... \ No newline at end of file diff --git a/django/contrib/admindocs/views.pyi b/django/contrib/admindocs/views.pyi new file mode 100644 index 0000000..6e72e1a --- /dev/null +++ b/django/contrib/admindocs/views.pyi @@ -0,0 +1,4 @@ +from django.db.models.fields import Field + + +def get_readable_field_data_type(field: Field) -> str: ... \ No newline at end of file diff --git a/django/contrib/auth/__init__.pyi b/django/contrib/auth/__init__.pyi new file mode 100644 index 0000000..627f1bb --- /dev/null +++ b/django/contrib/auth/__init__.pyi @@ -0,0 +1,70 @@ +from django.contrib.auth.backends import ModelBackend +from django.contrib.auth.base_user import AbstractBaseUser +from django.contrib.auth.models import ( + AnonymousUser, + User, +) +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.base import Model +from django.db.models.options import Options +from django.http.request import HttpRequest +from django.utils.functional import SimpleLazyObject +from test_client.auth_backends import BackendWithoutGetUserMethod +from typing import ( + Any, + Dict, + List, + Optional, + Type, + Union, +) + + +def _clean_credentials(credentials: Dict[str, Union[str, None]]) -> Dict[str, Union[str, None]]: ... + + +def _get_backends(return_tuples: bool = ...) -> Any: ... + + +def _get_user_session_key(request: HttpRequest) -> int: ... + + +def authenticate( + request: Optional[HttpRequest] = ..., + **credentials +) -> Optional[AbstractBaseUser]: ... + + +def get_backends() -> List[ModelBackend]: ... + + +def get_permission_codename(action: str, opts: Options) -> str: ... + + +def get_user( + request: HttpRequest +) -> Union[AnonymousUser, AbstractBaseUser]: ... + + +def get_user_model() -> Type[Model]: ... + + +def load_backend( + path: str +) -> Union[ModelBackend, BackendWithoutGetUserMethod]: ... + + +def login( + request: HttpRequest, + user: User, + backend: Optional[Union[str, Type[ModelBackend]]] = ... +) -> None: ... + + +def logout(request: HttpRequest) -> None: ... + + +def update_session_auth_hash( + request: WSGIRequest, + user: SimpleLazyObject +) -> None: ... \ No newline at end of file diff --git a/django/contrib/auth/admin.pyi b/django/contrib/auth/admin.pyi new file mode 100644 index 0000000..bf4af0a --- /dev/null +++ b/django/contrib/auth/admin.pyi @@ -0,0 +1,56 @@ +from django.contrib.auth.models import User +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.fields.related import ManyToManyField +from django.forms.models import ModelMultipleChoiceField +from django.http.response import HttpResponseRedirect +from django.template.response import TemplateResponse +from django.urls.resolvers import URLPattern +from typing import ( + Dict, + List, + Tuple, + Union, +) + + +class GroupAdmin: + def formfield_for_manytomany( + self, + db_field: ManyToManyField, + request: WSGIRequest = ..., + **kwargs + ) -> ModelMultipleChoiceField: ... + + +class UserAdmin: + def _add_view( + self, + request: WSGIRequest, + form_url: str = ..., + extra_context: None = ... + ) -> Union[HttpResponseRedirect, TemplateResponse]: ... + def add_view( + self, + request: WSGIRequest, + form_url: str = ..., + extra_context: None = ... + ): ... + def get_fieldsets( + self, + request: WSGIRequest, + obj: None = ... + ) -> Tuple[Tuple[None, Dict[str, Union[Tuple[str], Tuple[str, str, str]]]]]: ... + def get_urls(self) -> List[URLPattern]: ... + def lookup_allowed(self, lookup: str, value: str) -> bool: ... + def response_add( + self, + request: WSGIRequest, + obj: User, + post_url_continue: None = ... + ) -> HttpResponseRedirect: ... + def user_change_password( + self, + request: WSGIRequest, + id: str, + form_url: str = ... + ) -> Union[HttpResponseRedirect, TemplateResponse]: ... \ No newline at end of file diff --git a/django/contrib/auth/apps.pyi b/django/contrib/auth/apps.pyi new file mode 100644 index 0000000..85ae3c6 --- /dev/null +++ b/django/contrib/auth/apps.pyi @@ -0,0 +1,2 @@ +class AuthConfig: + def ready(self) -> None: ... \ No newline at end of file diff --git a/django/contrib/auth/backends.pyi b/django/contrib/auth/backends.pyi new file mode 100644 index 0000000..5ed6cd6 --- /dev/null +++ b/django/contrib/auth/backends.pyi @@ -0,0 +1,60 @@ +from django.contrib.auth.base_user import AbstractBaseUser +from django.contrib.auth.models import ( + AnonymousUser, + User, +) +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.query import QuerySet +from django.http.request import HttpRequest +from typing import ( + Optional, + Set, + Union, +) + + +class AllowAllUsersModelBackend: + def user_can_authenticate(self, user: User) -> bool: ... + + +class AllowAllUsersRemoteUserBackend: + def user_can_authenticate(self, user: User) -> bool: ... + + +class ModelBackend: + def _get_group_permissions(self, user_obj: User) -> QuerySet: ... + def _get_permissions(self, user_obj: User, obj: None, from_name: str) -> Set[str]: ... + def _get_user_permissions(self, user_obj: User) -> QuerySet: ... + def authenticate( + self, + request: Optional[HttpRequest], + username: Optional[str] = ..., + password: Optional[str] = ..., + **kwargs + ) -> Optional[User]: ... + def get_all_permissions(self, user_obj: User, obj: Optional[str] = ...) -> Set[str]: ... + def get_group_permissions(self, user_obj: User, obj: None = ...) -> Set[str]: ... + def get_user(self, user_id: int) -> User: ... + def get_user_permissions(self, user_obj: User, obj: None = ...) -> Set[str]: ... + def has_module_perms( + self, + user_obj: Union[AnonymousUser, User], + app_label: str + ) -> bool: ... + def has_perm( + self, + user_obj: Union[AnonymousUser, User], + perm: str, + obj: None = ... + ) -> bool: ... + def user_can_authenticate(self, user: Optional[AbstractBaseUser]) -> bool: ... + + +class RemoteUserBackend: + def authenticate( + self, + request: WSGIRequest, + remote_user: Optional[str] + ) -> Optional[User]: ... + def clean_username(self, username: str) -> str: ... + def configure_user(self, user: User) -> User: ... \ No newline at end of file diff --git a/django/contrib/auth/base_user.pyi b/django/contrib/auth/base_user.pyi new file mode 100644 index 0000000..ad5eb39 --- /dev/null +++ b/django/contrib/auth/base_user.pyi @@ -0,0 +1,27 @@ +from typing import Optional + + +class AbstractBaseUser: + def __str__(self) -> str: ... + def check_password(self, raw_password: str) -> bool: ... + def clean(self) -> None: ... + @classmethod + def get_email_field_name(cls) -> str: ... + def get_session_auth_hash(self) -> str: ... + def get_username(self) -> str: ... + def has_usable_password(self) -> bool: ... + @property + def is_anonymous(self) -> bool: ... + @property + def is_authenticated(self) -> bool: ... + @classmethod + def normalize_username(cls, username: str) -> str: ... + def save(self, *args, **kwargs) -> None: ... + def set_password(self, raw_password: Optional[str]) -> None: ... + def set_unusable_password(self) -> None: ... + + +class BaseUserManager: + def get_by_natural_key(self, username: Optional[str]) -> AbstractBaseUser: ... + @classmethod + def normalize_email(cls, email: Optional[str]) -> str: ... \ No newline at end of file diff --git a/django/contrib/auth/checks.pyi b/django/contrib/auth/checks.pyi new file mode 100644 index 0000000..296c654 --- /dev/null +++ b/django/contrib/auth/checks.pyi @@ -0,0 +1,10 @@ +from typing import ( + Any, + List, +) + + +def check_models_permissions(app_configs: None = ..., **kwargs) -> List[Any]: ... + + +def check_user_model(app_configs: None = ..., **kwargs) -> List[Any]: ... \ No newline at end of file diff --git a/django/contrib/auth/context_processors.pyi b/django/contrib/auth/context_processors.pyi new file mode 100644 index 0000000..5885600 --- /dev/null +++ b/django/contrib/auth/context_processors.pyi @@ -0,0 +1,31 @@ +from auth_tests.test_context_processors import MockUser +from django.contrib.auth.models import ( + AnonymousUser, + User, +) +from django.http.request import HttpRequest +from typing import ( + Dict, + Union, +) + + +def auth( + request: HttpRequest +) -> Dict[str, Union[AnonymousUser, PermWrapper, User]]: ... + + +class PermLookupDict: + def __bool__(self) -> bool: ... + def __getitem__(self, perm_name: str) -> bool: ... + def __init__(self, user: MockUser, app_label: str) -> None: ... + + +class PermWrapper: + def __contains__(self, perm_name: str) -> bool: ... + def __getitem__(self, app_label: str) -> PermLookupDict: ... + def __init__( + self, + user: Union[MockUser, AnonymousUser, User] + ) -> None: ... + def __iter__(self): ... \ No newline at end of file diff --git a/django/contrib/auth/decorators.pyi b/django/contrib/auth/decorators.pyi new file mode 100644 index 0000000..c752910 --- /dev/null +++ b/django/contrib/auth/decorators.pyi @@ -0,0 +1,27 @@ +from typing import ( + Callable, + List, + Optional, + Union, +) + + +def login_required( + function: Optional[Callable] = ..., + redirect_field_name: str = ..., + login_url: None = ... +) -> Callable: ... + + +def permission_required( + perm: Union[str, List[str]], + login_url: None = ..., + raise_exception: bool = ... +) -> Callable: ... + + +def user_passes_test( + test_func: Callable, + login_url: Optional[str] = ..., + redirect_field_name: str = ... +) -> Callable: ... \ No newline at end of file diff --git a/django/contrib/auth/forms.pyi b/django/contrib/auth/forms.pyi new file mode 100644 index 0000000..4d3986c --- /dev/null +++ b/django/contrib/auth/forms.pyi @@ -0,0 +1,93 @@ +from django.contrib.auth.models import User +from django.contrib.auth.tokens import PasswordResetTokenGenerator +from django.core.exceptions import ValidationError +from django.core.handlers.wsgi import WSGIRequest +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Union, +) + + +class AdminPasswordChangeForm: + def __init__(self, user: User, *args, **kwargs) -> None: ... + @property + def changed_data(self) -> List[str]: ... + def clean_password2(self) -> str: ... + def save(self, commit: bool = ...) -> User: ... + + +class AuthenticationForm: + def __init__(self, request: object = ..., *args, **kwargs) -> None: ... + def clean(self) -> Dict[str, str]: ... + def confirm_login_allowed(self, user: User) -> None: ... + def get_invalid_login_error(self) -> ValidationError: ... + def get_user(self) -> User: ... + + +class PasswordChangeForm: + def clean_old_password(self) -> str: ... + + +class PasswordResetForm: + def get_users(self, email: str) -> Iterator[Any]: ... + def save( + self, + domain_override: None = ..., + subject_template_name: str = ..., + email_template_name: str = ..., + use_https: bool = ..., + token_generator: PasswordResetTokenGenerator = ..., + from_email: None = ..., + request: Optional[WSGIRequest] = ..., + html_email_template_name: None = ..., + extra_email_context: Optional[Dict[str, str]] = ... + ) -> None: ... + def send_mail( + self, + subject_template_name: str, + email_template_name: str, + context: Dict[str, Union[str, User]], + from_email: Optional[str], + to_email: str, + html_email_template_name: None = ... + ) -> None: ... + + +class ReadOnlyPasswordHashField: + def __init__(self, *args, **kwargs) -> None: ... + def has_changed(self, initial: str, data: None) -> bool: ... + + +class ReadOnlyPasswordHashWidget: + def get_context( + self, + name: str, + value: str, + attrs: Dict[str, str] + ) -> Dict[str, Union[Dict[str, Union[str, bool, Dict[str, str]]], List[Dict[str, str]]]]: ... + + +class SetPasswordForm: + def __init__(self, user: Optional[User], *args, **kwargs) -> None: ... + def clean_new_password2(self) -> str: ... + def save(self, commit: bool = ...) -> User: ... + + +class UserChangeForm: + def __init__(self, *args, **kwargs) -> None: ... + def clean_password(self) -> str: ... + + +class UserCreationForm: + def __init__(self, *args, **kwargs) -> None: ... + def _post_clean(self) -> None: ... + def clean_password2(self) -> str: ... + def save(self, commit: bool = ...) -> User: ... + + +class UsernameField: + def to_python(self, value: Optional[str]) -> str: ... \ No newline at end of file diff --git a/django/contrib/auth/handlers/modwsgi.pyi b/django/contrib/auth/handlers/modwsgi.pyi new file mode 100644 index 0000000..1a90369 --- /dev/null +++ b/django/contrib/auth/handlers/modwsgi.pyi @@ -0,0 +1,10 @@ +from typing import ( + Any, + Dict, +) + + +def check_password(environ: Dict[Any, Any], username: str, password: str): ... + + +def groups_for_user(environ: Dict[Any, Any], username: str): ... \ No newline at end of file diff --git a/django/contrib/auth/hashers.pyi b/django/contrib/auth/hashers.pyi new file mode 100644 index 0000000..9e319e5 --- /dev/null +++ b/django/contrib/auth/hashers.pyi @@ -0,0 +1,76 @@ +from collections import OrderedDict +from typing import ( + Callable, + Dict, + List, + Optional, + Union, +) + + +def check_password( + password: str, + encoded: str, + setter: Optional[Callable] = ..., + preferred: str = ... +) -> bool: ... + + +def get_hasher(algorithm: str = ...) -> BasePasswordHasher: ... + + +def get_hashers( +) -> Union[List[MD5PasswordHasher], List[BasePasswordHasher], List[PBKDF2PasswordHasher], List[UnsaltedMD5PasswordHasher]]: ... + + +def get_hashers_by_algorithm() -> Dict[str, BasePasswordHasher]: ... + + +def identify_hasher(encoded: str) -> BasePasswordHasher: ... + + +def is_password_usable(encoded: Optional[str]) -> bool: ... + + +def make_password(password: Optional[str], salt: Optional[str] = ..., hasher: str = ...) -> str: ... + + +def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ... + + +def reset_hashers(**kwargs) -> None: ... + + +class BasePasswordHasher: + def harden_runtime(self, password: str, encoded: str) -> None: ... + def must_update(self, encoded: str) -> bool: ... + def safe_summary(self, encoded: str): ... + def salt(self) -> str: ... + + +class MD5PasswordHasher: + def encode(self, password: str, salt: str) -> str: ... + def safe_summary(self, encoded: str) -> OrderedDict: ... + def verify(self, password: str, encoded: str) -> bool: ... + + +class PBKDF2PasswordHasher: + def encode(self, password: str, salt: str, iterations: Optional[int] = ...) -> str: ... + def must_update(self, encoded: str) -> bool: ... + def verify(self, password: str, encoded: str) -> bool: ... + + +class SHA1PasswordHasher: + def encode(self, password: str, salt: str) -> str: ... + def verify(self, password: str, encoded: str) -> bool: ... + + +class UnsaltedMD5PasswordHasher: + def encode(self, password: str, salt: str) -> str: ... + def verify(self, password: str, encoded: str) -> bool: ... + + +class UnsaltedSHA1PasswordHasher: + def encode(self, password: str, salt: str) -> str: ... + def salt(self) -> str: ... + def verify(self, password: str, encoded: str) -> bool: ... \ No newline at end of file diff --git a/django/contrib/auth/management/__init__.pyi b/django/contrib/auth/management/__init__.pyi new file mode 100644 index 0000000..bfd892d --- /dev/null +++ b/django/contrib/auth/management/__init__.pyi @@ -0,0 +1,29 @@ +from django.apps.config import AppConfig +from django.apps.registry import Apps +from django.db.models.options import Options +from typing import ( + List, + Tuple, +) + + +def _get_all_permissions(opts: Options) -> List[Tuple[str, str]]: ... + + +def _get_builtin_permissions(opts: Options) -> List[Tuple[str, str]]: ... + + +def create_permissions( + app_config: AppConfig, + verbosity: int = ..., + interactive: bool = ..., + using: str = ..., + apps: Apps = ..., + **kwargs +) -> None: ... + + +def get_default_username(check_db: bool = ...) -> str: ... + + +def get_system_username() -> str: ... \ No newline at end of file diff --git a/django/contrib/auth/management/commands/changepassword.pyi b/django/contrib/auth/management/commands/changepassword.pyi new file mode 100644 index 0000000..46022d2 --- /dev/null +++ b/django/contrib/auth/management/commands/changepassword.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, *args, **options) -> str: ... \ No newline at end of file diff --git a/django/contrib/auth/management/commands/createsuperuser.pyi b/django/contrib/auth/management/commands/createsuperuser.pyi new file mode 100644 index 0000000..082399b --- /dev/null +++ b/django/contrib/auth/management/commands/createsuperuser.pyi @@ -0,0 +1,20 @@ +from django.core.management.base import CommandParser +from django.db.models.fields import CharField +from django.db.models.fields.related import ForeignKey +from typing import ( + Optional, + Union, +) + + +class Command: + def __init__(self, *args, **kwargs) -> None: ... + def add_arguments(self, parser: CommandParser) -> None: ... + def execute(self, *args, **options) -> None: ... + def get_input_data( + self, + field: Union[CharField, related.ForeignKey], + message: str, + default: Optional[str] = ... + ) -> Optional[str]: ... + def handle(self, *args, **options) -> None: ... \ No newline at end of file diff --git a/django/contrib/auth/middleware.pyi b/django/contrib/auth/middleware.pyi new file mode 100644 index 0000000..0333931 --- /dev/null +++ b/django/contrib/auth/middleware.pyi @@ -0,0 +1,22 @@ +from django.contrib.auth.models import ( + AnonymousUser, + User, +) +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from typing import Union + + +def get_user( + request: HttpRequest +) -> Union[AnonymousUser, User]: ... + + +class AuthenticationMiddleware: + def process_request(self, request: HttpRequest) -> None: ... + + +class RemoteUserMiddleware: + def _remove_invalid_user(self, request: WSGIRequest) -> None: ... + def clean_username(self, username: str, request: WSGIRequest) -> str: ... + def process_request(self, request: WSGIRequest) -> None: ... \ No newline at end of file diff --git a/django/contrib/auth/mixins.pyi b/django/contrib/auth/mixins.pyi new file mode 100644 index 0000000..c8943da --- /dev/null +++ b/django/contrib/auth/mixins.pyi @@ -0,0 +1,30 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import HttpResponse +from typing import ( + Callable, + List, +) + + +class AccessMixin: + def get_permission_denied_message(self) -> str: ... + def get_redirect_field_name(self) -> str: ... + def handle_no_permission(self): ... + + +class LoginRequiredMixin: + def dispatch(self, request: WSGIRequest, *args, **kwargs): ... + + +class PermissionRequiredMixin: + def dispatch( + self, + request: WSGIRequest, + *args, + **kwargs + ) -> HttpResponse: ... + def get_permission_required(self) -> List[str]: ... + + +class UserPassesTestMixin: + def get_test_func(self) -> Callable: ... \ No newline at end of file diff --git a/django/contrib/auth/models.pyi b/django/contrib/auth/models.pyi new file mode 100644 index 0000000..233f2ad --- /dev/null +++ b/django/contrib/auth/models.pyi @@ -0,0 +1,98 @@ +from typing import ( + List, + Optional, + Set, + Tuple, + Type, + Union, +) + + +def _user_get_all_permissions(user: User, obj: Optional[str]) -> Set[str]: ... + + +def _user_has_module_perms( + user: Union[AnonymousUser, User], + app_label: str +) -> bool: ... + + +def _user_has_perm( + user: Union[AnonymousUser, User], + perm: str, + obj: Optional[str] +) -> bool: ... + + +def update_last_login( + sender: Type[User], + user: User, + **kwargs +) -> None: ... + + +class AbstractUser: + def clean(self) -> None: ... + def get_short_name(self) -> str: ... + + +class AnonymousUser: + def __str__(self) -> str: ... + def delete(self): ... + def get_username(self) -> str: ... + def has_module_perms(self, module: str) -> bool: ... + def has_perm(self, perm: str, obj: None = ...) -> bool: ... + def has_perms(self, perm_list: Union[Tuple[str], List[str]], obj: None = ...) -> bool: ... + @property + def is_anonymous(self) -> bool: ... + @property + def is_authenticated(self) -> bool: ... + def set_password(self, raw_password: str): ... + + +class Group: + def __str__(self) -> str: ... + + +class GroupManager: + def get_by_natural_key(self, name: str) -> Group: ... + + +class Permission: + def __str__(self) -> str: ... + def natural_key(self) -> Tuple[str, str, str]: ... + + +class PermissionManager: + def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ... + + +class PermissionsMixin: + def get_all_permissions(self, obj: None = ...) -> Set[str]: ... + def has_module_perms(self, app_label: str) -> bool: ... + def has_perm(self, perm: str, obj: None = ...) -> bool: ... + def has_perms(self, perm_list: Union[Tuple[str], List[str]], obj: None = ...) -> bool: ... + + +class UserManager: + def _create_user( + self, + username: str, + email: Optional[str], + password: Optional[str], + **extra_fields + ) -> User: ... + def create_superuser( + self, + username: str, + email: str, + password: Optional[str], + **extra_fields + ) -> User: ... + def create_user( + self, + username: str, + email: Optional[str] = ..., + password: Optional[str] = ..., + **extra_fields + ) -> User: ... \ No newline at end of file diff --git a/django/contrib/auth/password_validation.pyi b/django/contrib/auth/password_validation.pyi new file mode 100644 index 0000000..f451e70 --- /dev/null +++ b/django/contrib/auth/password_validation.pyi @@ -0,0 +1,60 @@ +from django.contrib.auth.base_user import AbstractBaseUser +from django.contrib.auth.models import User +from pathlib import PosixPath +from typing import ( + Dict, + List, + Optional, + Tuple, + Union, +) + + +def _password_validators_help_text_html(password_validators: None = ...) -> str: ... + + +def get_default_password_validators( +) -> Union[List[UserAttributeSimilarityValidator], List[NumericPasswordValidator]]: ... + + +def get_password_validators( + validator_config: List[Dict[str, str]] +) -> Union[List[UserAttributeSimilarityValidator], List[NumericPasswordValidator]]: ... + + +def password_changed( + password: str, + user: AbstractBaseUser = ..., + password_validators: None = ... +) -> None: ... + + +def password_validators_help_texts(password_validators: None = ...) -> List[str]: ... + + +def validate_password( + password: str, + user: Optional[User] = ..., + password_validators: None = ... +) -> None: ... + + +class CommonPasswordValidator: + def __init__(self, password_list_path: PosixPath = ...) -> None: ... + def validate(self, password: str, user: None = ...) -> None: ... + + +class MinimumLengthValidator: + def __init__(self, min_length: int = ...) -> None: ... + def get_help_text(self) -> str: ... + def validate(self, password: str, user: None = ...) -> None: ... + + +class NumericPasswordValidator: + def validate(self, password: str, user: User = ...) -> None: ... + + +class UserAttributeSimilarityValidator: + def __init__(self, user_attributes: Tuple[str, str, str, str] = ..., max_similarity: float = ...) -> None: ... + def get_help_text(self) -> str: ... + def validate(self, password: str, user: None = ...) -> None: ... \ No newline at end of file diff --git a/django/contrib/auth/tokens.pyi b/django/contrib/auth/tokens.pyi new file mode 100644 index 0000000..44ceb27 --- /dev/null +++ b/django/contrib/auth/tokens.pyi @@ -0,0 +1,12 @@ +from datetime import date +from django.contrib.auth.models import User +from typing import Optional + + +class PasswordResetTokenGenerator: + def _make_hash_value(self, user: User, timestamp: int) -> str: ... + def _make_token_with_timestamp(self, user: User, timestamp: int) -> str: ... + def _num_days(self, dt: date) -> int: ... + def _today(self) -> date: ... + def check_token(self, user: User, token: Optional[str]) -> bool: ... + def make_token(self, user: User) -> str: ... \ No newline at end of file diff --git a/django/contrib/auth/views.pyi b/django/contrib/auth/views.pyi new file mode 100644 index 0000000..0d5c4c3 --- /dev/null +++ b/django/contrib/auth/views.pyi @@ -0,0 +1,107 @@ +from django.contrib.auth.forms import ( + AuthenticationForm, + PasswordChangeForm, + PasswordResetForm, + SetPasswordForm, +) +from django.contrib.auth.models import User +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from django.http.response import HttpResponseRedirect +from django.template.response import TemplateResponse +from django.utils.datastructures import MultiValueDict +from typing import ( + Any, + Dict, + Optional, + Set, + Union, +) + + +def redirect_to_login( + next: str, + login_url: Optional[str] = ..., + redirect_field_name: Optional[str] = ... +) -> HttpResponseRedirect: ... + + +class LoginView: + def dispatch( + self, + request: HttpRequest, + *args, + **kwargs + ) -> Union[HttpResponseRedirect, TemplateResponse]: ... + def form_valid( + self, + form: AuthenticationForm + ) -> HttpResponseRedirect: ... + def get_context_data(self, **kwargs) -> Dict[str, Any]: ... + def get_form_class(self) -> Any: ... + def get_form_kwargs( + self + ) -> Dict[str, Union[None, MultiValueDict, WSGIRequest]]: ... + def get_redirect_url(self) -> str: ... + def get_success_url(self) -> str: ... + + +class LogoutView: + def dispatch( + self, + request: HttpRequest, + *args, + **kwargs + ) -> Union[HttpResponseRedirect, TemplateResponse]: ... + def get_next_page(self) -> Optional[str]: ... + def post( + self, + request: WSGIRequest, + *args, + **kwargs + ) -> TemplateResponse: ... + + +class PasswordChangeDoneView: + def dispatch(self, *args, **kwargs) -> TemplateResponse: ... + + +class PasswordChangeView: + def dispatch( + self, + *args, + **kwargs + ) -> Union[HttpResponseRedirect, TemplateResponse]: ... + def form_valid( + self, + form: PasswordChangeForm + ) -> HttpResponseRedirect: ... + def get_form_kwargs( + self + ) -> Dict[str, Union[None, User, MultiValueDict]]: ... + + +class PasswordResetConfirmView: + def dispatch( + self, + *args, + **kwargs + ) -> Union[HttpResponseRedirect, TemplateResponse]: ... + def form_valid(self, form: SetPasswordForm) -> HttpResponseRedirect: ... + def get_form_kwargs( + self + ) -> Dict[str, Union[None, User, MultiValueDict]]: ... + def get_user(self, uidb64: str) -> Optional[User]: ... + + +class PasswordResetView: + def dispatch( + self, + *args, + **kwargs + ) -> Union[HttpResponseRedirect, TemplateResponse]: ... + def form_valid(self, form: PasswordResetForm) -> HttpResponseRedirect: ... + + +class SuccessURLAllowedHostsMixin: + def get_success_url_allowed_hosts(self) -> Set[str]: ... \ No newline at end of file diff --git a/django/contrib/contenttypes/admin.pyi b/django/contrib/contenttypes/admin.pyi new file mode 100644 index 0000000..be535d7 --- /dev/null +++ b/django/contrib/contenttypes/admin.pyi @@ -0,0 +1,19 @@ +from django.db.models.base import Model +from typing import ( + Any, + List, + Type, +) + + +class GenericInlineModelAdminChecks: + def _check_exclude_of_parent_model( + self, + obj: GenericTabularInline, + parent_model: Type[Model] + ) -> List[Any]: ... + def _check_relation( + self, + obj: GenericTabularInline, + parent_model: Type[Model] + ) -> List[Any]: ... \ No newline at end of file diff --git a/django/contrib/contenttypes/apps.pyi b/django/contrib/contenttypes/apps.pyi new file mode 100644 index 0000000..51d3703 --- /dev/null +++ b/django/contrib/contenttypes/apps.pyi @@ -0,0 +1,2 @@ +class ContentTypesConfig: + def ready(self) -> None: ... \ No newline at end of file diff --git a/django/contrib/contenttypes/checks.pyi b/django/contrib/contenttypes/checks.pyi new file mode 100644 index 0000000..8de09a8 --- /dev/null +++ b/django/contrib/contenttypes/checks.pyi @@ -0,0 +1,10 @@ +from typing import ( + Any, + List, +) + + +def check_generic_foreign_keys(app_configs: None = ..., **kwargs) -> List[Any]: ... + + +def check_model_name_lengths(app_configs: None = ..., **kwargs) -> List[Any]: ... \ No newline at end of file diff --git a/django/contrib/contenttypes/fields.pyi b/django/contrib/contenttypes/fields.pyi new file mode 100644 index 0000000..cf5b763 --- /dev/null +++ b/django/contrib/contenttypes/fields.pyi @@ -0,0 +1,103 @@ +from django.contrib.contenttypes.models import ContentType +from django.core.checks.messages import Error +from django.db.models.base import Model +from django.db.models.fields import ( + AutoField, + PositiveIntegerField, +) +from django.db.models.fields.related import OneToOneField +from django.db.models.query import QuerySet +from django.db.models.query_utils import ( + FilteredRelation, + PathInfo, +) +from django.db.models.sql.where import WhereNode +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +class GenericForeignKey: + def __get__(self, instance: Any, cls: Any = ...) -> Any: ... + def __init__(self, ct_field: str = ..., fk_field: str = ..., for_concrete_model: bool = ...) -> None: ... + def __set__(self, instance: Model, value: Any) -> None: ... + def __str__(self) -> str: ... + def _check_content_type_field(self) -> List[Error]: ... + def _check_field_name(self) -> List[Any]: ... + def _check_object_id_field(self) -> List[Any]: ... + def check(self, **kwargs) -> List[Error]: ... + def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ... + def get_cache_name(self) -> str: ... + def get_content_type( + self, + obj: Any = ..., + id: Optional[int] = ..., + using: Optional[str] = ... + ) -> ContentType: ... + def get_filter_kwargs_for_object( + self, + obj: Model + ) -> Dict[str, Union[None, ContentType, int]]: ... + def get_forward_related_filter(self, obj: Model) -> Dict[str, int]: ... + def get_prefetch_queryset( + self, + instances: Union[List[Model], QuerySet], + queryset: Optional[QuerySet] = ... + ) -> Tuple[List[Model], Callable, Callable, bool, str, bool]: ... + + +class GenericRel: + def __init__( + self, + field: GenericRelation, + to: Any, + related_name: None = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: None = ... + ) -> None: ... + + +class GenericRelation: + def __init__( + self, + to: Any, + object_id_field: str = ..., + content_type_field: str = ..., + for_concrete_model: bool = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: None = ..., + **kwargs + ) -> None: ... + def _check_generic_foreign_key_existence(self) -> List[Any]: ... + def _get_path_info_with_parent(self, filtered_relation: None) -> List[PathInfo]: ... + def _is_matching_generic_foreign_key( + self, + field: Optional[Union[GenericForeignKey, GenericRelation]] + ) -> bool: ... + def bulk_related_objects(self, objs: Any, using: str = ...) -> QuerySet: ... + def check(self, **kwargs) -> List[Error]: ... + def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ... + def get_content_type(self) -> ContentType: ... + def get_extra_restriction( + self, + where_class: Type[WhereNode], + alias: Optional[str], + remote_alias: str + ) -> WhereNode: ... + def get_internal_type(self) -> str: ... + def get_path_info( + self, + filtered_relation: Optional[FilteredRelation] = ... + ) -> List[PathInfo]: ... + def get_reverse_path_info(self, filtered_relation: None = ...) -> List[PathInfo]: ... + def resolve_related_fields( + self + ) -> Union[List[Tuple[PositiveIntegerField, AutoField]], List[Tuple[PositiveIntegerField, related.OneToOneField]]]: ... + def set_attributes_from_rel(self) -> None: ... \ No newline at end of file diff --git a/django/contrib/contenttypes/forms.pyi b/django/contrib/contenttypes/forms.pyi new file mode 100644 index 0000000..e69de29 diff --git a/django/contrib/contenttypes/management/__init__.pyi b/django/contrib/contenttypes/management/__init__.pyi new file mode 100644 index 0000000..bdeb0e6 --- /dev/null +++ b/django/contrib/contenttypes/management/__init__.pyi @@ -0,0 +1,55 @@ +from django.apps.config import AppConfig +from django.apps.registry import Apps +from django.contrib.contenttypes.models import ContentType +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.migrations.state import StateApps +from typing import ( + Any, + Type, +) + + +def create_contenttypes( + app_config: AppConfig, + verbosity: int = ..., + interactive: bool = ..., + using: str = ..., + apps: Apps = ..., + **kwargs +) -> None: ... + + +def get_contenttypes_and_models( + app_config: AppConfig, + using: str, + ContentType: Type[ContentType] +) -> Any: ... + + +def inject_rename_contenttypes_operations( + plan: Any = ..., + apps: StateApps = ..., + using: str = ..., + **kwargs +) -> None: ... + + +class RenameContentType: + def __init__(self, app_label: str, old_model: str, new_model: str) -> None: ... + def _rename( + self, + apps: StateApps, + schema_editor: DatabaseSchemaEditor, + old_model: str, + new_model: str + ) -> None: ... + def rename_backward( + self, + apps: StateApps, + schema_editor: DatabaseSchemaEditor + ) -> None: ... + def rename_forward( + self, + apps: StateApps, + schema_editor: DatabaseSchemaEditor + ) -> None: ... \ No newline at end of file diff --git a/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi b/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi new file mode 100644 index 0000000..8546f6e --- /dev/null +++ b/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi @@ -0,0 +1,10 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, **options) -> None: ... + + +class NoFastDeleteCollector: + def can_fast_delete(self, *args, **kwargs) -> bool: ... \ No newline at end of file diff --git a/django/contrib/contenttypes/models.pyi b/django/contrib/contenttypes/models.pyi new file mode 100644 index 0000000..04d9a02 --- /dev/null +++ b/django/contrib/contenttypes/models.pyi @@ -0,0 +1,39 @@ +from django.db.models.base import Model +from django.db.models.options import Options +from django.db.models.query import QuerySet +from typing import ( + Any, + Dict, + Tuple, + Type, +) + + +class ContentType: + def __str__(self) -> str: ... + def get_all_objects_for_this_type(self, **kwargs) -> QuerySet: ... + def get_object_for_this_type(self, **kwargs) -> Model: ... + def model_class(self) -> Any: ... + @property + def name(self) -> str: ... + def natural_key(self) -> Tuple[str, str]: ... + + +class ContentTypeManager: + def __init__(self, *args, **kwargs) -> None: ... + def _add_to_cache(self, using: str, ct: ContentType) -> None: ... + def _get_from_cache(self, opts: Options) -> ContentType: ... + def _get_opts(self, model: Any, for_concrete_model: bool) -> Options: ... + def clear_cache(self) -> None: ... + def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ... + def get_for_id(self, id: int) -> ContentType: ... + def get_for_model( + self, + model: Any, + for_concrete_model: bool = ... + ) -> ContentType: ... + def get_for_models( + self, + *models, + for_concrete_models = ... + ) -> Dict[Type[Model], ContentType]: ... \ No newline at end of file diff --git a/django/contrib/contenttypes/views.pyi b/django/contrib/contenttypes/views.pyi new file mode 100644 index 0000000..e907553 --- /dev/null +++ b/django/contrib/contenttypes/views.pyi @@ -0,0 +1,10 @@ +from django.http.request import HttpRequest +from django.http.response import HttpResponseRedirect +from typing import Union + + +def shortcut( + request: HttpRequest, + content_type_id: Union[str, int], + object_id: Union[str, int] +) -> HttpResponseRedirect: ... \ No newline at end of file diff --git a/django/contrib/flatpages/forms.pyi b/django/contrib/flatpages/forms.pyi new file mode 100644 index 0000000..e69de29 diff --git a/django/contrib/flatpages/middleware.pyi b/django/contrib/flatpages/middleware.pyi new file mode 100644 index 0000000..e69de29 diff --git a/django/contrib/flatpages/models.pyi b/django/contrib/flatpages/models.pyi new file mode 100644 index 0000000..e69de29 diff --git a/django/contrib/flatpages/sitemaps.pyi b/django/contrib/flatpages/sitemaps.pyi new file mode 100644 index 0000000..61e7451 --- /dev/null +++ b/django/contrib/flatpages/sitemaps.pyi @@ -0,0 +1,5 @@ +from django.db.models.query import QuerySet + + +class FlatPageSitemap: + def items(self) -> QuerySet: ... \ No newline at end of file diff --git a/django/contrib/flatpages/templatetags/flatpages.pyi b/django/contrib/flatpages/templatetags/flatpages.pyi new file mode 100644 index 0000000..e69de29 diff --git a/django/contrib/flatpages/views.pyi b/django/contrib/flatpages/views.pyi new file mode 100644 index 0000000..e69de29 diff --git a/django/contrib/humanize/templatetags/humanize.pyi b/django/contrib/humanize/templatetags/humanize.pyi new file mode 100644 index 0000000..438cbc7 --- /dev/null +++ b/django/contrib/humanize/templatetags/humanize.pyi @@ -0,0 +1,26 @@ +from datetime import ( + date, + datetime, +) +from typing import ( + Optional, + Union, +) + + +def apnumber(value: str) -> str: ... + + +def intcomma(value: Optional[Union[str, float, int]], use_l10n: bool = ...) -> str: ... + + +def intword(value: Optional[str]) -> Optional[str]: ... + + +def naturalday(value: Optional[date], arg: None = ...) -> Optional[str]: ... + + +def naturaltime(value: datetime) -> str: ... + + +def ordinal(value: Optional[str]) -> Optional[str]: ... \ No newline at end of file diff --git a/django/contrib/messages/api.pyi b/django/contrib/messages/api.pyi new file mode 100644 index 0000000..47d6366 --- /dev/null +++ b/django/contrib/messages/api.pyi @@ -0,0 +1,65 @@ +from django.contrib.messages.storage.base import BaseStorage +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from typing import ( + Optional, + Union, +) + + +def add_message( + request: Optional[WSGIRequest], + level: int, + message: str, + extra_tags: str = ..., + fail_silently: Union[str, bool] = ... +) -> None: ... + + +def debug( + request: WSGIRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[str, bool] = ... +) -> None: ... + + +def error( + request: WSGIRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[str, bool] = ... +) -> None: ... + + +def get_level(request: HttpRequest) -> int: ... + + +def get_messages(request: HttpRequest) -> BaseStorage: ... + + +def info( + request: WSGIRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[str, bool] = ... +) -> None: ... + + +def set_level(request: HttpRequest, level: int) -> bool: ... + + +def success( + request: WSGIRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[str, bool] = ... +) -> None: ... + + +def warning( + request: WSGIRequest, + message: str, + extra_tags: str = ..., + fail_silently: Union[str, bool] = ... +) -> None: ... \ No newline at end of file diff --git a/django/contrib/messages/context_processors.pyi b/django/contrib/messages/context_processors.pyi new file mode 100644 index 0000000..607e173 --- /dev/null +++ b/django/contrib/messages/context_processors.pyi @@ -0,0 +1,11 @@ +from django.contrib.messages.storage.base import BaseStorage +from django.http.request import HttpRequest +from typing import ( + Dict, + Union, +) + + +def messages( + request: HttpRequest +) -> Dict[str, Union[Dict[str, int], BaseStorage]]: ... \ No newline at end of file diff --git a/django/contrib/messages/middleware.pyi b/django/contrib/messages/middleware.pyi new file mode 100644 index 0000000..19304c0 --- /dev/null +++ b/django/contrib/messages/middleware.pyi @@ -0,0 +1,12 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase + + +class MessageMiddleware: + def process_request(self, request: WSGIRequest) -> None: ... + def process_response( + self, + request: HttpRequest, + response: HttpResponseBase + ) -> HttpResponseBase: ... \ No newline at end of file diff --git a/django/contrib/messages/storage/__init__.pyi b/django/contrib/messages/storage/__init__.pyi new file mode 100644 index 0000000..14369fc --- /dev/null +++ b/django/contrib/messages/storage/__init__.pyi @@ -0,0 +1,5 @@ +from django.contrib.messages.storage.base import BaseStorage +from django.http.request import HttpRequest + + +def default_storage(request: HttpRequest) -> BaseStorage: ... \ No newline at end of file diff --git a/django/contrib/messages/storage/base.pyi b/django/contrib/messages/storage/base.pyi new file mode 100644 index 0000000..177645e --- /dev/null +++ b/django/contrib/messages/storage/base.pyi @@ -0,0 +1,30 @@ +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase +from typing import ( + List, + Optional, + Union, +) + + +class BaseStorage: + def __init__(self, request: HttpRequest, *args, **kwargs) -> None: ... + def __len__(self) -> int: ... + def _get_level(self) -> int: ... + @property + def _loaded_messages(self) -> Union[List[str], List[Message]]: ... + def _prepare_messages(self, messages: List[Message]) -> None: ... + def _set_level(self, value: int = ...) -> None: ... + def add(self, level: int, message: str, extra_tags: Optional[str] = ...) -> None: ... + def update(self, response: HttpResponseBase) -> None: ... + + +class Message: + def __eq__(self, other: Union[str, Message]) -> bool: ... + def __init__(self, level: int, message: str, extra_tags: Optional[str] = ...) -> None: ... + def __str__(self) -> str: ... + def _prepare(self) -> None: ... + @property + def level_tag(self) -> str: ... + @property + def tags(self) -> str: ... \ No newline at end of file diff --git a/django/contrib/messages/storage/cookie.pyi b/django/contrib/messages/storage/cookie.pyi new file mode 100644 index 0000000..7dc2e74 --- /dev/null +++ b/django/contrib/messages/storage/cookie.pyi @@ -0,0 +1,46 @@ +from django.contrib.messages.storage.base import Message +from django.http.response import HttpResponse +from typing import ( + Any, + List, + Optional, + Tuple, + Union, +) + + +class CookieStorage: + def _decode(self, data: Optional[str]) -> Any: ... + def _encode( + self, + messages: Union[List[str], List[Message]], + encode_empty: bool = ... + ) -> Optional[str]: ... + def _get( + self, + *args, + **kwargs + ) -> Union[Tuple[None, bool], Tuple[List[str], bool], Tuple[List[Any], bool], Tuple[List[Message], bool]]: ... + def _hash(self, value: str) -> str: ... + def _store( + self, + messages: List[Message], + response: HttpResponse, + remove_oldest: bool = ..., + *args, + **kwargs + ) -> List[Message]: ... + def _update_cookie(self, encoded_data: Optional[str], response: HttpResponse) -> None: ... + + +class MessageDecoder: + def decode( + self, + s: str, + **kwargs + ) -> Union[List[Message], List[Union[Message, str]], List[str]]: ... + def process_messages(self, obj: Any) -> Any: ... + + +class MessageEncoder: + def default(self, obj: Message) -> List[Union[int, str]]: ... \ No newline at end of file diff --git a/django/contrib/messages/storage/fallback.pyi b/django/contrib/messages/storage/fallback.pyi new file mode 100644 index 0000000..4b15b83 --- /dev/null +++ b/django/contrib/messages/storage/fallback.pyi @@ -0,0 +1,24 @@ +from django.contrib.messages.storage.base import Message +from django.http.response import HttpResponse +from typing import ( + Any, + List, + Tuple, + Union, +) + + +class FallbackStorage: + def __init__(self, *args, **kwargs) -> None: ... + def _get( + self, + *args, + **kwargs + ) -> Union[Tuple[List[str], bool], Tuple[List[Any], bool], Tuple[List[Message], bool]]: ... + def _store( + self, + messages: List[Message], + response: HttpResponse, + *args, + **kwargs + ) -> List[Any]: ... \ No newline at end of file diff --git a/django/contrib/messages/storage/session.pyi b/django/contrib/messages/storage/session.pyi new file mode 100644 index 0000000..36419be --- /dev/null +++ b/django/contrib/messages/storage/session.pyi @@ -0,0 +1,31 @@ +from django.contrib.messages.storage.base import Message +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from typing import ( + Any, + List, + Optional, + Tuple, + Union, +) + + +class SessionStorage: + def __init__(self, request: HttpRequest, *args, **kwargs) -> None: ... + def _get( + self, + *args, + **kwargs + ) -> Union[Tuple[None, bool], Tuple[List[str], bool], Tuple[List[Message], bool]]: ... + def _store( + self, + messages: List[Message], + response: HttpResponse, + *args, + **kwargs + ) -> List[Any]: ... + def deserialize_messages( + self, + data: Optional[str] + ) -> Optional[Union[List[str], List[Message]]]: ... + def serialize_messages(self, messages: Union[List[Message], List[str]]) -> str: ... \ No newline at end of file diff --git a/django/contrib/messages/utils.pyi b/django/contrib/messages/utils.pyi new file mode 100644 index 0000000..30c0595 --- /dev/null +++ b/django/contrib/messages/utils.pyi @@ -0,0 +1,4 @@ +from typing import Dict + + +def get_level_tags() -> Dict[int, str]: ... \ No newline at end of file diff --git a/django/contrib/redirects/middleware.pyi b/django/contrib/redirects/middleware.pyi new file mode 100644 index 0000000..e69de29 diff --git a/django/contrib/sessions/backends/base.pyi b/django/contrib/sessions/backends/base.pyi new file mode 100644 index 0000000..93e1ce4 --- /dev/null +++ b/django/contrib/sessions/backends/base.pyi @@ -0,0 +1,43 @@ +from datetime import ( + datetime, + timedelta, +) +from django.db.models.base import Model +from typing import ( + Dict, + Optional, + Union, +) + + +class SessionBase: + def __contains__(self, key: str) -> bool: ... + def __delitem__(self, key: str) -> None: ... + def __getitem__(self, key: str) -> Union[str, Model, int]: ... + def __init__(self, session_key: Optional[str] = ...) -> None: ... + def __setitem__(self, key: str, value: Union[str, datetime, int]) -> None: ... + def _get_new_session_key(self) -> str: ... + def _get_or_create_session_key(self) -> str: ... + def _get_session( + self, + no_load: bool = ... + ) -> Dict[str, Union[Model, int, str, datetime]]: ... + def _get_session_key(self) -> Optional[str]: ... + def _hash(self, value: bytes) -> str: ... + def _set_session_key(self, value: Optional[str]) -> None: ... + def _validate_session_key(self, key: Optional[str]) -> Optional[Union[str, bool]]: ... + def clear(self) -> None: ... + def cycle_key(self) -> None: ... + def decode(self, session_data: Union[str, bytes]) -> Dict[str, Union[str, int]]: ... + def encode(self, session_dict: Dict[str, Union[int, str, datetime]]) -> str: ... + def flush(self) -> None: ... + def get(self, key: str, default: Optional[str] = ...) -> Optional[Union[str, datetime, int]]: ... + def get_expire_at_browser_close(self) -> bool: ... + def get_expiry_age(self, **kwargs) -> int: ... + def get_expiry_date(self, **kwargs) -> datetime: ... + def is_empty(self) -> bool: ... + def pop(self, key: str, default: object = ...) -> Union[str, int]: ... + def set_expiry(self, value: Optional[Union[int, datetime, timedelta]]) -> None: ... + def setdefault(self, key: str, value: str) -> str: ... + def test_cookie_worked(self) -> bool: ... + def update(self, dict_: Dict[str, int]) -> None: ... \ No newline at end of file diff --git a/django/contrib/sessions/backends/cache.pyi b/django/contrib/sessions/backends/cache.pyi new file mode 100644 index 0000000..3f937d2 --- /dev/null +++ b/django/contrib/sessions/backends/cache.pyi @@ -0,0 +1,16 @@ +from typing import ( + Any, + Dict, + Optional, +) + + +class SessionStore: + def __init__(self, session_key: None = ...) -> None: ... + @property + def cache_key(self) -> str: ... + def create(self) -> None: ... + def delete(self, session_key: Optional[str] = ...) -> None: ... + def exists(self, session_key: Optional[str]) -> bool: ... + def load(self) -> Dict[Any, Any]: ... + def save(self, must_create: bool = ...) -> None: ... \ No newline at end of file diff --git a/django/contrib/sessions/backends/cached_db.pyi b/django/contrib/sessions/backends/cached_db.pyi new file mode 100644 index 0000000..0e2b08e --- /dev/null +++ b/django/contrib/sessions/backends/cached_db.pyi @@ -0,0 +1,16 @@ +from typing import ( + Any, + Dict, + Optional, +) + + +class SessionStore: + def __init__(self, session_key: Optional[str] = ...) -> None: ... + @property + def cache_key(self) -> str: ... + def delete(self, session_key: Optional[str] = ...) -> None: ... + def exists(self, session_key: str) -> bool: ... + def flush(self) -> None: ... + def load(self) -> Dict[Any, Any]: ... + def save(self, must_create: bool = ...) -> None: ... \ No newline at end of file diff --git a/django/contrib/sessions/backends/db.pyi b/django/contrib/sessions/backends/db.pyi new file mode 100644 index 0000000..fb2c15f --- /dev/null +++ b/django/contrib/sessions/backends/db.pyi @@ -0,0 +1,29 @@ +from datetime import datetime +from django.contrib.sessions.base_session import AbstractBaseSession +from django.contrib.sessions.models import Session +from typing import ( + Dict, + Optional, + Type, + Union, +) + + +class SessionStore: + def __init__(self, session_key: Optional[str] = ...) -> None: ... + def _get_session_from_db(self) -> Optional[AbstractBaseSession]: ... + @classmethod + def clear_expired(cls) -> None: ... + def create(self) -> None: ... + def create_model_instance( + self, + data: Dict[str, Union[int, str, datetime]] + ) -> AbstractBaseSession: ... + def delete(self, session_key: Optional[str] = ...) -> None: ... + def exists(self, session_key: Optional[str]) -> bool: ... + @classmethod + def get_model_class(cls) -> Type[Session]: ... + def load(self) -> Dict[str, Union[str, int]]: ... + @cached_property + def model(self) -> Type[AbstractBaseSession]: ... + def save(self, must_create: bool = ...) -> None: ... \ No newline at end of file diff --git a/django/contrib/sessions/backends/file.pyi b/django/contrib/sessions/backends/file.pyi new file mode 100644 index 0000000..925761c --- /dev/null +++ b/django/contrib/sessions/backends/file.pyi @@ -0,0 +1,18 @@ +from typing import ( + Dict, + Optional, +) + + +class SessionStore: + def __init__(self, session_key: Optional[str] = ...) -> None: ... + @classmethod + def _get_storage_path(cls) -> str: ... + def _key_to_file(self, session_key: Optional[str] = ...) -> str: ... + @classmethod + def clear_expired(cls) -> None: ... + def create(self) -> None: ... + def delete(self, session_key: Optional[str] = ...) -> None: ... + def exists(self, session_key: Optional[str]) -> bool: ... + def load(self) -> Dict[str, str]: ... + def save(self, must_create: bool = ...) -> None: ... \ No newline at end of file diff --git a/django/contrib/sessions/backends/signed_cookies.pyi b/django/contrib/sessions/backends/signed_cookies.pyi new file mode 100644 index 0000000..827b6c4 --- /dev/null +++ b/django/contrib/sessions/backends/signed_cookies.pyi @@ -0,0 +1,14 @@ +from datetime import datetime +from typing import ( + Dict, + Optional, + Union, +) + + +class SessionStore: + def _get_session_key(self) -> str: ... + def delete(self, session_key: Optional[str] = ...) -> None: ... + def exists(self, session_key: str = ...) -> bool: ... + def load(self) -> Dict[str, Union[str, datetime]]: ... + def save(self, must_create: bool = ...) -> None: ... \ No newline at end of file diff --git a/django/contrib/sessions/base_session.pyi b/django/contrib/sessions/base_session.pyi new file mode 100644 index 0000000..59439f1 --- /dev/null +++ b/django/contrib/sessions/base_session.pyi @@ -0,0 +1,6 @@ +from typing import Dict + + +class AbstractBaseSession: + def __str__(self) -> str: ... + def get_decoded(self) -> Dict[str, int]: ... \ No newline at end of file diff --git a/django/contrib/sessions/management/commands/clearsessions.pyi b/django/contrib/sessions/management/commands/clearsessions.pyi new file mode 100644 index 0000000..5792b90 --- /dev/null +++ b/django/contrib/sessions/management/commands/clearsessions.pyi @@ -0,0 +1,2 @@ +class Command: + def handle(self, **options) -> None: ... \ No newline at end of file diff --git a/django/contrib/sessions/middleware.pyi b/django/contrib/sessions/middleware.pyi new file mode 100644 index 0000000..8df3396 --- /dev/null +++ b/django/contrib/sessions/middleware.pyi @@ -0,0 +1,16 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import HttpResponseBase +from typing import ( + Callable, + Optional, +) + + +class SessionMiddleware: + def __init__(self, get_response: Optional[Callable] = ...) -> None: ... + def process_request(self, request: WSGIRequest) -> None: ... + def process_response( + self, + request: WSGIRequest, + response: HttpResponseBase + ) -> HttpResponseBase: ... \ No newline at end of file diff --git a/django/contrib/sessions/models.pyi b/django/contrib/sessions/models.pyi new file mode 100644 index 0000000..aecf282 --- /dev/null +++ b/django/contrib/sessions/models.pyi @@ -0,0 +1,7 @@ +from django.contrib.sessions.backends.db import SessionStore +from typing import Type + + +class Session: + @classmethod + def get_session_store_class(cls) -> Type[SessionStore]: ... \ No newline at end of file diff --git a/django/contrib/sessions/serializers.pyi b/django/contrib/sessions/serializers.pyi new file mode 100644 index 0000000..b9f02e0 --- /dev/null +++ b/django/contrib/sessions/serializers.pyi @@ -0,0 +1,11 @@ +from datetime import datetime +from django.db.models.base import Model +from typing import ( + Dict, + Union, +) + + +class PickleSerializer: + def dumps(self, obj: Dict[str, Union[str, datetime]]) -> bytes: ... + def loads(self, data: bytes) -> Dict[str, Model]: ... \ No newline at end of file diff --git a/django/contrib/sitemaps/__init__.pyi b/django/contrib/sitemaps/__init__.pyi new file mode 100644 index 0000000..ad16e2a --- /dev/null +++ b/django/contrib/sitemaps/__init__.pyi @@ -0,0 +1,49 @@ +from datetime import datetime +from django.contrib.sites.models import Site +from django.contrib.sites.requests import RequestSite +from django.core.paginator import Paginator +from django.db.models.base import Model +from django.db.models.query import QuerySet +from typing import ( + Any, + Dict, + List, + Optional, + Union, +) + + +def _get_sitemap_full_url(sitemap_url: None): ... + + +def ping_google(sitemap_url: None = ..., ping_url: str = ...) -> None: ... + + +class GenericSitemap: + def __init__( + self, + info_dict: Dict[str, Union[QuerySet, datetime]], + priority: Optional[float] = ..., + changefreq: Optional[str] = ..., + protocol: Optional[str] = ... + ) -> None: ... + def lastmod(self, item: Model) -> None: ... + + +class Sitemap: + def _urls( + self, + page: Union[str, int], + protocol: str, + domain: str + ) -> Union[List[Dict[str, Union[Model, str, None]]], List[Dict[str, object]]]: ... + def get_urls( + self, + page: Union[str, int] = ..., + site: Optional[Union[RequestSite, Site]] = ..., + protocol: Optional[str] = ... + ) -> Union[List[Dict[str, Union[Model, str, datetime, None]]], List[Dict[str, object]]]: ... + def items(self) -> List[Any]: ... + def location(self, obj: Model) -> str: ... + @property + def paginator(self) -> Paginator: ... \ No newline at end of file diff --git a/django/contrib/sitemaps/management/commands/ping_google.pyi b/django/contrib/sitemaps/management/commands/ping_google.pyi new file mode 100644 index 0000000..2088942 --- /dev/null +++ b/django/contrib/sitemaps/management/commands/ping_google.pyi @@ -0,0 +1,2 @@ +class Command: + def handle(self, *args, **options) -> None: ... \ No newline at end of file diff --git a/django/contrib/sitemaps/views.pyi b/django/contrib/sitemaps/views.pyi new file mode 100644 index 0000000..3bc10b8 --- /dev/null +++ b/django/contrib/sitemaps/views.pyi @@ -0,0 +1,31 @@ +from django.contrib.sitemaps import Sitemap +from django.core.handlers.wsgi import WSGIRequest +from django.template.response import TemplateResponse +from typing import ( + Any, + Callable, + Dict, + Optional, + Type, +) + + +def index( + request: WSGIRequest, + sitemaps: Dict[str, Type[Sitemap]], + template_name: str = ..., + content_type: str = ..., + sitemap_url_name: str = ... +) -> TemplateResponse: ... + + +def sitemap( + request: WSGIRequest, + sitemaps: Dict[str, Any], + section: Optional[str] = ..., + template_name: str = ..., + content_type: str = ... +) -> TemplateResponse: ... + + +def x_robots_tag(func: Callable) -> Callable: ... \ No newline at end of file diff --git a/django/contrib/sites/apps.pyi b/django/contrib/sites/apps.pyi new file mode 100644 index 0000000..5900579 --- /dev/null +++ b/django/contrib/sites/apps.pyi @@ -0,0 +1,2 @@ +class SitesConfig: + def ready(self) -> None: ... \ No newline at end of file diff --git a/django/contrib/sites/management.pyi b/django/contrib/sites/management.pyi new file mode 100644 index 0000000..9683dda --- /dev/null +++ b/django/contrib/sites/management.pyi @@ -0,0 +1,12 @@ +from django.apps.registry import Apps +from django.contrib.sites.apps import SitesConfig + + +def create_default_site( + app_config: SitesConfig, + verbosity: int = ..., + interactive: bool = ..., + using: str = ..., + apps: Apps = ..., + **kwargs +) -> None: ... \ No newline at end of file diff --git a/django/contrib/sites/managers.pyi b/django/contrib/sites/managers.pyi new file mode 100644 index 0000000..82bee06 --- /dev/null +++ b/django/contrib/sites/managers.pyi @@ -0,0 +1,11 @@ +from django.core.checks.messages import Error +from django.db.models.query import QuerySet +from typing import List + + +class CurrentSiteManager: + def __init__(self, field_name: None = ...) -> None: ... + def _check_field_name(self) -> List[Error]: ... + def _get_field_name(self) -> str: ... + def check(self, **kwargs) -> List[Error]: ... + def get_queryset(self) -> QuerySet: ... \ No newline at end of file diff --git a/django/contrib/sites/middleware.pyi b/django/contrib/sites/middleware.pyi new file mode 100644 index 0000000..0d3d5c8 --- /dev/null +++ b/django/contrib/sites/middleware.pyi @@ -0,0 +1,5 @@ +from django.http.request import HttpRequest + + +class CurrentSiteMiddleware: + def process_request(self, request: HttpRequest) -> None: ... \ No newline at end of file diff --git a/django/contrib/sites/models.pyi b/django/contrib/sites/models.pyi new file mode 100644 index 0000000..3f756e9 --- /dev/null +++ b/django/contrib/sites/models.pyi @@ -0,0 +1,26 @@ +from django.http.request import HttpRequest +from typing import ( + Optional, + Type, +) + + +def _simple_domain_name_validator(value: str): ... + + +def clear_site_cache(sender: Type[Site], **kwargs) -> None: ... + + +class Site: + def __str__(self) -> str: ... + + +class SiteManager: + def _get_site_by_id(self, site_id: int) -> Site: ... + def _get_site_by_request(self, request: HttpRequest) -> Site: ... + def clear_cache(self) -> None: ... + def get_by_natural_key(self, domain: str) -> Site: ... + def get_current( + self, + request: Optional[HttpRequest] = ... + ) -> Site: ... \ No newline at end of file diff --git a/django/contrib/sites/requests.pyi b/django/contrib/sites/requests.pyi new file mode 100644 index 0000000..eb04efb --- /dev/null +++ b/django/contrib/sites/requests.pyi @@ -0,0 +1,6 @@ +from django.http.request import HttpRequest + + +class RequestSite: + def __init__(self, request: HttpRequest) -> None: ... + def __str__(self) -> str: ... \ No newline at end of file diff --git a/django/contrib/sites/shortcuts.pyi b/django/contrib/sites/shortcuts.pyi new file mode 100644 index 0000000..b031e8d --- /dev/null +++ b/django/contrib/sites/shortcuts.pyi @@ -0,0 +1,12 @@ +from django.contrib.sites.models import Site +from django.contrib.sites.requests import RequestSite +from django.http.request import HttpRequest +from typing import ( + Optional, + Union, +) + + +def get_current_site( + request: Optional[HttpRequest] +) -> Union[RequestSite, Site]: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/apps.pyi b/django/contrib/staticfiles/apps.pyi new file mode 100644 index 0000000..6efa63f --- /dev/null +++ b/django/contrib/staticfiles/apps.pyi @@ -0,0 +1,2 @@ +class StaticFilesConfig: + def ready(self) -> None: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/checks.pyi b/django/contrib/staticfiles/checks.pyi new file mode 100644 index 0000000..efb3f4b --- /dev/null +++ b/django/contrib/staticfiles/checks.pyi @@ -0,0 +1,7 @@ +from typing import ( + Any, + List, +) + + +def check_finders(app_configs: None = ..., **kwargs) -> List[Any]: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/finders.pyi b/django/contrib/staticfiles/finders.pyi new file mode 100644 index 0000000..87eace0 --- /dev/null +++ b/django/contrib/staticfiles/finders.pyi @@ -0,0 +1,55 @@ +from django.contrib.staticfiles.storage import StaticFilesStorage +from django.core.checks.messages import Error +from django.core.files.storage import ( + DefaultStorage, + FileSystemStorage, +) +from typing import ( + Iterator, + List, + Optional, + Tuple, + Union, +) + + +def find(path: str, all: bool = ...) -> Optional[str]: ... + + +def get_finder(import_path: str) -> BaseFinder: ... + + +def get_finders() -> Iterator[BaseFinder]: ... + + +class AppDirectoriesFinder: + def __init__(self, app_names: None = ..., *args, **kwargs) -> None: ... + def find(self, path: str, all: bool = ...) -> str: ... + def find_in_app(self, app: str, path: str) -> Optional[str]: ... + def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ... + + +class BaseFinder: + def check(self, **kwargs): ... + + +class BaseStorageFinder: + def __init__( + self, + storage: Optional[StaticFilesStorage] = ..., + *args, + **kwargs + ) -> None: ... + def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, DefaultStorage]]: ... + + +class DefaultStorageFinder: + def __init__(self, *args, **kwargs) -> None: ... + + +class FileSystemFinder: + def __init__(self, app_names: None = ..., *args, **kwargs) -> None: ... + def check(self, **kwargs) -> List[Error]: ... + def find(self, path: str, all: bool = ...) -> Union[str, List[str]]: ... + def find_location(self, root: str, path: str, prefix: str = ...) -> Optional[str]: ... + def list(self, ignore_patterns: List[str]) -> Iterator[Tuple[str, FileSystemStorage]]: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/handlers.pyi b/django/contrib/staticfiles/handlers.pyi new file mode 100644 index 0000000..a6bc81e --- /dev/null +++ b/django/contrib/staticfiles/handlers.pyi @@ -0,0 +1,7 @@ +from django.core.handlers.wsgi import WSGIRequest + + +class StaticFilesHandler: + def file_path(self, url: str) -> str: ... + def get_response(self, request: WSGIRequest): ... + def load_middleware(self) -> None: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/management/commands/collectstatic.pyi b/django/contrib/staticfiles/management/commands/collectstatic.pyi new file mode 100644 index 0000000..029ebdf --- /dev/null +++ b/django/contrib/staticfiles/management/commands/collectstatic.pyi @@ -0,0 +1,42 @@ +from django.core.files.storage import ( + DefaultStorage, + FileSystemStorage, +) +from django.core.management.base import CommandParser +from typing import ( + Dict, + List, + Optional, + Union, +) + + +class Command: + def __init__(self, *args, **kwargs) -> None: ... + def add_arguments(self, parser: CommandParser) -> None: ... + def clear_dir(self, path: str) -> None: ... + def collect(self) -> Dict[str, List[str]]: ... + def copy_file( + self, + path: str, + prefixed_path: str, + source_storage: Union[FileSystemStorage, DefaultStorage] + ) -> None: ... + def delete_file( + self, + path: str, + prefixed_path: str, + source_storage: Union[FileSystemStorage, DefaultStorage] + ) -> bool: ... + def handle(self, **options) -> Optional[str]: ... + def is_local_storage(self) -> bool: ... + def link_file( + self, + path: str, + prefixed_path: str, + source_storage: Union[FileSystemStorage, DefaultStorage] + ) -> None: ... + @cached_property + def local(self) -> bool: ... + def log(self, msg: str, level: int = ...) -> None: ... + def set_options(self, **options) -> None: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/management/commands/findstatic.pyi b/django/contrib/staticfiles/management/commands/findstatic.pyi new file mode 100644 index 0000000..a53237b --- /dev/null +++ b/django/contrib/staticfiles/management/commands/findstatic.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle_label(self, path: str, **options) -> str: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/management/commands/runserver.pyi b/django/contrib/staticfiles/management/commands/runserver.pyi new file mode 100644 index 0000000..ad6f6b4 --- /dev/null +++ b/django/contrib/staticfiles/management/commands/runserver.pyi @@ -0,0 +1,5 @@ +from django.contrib.staticfiles.handlers import StaticFilesHandler + + +class Command: + def get_handler(self, *args, **options) -> StaticFilesHandler: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/storage.pyi b/django/contrib/staticfiles/storage.pyi new file mode 100644 index 0000000..469b85b --- /dev/null +++ b/django/contrib/staticfiles/storage.pyi @@ -0,0 +1,82 @@ +from collections import OrderedDict +from django.core.cache import DefaultCacheProxy +from django.core.files.base import File +from django.core.files.storage import FileSystemStorage +from django.utils.safestring import SafeText +from typing import ( + Callable, + Dict, + Iterator, + List, + Optional, + Tuple, + Union, +) + + +class CachedFilesMixin: + def __init__(self, *args, **kwargs) -> None: ... + def hash_key(self, name: str) -> str: ... + + +class ConfiguredStorage: + def _setup(self) -> None: ... + + +class HashedFilesMixin: + def __init__(self, *args, **kwargs) -> None: ... + def _post_process( + self, + paths: Union[OrderedDict, Dict[str, Tuple[FileSystemStorage, str]]], + adjustable_paths: List[str], + hashed_files: OrderedDict + ) -> Iterator[Tuple[str, str, bool, bool]]: ... + def _stored_name(self, name: str, hashed_files: OrderedDict) -> str: ... + def _url( + self, + hashed_name_func: Callable, + name: str, + force: bool = ..., + hashed_files: Optional[OrderedDict] = ... + ) -> str: ... + def clean_name(self, name: str) -> str: ... + def file_hash(self, name: str, content: File = ...) -> str: ... + def hash_key(self, name: str) -> str: ... + def hashed_name( + self, + name: str, + content: Optional[File] = ..., + filename: Optional[str] = ... + ) -> str: ... + def post_process( + self, + paths: OrderedDict, + dry_run: bool = ..., + **options + ) -> Iterator[Tuple[str, str, bool]]: ... + def stored_name(self, name: SafeText) -> str: ... + def url(self, name: SafeText, force: bool = ...) -> str: ... + def url_converter(self, name: str, hashed_files: OrderedDict, template: str = ...) -> Callable: ... + + +class ManifestFilesMixin: + def __init__(self, *args, **kwargs) -> None: ... + def load_manifest(self) -> OrderedDict: ... + def post_process(self, *args, **kwargs) -> None: ... + def read_manifest(self) -> None: ... + def save_manifest(self) -> None: ... + def stored_name(self, name: SafeText) -> str: ... + + +class StaticFilesStorage: + def __init__(self, location: Optional[str] = ..., base_url: None = ..., *args, **kwargs) -> None: ... + def path(self, name: str) -> str: ... + + +class _MappingCache: + def __getitem__(self, key: str) -> str: ... + def __init__(self, cache: DefaultCacheProxy) -> None: ... + def __setitem__(self, key: str, value: str) -> None: ... + def clear(self) -> None: ... + def get(self, key: str, default: None = ...) -> Optional[str]: ... + def update(self, data: OrderedDict) -> None: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/templatetags/staticfiles.pyi b/django/contrib/staticfiles/templatetags/staticfiles.pyi new file mode 100644 index 0000000..256ba98 --- /dev/null +++ b/django/contrib/staticfiles/templatetags/staticfiles.pyi @@ -0,0 +1,11 @@ +from django.template.base import ( + Parser, + Token, +) +from django.templatetags.static import StaticNode + + +def do_static( + parser: Parser, + token: Token +) -> StaticNode: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/urls.pyi b/django/contrib/staticfiles/urls.pyi new file mode 100644 index 0000000..be49f62 --- /dev/null +++ b/django/contrib/staticfiles/urls.pyi @@ -0,0 +1,5 @@ +from django.urls.resolvers import URLPattern +from typing import List + + +def staticfiles_urlpatterns(prefix: None = ...) -> List[URLPattern]: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/utils.pyi b/django/contrib/staticfiles/utils.pyi new file mode 100644 index 0000000..f533152 --- /dev/null +++ b/django/contrib/staticfiles/utils.pyi @@ -0,0 +1,24 @@ +from collections import OrderedDict +from django.core.files.storage import ( + DefaultStorage, + FileSystemStorage, +) +from typing import ( + Iterator, + List, + Tuple, + Union, +) + + +def check_settings(base_url: str = ...) -> None: ... + + +def get_files( + storage: Union[FileSystemStorage, DefaultStorage], + ignore_patterns: List[str] = ..., + location: str = ... +) -> Iterator[str]: ... + + +def matches_patterns(path: str, patterns: Union[OrderedDict, Tuple[str], List[str]] = ...) -> bool: ... \ No newline at end of file diff --git a/django/contrib/staticfiles/views.pyi b/django/contrib/staticfiles/views.pyi new file mode 100644 index 0000000..9c73dd5 --- /dev/null +++ b/django/contrib/staticfiles/views.pyi @@ -0,0 +1,10 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import FileResponse + + +def serve( + request: WSGIRequest, + path: str, + insecure: bool = ..., + **kwargs +) -> FileResponse: ... \ No newline at end of file diff --git a/django/contrib/syndication/views.pyi b/django/contrib/syndication/views.pyi new file mode 100644 index 0000000..3e16484 --- /dev/null +++ b/django/contrib/syndication/views.pyi @@ -0,0 +1,47 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.base import Model +from django.http.response import HttpResponse +from django.utils.feedgenerator import ( + Atom1Feed, + Enclosure, + Rss201rev2Feed, +) +from django.utils.safestring import SafeText +from typing import ( + Any, + Dict, + List, + Optional, + Union, +) + + +def add_domain(domain: str, url: str, secure: bool = ...) -> str: ... + + +class Feed: + def __call__( + self, + request: WSGIRequest, + *args, + **kwargs + ) -> HttpResponse: ... + def _get_dynamic_attr( + self, + attname: str, + obj: Optional[Model], + default: Optional[str] = ... + ) -> Any: ... + def feed_extra_kwargs(self, obj: None) -> Dict[Any, Any]: ... + def get_context_data(self, **kwargs) -> Dict[str, Model]: ... + def get_feed( + self, + obj: None, + request: WSGIRequest + ) -> Union[Atom1Feed, Rss201rev2Feed]: ... + def get_object(self, request: WSGIRequest, *args, **kwargs) -> None: ... + def item_description(self, item: Model) -> str: ... + def item_enclosures(self, item: Model) -> List[Enclosure]: ... + def item_extra_kwargs(self, item: Model) -> Dict[Any, Any]: ... + def item_link(self, item: Model) -> str: ... + def item_title(self, item: Model) -> SafeText: ... \ No newline at end of file diff --git a/django/core/cache/__init__.pyi b/django/core/cache/__init__.pyi new file mode 100644 index 0000000..bc5f6c9 --- /dev/null +++ b/django/core/cache/__init__.pyi @@ -0,0 +1,23 @@ +from collections import OrderedDict +from django.core.cache.backends.base import BaseCache +from typing import ( + Callable, + Dict, + Union, +) + + +def _create_cache(backend: str, **kwargs) -> BaseCache: ... + + +def close_caches(**kwargs) -> None: ... + + +class CacheHandler: + def __getitem__(self, alias: str) -> BaseCache: ... + + +class DefaultCacheProxy: + def __contains__(self, key: str) -> bool: ... + def __getattr__(self, name: str) -> Union[OrderedDict, Callable, Dict[str, float]]: ... + def __setattr__(self, name: str, value: Callable) -> None: ... \ No newline at end of file diff --git a/django/core/cache/backends/base.pyi b/django/core/cache/backends/base.pyi new file mode 100644 index 0000000..d14c8a8 --- /dev/null +++ b/django/core/cache/backends/base.pyi @@ -0,0 +1,43 @@ +from collections import OrderedDict +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Union, +) + + +def default_key_func(key: Union[str, int], key_prefix: str, version: Union[str, int]) -> str: ... + + +def get_key_func(key_func: Optional[Union[str, Callable]]) -> Callable: ... + + +class BaseCache: + def __contains__(self, key: str) -> bool: ... + def __init__(self, params: Dict[str, Any]) -> None: ... + def close(self, **kwargs) -> None: ... + def decr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... + def decr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... + def delete_many(self, keys: List[str], version: None = ...) -> None: ... + def get_backend_timeout(self, timeout: object = ...) -> Optional[float]: ... + def get_many(self, keys: List[str], version: Optional[int] = ...) -> Dict[str, Union[str, int]]: ... + def get_or_set( + self, + key: str, + default: Optional[Union[str, Callable, int]], + timeout: object = ..., + version: Optional[int] = ... + ) -> Optional[Union[str, int]]: ... + def incr(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... + def incr_version(self, key: str, delta: int = ..., version: Optional[int] = ...) -> int: ... + def make_key(self, key: Union[str, int], version: Optional[Union[str, int]] = ...) -> str: ... + def set_many( + self, + data: Union[Dict[str, str], Dict[str, Union[Dict[str, int], str]], Dict[str, int], OrderedDict], + timeout: object = ..., + version: Optional[int] = ... + ) -> List[Any]: ... + def validate_key(self, key: str) -> None: ... \ No newline at end of file diff --git a/django/core/cache/backends/db.pyi b/django/core/cache/backends/db.pyi new file mode 100644 index 0000000..8ce17d2 --- /dev/null +++ b/django/core/cache/backends/db.pyi @@ -0,0 +1,35 @@ +from datetime import datetime +from django.db.backends.utils import CursorWrapper +from typing import ( + Any, + Callable, + Dict, + Optional, + Union, +) + + +class BaseDatabaseCache: + def __init__(self, table: str, params: Dict[str, Union[int, Callable, str, Dict[str, int]]]) -> None: ... + + +class DatabaseCache: + def _base_set(self, mode: str, key: str, value: Any, timeout: object = ...): ... + def _cull(self, db: str, cursor: CursorWrapper, now: datetime) -> None: ... + def add( + self, + key: str, + value: Union[str, bytes, Dict[str, int], int], + timeout: object = ..., + version: Optional[int] = ... + ) -> bool: ... + def clear(self) -> None: ... + def delete(self, key: str, version: Optional[int] = ...) -> None: ... + def get(self, key: str, default: Optional[Union[str, int]] = ..., version: Optional[int] = ...) -> Any: ... + def has_key(self, key: str, version: Optional[int] = ...): ... + def set(self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...) -> None: ... + def touch(self, key: str, timeout: Optional[int] = ..., version: None = ...) -> bool: ... + + +class Options: + def __init__(self, table: str) -> None: ... \ No newline at end of file diff --git a/django/core/cache/backends/dummy.pyi b/django/core/cache/backends/dummy.pyi new file mode 100644 index 0000000..6ad42ab --- /dev/null +++ b/django/core/cache/backends/dummy.pyi @@ -0,0 +1,20 @@ +from typing import ( + Any, + Dict, + Optional, + Union, +) + + +class DummyCache: + def __init__(self, host: str, *args, **kwargs) -> None: ... + def add(self, key: str, value: str, timeout: object = ..., version: None = ...) -> bool: ... + def get(self, key: str, default: Optional[str] = ..., version: Optional[int] = ...) -> Optional[str]: ... + def has_key(self, key: str, version: None = ...) -> bool: ... + def set( + self, + key: str, + value: Union[str, int, Dict[str, Any]], + timeout: object = ..., + version: Optional[str] = ... + ) -> None: ... \ No newline at end of file diff --git a/django/core/cache/backends/filebased.pyi b/django/core/cache/backends/filebased.pyi new file mode 100644 index 0000000..09c4279 --- /dev/null +++ b/django/core/cache/backends/filebased.pyi @@ -0,0 +1,44 @@ +from io import ( + BufferedRandom, + BufferedReader, + BufferedWriter, +) +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Union, +) + + +def _write_content(f: Union[BufferedRandom, BufferedWriter], expiry: float, value: Any) -> None: ... + + +class FileBasedCache: + def __init__(self, dir: str, params: Dict[str, Union[Callable, int]]) -> None: ... + def _createdir(self) -> None: ... + def _cull(self) -> None: ... + def _delete(self, fname: str) -> None: ... + def _is_expired(self, f: BufferedReader) -> bool: ... + def _key_to_file(self, key: str, version: Optional[int] = ...) -> str: ... + def _list_cache_files(self) -> List[str]: ... + def add( + self, + key: str, + value: Union[str, bytes, int], + timeout: object = ..., + version: Optional[int] = ... + ) -> bool: ... + def clear(self) -> None: ... + def delete(self, key: str, version: Optional[int] = ...) -> None: ... + def get( + self, + key: str, + default: Optional[Union[str, int]] = ..., + version: Optional[int] = ... + ) -> Optional[str]: ... + def has_key(self, key: str, version: Optional[int] = ...) -> bool: ... + def set(self, key: str, value: Any, timeout: object = ..., version: Optional[int] = ...) -> None: ... + def touch(self, key: str, timeout: object = ..., version: None = ...): ... \ No newline at end of file diff --git a/django/core/cache/backends/locmem.pyi b/django/core/cache/backends/locmem.pyi new file mode 100644 index 0000000..13a00ac --- /dev/null +++ b/django/core/cache/backends/locmem.pyi @@ -0,0 +1,38 @@ +from typing import ( + Any, + Dict, + Optional, + Union, +) + + +class LocMemCache: + def __init__(self, name: str, params: Dict[str, Any]) -> None: ... + def _delete(self, key: str) -> None: ... + def _has_expired(self, key: str) -> bool: ... + def _set(self, key: str, value: bytes, timeout: object = ...) -> None: ... + def add( + self, + key: str, + value: Union[int, Dict[str, int], str, Dict[str, str]], + timeout: object = ..., + version: Optional[int] = ... + ): ... + def clear(self) -> None: ... + def delete(self, key: str, version: Optional[int] = ...) -> None: ... + def get( + self, + key: Union[str, int], + default: Optional[Union[str, int]] = ..., + version: Optional[int] = ... + ) -> Any: ... + def has_key(self, key: str, version: Optional[int] = ...): ... + def incr(self, key: Union[str, int], delta: int = ..., version: Optional[int] = ...) -> int: ... + def set( + self, + key: Union[str, int], + value: Any, + timeout: object = ..., + version: Optional[int] = ... + ) -> None: ... + def touch(self, key: str, timeout: object = ..., version: None = ...): ... \ No newline at end of file diff --git a/django/core/cache/utils.pyi b/django/core/cache/utils.pyi new file mode 100644 index 0000000..b07e15b --- /dev/null +++ b/django/core/cache/utils.pyi @@ -0,0 +1,8 @@ +from typing import ( + List, + Optional, + Union, +) + + +def make_template_fragment_key(fragment_name: str, vary_on: Optional[Union[List[int], List[str]]] = ...) -> str: ... \ No newline at end of file diff --git a/django/core/checks/caches.pyi b/django/core/checks/caches.pyi new file mode 100644 index 0000000..94863d3 --- /dev/null +++ b/django/core/checks/caches.pyi @@ -0,0 +1,5 @@ +from django.core.checks.messages import Error +from typing import List + + +def check_default_cache_is_configured(app_configs: None, **kwargs) -> List[Error]: ... \ No newline at end of file diff --git a/django/core/checks/messages.pyi b/django/core/checks/messages.pyi new file mode 100644 index 0000000..9b20981 --- /dev/null +++ b/django/core/checks/messages.pyi @@ -0,0 +1,31 @@ +from typing import ( + Any, + Optional, +) + + +class CheckMessage: + def __eq__(self, other: CheckMessage) -> bool: ... + def __init__( + self, + level: int, + msg: str, + hint: Optional[str] = ..., + obj: Any = ..., + id: Optional[str] = ... + ) -> None: ... + def __str__(self) -> str: ... + def is_serious(self, level: int = ...) -> bool: ... + def is_silenced(self) -> bool: ... + + +class Critical: + def __init__(self, *args, **kwargs) -> None: ... + + +class Error: + def __init__(self, *args, **kwargs) -> None: ... + + +class Warning: + def __init__(self, *args, **kwargs) -> None: ... \ No newline at end of file diff --git a/django/core/checks/model_checks.pyi b/django/core/checks/model_checks.pyi new file mode 100644 index 0000000..a07f4aa --- /dev/null +++ b/django/core/checks/model_checks.pyi @@ -0,0 +1,24 @@ +from django.apps.registry import Apps +from django.core.checks.messages import ( + Error, + Warning, +) +from typing import ( + Any, + List, + Optional, + Set, + Tuple, +) + + +def _check_lazy_references( + apps: Apps, + ignore: Optional[Set[Tuple[str, str]]] = ... +) -> List[Error]: ... + + +def check_all_models(app_configs: None = ..., **kwargs) -> List[Warning]: ... + + +def check_lazy_references(app_configs: None = ..., **kwargs) -> List[Any]: ... \ No newline at end of file diff --git a/django/core/checks/registry.pyi b/django/core/checks/registry.pyi new file mode 100644 index 0000000..bd26ab2 --- /dev/null +++ b/django/core/checks/registry.pyi @@ -0,0 +1,20 @@ +from django.core.checks.messages import Warning +from typing import ( + Callable, + List, + Optional, + Union, +) + + +class CheckRegistry: + def __init__(self) -> None: ... + def get_checks(self, include_deployment_checks: bool = ...) -> List[Callable]: ... + def register(self, check: Union[str, Callable] = ..., *tags, **kwargs) -> Callable: ... + def run_checks( + self, + app_configs: None = ..., + tags: Optional[List[str]] = ..., + include_deployment_checks: bool = ... + ) -> Union[List[str], List[Warning], List[int]]: ... + def tag_exists(self, tag: str, include_deployment_checks: bool = ...) -> bool: ... \ No newline at end of file diff --git a/django/core/checks/security/base.pyi b/django/core/checks/security/base.pyi new file mode 100644 index 0000000..4deef38 --- /dev/null +++ b/django/core/checks/security/base.pyi @@ -0,0 +1,35 @@ +from django.core.checks.messages import Warning +from typing import ( + Any, + List, +) + + +def _security_middleware() -> bool: ... + + +def _xframe_middleware() -> bool: ... + + +def check_content_type_nosniff(app_configs: None, **kwargs) -> List[Warning]: ... + + +def check_debug(app_configs: None, **kwargs) -> List[Any]: ... + + +def check_secret_key(app_configs: None, **kwargs) -> List[Warning]: ... + + +def check_security_middleware(app_configs: None, **kwargs) -> List[Warning]: ... + + +def check_ssl_redirect(app_configs: None, **kwargs) -> List[Warning]: ... + + +def check_sts(app_configs: None, **kwargs) -> List[Warning]: ... + + +def check_xframe_deny(app_configs: None, **kwargs) -> List[Warning]: ... + + +def check_xss_filter(app_configs: None, **kwargs) -> List[Warning]: ... \ No newline at end of file diff --git a/django/core/checks/security/csrf.pyi b/django/core/checks/security/csrf.pyi new file mode 100644 index 0000000..ab5cb21 --- /dev/null +++ b/django/core/checks/security/csrf.pyi @@ -0,0 +1,8 @@ +from django.core.checks.messages import Warning +from typing import List + + +def _csrf_middleware() -> bool: ... + + +def check_csrf_middleware(app_configs: None, **kwargs) -> List[Warning]: ... \ No newline at end of file diff --git a/django/core/checks/security/sessions.pyi b/django/core/checks/security/sessions.pyi new file mode 100644 index 0000000..4b40647 --- /dev/null +++ b/django/core/checks/security/sessions.pyi @@ -0,0 +1,13 @@ +from typing import ( + Any, + List, +) + + +def _session_app() -> bool: ... + + +def _session_middleware() -> bool: ... + + +def check_session_cookie_secure(app_configs: None, **kwargs) -> List[Any]: ... \ No newline at end of file diff --git a/django/core/checks/templates.pyi b/django/core/checks/templates.pyi new file mode 100644 index 0000000..13348b9 --- /dev/null +++ b/django/core/checks/templates.pyi @@ -0,0 +1,11 @@ +from django.core.checks.messages import Error +from typing import ( + Any, + List, +) + + +def check_setting_app_dirs_loaders(app_configs: None, **kwargs) -> List[Any]: ... + + +def check_string_if_invalid_is_string(app_configs: None, **kwargs) -> List[Error]: ... \ No newline at end of file diff --git a/django/core/checks/urls.pyi b/django/core/checks/urls.pyi new file mode 100644 index 0000000..8c6673b --- /dev/null +++ b/django/core/checks/urls.pyi @@ -0,0 +1,38 @@ +from django.core.checks.messages import ( + Error, + Warning, +) +from django.urls.resolvers import ( + URLPattern, + URLResolver, +) +from typing import ( + Any, + Callable, + List, + Tuple, + Union, +) + + +def E006(name: str) -> Error: ... + + +def _load_all_namespaces(resolver: URLResolver, parents: Tuple = ...) -> List[str]: ... + + +def check_resolver( + resolver: Union[URLResolver, URLPattern] +) -> Union[List[Error], List[Warning]]: ... + + +def check_url_config(app_configs: None, **kwargs) -> List[Warning]: ... + + +def check_url_namespaces_unique(app_configs: None, **kwargs) -> List[Any]: ... + + +def check_url_settings(app_configs: None, **kwargs) -> List[Error]: ... + + +def get_warning_for_invalid_pattern(pattern: Tuple[str, Callable]) -> List[Error]: ... \ No newline at end of file diff --git a/django/core/exceptions.pyi b/django/core/exceptions.pyi new file mode 100644 index 0000000..2821bf1 --- /dev/null +++ b/django/core/exceptions.pyi @@ -0,0 +1,24 @@ +from django.forms.utils import ErrorDict +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Tuple, + Union, +) + + +class ValidationError: + def __init__(self, message: Any, code: Optional[str] = ..., params: Any = ...) -> None: ... + def __iter__(self) -> Iterator[Union[str, Tuple[str, List[str]]]]: ... + def __str__(self) -> str: ... + @property + def message_dict(self) -> Dict[str, List[str]]: ... + @property + def messages(self) -> List[str]: ... + def update_error_dict( + self, + error_dict: Union[Dict[str, List[ValidationError]], ErrorDict] + ) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ... \ No newline at end of file diff --git a/django/core/files/base.pyi b/django/core/files/base.pyi new file mode 100644 index 0000000..31f8d42 --- /dev/null +++ b/django/core/files/base.pyi @@ -0,0 +1,36 @@ +from typing import ( + Any, + Iterator, + Optional, + Union, +) + + +def endswith_cr(line: bytes) -> bool: ... + + +def endswith_lf(line: Union[str, bytes]) -> bool: ... + + +def equals_lf(line: bytes) -> bool: ... + + +class ContentFile: + def __bool__(self) -> bool: ... + def __init__(self, content: Union[str, bytes], name: Optional[str] = ...) -> None: ... + def close(self) -> None: ... + + +class File: + def __bool__(self) -> bool: ... + def __enter__(self) -> File: ... + def __exit__(self, exc_type: None, exc_value: None, tb: None) -> None: ... + def __init__(self, file: Any, name: Optional[str] = ...) -> None: ... + def __iter__(self) -> Iterator[Union[str, bytes]]: ... + def __len__(self) -> int: ... + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def chunks(self, chunk_size: None = ...) -> Iterator[Union[str, bytes]]: ... + def close(self) -> None: ... + @cached_property + def size(self) -> int: ... \ No newline at end of file diff --git a/django/core/files/locks.pyi b/django/core/files/locks.pyi new file mode 100644 index 0000000..ab5fe1b --- /dev/null +++ b/django/core/files/locks.pyi @@ -0,0 +1,11 @@ +from io import BufferedRandom +from typing import Union + + +def _fd(f: Union[BufferedRandom, int]) -> int: ... + + +def lock(f: Union[BufferedRandom, int], flags: int) -> bool: ... + + +def unlock(f: int) -> bool: ... \ No newline at end of file diff --git a/django/core/files/move.pyi b/django/core/files/move.pyi new file mode 100644 index 0000000..006650b --- /dev/null +++ b/django/core/files/move.pyi @@ -0,0 +1,9 @@ +def _samefile(src: str, dst: str) -> bool: ... + + +def file_move_safe( + old_file_name: str, + new_file_name: str, + chunk_size: int = ..., + allow_overwrite: bool = ... +) -> None: ... \ No newline at end of file diff --git a/django/core/files/storage.pyi b/django/core/files/storage.pyi new file mode 100644 index 0000000..0733748 --- /dev/null +++ b/django/core/files/storage.pyi @@ -0,0 +1,67 @@ +from io import StringIO +from datetime import datetime +from django.core.files.base import File +from typing import ( + Any, + List, + Optional, + Tuple, + Union, +) + + +def get_storage_class(import_path: Optional[str] = ...) -> Any: ... + + +class FileSystemStorage: + def __init__( + self, + location: Optional[str] = ..., + base_url: Optional[str] = ..., + file_permissions_mode: Optional[int] = ..., + directory_permissions_mode: Optional[int] = ... + ) -> None: ... + def _clear_cached_properties(self, setting: str, **kwargs) -> None: ... + def _datetime_from_timestamp(self, ts: float) -> datetime: ... + def _open(self, name: str, mode: str = ...) -> File: ... + def _save(self, name: str, content: File) -> str: ... + def _value_or_setting( + self, + value: Optional[Union[str, int]], + setting: Optional[Union[str, int]] + ) -> Optional[Union[str, int]]: ... + @cached_property + def base_location(self) -> str: ... + @cached_property + def base_url(self) -> str: ... + def delete(self, name: str) -> None: ... + @cached_property + def directory_permissions_mode(self) -> Optional[int]: ... + def exists(self, name: str) -> bool: ... + @cached_property + def file_permissions_mode(self) -> Optional[int]: ... + def get_accessed_time(self, name: str) -> datetime: ... + def get_created_time(self, name: str) -> datetime: ... + def get_modified_time(self, name: str) -> datetime: ... + def listdir( + self, + path: str + ) -> Union[Tuple[List[Any], List[Any]], Tuple[List[Any], List[str]], Tuple[List[str], List[Any]], Tuple[List[str], List[str]]]: ... + @cached_property + def location(self) -> str: ... + def path(self, name: str) -> str: ... + def size(self, name: str) -> int: ... + def url(self, name: str) -> str: ... + + +class Storage: + def generate_filename(self, filename: str) -> str: ... + def get_available_name(self, name: str, max_length: Optional[int] = ...) -> str: ... + def get_valid_name(self, name: str) -> str: ... + def open(self, name: str, mode: str = ...) -> File: ... + def save( + self, + name: Optional[str], + content: Union[StringIO, File], + max_length: Optional[int] = ... + ) -> str: ... \ No newline at end of file diff --git a/django/core/files/uploadedfile.pyi b/django/core/files/uploadedfile.pyi new file mode 100644 index 0000000..be4a30d --- /dev/null +++ b/django/core/files/uploadedfile.pyi @@ -0,0 +1,57 @@ +from io import ( + BytesIO, + StringIO, +) +from tempfile import _TemporaryFileWrapper +from typing import ( + Iterator, + Optional, + Union, +) + + +class InMemoryUploadedFile: + def __init__( + self, + file: Union[StringIO, BytesIO], + field_name: Optional[str], + name: str, + content_type: str, + size: int, + charset: Optional[str], + content_type_extra: None = ... + ) -> None: ... + def chunks(self, chunk_size: None = ...) -> Iterator[Union[str, bytes]]: ... + def open(self, mode: None = ...) -> InMemoryUploadedFile: ... + + +class SimpleUploadedFile: + def __init__(self, name: str, content: Optional[bytes], content_type: str = ...) -> None: ... + + +class TemporaryUploadedFile: + def __init__( + self, + name: str, + content_type: str, + size: int, + charset: str, + content_type_extra: None = ... + ) -> None: ... + def close(self) -> None: ... + def temporary_file_path(self) -> str: ... + + +class UploadedFile: + def __init__( + self, + file: Optional[Union[_TemporaryFileWrapper, StringIO, BytesIO]] = ..., + name: str = ..., + content_type: str = ..., + size: Optional[int] = ..., + charset: Optional[str] = ..., + content_type_extra: None = ... + ) -> None: ... + def __repr__(self) -> str: ... + def _get_name(self) -> str: ... + def _set_name(self, name: str) -> None: ... \ No newline at end of file diff --git a/django/core/files/uploadhandler.pyi b/django/core/files/uploadhandler.pyi new file mode 100644 index 0000000..78ecbcb --- /dev/null +++ b/django/core/files/uploadhandler.pyi @@ -0,0 +1,57 @@ +from io import BytesIO +from django.core.files.uploadedfile import ( + InMemoryUploadedFile, + TemporaryUploadedFile, +) +from django.core.handlers.wsgi import WSGIRequest +from typing import ( + Any, + Dict, + Optional, + Union, +) + + +def load_handler(path: str, *args, **kwargs) -> FileUploadHandler: ... + + +class FileUploadHandler: + def __init__(self, request: WSGIRequest = ...) -> None: ... + def handle_raw_input( + self, + input_data: WSGIRequest, + META: Dict[str, Any], + content_length: int, + boundary: bytes, + encoding: str = ... + ) -> None: ... + def new_file( + self, + field_name: str, + file_name: str, + content_type: str, + content_length: None, + charset: None = ..., + content_type_extra: Dict[Any, Any] = ... + ) -> None: ... + def upload_complete(self) -> None: ... + + +class MemoryFileUploadHandler: + def file_complete(self, file_size: int) -> Optional[InMemoryUploadedFile]: ... + def handle_raw_input( + self, + input_data: Union[BytesIO, WSGIRequest], + META: Dict[str, Any], + content_length: int, + boundary: bytes, + encoding: str = ... + ) -> None: ... + def new_file(self, *args, **kwargs) -> None: ... + def receive_data_chunk(self, raw_data: bytes, start: int) -> Optional[bytes]: ... + + +class TemporaryFileUploadHandler: + def file_complete(self, file_size: int) -> TemporaryUploadedFile: ... + def new_file(self, *args, **kwargs) -> None: ... + def receive_data_chunk(self, raw_data: bytes, start: int) -> None: ... \ No newline at end of file diff --git a/django/core/files/utils.pyi b/django/core/files/utils.pyi new file mode 100644 index 0000000..cb24c2a --- /dev/null +++ b/django/core/files/utils.pyi @@ -0,0 +1,4 @@ +class FileProxyMixin: + @property + def closed(self) -> bool: ... + def readable(self) -> bool: ... \ No newline at end of file diff --git a/django/core/handlers/base.pyi b/django/core/handlers/base.pyi new file mode 100644 index 0000000..3f41860 --- /dev/null +++ b/django/core/handlers/base.pyi @@ -0,0 +1,25 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import ( + FileResponse, + HttpResponse, + HttpResponseBase, +) +from typing import ( + Callable, + Union, +) + + +class BaseHandler: + def _get_response( + self, + request: WSGIRequest + ) -> Union[HttpResponse, FileResponse]: ... + def get_response(self, request: WSGIRequest) -> HttpResponseBase: ... + def load_middleware(self) -> None: ... + def make_view_atomic(self, view: Callable) -> Callable: ... + def process_exception_by_middleware( + self, + exception: Exception, + request: WSGIRequest + ) -> HttpResponse: ... \ No newline at end of file diff --git a/django/core/handlers/exception.pyi b/django/core/handlers/exception.pyi new file mode 100644 index 0000000..cb27356 --- /dev/null +++ b/django/core/handlers/exception.pyi @@ -0,0 +1,22 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import HttpResponse +from django.urls.resolvers import URLResolver +from typing import Callable + + +def convert_exception_to_response(get_response: Callable) -> Callable: ... + + +def get_exception_response( + request: WSGIRequest, + resolver: URLResolver, + status_code: int, + exception: Exception, + sender: None = ... +) -> HttpResponse: ... + + +def response_for_exception( + request: WSGIRequest, + exc: Exception +) -> HttpResponse: ... \ No newline at end of file diff --git a/django/core/handlers/wsgi.pyi b/django/core/handlers/wsgi.pyi new file mode 100644 index 0000000..5a7cbff --- /dev/null +++ b/django/core/handlers/wsgi.pyi @@ -0,0 +1,54 @@ +from io import BytesIO +from django.http.request import QueryDict +from django.http.response import HttpResponse +from django.test.client import FakePayload +from django.utils.datastructures import MultiValueDict +from typing import ( + Any, + Callable, + Dict, + Optional, + Union, +) + + +def get_bytes_from_wsgi(environ: Dict[str, Any], key: str, default: str) -> bytes: ... + + +def get_path_info(environ: Dict[str, Any]) -> str: ... + + +def get_script_name(environ: Dict[str, Any]) -> str: ... + + +def get_str_from_wsgi(environ: Dict[str, Any], key: str, default: str) -> str: ... + + +class LimitedStream: + def __init__( + self, + stream: Union[str, BytesIO, FakePayload], + limit: int, + buf_size: int = ... + ) -> None: ... + def _read_limited(self, size: Optional[int] = ...) -> bytes: ... + def read(self, size: Optional[int] = ...) -> bytes: ... + def readline(self, size: Optional[int] = ...) -> bytes: ... + + +class WSGIHandler: + def __call__(self, environ: Dict[str, Any], start_response: Callable) -> HttpResponse: ... + def __init__(self, *args, **kwargs) -> None: ... + + +class WSGIRequest: + @cached_property + def COOKIES(self) -> Dict[str, str]: ... + @property + def FILES(self) -> MultiValueDict: ... + @cached_property + def GET(self) -> QueryDict: ... + def __init__(self, environ: Dict[str, Any]) -> None: ... + def _get_post(self) -> QueryDict: ... + def _get_scheme(self) -> str: ... + def _set_post(self, post: QueryDict) -> None: ... \ No newline at end of file diff --git a/django/core/mail/__init__.pyi b/django/core/mail/__init__.pyi new file mode 100644 index 0000000..630f18f --- /dev/null +++ b/django/core/mail/__init__.pyi @@ -0,0 +1,54 @@ +from django.core.mail.backends.base import BaseEmailBackend +from mail.custombackend import EmailBackend +from typing import ( + List, + Optional, + Tuple, +) + + +def get_connection( + backend: Optional[str] = ..., + fail_silently: bool = ..., + **kwds +) -> BaseEmailBackend: ... + + +def mail_admins( + subject: str, + message: str, + fail_silently: bool = ..., + connection: Optional[BaseEmailBackend] = ..., + html_message: Optional[str] = ... +) -> None: ... + + +def mail_managers( + subject: str, + message: str, + fail_silently: bool = ..., + connection: None = ..., + html_message: None = ... +) -> None: ... + + +def send_mail( + subject: str, + message: str, + from_email: Optional[str], + recipient_list: List[str], + fail_silently: bool = ..., + auth_user: None = ..., + auth_password: None = ..., + connection: Optional[BaseEmailBackend] = ..., + html_message: Optional[str] = ... +) -> int: ... + + +def send_mass_mail( + datatuple: List[Tuple[str, str, str, List[str]]], + fail_silently: bool = ..., + auth_user: None = ..., + auth_password: None = ..., + connection: EmailBackend = ... +) -> int: ... \ No newline at end of file diff --git a/django/core/mail/backends/base.pyi b/django/core/mail/backends/base.pyi new file mode 100644 index 0000000..753002c --- /dev/null +++ b/django/core/mail/backends/base.pyi @@ -0,0 +1,6 @@ +class BaseEmailBackend: + def __enter__(self) -> BaseEmailBackend: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + def __init__(self, fail_silently: bool = ..., **kwargs) -> None: ... + def close(self) -> None: ... + def open(self) -> None: ... \ No newline at end of file diff --git a/django/core/mail/backends/console.pyi b/django/core/mail/backends/console.pyi new file mode 100644 index 0000000..7416e51 --- /dev/null +++ b/django/core/mail/backends/console.pyi @@ -0,0 +1,17 @@ +from django.core.mail.message import ( + EmailMessage, + EmailMultiAlternatives, +) +from typing import ( + List, + Union, +) + + +class EmailBackend: + def __init__(self, *args, **kwargs) -> None: ... + def send_messages( + self, + email_messages: Union[List[EmailMultiAlternatives], List[EmailMessage]] + ) -> int: ... + def write_message(self, message: EmailMultiAlternatives) -> None: ... \ No newline at end of file diff --git a/django/core/mail/backends/dummy.pyi b/django/core/mail/backends/dummy.pyi new file mode 100644 index 0000000..ea692ef --- /dev/null +++ b/django/core/mail/backends/dummy.pyi @@ -0,0 +1,6 @@ +from django.core.mail.message import EmailMessage +from typing import List + + +class EmailBackend: + def send_messages(self, email_messages: List[EmailMessage]) -> int: ... \ No newline at end of file diff --git a/django/core/mail/backends/filebased.pyi b/django/core/mail/backends/filebased.pyi new file mode 100644 index 0000000..09a7ac9 --- /dev/null +++ b/django/core/mail/backends/filebased.pyi @@ -0,0 +1,9 @@ +from django.core.mail.message import EmailMessage + + +class EmailBackend: + def __init__(self, *args, file_path = ..., **kwargs) -> None: ... + def _get_filename(self) -> str: ... + def close(self) -> None: ... + def open(self) -> bool: ... + def write_message(self, message: EmailMessage) -> None: ... \ No newline at end of file diff --git a/django/core/mail/backends/locmem.pyi b/django/core/mail/backends/locmem.pyi new file mode 100644 index 0000000..9ad9a2b --- /dev/null +++ b/django/core/mail/backends/locmem.pyi @@ -0,0 +1,16 @@ +from django.core.mail.message import ( + EmailMessage, + EmailMultiAlternatives, +) +from typing import ( + List, + Union, +) + + +class EmailBackend: + def __init__(self, *args, **kwargs) -> None: ... + def send_messages( + self, + messages: Union[List[EmailMultiAlternatives], List[EmailMessage]] + ) -> int: ... \ No newline at end of file diff --git a/django/core/mail/backends/smtp.pyi b/django/core/mail/backends/smtp.pyi new file mode 100644 index 0000000..286ab7d --- /dev/null +++ b/django/core/mail/backends/smtp.pyi @@ -0,0 +1,30 @@ +from django.core.mail.message import EmailMessage +from smtplib import SMTP +from typing import ( + List, + Optional, + Type, +) + + +class EmailBackend: + def __init__( + self, + host: None = ..., + port: None = ..., + username: Optional[str] = ..., + password: Optional[str] = ..., + use_tls: None = ..., + fail_silently: bool = ..., + use_ssl: None = ..., + timeout: None = ..., + ssl_keyfile: None = ..., + ssl_certfile: None = ..., + **kwargs + ) -> None: ... + def _send(self, email_message: EmailMessage) -> bool: ... + def close(self) -> None: ... + @property + def connection_class(self) -> Type[SMTP]: ... + def open(self) -> bool: ... + def send_messages(self, email_messages: List[EmailMessage]) -> int: ... \ No newline at end of file diff --git a/django/core/mail/message.pyi b/django/core/mail/message.pyi new file mode 100644 index 0000000..bd41998 --- /dev/null +++ b/django/core/mail/message.pyi @@ -0,0 +1,116 @@ +from django.core.mail.backends.base import BaseEmailBackend +from email.mime.base import MIMEBase +from email.mime.text import MIMEText +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Union, +) + + +def forbid_multi_line_headers(name: str, val: str, encoding: str) -> Tuple[str, str]: ... + + +def sanitize_address(addr: Union[str, Tuple[str, str]], encoding: str) -> str: ... + + +def split_addr(addr: str, encoding: str) -> Tuple[str, str]: ... + + +class EmailMessage: + def __init__( + self, + subject: str = ..., + body: str = ..., + from_email: Optional[str] = ..., + to: Optional[List[str]] = ..., + bcc: None = ..., + connection: Any = ..., + attachments: Optional[List[MIMEText]] = ..., + headers: Optional[Dict[str, str]] = ..., + cc: Optional[List[str]] = ..., + reply_to: Optional[List[str]] = ... + ) -> None: ... + def _create_attachment( + self, + filename: Optional[str], + content: Union[str, bytes, SafeMIMEText], + mimetype: str = ... + ) -> MIMEBase: ... + def _create_attachments( + self, + msg: Union[SafeMIMEMultipart, SafeMIMEText] + ) -> Union[SafeMIMEMultipart, SafeMIMEText]: ... + def _create_message( + self, + msg: SafeMIMEText + ) -> Union[SafeMIMEMultipart, SafeMIMEText]: ... + def _create_mime_attachment(self, content: Union[str, bytes], mimetype: str) -> MIMEBase: ... + def _set_list_header_if_not_empty( + self, + msg: Union[SafeMIMEMultipart, SafeMIMEText], + header: str, + values: List[str] + ) -> None: ... + def attach(self, filename: str = ..., content: bytes = ..., mimetype: Optional[str] = ...) -> None: ... + def attach_file(self, path: str, mimetype: Optional[str] = ...) -> None: ... + def get_connection(self, fail_silently: bool = ...) -> BaseEmailBackend: ... + def message(self) -> Union[SafeMIMEMultipart, SafeMIMEText]: ... + def recipients(self) -> List[str]: ... + def send(self, fail_silently: bool = ...) -> int: ... + + +class EmailMultiAlternatives: + def __init__( + self, + subject: str = ..., + body: str = ..., + from_email: Optional[str] = ..., + to: List[str] = ..., + bcc: None = ..., + connection: Any = ..., + attachments: None = ..., + headers: Optional[Dict[str, str]] = ..., + alternatives: None = ..., + cc: None = ..., + reply_to: None = ... + ) -> None: ... + def _create_alternatives( + self, + msg: SafeMIMEText + ) -> Union[SafeMIMEMultipart, SafeMIMEText]: ... + def _create_message( + self, + msg: SafeMIMEText + ) -> Union[SafeMIMEMultipart, SafeMIMEText]: ... + def attach_alternative(self, content: str, mimetype: str) -> None: ... + + +class MIMEMixin: + def as_bytes(self, unixfrom: bool = ..., linesep: str = ...) -> bytes: ... + def as_string(self, unixfrom: bool = ..., linesep: str = ...) -> str: ... + + +class SafeMIMEMessage: + def __setitem__(self, name: str, val: str) -> None: ... + + +class SafeMIMEMultipart: + def __init__( + self, + _subtype: str = ..., + boundary: None = ..., + _subparts: None = ..., + encoding: str = ..., + **_params + ) -> None: ... + def __setitem__(self, name: str, val: str) -> None: ... + + +class SafeMIMEText: + def __init__(self, _text: str, _subtype: str = ..., _charset: str = ...) -> None: ... + def __setitem__(self, name: str, val: str) -> None: ... + def set_payload(self, payload: str, charset: str = ...) -> None: ... \ No newline at end of file diff --git a/django/core/mail/utils.pyi b/django/core/mail/utils.pyi new file mode 100644 index 0000000..9828844 --- /dev/null +++ b/django/core/mail/utils.pyi @@ -0,0 +1,3 @@ +class CachedDnsName: + def __str__(self) -> str: ... + def get_fqdn(self) -> str: ... \ No newline at end of file diff --git a/django/core/management/__init__.pyi b/django/core/management/__init__.pyi new file mode 100644 index 0000000..bf5cc1d --- /dev/null +++ b/django/core/management/__init__.pyi @@ -0,0 +1,26 @@ +from django.core.management.base import BaseCommand +from typing import ( + Dict, + List, + Optional, + Union, +) + + +def call_command(command_name: Union[str, BaseCommand], *args, **options) -> Optional[str]: ... + + +def find_commands(management_dir: str) -> List[str]: ... + + +def get_commands() -> Dict[str, str]: ... + + +def load_command_class(app_name: str, name: str) -> BaseCommand: ... + + +class ManagementUtility: + def __init__(self, argv: List[str] = ...) -> None: ... + def autocomplete(self): ... + def execute(self) -> None: ... + def fetch_command(self, subcommand: str) -> BaseCommand: ... \ No newline at end of file diff --git a/django/core/management/base.pyi b/django/core/management/base.pyi new file mode 100644 index 0000000..1e6b04c --- /dev/null +++ b/django/core/management/base.pyi @@ -0,0 +1,76 @@ +from io import ( + StringIO, + TextIOWrapper, +) +from argparse import ( + Action, + Namespace, +) +from django.core.checks.messages import Warning +from typing import ( + Any, + Callable, + List, + Optional, + Tuple, + Union, +) + + +def handle_default_options(options: Namespace) -> None: ... + + +def no_translations(handle_func: Callable) -> Callable: ... + + +class BaseCommand: + def __init__( + self, + stdout: Optional[StringIO] = ..., + stderr: None = ..., + no_color: bool = ... + ) -> None: ... + def _run_checks(self, **kwargs) -> List[Warning]: ... + def add_arguments(self, parser: CommandParser) -> None: ... + def check( + self, + app_configs: None = ..., + tags: None = ..., + display_num_errors: bool = ..., + include_deployment_checks: bool = ..., + fail_level: int = ... + ) -> None: ... + def check_migrations(self) -> None: ... + def create_parser(self, prog_name: str, subcommand: str) -> CommandParser: ... + def execute(self, *args, **options) -> Optional[Union[str, Tuple]]: ... + def get_version(self) -> str: ... + def print_help(self, prog_name: str, subcommand: str) -> None: ... + def run_from_argv(self, argv: List[str]): ... + + +class CommandParser: + def __init__(self, **kwargs) -> None: ... + def error(self, message: str): ... + def parse_args(self, args: List[str] = ..., namespace: None = ...) -> Namespace: ... + + +class DjangoHelpFormatter: + def _reordered_actions(self, actions: List[Action]) -> List[Action]: ... + def add_usage(self, usage: None, actions: List[Any], *args, **kwargs) -> None: ... + + +class LabelCommand: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, *labels, **options) -> str: ... + + +class OutputWrapper: + def __getattr__(self, name: str) -> Callable: ... + def __init__( + self, + out: Union[StringIO, TextIOWrapper], + style_func: Optional[Callable] = ..., + ending: str = ... + ) -> None: ... + def isatty(self) -> bool: ... + def write(self, msg: str, style_func: Optional[Callable] = ..., ending: Optional[str] = ...) -> None: ... \ No newline at end of file diff --git a/django/core/management/color.pyi b/django/core/management/color.pyi new file mode 100644 index 0000000..9bd059e --- /dev/null +++ b/django/core/management/color.pyi @@ -0,0 +1,7 @@ +def color_style() -> Style: ... + + +def make_style(config_string: str = ...) -> Style: ... + + +def supports_color() -> bool: ... \ No newline at end of file diff --git a/django/core/management/commands/check.pyi b/django/core/management/commands/check.pyi new file mode 100644 index 0000000..7027f0e --- /dev/null +++ b/django/core/management/commands/check.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, *app_labels, **options) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/compilemessages.pyi b/django/core/management/commands/compilemessages.pyi new file mode 100644 index 0000000..0d4a4f0 --- /dev/null +++ b/django/core/management/commands/compilemessages.pyi @@ -0,0 +1,17 @@ +from django.core.management.base import CommandParser +from typing import ( + List, + Tuple, +) + + +def has_bom(fn: str) -> bool: ... + + +def is_writable(path: str) -> bool: ... + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def compile_messages(self, locations: List[Tuple[str, str]]) -> None: ... + def handle(self, **options) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/createcachetable.pyi b/django/core/management/commands/createcachetable.pyi new file mode 100644 index 0000000..88b493d --- /dev/null +++ b/django/core/management/commands/createcachetable.pyi @@ -0,0 +1,7 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def create_table(self, database: str, tablename: str, dry_run: bool) -> None: ... + def handle(self, *tablenames, **options) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/dumpdata.pyi b/django/core/management/commands/dumpdata.pyi new file mode 100644 index 0000000..7027f0e --- /dev/null +++ b/django/core/management/commands/dumpdata.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, *app_labels, **options) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/flush.pyi b/django/core/management/commands/flush.pyi new file mode 100644 index 0000000..05fd1f0 --- /dev/null +++ b/django/core/management/commands/flush.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, **options) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/inspectdb.pyi b/django/core/management/commands/inspectdb.pyi new file mode 100644 index 0000000..7deee38 --- /dev/null +++ b/django/core/management/commands/inspectdb.pyi @@ -0,0 +1,37 @@ +from collections import OrderedDict +from django.core.management.base import CommandParser +from django.db.backends.base.introspection import FieldInfo +from django.db.backends.sqlite3.base import DatabaseWrapper +from typing import ( + Any, + Dict, + Iterator, + List, + Tuple, + Union, +) + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def get_field_type( + self, + connection: DatabaseWrapper, + table_name: str, + row: FieldInfo + ) -> Union[Tuple[str, OrderedDict, List[str]], Tuple[str, OrderedDict, List[Any]]]: ... + def get_meta( + self, + table_name: str, + constraints: Dict[str, Dict[str, Union[List[str], bool, str, Tuple[str, str]]]], + column_to_field_name: Dict[str, str], + is_view: bool + ) -> List[str]: ... + def handle(self, **options) -> None: ... + def handle_inspection(self, options: Dict[str, Any]) -> Iterator[str]: ... + def normalize_col_name( + self, + col_name: str, + used_column_names: List[str], + is_relation: bool + ) -> Union[Tuple[str, Dict[str, str], List[str]], Tuple[str, Dict[Any, Any], List[Any]]]: ... \ No newline at end of file diff --git a/django/core/management/commands/loaddata.pyi b/django/core/management/commands/loaddata.pyi new file mode 100644 index 0000000..ad28722 --- /dev/null +++ b/django/core/management/commands/loaddata.pyi @@ -0,0 +1,27 @@ +from django.core.management.base import CommandParser +from typing import ( + List, + Tuple, + Union, +) + + +def humanize(dirname: str) -> str: ... + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def find_fixtures(self, fixture_label: str) -> List[Tuple[str, str, str]]: ... + @cached_property + def fixture_dirs(self) -> List[str]: ... + def handle(self, *fixture_labels, **options) -> None: ... + def load_label(self, fixture_label: str) -> None: ... + def loaddata(self, fixture_labels: Union[Tuple[str], Tuple[str, str]]) -> None: ... + def parse_name( + self, + fixture_name: str + ) -> Union[Tuple[str, str, str], Tuple[str, str, None], Tuple[str, None, None]]: ... + + +class SingleZipReader: + def read(self) -> bytes: ... \ No newline at end of file diff --git a/django/core/management/commands/makemessages.pyi b/django/core/management/commands/makemessages.pyi new file mode 100644 index 0000000..60b83c1 --- /dev/null +++ b/django/core/management/commands/makemessages.pyi @@ -0,0 +1,60 @@ +from django.core.management.base import CommandParser +from typing import ( + List, + Tuple, +) + + +def check_programs(*programs) -> None: ... + + +def normalize_eols(raw_contents: str) -> str: ... + + +def write_pot_file(potfile: str, msgs: str) -> None: ... + + +class BuildFile: + def __init__( + self, + command: Command, + domain: str, + translatable: TranslatableFile + ) -> None: ... + def cleanup(self) -> None: ... + @cached_property + def is_templatized(self) -> bool: ... + @cached_property + def path(self) -> str: ... + def postprocess_messages(self, msgs: str) -> str: ... + def preprocess(self) -> None: ... + @cached_property + def work_path(self) -> str: ... + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def build_potfiles(self) -> List[str]: ... + def copy_plural_forms(self, msgs: str, locale: str) -> str: ... + def find_files(self, root: str) -> List[TranslatableFile]: ... + @cached_property + def gettext_version(self) -> Tuple[int, int, int]: ... + def handle(self, *args, **options) -> None: ... + def process_files(self, file_list: List[TranslatableFile]) -> None: ... + def process_locale_dir( + self, + locale_dir: str, + files: List[TranslatableFile] + ) -> None: ... + def remove_potfiles(self) -> None: ... + @cached_property + def settings_available(self) -> bool: ... + def write_po_file(self, potfile: str, locale: str) -> None: ... + + +class TranslatableFile: + def __eq__(self, other: TranslatableFile) -> bool: ... + def __init__(self, dirpath: str, file_name: str, locale_dir: object) -> None: ... + def __lt__(self, other: TranslatableFile) -> bool: ... + @property + def path(self) -> str: ... \ No newline at end of file diff --git a/django/core/management/commands/makemigrations.pyi b/django/core/management/commands/makemigrations.pyi new file mode 100644 index 0000000..3e9a08c --- /dev/null +++ b/django/core/management/commands/makemigrations.pyi @@ -0,0 +1,14 @@ +from django.core.management.base import CommandParser +from django.db.migrations.loader import MigrationLoader +from django.db.migrations.migration import Migration +from typing import ( + Dict, + List, + Set, +) + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle_merge(self, loader: MigrationLoader, conflicts: Dict[str, Set[str]]) -> None: ... + def write_migration_files(self, changes: Dict[str, List[Migration]]) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/migrate.pyi b/django/core/management/commands/migrate.pyi new file mode 100644 index 0000000..5ee9f80 --- /dev/null +++ b/django/core/management/commands/migrate.pyi @@ -0,0 +1,14 @@ +from django.core.management.base import CommandParser +from django.db.backends.sqlite3.base import DatabaseWrapper +from typing import ( + Any, + List, + Set, +) + + +class Command: + def _run_checks(self, **kwargs) -> List[Any]: ... + def add_arguments(self, parser: CommandParser) -> None: ... + def migration_progress_callback(self, action: str, migration: Any = ..., fake: bool = ...) -> None: ... + def sync_apps(self, connection: DatabaseWrapper, app_labels: Set[str]) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/runserver.pyi b/django/core/management/commands/runserver.pyi new file mode 100644 index 0000000..6b83c47 --- /dev/null +++ b/django/core/management/commands/runserver.pyi @@ -0,0 +1,9 @@ +from django.core.handlers.wsgi import WSGIHandler +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def execute(self, *args, **options) -> None: ... + def get_handler(self, *args, **options) -> WSGIHandler: ... + def handle(self, *args, **options) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/sendtestemail.pyi b/django/core/management/commands/sendtestemail.pyi new file mode 100644 index 0000000..e29171c --- /dev/null +++ b/django/core/management/commands/sendtestemail.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, *args, **kwargs) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/shell.pyi b/django/core/management/commands/shell.pyi new file mode 100644 index 0000000..996b21a --- /dev/null +++ b/django/core/management/commands/shell.pyi @@ -0,0 +1,5 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/showmigrations.pyi b/django/core/management/commands/showmigrations.pyi new file mode 100644 index 0000000..354f926 --- /dev/null +++ b/django/core/management/commands/showmigrations.pyi @@ -0,0 +1,20 @@ +from django.core.management.base import CommandParser +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.migrations.loader import MigrationLoader +from typing import List + + +class Command: + def _validate_app_names(self, loader: MigrationLoader, app_names: List[str]) -> None: ... + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, *args, **options) -> None: ... + def show_list( + self, + connection: DatabaseWrapper, + app_names: List[str] = ... + ) -> None: ... + def show_plan( + self, + connection: DatabaseWrapper, + app_names: List[str] = ... + ) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/sqlmigrate.pyi b/django/core/management/commands/sqlmigrate.pyi new file mode 100644 index 0000000..282e211 --- /dev/null +++ b/django/core/management/commands/sqlmigrate.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def execute(self, *args, **options) -> str: ... \ No newline at end of file diff --git a/django/core/management/commands/squashmigrations.pyi b/django/core/management/commands/squashmigrations.pyi new file mode 100644 index 0000000..05fd1f0 --- /dev/null +++ b/django/core/management/commands/squashmigrations.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import CommandParser + + +class Command: + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, **options) -> None: ... \ No newline at end of file diff --git a/django/core/management/commands/test.pyi b/django/core/management/commands/test.pyi new file mode 100644 index 0000000..a308a23 --- /dev/null +++ b/django/core/management/commands/test.pyi @@ -0,0 +1,2 @@ +class Command: + def handle(self, *test_labels, **options): ... \ No newline at end of file diff --git a/django/core/management/commands/testserver.pyi b/django/core/management/commands/testserver.pyi new file mode 100644 index 0000000..871ab80 --- /dev/null +++ b/django/core/management/commands/testserver.pyi @@ -0,0 +1,2 @@ +class Command: + def handle(self, *fixture_labels, **options) -> None: ... \ No newline at end of file diff --git a/django/core/management/sql.pyi b/django/core/management/sql.pyi new file mode 100644 index 0000000..0888766 --- /dev/null +++ b/django/core/management/sql.pyi @@ -0,0 +1,18 @@ +from django.core.management.color import Style +from django.db.backends.sqlite3.base import DatabaseWrapper +from typing import List + + +def emit_post_migrate_signal(verbosity: int, interactive: bool, db: str, **kwargs) -> None: ... + + +def emit_pre_migrate_signal(verbosity: int, interactive: bool, db: str, **kwargs) -> None: ... + + +def sql_flush( + style: Style, + connection: DatabaseWrapper, + only_django: bool = ..., + reset_sequences: bool = ..., + allow_cascade: bool = ... +) -> List[str]: ... \ No newline at end of file diff --git a/django/core/management/templates.pyi b/django/core/management/templates.pyi new file mode 100644 index 0000000..eb1f8ff --- /dev/null +++ b/django/core/management/templates.pyi @@ -0,0 +1,5 @@ +from django.core.management.base import CommandParser + + +class TemplateCommand: + def add_arguments(self, parser: CommandParser) -> None: ... \ No newline at end of file diff --git a/django/core/management/utils.pyi b/django/core/management/utils.pyi new file mode 100644 index 0000000..5af20f3 --- /dev/null +++ b/django/core/management/utils.pyi @@ -0,0 +1,23 @@ +from django.db.models.base import Model +from typing import ( + Any, + List, + Set, + Tuple, + Type, + Union, +) + + +def find_command(cmd: str, path: None = ..., pathext: None = ...) -> str: ... + + +def handle_extensions(extensions: List[str]) -> Set[str]: ... + + +def parse_apps_and_model_labels( + labels: List[str] +) -> Union[Tuple[Set[Type[Model]], Set[Any]], Tuple[Set[Any], Set[Any]]]: ... + + +def popen_wrapper(args: List[str], stdout_encoding: str = ...) -> Tuple[str, str, int]: ... \ No newline at end of file diff --git a/django/core/paginator.pyi b/django/core/paginator.pyi new file mode 100644 index 0000000..e9fd254 --- /dev/null +++ b/django/core/paginator.pyi @@ -0,0 +1,46 @@ +from django.db.models.base import Model +from django.db.models.query import QuerySet +from typing import ( + List, + Optional, + Union, +) + + +class Page: + def __getitem__(self, index: Union[slice, int]) -> Union[str, List[Model]]: ... + def __init__( + self, + object_list: Union[QuerySet, str, List[object], List[int]], + number: int, + paginator: Paginator + ) -> None: ... + def __repr__(self) -> str: ... + def end_index(self) -> int: ... + def has_next(self) -> bool: ... + def has_other_pages(self) -> bool: ... + def has_previous(self) -> bool: ... + def next_page_number(self) -> int: ... + def previous_page_number(self) -> int: ... + def start_index(self) -> int: ... + + +class Paginator: + def __init__( + self, + object_list: Union[List[object], QuerySet, List[int]], + per_page: Union[str, int], + orphans: Union[str, int] = ..., + allow_empty_first_page: bool = ... + ) -> None: ... + def _check_object_list_is_ordered(self) -> None: ... + def _get_page(self, *args, **kwargs) -> Page: ... + @cached_property + def count(self) -> int: ... + def get_page(self, number: Optional[int]) -> Page: ... + @cached_property + def num_pages(self) -> int: ... + def page(self, number: Union[str, int]) -> Page: ... + @property + def page_range(self) -> range: ... + def validate_number(self, number: Optional[Union[str, float, int]]) -> int: ... \ No newline at end of file diff --git a/django/core/serializers/__init__.pyi b/django/core/serializers/__init__.pyi new file mode 100644 index 0000000..3ff22d8 --- /dev/null +++ b/django/core/serializers/__init__.pyi @@ -0,0 +1,59 @@ +from collections import OrderedDict +from django.apps.config import AppConfig +from django.contrib.admin.apps import SimpleAdminConfig +from django.contrib.sites.apps import SitesConfig +from django.core.serializers.json import Serializer +from django.core.serializers.python import Serializer +from django.core.serializers.xml_serializer import ( + Deserializer, + Serializer, +) +from django.db.models.base import Model +from django.db.models.query import QuerySet +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +def _load_serializers() -> None: ... + + +def deserialize(format: str, stream_or_string: Any, **options) -> Deserializer: ... + + +def get_deserializer(format: str) -> Union[Type[Deserializer], Callable]: ... + + +def get_public_serializer_formats() -> List[str]: ... + + +def get_serializer( + format: str +) -> Union[Type[Serializer], Type[Serializer], Type[Serializer], BadSerializer]: ... + + +def register_serializer(format: str, serializer_module: str, serializers: Dict[str, Any] = ...) -> None: ... + + +def serialize( + format: str, + queryset: Union[List[Model], QuerySet], + **options +) -> Optional[Union[str, List[OrderedDict]]]: ... + + +def sort_dependencies( + app_list: Union[List[Union[Tuple[SitesConfig, None], Tuple[SimpleAdminConfig, None], Tuple[AppConfig, None]]], List[Tuple[str, List[Type[Model]]]], List[Union[Tuple[SitesConfig, None], Tuple[SimpleAdminConfig, None]]]] +) -> List[Type[Model]]: ... + + +class BadSerializer: + def __call__(self, *args, **kwargs): ... + def __init__(self, exception: ModuleNotFoundError) -> None: ... \ No newline at end of file diff --git a/django/core/serializers/base.pyi b/django/core/serializers/base.pyi new file mode 100644 index 0000000..59fd67e --- /dev/null +++ b/django/core/serializers/base.pyi @@ -0,0 +1,86 @@ +from io import ( + BufferedReader, + StringIO, + TextIOWrapper, +) +from collections import OrderedDict +from django.core.exceptions import ValidationError +from django.core.serializers.xml_serializer import Deserializer +from django.db.models.base import Model +from django.db.models.fields.related import ( + ForeignKey, + ManyToManyField, +) +from django.db.models.query import QuerySet +from typing import ( + Any, + Dict, + List, + Optional, + Union, +) +from uuid import UUID + + +def build_instance(Model: Any, data: Dict[str, Any], db: str) -> Model: ... + + +def deserialize_fk_value( + field: ForeignKey, + field_value: Any, + using: str +) -> Optional[Union[str, UUID, int]]: ... + + +def deserialize_m2m_values( + field: ManyToManyField, + field_value: Union[List[List[str]], List[Union[int, str]], List[int]], + using: str +) -> List[int]: ... + + +class DeserializationError: + @classmethod + def WithData( + cls, + original_exc: ValidationError, + model: str, + fk: str, + field_value: None + ) -> DeserializationError: ... + + +class DeserializedObject: + def __init__(self, obj: Model, m2m_data: Dict[str, List[int]] = ...) -> None: ... + def __repr__(self) -> str: ... + def save(self, save_m2m: bool = ..., using: Optional[str] = ..., **kwargs) -> None: ... + + +class Deserializer: + def __init__(self, stream_or_string: Union[str, BufferedReader, TextIOWrapper], **options) -> None: ... + def __iter__(self) -> Deserializer: ... + + +class M2MDeserializationError: + def __init__(self, original_exc: ValidationError, pk: str) -> None: ... + + +class ProgressBar: + def __init__(self, output: Optional[StringIO], total_count: int) -> None: ... + def update(self, count: int) -> None: ... + + +class Serializer: + def getvalue(self) -> Optional[str]: ... + def serialize( + self, + queryset: Union[List[Model], QuerySet], + *, + stream = ..., + fields = ..., + use_natural_foreign_keys = ..., + use_natural_primary_keys = ..., + progress_output = ..., + object_count = ..., + **options + ) -> Optional[Union[str, List[OrderedDict]]]: ... \ No newline at end of file diff --git a/django/core/serializers/json.pyi b/django/core/serializers/json.pyi new file mode 100644 index 0000000..4c9a074 --- /dev/null +++ b/django/core/serializers/json.pyi @@ -0,0 +1,27 @@ +from datetime import ( + date, + timedelta, +) +from decimal import Decimal +from django.db.models.base import Model +from typing import ( + Any, + Optional, + Union, +) +from uuid import UUID + + +def Deserializer(stream_or_string: Any, **options) -> None: ... + + +class DjangoJSONEncoder: + def default(self, o: Union[Decimal, UUID, date, timedelta]) -> str: ... + + +class Serializer: + def _init_options(self) -> None: ... + def end_object(self, obj: Model) -> None: ... + def end_serialization(self) -> None: ... + def getvalue(self) -> Optional[str]: ... + def start_serialization(self) -> None: ... \ No newline at end of file diff --git a/django/core/serializers/python.pyi b/django/core/serializers/python.pyi new file mode 100644 index 0000000..99db9e0 --- /dev/null +++ b/django/core/serializers/python.pyi @@ -0,0 +1,46 @@ +from collections import OrderedDict +from django.core.serializers.base import DeserializedObject +from django.db.models.base import Model +from django.db.models.fields import Field +from django.db.models.fields.related import ( + ForeignKey, + ManyToManyField, +) +from typing import ( + Any, + Iterator, + List, +) + + +def Deserializer( + object_list: Any, + *, + using = ..., + ignorenonexistent = ..., + **options +) -> Iterator[DeserializedObject]: ... + + +def _get_model(model_identifier: str) -> Any: ... + + +class Serializer: + def _value_from_field(self, obj: Model, field: Field) -> Any: ... + def end_object(self, obj: Model) -> None: ... + def end_serialization(self) -> None: ... + def get_dump_object(self, obj: Model) -> OrderedDict: ... + def getvalue(self) -> List[OrderedDict]: ... + def handle_field(self, obj: Model, field: Field) -> None: ... + def handle_fk_field( + self, + obj: Model, + field: ForeignKey + ) -> None: ... + def handle_m2m_field( + self, + obj: Model, + field: ManyToManyField + ) -> None: ... + def start_object(self, obj: Model) -> None: ... + def start_serialization(self) -> None: ... \ No newline at end of file diff --git a/django/core/serializers/xml_serializer.pyi b/django/core/serializers/xml_serializer.pyi new file mode 100644 index 0000000..ca2c27a --- /dev/null +++ b/django/core/serializers/xml_serializer.pyi @@ -0,0 +1,74 @@ +from io import ( + BufferedReader, + TextIOWrapper, +) +from django.core.serializers.base import DeserializedObject +from django.db.models.base import Model +from django.db.models.fields import Field +from django.db.models.fields.related import ( + ForeignKey, + ManyToManyField, +) +from typing import ( + Any, + List, + Optional, + Union, +) +from xml.dom.minidom import Element + + +def getInnerText(node: Element) -> str: ... + + +class DefusedExpatParser: + def __init__(self, *args, **kwargs) -> None: ... + def reset(self) -> None: ... + + +class Deserializer: + def __init__( + self, + stream_or_string: Union[str, TextIOWrapper, BufferedReader], + *, + using = ..., + ignorenonexistent = ..., + **options + ) -> None: ... + def __next__(self) -> DeserializedObject: ... + def _get_model_from_node(self, node: Element, attr: str) -> Any: ... + def _handle_fk_field_node( + self, + node: Element, + field: ForeignKey + ) -> Optional[int]: ... + def _handle_m2m_field_node( + self, + node: Element, + field: ManyToManyField + ) -> List[int]: ... + def _handle_object(self, node: Element) -> DeserializedObject: ... + def _make_parser(self) -> DefusedExpatParser: ... + + +class Serializer: + def _start_relational_field( + self, + field: Union[ManyToManyField, ForeignKey] + ) -> None: ... + def end_object(self, obj: Model) -> None: ... + def end_serialization(self) -> None: ... + def handle_field(self, obj: Model, field: Field) -> None: ... + def handle_fk_field( + self, + obj: Model, + field: ForeignKey + ) -> None: ... + def handle_m2m_field( + self, + obj: Model, + field: ManyToManyField + ) -> None: ... + def indent(self, level: int) -> None: ... + def start_object(self, obj: Model) -> None: ... + def start_serialization(self) -> None: ... \ No newline at end of file diff --git a/django/core/servers/basehttp.pyi b/django/core/servers/basehttp.pyi new file mode 100644 index 0000000..b0d0264 --- /dev/null +++ b/django/core/servers/basehttp.pyi @@ -0,0 +1,10 @@ +from typing import Dict + + +def get_internal_wsgi_application() -> object: ... + + +class WSGIRequestHandler: + def address_string(self) -> str: ... + def get_environ(self) -> Dict[str, str]: ... + def log_message(self, format: str, *args) -> None: ... \ No newline at end of file diff --git a/django/core/signing.pyi b/django/core/signing.pyi new file mode 100644 index 0000000..2acd4fb --- /dev/null +++ b/django/core/signing.pyi @@ -0,0 +1,63 @@ +from datetime import datetime +from django.contrib.sessions.serializers import PickleSerializer +from typing import ( + Any, + Dict, + List, + Optional, + Type, + Union, +) + + +def b64_decode(s: bytes) -> bytes: ... + + +def b64_encode(s: bytes) -> bytes: ... + + +def base64_hmac(salt: str, value: Union[str, bytes], key: Union[str, bytes]) -> str: ... + + +def dumps( + obj: Union[str, Dict[str, str], Dict[str, Union[str, datetime]], List[str]], + key: None = ..., + salt: str = ..., + serializer: Type[Union[JSONSerializer, PickleSerializer]] = ..., + compress: bool = ... +) -> str: ... + + +def get_cookie_signer(salt: str = ...) -> TimestampSigner: ... + + +def loads( + s: str, + key: None = ..., + salt: str = ..., + serializer: Type[Union[JSONSerializer, PickleSerializer]] = ..., + max_age: Optional[int] = ... +) -> Union[str, Dict[str, str], List[str]]: ... + + +class JSONSerializer: + def dumps(self, obj: Any) -> bytes: ... + def loads(self, data: bytes) -> Union[Dict[str, str], List[str]]: ... + + +class Signer: + def __init__( + self, + key: Optional[Union[str, bytes]] = ..., + sep: str = ..., + salt: Optional[str] = ... + ) -> None: ... + def sign(self, value: str) -> str: ... + def signature(self, value: Union[str, bytes]) -> str: ... + def unsign(self, signed_value: str) -> str: ... + + +class TimestampSigner: + def sign(self, value: str) -> str: ... + def timestamp(self) -> str: ... + def unsign(self, value: str, max_age: Optional[int] = ...) -> str: ... \ No newline at end of file diff --git a/django/core/validators.pyi b/django/core/validators.pyi new file mode 100644 index 0000000..4e65a2b --- /dev/null +++ b/django/core/validators.pyi @@ -0,0 +1,125 @@ +from datetime import datetime +from decimal import Decimal +from django.core.files.base import ContentFile +from django.utils.functional import SimpleLazyObject +from re import RegexFlag +from typing import ( + Any, + List, + Optional, + Union, +) + + +def _lazy_re_compile(regex: str, flags: int = ...) -> SimpleLazyObject: ... + + +def int_list_validator( + sep: str = ..., + message: None = ..., + code: str = ..., + allow_negative: bool = ... +) -> RegexValidator: ... + + +def ip_address_validators(protocol: str, unpack_ipv4: bool): ... + + +def validate_integer(value: str) -> None: ... + + +def validate_ipv46_address(value: str) -> None: ... + + +def validate_ipv4_address(value: str) -> None: ... + + +def validate_ipv6_address(value: str) -> None: ... + + +class BaseValidator: + def __call__(self, value: Any) -> None: ... + def __init__(self, limit_value: Any, message: None = ...) -> None: ... + def clean( + self, + x: Union[float, datetime, int, Decimal] + ) -> Union[float, datetime, int, Decimal]: ... + def compare(self, a: bool, b: bool) -> bool: ... + + +class DecimalValidator: + def __call__(self, value: Decimal) -> None: ... + def __eq__(self, other: DecimalValidator) -> bool: ... + def __init__(self, max_digits: Optional[int], decimal_places: Optional[int]) -> None: ... + + +class EmailValidator: + def __call__(self, value: str) -> None: ... + def __eq__(self, other: EmailValidator) -> bool: ... + def __init__( + self, + message: Optional[str] = ..., + code: Optional[str] = ..., + whitelist: Optional[List[str]] = ... + ) -> None: ... + def validate_domain_part(self, domain_part: str) -> bool: ... + + +class FileExtensionValidator: + def __call__(self, value: ContentFile): ... + def __eq__(self, other: FileExtensionValidator) -> bool: ... + def __init__( + self, + allowed_extensions: Optional[List[str]] = ..., + message: Optional[str] = ..., + code: Optional[str] = ... + ) -> None: ... + + +class MaxLengthValidator: + def clean(self, x: str) -> int: ... + def compare(self, a: int, b: int) -> bool: ... + + +class MaxValueValidator: + def compare(self, a: Union[float, Decimal, int], b: Union[float, Decimal, int]) -> bool: ... + + +class MinLengthValidator: + def clean(self, x: str) -> int: ... + def compare(self, a: int, b: int) -> bool: ... + + +class MinValueValidator: + def compare( + self, + a: Union[float, Decimal, int, datetime], + b: Union[float, Decimal, int, datetime] + ) -> bool: ... + + +class ProhibitNullCharactersValidator: + def __call__(self, value: Optional[str]) -> None: ... + def __eq__( + self, + other: Union[RegexValidator, ProhibitNullCharactersValidator] + ) -> bool: ... + def __init__(self, message: Optional[str] = ..., code: Optional[str] = ...) -> None: ... + + +class RegexValidator: + def __call__(self, value: Union[str, float]) -> None: ... + def __eq__(self, other: RegexValidator) -> bool: ... + def __init__( + self, + regex: Optional[str] = ..., + message: Optional[str] = ..., + code: Optional[str] = ..., + inverse_match: Optional[bool] = ..., + flags: Optional[RegexFlag] = ... + ) -> None: ... + + +class URLValidator: + def __call__(self, value: str) -> None: ... + def __init__(self, schemes: Optional[List[str]] = ..., **kwargs) -> None: ... \ No newline at end of file diff --git a/django/core/wsgi.pyi b/django/core/wsgi.pyi new file mode 100644 index 0000000..84eb9c2 --- /dev/null +++ b/django/core/wsgi.pyi @@ -0,0 +1,4 @@ +from django.core.handlers.wsgi import WSGIHandler + + +def get_wsgi_application() -> WSGIHandler: ... \ No newline at end of file diff --git a/django/db/__init__.pyi b/django/db/__init__.pyi new file mode 100644 index 0000000..2c151dd --- /dev/null +++ b/django/db/__init__.pyi @@ -0,0 +1,18 @@ +from django.db.backends.sqlite3.base import DatabaseWrapper +from typing import ( + Any, + Union, +) +from unittest.mock import MagicMock + + +def close_old_connections(**kwargs) -> None: ... + + +def reset_queries(**kwargs) -> None: ... + + +class DefaultConnectionProxy: + def __eq__(self, other: DatabaseWrapper) -> bool: ... + def __getattr__(self, item: str) -> Any: ... + def __setattr__(self, name: str, value: Union[MagicMock, bool]) -> None: ... \ No newline at end of file diff --git a/django/db/backends/base/base.pyi b/django/db/backends/base/base.pyi new file mode 100644 index 0000000..e3168f5 --- /dev/null +++ b/django/db/backends/base/base.pyi @@ -0,0 +1,82 @@ +from django.db.backends.sqlite3.base import ( + DatabaseWrapper, + SQLiteCursorWrapper, +) +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.backends.utils import ( + CursorDebugWrapper, + CursorWrapper, +) +from django.db.utils import DatabaseErrorWrapper +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, +) +from unittest.mock import MagicMock + + +class BaseDatabaseWrapper: + def __init__( + self, + settings_dict: Dict[str, Any], + alias: str = ..., + allow_thread_sharing: bool = ... + ) -> None: ... + def _commit(self): ... + def _cursor(self, name: None = ...): ... + def _prepare_cursor( + self, + cursor: SQLiteCursorWrapper + ) -> CursorWrapper: ... + def _rollback(self): ... + def _savepoint(self, sid: str) -> None: ... + def _savepoint_commit(self, sid: str) -> None: ... + def _savepoint_rollback(self, sid: str) -> None: ... + def check_settings(self) -> None: ... + def chunked_cursor(self) -> CursorWrapper: ... + def close(self) -> None: ... + def close_if_unusable_or_obsolete(self) -> None: ... + def commit(self) -> None: ... + def connect(self) -> None: ... + def constraint_checks_disabled(self) -> Iterator[None]: ... + def copy( + self, + alias: None = ..., + allow_thread_sharing: None = ... + ) -> DatabaseWrapper: ... + def cursor(self) -> CursorWrapper: ... + def ensure_connection(self) -> None: ... + def ensure_timezone(self) -> bool: ... + def execute_wrapper(self, wrapper: MagicMock) -> Iterator[None]: ... + def get_autocommit(self) -> bool: ... + def get_rollback(self) -> bool: ... + def make_cursor( + self, + cursor: SQLiteCursorWrapper + ) -> CursorWrapper: ... + def make_debug_cursor( + self, + cursor: SQLiteCursorWrapper + ) -> CursorDebugWrapper: ... + def on_commit(self, func: Callable) -> None: ... + def prepare_database(self) -> None: ... + @property + def queries(self) -> List[Dict[str, str]]: ... + @property + def queries_logged(self) -> bool: ... + def rollback(self) -> None: ... + def run_and_clear_commit_hooks(self) -> None: ... + def savepoint(self) -> str: ... + def savepoint_commit(self, sid: str) -> None: ... + def savepoint_rollback(self, sid: str) -> None: ... + def schema_editor(self, *args, **kwargs) -> DatabaseSchemaEditor: ... + def set_autocommit(self, autocommit: bool, force_begin_transaction_with_broken_autocommit: bool = ...) -> None: ... + def set_rollback(self, rollback: bool) -> None: ... + def validate_no_atomic_block(self) -> None: ... + def validate_no_broken_transaction(self) -> None: ... + def validate_thread_sharing(self) -> None: ... + @cached_property + def wrap_database_errors(self) -> DatabaseErrorWrapper: ... \ No newline at end of file diff --git a/django/db/backends/base/client.pyi b/django/db/backends/base/client.pyi new file mode 100644 index 0000000..7a4810c --- /dev/null +++ b/django/db/backends/base/client.pyi @@ -0,0 +1,5 @@ +from django.db.backends.base.base import BaseDatabaseWrapper + + +class BaseDatabaseClient: + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... \ No newline at end of file diff --git a/django/db/backends/base/creation.pyi b/django/db/backends/base/creation.pyi new file mode 100644 index 0000000..6b1dc5f --- /dev/null +++ b/django/db/backends/base/creation.pyi @@ -0,0 +1,31 @@ +from django.db.backends.sqlite3.base import DatabaseWrapper +from typing import ( + Dict, + Optional, + Tuple, + Union, +) + + +class BaseDatabaseCreation: + def __init__(self, connection: DatabaseWrapper) -> None: ... + def _get_database_display_str(self, verbosity: int, database_name: str) -> str: ... + def _get_test_db_name(self) -> str: ... + def create_test_db( + self, + verbosity: int = ..., + autoclobber: bool = ..., + serialize: bool = ..., + keepdb: bool = ... + ) -> str: ... + def deserialize_db_from_string(self, data: str) -> None: ... + def destroy_test_db( + self, + old_database_name: str = ..., + verbosity: int = ..., + keepdb: bool = ..., + suffix: None = ... + ) -> None: ... + def serialize_db_to_string(self) -> str: ... + def set_as_test_mirror(self, primary_settings_dict: Dict[str, Union[str, int, None, Dict[str, None]]]) -> None: ... + def test_db_signature(self) -> Tuple[str, str, str, str]: ... \ No newline at end of file diff --git a/django/db/backends/base/features.pyi b/django/db/backends/base/features.pyi new file mode 100644 index 0000000..f02515f --- /dev/null +++ b/django/db/backends/base/features.pyi @@ -0,0 +1,5 @@ +from django.db.backends.base.base import BaseDatabaseWrapper + + +class BaseDatabaseFeatures: + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... \ No newline at end of file diff --git a/django/db/backends/base/introspection.pyi b/django/db/backends/base/introspection.pyi new file mode 100644 index 0000000..8b6e7bd --- /dev/null +++ b/django/db/backends/base/introspection.pyi @@ -0,0 +1,26 @@ +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.utils import CursorWrapper +from typing import ( + Dict, + List, + Optional, + Tuple, + Union, +) + + +class BaseDatabaseIntrospection: + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + def column_name_converter(self, name: str) -> str: ... + def django_table_names(self, only_existing: bool = ..., include_views: bool = ...) -> List[str]: ... + def get_field_type( + self, + data_type: str, + description: FieldInfo + ) -> Union[str, Tuple[str, Dict[str, int]]]: ... + def table_name_converter(self, name: str) -> str: ... + def table_names( + self, + cursor: Optional[CursorWrapper] = ..., + include_views: bool = ... + ) -> List[str]: ... \ No newline at end of file diff --git a/django/db/backends/base/operations.pyi b/django/db/backends/base/operations.pyi new file mode 100644 index 0000000..e2379cc --- /dev/null +++ b/django/db/backends/base/operations.pyi @@ -0,0 +1,82 @@ +from datetime import ( + date, + datetime, + time, + timedelta, +) +from decimal import Decimal +from django.core.management.color import Style +from django.db import DefaultConnectionProxy +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.backends.utils import CursorWrapper +from django.db.models.expressions import Expression +from django.db.models.fields import Field +from typing import ( + Any, + List, + Optional, + Tuple, + Union, +) + + +class BaseDatabaseOperations: + def __init__( + self, + connection: Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper] + ) -> None: ... + def _get_limit_offset_params(self, low_mark: int, high_mark: Optional[int]) -> Tuple[int, int]: ... + def adapt_datefield_value(self, value: Optional[date]) -> Optional[str]: ... + def adapt_decimalfield_value( + self, + value: Optional[Decimal], + max_digits: Optional[int] = ..., + decimal_places: Optional[int] = ... + ) -> Optional[str]: ... + def adapt_ipaddressfield_value(self, value: Optional[str]) -> Optional[str]: ... + def adapt_timefield_value(self, value: Optional[Union[time, datetime]]) -> Optional[str]: ... + def adapt_unknown_value(self, value: Union[Decimal, time, date, int]) -> Union[str, int]: ... + def autoinc_sql(self, table: str, column: str) -> None: ... + def binary_placeholder_sql(self, value: Optional[memoryview]) -> str: ... + def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ... + def compiler(self, compiler_name: str) -> Any: ... + def convert_durationfield_value( + self, + value: Optional[Union[float, int]], + expression: Expression, + connection: DatabaseWrapper + ) -> Optional[timedelta]: ... + def date_extract_sql(self, lookup_type: None, field_name: None): ... + def datetime_cast_date_sql(self, field_name: None, tzname: None): ... + def datetime_trunc_sql(self, lookup_type: None, field_name: None, tzname: None): ... + def distinct_sql(self, fields: List[str], params: None) -> Tuple[List[str], List[Any]]: ... + def end_transaction_sql(self, success: bool = ...) -> str: ... + def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ... + def explain_query_prefix(self, format: None = ..., **options): ... + def field_cast_sql(self, db_type: Optional[str], internal_type: str) -> str: ... + def force_no_ordering(self) -> List[Any]: ... + def get_db_converters(self, expression: Expression) -> List[Any]: ... + def last_insert_id(self, cursor: CursorWrapper, table_name: str, pk_name: str) -> int: ... + def limit_offset_sql(self, low_mark: int, high_mark: Optional[int]) -> str: ... + def lookup_cast(self, lookup_type: str, internal_type: str = ...) -> str: ... + def max_in_list_size(self) -> None: ... + def max_name_length(self) -> None: ... + def modify_insert_params(self, placeholder: str, params: Any) -> Any: ... + def prep_for_like_query(self, x: str) -> str: ... + def process_clob(self, value: str) -> str: ... + def random_function_sql(self) -> str: ... + def savepoint_commit_sql(self, sid: str) -> str: ... + def savepoint_create_sql(self, sid: str) -> str: ... + def savepoint_rollback_sql(self, sid: str) -> str: ... + def sequence_reset_by_name_sql(self, style: None, sequences: List[Any]) -> List[Any]: ... + def sequence_reset_sql(self, style: Style, model_list: Any) -> List[Any]: ... + def set_time_zone_sql(self) -> str: ... + def tablespace_sql(self, tablespace: str, inline: bool = ...) -> str: ... + def time_extract_sql(self, lookup_type: None, field_name: None): ... + def time_trunc_sql(self, lookup_type: None, field_name: None): ... + def unification_cast_sql(self, output_field: Field) -> str: ... + def validate_autopk_value(self, value: int) -> int: ... + def window_frame_rows_start_end(self, start: None = ..., end: None = ...): ... + def year_lookup_bounds_for_date_field(self, value: int) -> List[str]: ... + def year_lookup_bounds_for_datetime_field(self, value: int) -> List[str]: ... \ No newline at end of file diff --git a/django/db/backends/base/schema.pyi b/django/db/backends/base/schema.pyi new file mode 100644 index 0000000..45e28ee --- /dev/null +++ b/django/db/backends/base/schema.pyi @@ -0,0 +1,69 @@ +from django.db.backends.ddl_references import Statement +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.models.base import Model +from django.db.models.fields import Field +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +class BaseDatabaseSchemaEditor: + def __enter__(self) -> DatabaseSchemaEditor: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + def __init__( + self, + connection: DatabaseWrapper, + collect_sql: bool = ..., + atomic: bool = ... + ) -> None: ... + def _constraint_names( + self, + model: Type[Model], + column_names: List[str] = ..., + unique: Optional[bool] = ..., + primary_key: None = ..., + index: Optional[bool] = ..., + foreign_key: None = ..., + check: None = ..., + type_: None = ... + ) -> List[str]: ... + def _create_index_name( + self, + table_name: str, + column_names: Union[Tuple[str, str, str], Tuple[str], List[str]], + suffix: str = ... + ) -> str: ... + def _create_index_sql( + self, + model: Any, + fields: Any, + *, + name = ..., + suffix = ..., + using = ..., + db_tablespace = ..., + col_suffixes = ..., + sql = ... + ) -> Statement: ... + def _create_unique_sql(self, model: Any, columns: List[str]) -> Statement: ... + def _delete_composed_index( + self, + model: Type[Model], + fields: Tuple[str, str], + constraint_kwargs: Dict[str, bool], + sql: str + ) -> None: ... + @classmethod + def _digest(cls, *args) -> str: ... + def _field_indexes_sql( + self, + model: Any, + field: Field + ) -> List[Statement]: ... \ No newline at end of file diff --git a/django/db/backends/base/validation.pyi b/django/db/backends/base/validation.pyi new file mode 100644 index 0000000..57ebf89 --- /dev/null +++ b/django/db/backends/base/validation.pyi @@ -0,0 +1,11 @@ +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.fields import Field +from typing import ( + Any, + List, +) + + +class BaseDatabaseValidation: + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + def check_field(self, field: Field, **kwargs) -> List[Any]: ... \ No newline at end of file diff --git a/django/db/backends/ddl_references.pyi b/django/db/backends/ddl_references.pyi new file mode 100644 index 0000000..cca2135 --- /dev/null +++ b/django/db/backends/ddl_references.pyi @@ -0,0 +1,59 @@ +from typing import ( + Callable, + List, + Tuple, + Union, +) + + +class Columns: + def __init__( + self, + table: str, + columns: List[str], + quote_name: Callable, + col_suffixes: Union[List[str], Tuple] = ... + ) -> None: ... + def __str__(self) -> str: ... + + +class ForeignKeyName: + def __init__( + self, + from_table: str, + from_columns: List[str], + to_table: str, + to_columns: List[str], + suffix_template: str, + create_fk_name: Callable + ) -> None: ... + def __str__(self) -> str: ... + def references_column(self, table: str, column: str) -> bool: ... + def references_table(self, table: str) -> bool: ... + def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ... + + +class IndexName: + def __init__(self, table: str, columns: List[str], suffix: str, create_index_name: Callable) -> None: ... + def __str__(self) -> str: ... + + +class Statement: + def __init__(self, template: str, **parts) -> None: ... + def __str__(self) -> str: ... + def references_column(self, table: str, column: str) -> bool: ... + def references_table(self, table: str) -> bool: ... + def rename_table_references(self, old_table: str, new_table: str) -> None: ... + + +class Table: + def __init__(self, table: str, quote_name: Callable) -> None: ... + def __str__(self) -> str: ... + def references_table(self, table: str) -> bool: ... + def rename_table_references(self, old_table: str, new_table: str) -> None: ... + + +class TableColumns: + def __init__(self, table: str, columns: List[str]) -> None: ... + def references_column(self, table: str, column: str) -> bool: ... + def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ... \ No newline at end of file diff --git a/django/db/backends/dummy/base.pyi b/django/db/backends/dummy/base.pyi new file mode 100644 index 0000000..0ee7a53 --- /dev/null +++ b/django/db/backends/dummy/base.pyi @@ -0,0 +1,4 @@ +def complain(*args, **kwargs): ... + + +def ignore(*args, **kwargs) -> None: ... \ No newline at end of file diff --git a/django/db/backends/mysql/client.pyi b/django/db/backends/mysql/client.pyi new file mode 100644 index 0000000..3b6af1c --- /dev/null +++ b/django/db/backends/mysql/client.pyi @@ -0,0 +1,10 @@ +from typing import ( + Dict, + List, + Optional, +) + + +class DatabaseClient: + @classmethod + def settings_to_cmd_args(cls, settings_dict: Dict[str, Union[str, None]]) -> List[str]: ... \ No newline at end of file diff --git a/django/db/backends/postgresql/client.pyi b/django/db/backends/postgresql/client.pyi new file mode 100644 index 0000000..f1198e9 --- /dev/null +++ b/django/db/backends/postgresql/client.pyi @@ -0,0 +1,9 @@ +from typing import Dict + + +def _escape_pgpass(txt: str) -> str: ... + + +class DatabaseClient: + @classmethod + def runshell_db(cls, conn_params: Dict[str, str]) -> None: ... \ No newline at end of file diff --git a/django/db/backends/sqlite3/base.pyi b/django/db/backends/sqlite3/base.pyi new file mode 100644 index 0000000..93255cb --- /dev/null +++ b/django/db/backends/sqlite3/base.pyi @@ -0,0 +1,82 @@ +from datetime import datetime +from sqlite3 import Connection +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) + + +def _sqlite_date_extract(lookup_type: str, dt: str) -> int: ... + + +def _sqlite_date_trunc(lookup_type: str, dt: str) -> str: ... + + +def _sqlite_datetime_cast_date(dt: str, tzname: Optional[str]) -> str: ... + + +def _sqlite_datetime_cast_time(dt: str, tzname: Optional[str]) -> str: ... + + +def _sqlite_datetime_extract(lookup_type: str, dt: str, tzname: Optional[str]) -> int: ... + + +def _sqlite_datetime_parse(dt: str, tzname: Optional[str]) -> datetime: ... + + +def _sqlite_datetime_trunc(lookup_type: str, dt: str, tzname: Optional[str]) -> str: ... + + +def _sqlite_format_dtdelta(conn: str, lhs: Union[str, int], rhs: Union[str, int]) -> str: ... + + +def _sqlite_lpad(text: str, length: int, fill_text: str) -> str: ... + + +def _sqlite_regexp(re_pattern: str, re_string: Optional[str]) -> bool: ... + + +def _sqlite_rpad(text: str, length: int, fill_text: str) -> str: ... + + +def _sqlite_time_extract(lookup_type: str, dt: str) -> int: ... + + +def _sqlite_time_trunc(lookup_type: str, dt: str) -> str: ... + + +def _sqlite_timestamp_diff(lhs: str, rhs: str) -> int: ... + + +def decoder(conv_func: Callable) -> Callable: ... + + +class DatabaseWrapper: + def _savepoint_allowed(self) -> bool: ... + def _set_autocommit(self, autocommit: bool) -> None: ... + def _start_transaction_under_autocommit(self) -> None: ... + def check_constraints(self, table_names: List[str] = ...) -> None: ... + def close(self) -> None: ... + def create_cursor(self, name: None = ...) -> SQLiteCursorWrapper: ... + def disable_constraint_checking(self) -> bool: ... + def enable_constraint_checking(self) -> None: ... + def get_connection_params(self) -> Dict[str, Union[int, str]]: ... + def get_new_connection(self, conn_params: Dict[str, Union[int, str]]) -> Connection: ... + def init_connection_state(self) -> None: ... + def is_in_memory_db(self) -> bool: ... + def is_usable(self) -> bool: ... + + +class SQLiteCursorWrapper: + def convert_query(self, query: str) -> str: ... + def execute(self, query: str, params: Any = ...) -> SQLiteCursorWrapper: ... + def executemany( + self, + query: str, + param_list: Union[List[Tuple[int]], List[Tuple[int, int]]] + ) -> SQLiteCursorWrapper: ... \ No newline at end of file diff --git a/django/db/backends/sqlite3/creation.pyi b/django/db/backends/sqlite3/creation.pyi new file mode 100644 index 0000000..015e6fb --- /dev/null +++ b/django/db/backends/sqlite3/creation.pyi @@ -0,0 +1,10 @@ +from typing import Tuple + + +class DatabaseCreation: + def _create_test_db(self, verbosity: int, autoclobber: bool, keepdb: bool = ...) -> str: ... + def _destroy_test_db(self, test_database_name: str, verbosity: int) -> None: ... + def _get_test_db_name(self) -> str: ... + @staticmethod + def is_in_memory_db(database_name: str) -> bool: ... + def test_db_signature(self) -> Tuple[str, str]: ... \ No newline at end of file diff --git a/django/db/backends/sqlite3/features.pyi b/django/db/backends/sqlite3/features.pyi new file mode 100644 index 0000000..1ed8684 --- /dev/null +++ b/django/db/backends/sqlite3/features.pyi @@ -0,0 +1,3 @@ +class DatabaseFeatures: + @cached_property + def supports_stddev(self) -> bool: ... \ No newline at end of file diff --git a/django/db/backends/sqlite3/introspection.pyi b/django/db/backends/sqlite3/introspection.pyi new file mode 100644 index 0000000..e35750c --- /dev/null +++ b/django/db/backends/sqlite3/introspection.pyi @@ -0,0 +1,65 @@ +from django.db.backends.base.introspection import ( + FieldInfo, + TableInfo, +) +from django.db.backends.utils import CursorWrapper +from django.db.models.fields import CharField +from django.db.models.fields.related import ForeignKey +from typing import ( + Dict, + List, + Optional, + Tuple, + Union, +) + + +def get_field_size(name: str) -> Optional[int]: ... + + +class DatabaseIntrospection: + def _get_foreign_key_constraints( + self, + cursor: CursorWrapper, + table_name: str + ) -> Dict[str, Dict[str, Union[List[str], bool, Tuple[str, str]]]]: ... + def _table_info( + self, + cursor: CursorWrapper, + name: str + ) -> List[Dict[str, Union[str, None, int]]]: ... + def get_constraints( + self, + cursor: CursorWrapper, + table_name: str + ) -> Dict[str, Dict[str, Union[List[str], bool, str, Tuple[str, str]]]]: ... + def get_key_columns( + self, + cursor: CursorWrapper, + table_name: str + ) -> List[Tuple[str, str, str]]: ... + def get_primary_key_column(self, cursor: CursorWrapper, table_name: str) -> str: ... + def get_relations( + self, + cursor: CursorWrapper, + table_name: str + ) -> Dict[str, Tuple[str, str]]: ... + def get_sequences( + self, + cursor: CursorWrapper, + table_name: str, + table_fields: List[Union[ForeignKey, CharField]] = ... + ) -> List[Dict[str, str]]: ... + def get_table_description( + self, + cursor: CursorWrapper, + table_name: str + ) -> List[FieldInfo]: ... + def get_table_list( + self, + cursor: CursorWrapper + ) -> List[TableInfo]: ... + + +class FlexibleFieldLookupDict: + def __getitem__(self, key: str) -> Union[str, Tuple[str, Dict[str, int]]]: ... \ No newline at end of file diff --git a/django/db/backends/sqlite3/operations.pyi b/django/db/backends/sqlite3/operations.pyi new file mode 100644 index 0000000..7de077f --- /dev/null +++ b/django/db/backends/sqlite3/operations.pyi @@ -0,0 +1,114 @@ +from datetime import ( + date, + datetime, + time, + timedelta, +) +from django.core.management.color import Style +from django.db.backends.sqlite3.base import ( + DatabaseWrapper, + SQLiteCursorWrapper, +) +from django.db.backends.utils import CursorDebugWrapper +from django.db.models.aggregates import Aggregate +from django.db.models.expressions import ( + BaseExpression, + Col, + CombinedExpression, + Expression, + F, +) +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) +from uuid import UUID + + +class DatabaseOperations: + def _convert_tzname_to_sql(self, tzname: Optional[str]) -> str: ... + def _quote_params_for_last_executed_query(self, params: Any): ... + def adapt_datetimefield_value( + self, + value: Optional[Union[datetime, F]] + ) -> Optional[Union[str, F]]: ... + def adapt_timefield_value(self, value: Optional[time]) -> Optional[str]: ... + def bulk_batch_size(self, fields: Any, objs: Any) -> int: ... + def bulk_insert_sql(self, fields: Any, placeholder_rows: Any) -> str: ... + def check_expression_support(self, expression: BaseExpression) -> None: ... + def combine_duration_expression(self, connector: str, sub_expressions: List[str]) -> str: ... + def combine_expression(self, connector: str, sub_expressions: List[str]) -> str: ... + def convert_booleanfield_value( + self, + value: Optional[int], + expression: Expression, + connection: DatabaseWrapper + ) -> Optional[bool]: ... + def convert_datefield_value( + self, + value: Optional[Union[str, date]], + expression: Expression, + connection: DatabaseWrapper + ) -> Optional[date]: ... + def convert_datetimefield_value( + self, + value: Optional[Union[str, datetime]], + expression: Expression, + connection: DatabaseWrapper + ) -> Optional[datetime]: ... + def convert_timefield_value( + self, + value: Optional[Union[str, time]], + expression: Expression, + connection: DatabaseWrapper + ) -> Optional[time]: ... + def convert_uuidfield_value( + self, + value: Optional[str], + expression: Col, + connection: DatabaseWrapper + ) -> Optional[UUID]: ... + def date_extract_sql(self, lookup_type: str, field_name: str) -> str: ... + def date_interval_sql(self, timedelta: timedelta) -> str: ... + def date_trunc_sql(self, lookup_type: str, field_name: str) -> str: ... + def datetime_cast_date_sql(self, field_name: str, tzname: str) -> str: ... + def datetime_cast_time_sql(self, field_name: str, tzname: str) -> str: ... + def datetime_extract_sql(self, lookup_type: str, field_name: str, tzname: Optional[str]) -> str: ... + def datetime_trunc_sql(self, lookup_type: str, field_name: str, tzname: Optional[str]) -> str: ... + def execute_sql_flush(self, using: str, sql_list: List[str]) -> None: ... + def format_for_duration_arithmetic(self, sql: str) -> str: ... + def get_db_converters(self, expression: Expression) -> List[Callable]: ... + def get_decimalfield_converter( + self, + expression: Union[Col, CombinedExpression, Aggregate] + ) -> Callable: ... + def integer_field_range(self, internal_type: str) -> Tuple[None, None]: ... + def last_executed_query( + self, + cursor: Union[SQLiteCursorWrapper, CursorDebugWrapper], + sql: str, + params: Optional[Union[Tuple, List[str]]] + ) -> str: ... + def no_limit_value(self) -> int: ... + def pk_default_value(self) -> str: ... + def quote_name(self, name: str) -> str: ... + def sql_flush( + self, + style: Style, + tables: List[str], + sequences: Union[List[Dict[str, str]], Tuple], + allow_cascade: bool = ... + ) -> List[str]: ... + def subtract_temporals( + self, + internal_type: str, + lhs: Tuple[str, List[Any]], + rhs: Union[Tuple[str, List[Any]], Tuple[str, List[str]]] + ) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + def time_extract_sql(self, lookup_type: str, field_name: str) -> str: ... + def time_trunc_sql(self, lookup_type: str, field_name: str) -> str: ... \ No newline at end of file diff --git a/django/db/backends/sqlite3/schema.pyi b/django/db/backends/sqlite3/schema.pyi new file mode 100644 index 0000000..469a00e --- /dev/null +++ b/django/db/backends/sqlite3/schema.pyi @@ -0,0 +1,62 @@ +from django.db.models.base import Model +from django.db.models.fields import ( + AutoField, + Field, + IntegerField, + SlugField, + TimeField, +) +from typing import ( + Any, + Dict, + Optional, + Type, + Union, +) + + +class DatabaseSchemaEditor: + def __enter__(self) -> DatabaseSchemaEditor: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + def _alter_field( + self, + model: Any, + old_field: Field, + new_field: Field, + old_type: str, + new_type: str, + old_db_params: Dict[str, Union[str, None]], + new_db_params: Dict[str, Union[str, None]], + strict: bool = ... + ) -> None: ... + def _is_referenced_by_fk_constraint( + self, + table_name: str, + column_name: Optional[str] = ..., + ignore_self: bool = ... + ) -> bool: ... + def _remake_table( + self, + model: Any, + create_field: Optional[Union[IntegerField, TimeField]] = ..., + delete_field: Optional[Union[AutoField, SlugField]] = ..., + alter_field: Any = ... + ) -> None: ... + def add_field(self, model: Type[Model], field: Field) -> None: ... + def alter_db_table( + self, + model: Any, + old_db_table: str, + new_db_table: str, + disable_constraints: bool = ... + ) -> None: ... + def alter_field( + self, + model: Any, + old_field: Field, + new_field: Field, + strict: bool = ... + ) -> None: ... + def delete_model(self, model: Any, handle_autom2m: bool = ...) -> None: ... + def quote_value(self, value: Optional[Union[int, memoryview, str]]) -> str: ... + def remove_field(self, model: Type[Model], field: Field) -> None: ... \ No newline at end of file diff --git a/django/db/backends/utils.pyi b/django/db/backends/utils.pyi new file mode 100644 index 0000000..b332dbe --- /dev/null +++ b/django/db/backends/utils.pyi @@ -0,0 +1,78 @@ +from datetime import ( + date, + time, +) +from decimal import Decimal +from django.db.backends.sqlite3.base import ( + DatabaseWrapper, + SQLiteCursorWrapper, +) +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) + + +def format_number( + value: Optional[Decimal], + max_digits: Optional[int], + decimal_places: Optional[int] +) -> Optional[str]: ... + + +def rev_typecast_decimal(d: Decimal) -> str: ... + + +def split_identifier(identifier: str) -> Tuple[str, str]: ... + + +def strip_quotes(table_name: str) -> str: ... + + +def truncate_name(identifier: str, length: Optional[int] = ..., hash_len: int = ...) -> str: ... + + +def typecast_date(s: str) -> date: ... + + +def typecast_time(s: str) -> Optional[time]: ... + + +def typecast_timestamp(s: str) -> date: ... + + +class CursorDebugWrapper: + def execute(self, sql: str, params: Optional[Union[Tuple, List[str]]] = ...): ... + + +class CursorWrapper: + def __enter__(self) -> CursorWrapper: ... + def __exit__(self, type: None, value: None, traceback: None) -> None: ... + def __getattr__(self, attr: str) -> Any: ... + def __init__( + self, + cursor: SQLiteCursorWrapper, + db: DatabaseWrapper + ) -> None: ... + def __iter__(self) -> None: ... + def _execute(self, sql: str, params: Any, *ignored_wrapper_args): ... + def _execute_with_wrappers( + self, + sql: str, + params: Any, + many: bool, + executor: Callable + ) -> Optional[SQLiteCursorWrapper]: ... + def _executemany( + self, + sql: str, + param_list: Union[List[Tuple[int]], List[Tuple[int, int, int]]], + *ignored_wrapper_args + ): ... + def callproc(self, procname: str, params: List[Any] = ..., kparams: Dict[str, int] = ...): ... + def execute(self, sql: str, params: Any = ...) -> SQLiteCursorWrapper: ... \ No newline at end of file diff --git a/django/db/migrations/autodetector.pyi b/django/db/migrations/autodetector.pyi new file mode 100644 index 0000000..bd0595c --- /dev/null +++ b/django/db/migrations/autodetector.pyi @@ -0,0 +1,114 @@ +from django.db.migrations.graph import MigrationGraph +from django.db.migrations.migration import Migration +from django.db.migrations.operations.base import Operation +from django.db.migrations.operations.fields import FieldOperation +from django.db.migrations.operations.models import ( + CreateModel, + DeleteModel, + FieldRelatedOptionOperation, + ModelOperation, +) +from django.db.migrations.questioner import MigrationQuestioner +from django.db.migrations.state import ProjectState +from django.db.models.fields.related import ( + ForeignKey, + ManyToManyField, +) +from django.db.models.fields.reverse_related import ManyToOneRel +from typing import ( + Any, + Dict, + List, + Optional, + Set, + Tuple, + Type, + Union, +) + + +class MigrationAutodetector: + def __init__( + self, + from_state: ProjectState, + to_state: ProjectState, + questioner: Optional[MigrationQuestioner] = ... + ) -> None: ... + def _build_migration_list(self, graph: Optional[MigrationGraph] = ...) -> None: ... + def _detect_changes( + self, + convert_apps: Optional[Set[str]] = ..., + graph: Optional[MigrationGraph] = ... + ) -> Dict[str, List[Migration]]: ... + def _generate_added_field(self, app_label: str, model_name: str, field_name: str) -> None: ... + def _generate_altered_foo_together( + self, + operation: Type[FieldRelatedOptionOperation] + ) -> None: ... + def _generate_removed_field(self, app_label: str, model_name: str, field_name: str) -> None: ... + def _generate_through_model_map(self) -> None: ... + def _get_dependencies_for_foreign_key( + self, + field: Union[ManyToOneRel, ManyToManyField, ForeignKey] + ) -> List[Tuple[str, str, None, bool]]: ... + def _optimize_migrations(self) -> None: ... + def _prepare_field_lists(self) -> None: ... + def _sort_migrations(self) -> None: ... + def _trim_to_apps( + self, + changes: Dict[str, List[Migration]], + app_labels: Set[str] + ) -> Dict[str, List[Migration]]: ... + def add_operation( + self, + app_label: str, + operation: Operation, + dependencies: Any = ..., + beginning: bool = ... + ) -> None: ... + def arrange_for_graph( + self, + changes: Dict[str, List[Migration]], + graph: MigrationGraph, + migration_name: Optional[str] = ... + ) -> Dict[str, List[Migration]]: ... + def changes( + self, + graph: MigrationGraph, + trim_to_apps: Optional[Set[str]] = ..., + convert_apps: Optional[Set[str]] = ..., + migration_name: None = ... + ) -> Dict[str, List[Migration]]: ... + def check_dependency( + self, + operation: Operation, + dependency: Union[Tuple[str, str, str, str], Tuple[str, str, str, bool], Tuple[str, str, None, bool]] + ) -> bool: ... + def create_altered_indexes(self) -> None: ... + def deep_deconstruct(self, obj: Any) -> Any: ... + def generate_added_fields(self) -> None: ... + def generate_added_indexes(self) -> None: ... + def generate_altered_db_table(self) -> None: ... + def generate_altered_fields(self) -> None: ... + def generate_altered_index_together(self) -> None: ... + def generate_altered_managers(self) -> None: ... + def generate_altered_options(self) -> None: ... + def generate_altered_order_with_respect_to(self) -> None: ... + def generate_altered_unique_together(self) -> None: ... + def generate_created_models(self) -> None: ... + def generate_created_proxies(self) -> None: ... + def generate_deleted_models(self) -> None: ... + def generate_deleted_proxies(self) -> None: ... + def generate_removed_fields(self) -> None: ... + def generate_removed_indexes(self) -> None: ... + def generate_renamed_fields(self) -> None: ... + def generate_renamed_models(self) -> None: ... + def only_relation_agnostic_fields(self, fields: Any) -> Any: ... + @classmethod + def parse_number(cls, name: str) -> int: ... + @classmethod + def suggest_name( + cls, + ops: Union[List[Union[CreateModel, FieldOperation]], List[CreateModel], List[ModelOperation], List[DeleteModel]] + ) -> str: ... + def swappable_first_key(self, item: Tuple[str, str]) -> Tuple[str, str]: ... \ No newline at end of file diff --git a/django/db/migrations/exceptions.pyi b/django/db/migrations/exceptions.pyi new file mode 100644 index 0000000..1c14a00 --- /dev/null +++ b/django/db/migrations/exceptions.pyi @@ -0,0 +1,16 @@ +from django.db.migrations.migration import Migration +from typing import ( + Optional, + Tuple, + Union, +) + + +class NodeNotFoundError: + def __init__( + self, + message: str, + node: Tuple[str, str], + origin: Optional[Union[str, Migration]] = ... + ) -> None: ... + def __str__(self) -> str: ... \ No newline at end of file diff --git a/django/db/migrations/executor.pyi b/django/db/migrations/executor.pyi new file mode 100644 index 0000000..929378f --- /dev/null +++ b/django/db/migrations/executor.pyi @@ -0,0 +1,63 @@ +from django.db import DefaultConnectionProxy +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.migrations.migration import Migration +from django.db.migrations.state import ProjectState +from typing import ( + Any, + Callable, + List, + Optional, + Set, + Tuple, + Union, +) + + +class MigrationExecutor: + def __init__( + self, + connection: Optional[Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper]], + progress_callback: Optional[Callable] = ... + ) -> None: ... + def _create_project_state(self, with_applied_migrations: bool = ...) -> ProjectState: ... + def _migrate_all_backwards(self, plan: Any, full_plan: Any, fake: bool) -> ProjectState: ... + def _migrate_all_forwards( + self, + state: ProjectState, + plan: Any, + full_plan: Any, + fake: bool, + fake_initial: bool + ) -> ProjectState: ... + def apply_migration( + self, + state: ProjectState, + migration: Migration, + fake: bool = ..., + fake_initial: bool = ... + ) -> ProjectState: ... + def check_replacements(self) -> None: ... + def detect_soft_applied( + self, + project_state: None, + migration: Migration + ) -> Tuple[bool, ProjectState]: ... + def migrate( + self, + targets: Optional[Union[List[Tuple[str, str]], List[Tuple[str, None]]]], + plan: Any = ..., + state: Optional[ProjectState] = ..., + fake: bool = ..., + fake_initial: bool = ... + ) -> ProjectState: ... + def migration_plan( + self, + targets: Union[Set[Tuple[str, str]], List[Tuple[str, str]], List[Tuple[str, None]]], + clean_start: bool = ... + ) -> Any: ... + def unapply_migration( + self, + state: ProjectState, + migration: Migration, + fake: bool = ... + ) -> ProjectState: ... \ No newline at end of file diff --git a/django/db/migrations/graph.pyi b/django/db/migrations/graph.pyi new file mode 100644 index 0000000..da8eda3 --- /dev/null +++ b/django/db/migrations/graph.pyi @@ -0,0 +1,65 @@ +from django.db.migrations.migration import SwappableTuple +from django.db.migrations.state import ProjectState +from typing import ( + Any, + Callable, + List, + Optional, + Tuple, + Union, +) + + +class DummyNode: + def __init__(self, key: Tuple[str, str], origin: Any, error_message: str) -> None: ... + def promote(self) -> None: ... + def raise_error(self): ... + + +class MigrationGraph: + def __contains__(self, node: Union[SwappableTuple, Tuple[str, str]]) -> bool: ... + def __init__(self) -> None: ... + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def _generate_plan(self, nodes: List[Tuple[str, str]], at_end: bool) -> List[Tuple[str, str]]: ... + def _nodes_and_edges(self) -> Tuple[int, int]: ... + def add_dependency( + self, + migration: Any, + child: Tuple[str, str], + parent: Tuple[str, str], + skip_validation: bool = ... + ) -> None: ... + def add_dummy_node(self, key: Tuple[str, str], origin: Any, error_message: str) -> None: ... + def add_node(self, key: Tuple[str, str], migration: Any) -> None: ... + def backwards_plan(self, target: Union[Tuple[str, str], Node]) -> List[Tuple[str, str]]: ... + def clear_cache(self) -> None: ... + def ensure_not_cyclic( + self, + start: Union[Node, Tuple[str, str]], + get_children: Callable + ) -> None: ... + def forwards_plan(self, target: Tuple[str, str]) -> List[Tuple[str, str]]: ... + def leaf_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ... + def make_state( + self, + nodes: Optional[Tuple[str, str]] = ..., + at_end: bool = ..., + real_apps: List[str] = ... + ) -> ProjectState: ... + def remove_replaced_nodes(self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]]) -> None: ... + def remove_replacement_node(self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]]) -> None: ... + def root_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ... + def validate_consistency(self) -> None: ... + + +class Node: + def __eq__(self, other: Tuple[str, str]) -> bool: ... + def __getitem__(self, item: int) -> str: ... + def __hash__(self) -> int: ... + def __init__(self, key: Tuple[str, str]) -> None: ... + def __lt__(self, other: Union[Node, Tuple[str, str]]) -> bool: ... + def add_child(self, child: Node) -> None: ... + def add_parent(self, parent: Node) -> None: ... + def ancestors(self) -> List[Tuple[str, str]]: ... + def descendants(self) -> List[Tuple[str, str]]: ... \ No newline at end of file diff --git a/django/db/migrations/loader.pyi b/django/db/migrations/loader.pyi new file mode 100644 index 0000000..3a5ce86 --- /dev/null +++ b/django/db/migrations/loader.pyi @@ -0,0 +1,54 @@ +from django.db import DefaultConnectionProxy +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.migrations.migration import ( + Migration, + SwappableTuple, +) +from django.db.migrations.state import ProjectState +from typing import ( + Dict, + Optional, + Set, + Tuple, + Union, +) + + +class MigrationLoader: + def __init__( + self, + connection: Optional[Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]], + load: bool = ..., + ignore_no_migrations: bool = ... + ) -> None: ... + def add_external_dependencies( + self, + key: Tuple[str, str], + migration: Migration + ) -> None: ... + def add_internal_dependencies( + self, + key: Tuple[str, str], + migration: Migration + ) -> None: ... + def build_graph(self) -> None: ... + def check_consistent_history( + self, + connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper] + ) -> None: ... + def check_key( + self, + key: Union[SwappableTuple, Tuple[str, str]], + current_app: str + ) -> Optional[Tuple[str, str]]: ... + def detect_conflicts(self) -> Dict[str, Set[str]]: ... + def get_migration(self, app_label: str, name_prefix: str) -> Migration: ... + def get_migration_by_prefix(self, app_label: str, name_prefix: str) -> Migration: ... + def load_disk(self) -> None: ... + @classmethod + def migrations_module(cls, app_label: str) -> Union[Tuple[None, bool], Tuple[str, bool]]: ... + def project_state( + self, + nodes: Optional[Tuple[str, str]] = ..., + at_end: bool = ... + ) -> ProjectState: ... \ No newline at end of file diff --git a/django/db/migrations/migration.pyi b/django/db/migrations/migration.pyi new file mode 100644 index 0000000..b4bc3f0 --- /dev/null +++ b/django/db/migrations/migration.pyi @@ -0,0 +1,43 @@ +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.migrations.state import ProjectState +from typing import ( + Tuple, + Type, +) + + +def swappable_dependency(value: str) -> SwappableTuple: ... + + +class Migration: + def __eq__(self, other: Migration) -> bool: ... + def __hash__(self) -> int: ... + def __init__(self, name: str, app_label: str) -> None: ... + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def apply( + self, + project_state: ProjectState, + schema_editor: DatabaseSchemaEditor, + collect_sql: bool = ... + ) -> ProjectState: ... + def mutate_state( + self, + project_state: ProjectState, + preserve: bool = ... + ) -> ProjectState: ... + def unapply( + self, + project_state: ProjectState, + schema_editor: DatabaseSchemaEditor, + collect_sql: bool = ... + ) -> ProjectState: ... + + +class SwappableTuple: + @staticmethod + def __new__( + cls: Type[SwappableTuple], + value: Tuple[str, str], + setting: str + ) -> SwappableTuple: ... \ No newline at end of file diff --git a/django/db/migrations/operations/base.pyi b/django/db/migrations/operations/base.pyi new file mode 100644 index 0000000..b23b270 --- /dev/null +++ b/django/db/migrations/operations/base.pyi @@ -0,0 +1,22 @@ +from django.db.migrations.operations.models import CreateModel +from typing import ( + Any, + List, + Optional, + Tuple, + Union, +) + + +class Operation: + @staticmethod + def __new__(cls: Any, *args, **kwargs) -> Operation: ... + def _get_model_tuple(self, remote_model: str, app_label: str, model_name: str) -> Tuple[str, str]: ... + def reduce( + self, + operation: Operation, + in_between: Any, + app_label: Optional[str] = ... + ) -> Union[bool, List[CreateModel]]: ... + def references_field(self, model_name: str, name: str, app_label: str = ...) -> bool: ... + def references_model(self, name: str, app_label: str = ...) -> bool: ... \ No newline at end of file diff --git a/django/db/migrations/operations/fields.pyi b/django/db/migrations/operations/fields.pyi new file mode 100644 index 0000000..9827662 --- /dev/null +++ b/django/db/migrations/operations/fields.pyi @@ -0,0 +1,141 @@ +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.migrations.operations.base import Operation +from django.db.migrations.operations.models import ( + AlterUniqueTogether, + DeleteModel, +) +from django.db.migrations.state import ProjectState +from django.db.models.fields import ( + CharField, + Field, + IntegerField, + SlugField, +) +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Union, +) + + +class AddField: + def __init__( + self, + model_name: str, + name: str, + field: Field, + preserve_default: bool = ... + ) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Any: ... + def describe(self) -> str: ... + def reduce( + self, + operation: Operation, + in_between: List[AddField], + app_label: Optional[str] = ... + ) -> Union[bool, List[AddField]]: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class AlterField: + def __init__( + self, + model_name: str, + name: str, + field: Field, + preserve_default: bool = ... + ) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct( + self + ) -> Union[Tuple[str, List[Any], Dict[str, Union[str, SlugField]]], Tuple[str, List[Any], Dict[str, Union[str, CharField]]], Tuple[str, List[Any], Dict[str, Union[str, IntegerField]]]]: ... + def describe(self) -> str: ... + def reduce( + self, + operation: Union[DeleteModel, AlterField, AlterUniqueTogether], + in_between: List[Any], + app_label: str = ... + ) -> bool: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class FieldOperation: + def __init__(self, model_name: str, name: str) -> None: ... + def is_same_field_operation(self, operation: FieldOperation) -> bool: ... + def is_same_model_operation(self, operation: FieldOperation) -> bool: ... + @cached_property + def model_name_lower(self) -> str: ... + @cached_property + def name_lower(self) -> str: ... + def reduce( + self, + operation: Operation, + in_between: Any, + app_label: str = ... + ) -> bool: ... + def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ... + def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ... + + +class RemoveField: + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ... + def describe(self) -> str: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class RenameField: + def __init__(self, model_name: str, old_name: str, new_name: str) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ... + @cached_property + def old_name_lower(self) -> str: ... + def reduce( + self, + operation: Union[FieldOperation, AlterUniqueTogether], + in_between: List[Any], + app_label: Optional[str] = ... + ) -> Union[bool, List[RenameField]]: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... \ No newline at end of file diff --git a/django/db/migrations/operations/models.pyi b/django/db/migrations/operations/models.pyi new file mode 100644 index 0000000..fed2226 --- /dev/null +++ b/django/db/migrations/operations/models.pyi @@ -0,0 +1,258 @@ +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.migrations.operations.base import Operation +from django.db.migrations.state import ProjectState +from django.db.models.indexes import Index +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Set, + Tuple, + Union, +) + + +def _check_for_duplicates(arg_name: str, objs: Iterator[Any]) -> None: ... + + +class AddIndex: + def __init__(self, model_name: str, index: Index) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def describe(self) -> str: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class AlterIndexTogether: + def __init__( + self, + name: str, + index_together: Optional[Union[List[List[str]], List[Tuple[str, str]], Set[Tuple[str, str]]]] + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Set[Tuple[str, str]]]]]: ... + def references_field(self, model_name: str, name: str, app_label: None = ...) -> bool: ... + + +class AlterModelManagers: + def __init__(self, name: str, managers: List[Any]) -> None: ... + def describe(self) -> str: ... + + +class AlterModelOptions: + def __init__(self, name: str, options: Dict[str, Union[List[Tuple[str, str]], str]]) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Dict[str, List[Tuple[str, str]]]]]]: ... + + +class AlterModelTable: + def __init__(self, name: str, table: str) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ... + def describe(self) -> str: ... + def reduce( + self, + operation: DeleteModel, + in_between: List[Any], + app_label: None = ... + ) -> List[DeleteModel]: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class AlterOrderWithRespectTo: + def __init__(self, name: str, order_with_respect_to: str) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ... + def describe(self) -> str: ... + def references_field(self, model_name: str, name: str, app_label: None = ...) -> bool: ... + + +class AlterUniqueTogether: + def __init__( + self, + name: str, + unique_together: Optional[Union[List[List[str]], Set[Tuple[str, str]], List[Tuple[str, str]]]] + ) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Set[Tuple[str, str]]]]]: ... + def describe(self) -> str: ... + def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class CreateModel: + def __init__( + self, + name: str, + fields: Any, + options: Any = ..., + bases: Any = ..., + managers: Any = ... + ) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Any: ... + def describe(self) -> str: ... + def model_to_key(self, model: str) -> List[str]: ... + def reduce( + self, + operation: Operation, + in_between: Any, + app_label: Optional[str] = ... + ) -> Union[bool, List[CreateModel]]: ... + def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class DeleteModel: + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ... + def describe(self) -> str: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class FieldRelatedOptionOperation: + def reduce( + self, + operation: Operation, + in_between: List[DeleteModel], + app_label: Optional[str] = ... + ) -> Any: ... + + +class IndexOperation: + @cached_property + def model_name_lower(self) -> str: ... + + +class ModelOperation: + def __init__(self, name: str) -> None: ... + @cached_property + def name_lower(self) -> str: ... + def reduce( + self, + operation: Operation, + in_between: Any, + app_label: Optional[str] = ... + ) -> bool: ... + def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ... + + +class ModelOptionOperation: + def reduce( + self, + operation: Operation, + in_between: List[DeleteModel], + app_label: Optional[str] = ... + ) -> Union[bool, List[AlterUniqueTogether]]: ... + + +class RemoveIndex: + def __init__(self, model_name: str, name: str) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class RenameModel: + def __init__(self, old_name: str, new_name: str) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ... + @cached_property + def new_name_lower(self) -> str: ... + @cached_property + def old_name_lower(self) -> str: ... + def reduce( + self, + operation: AlterModelTable, + in_between: List[Any], + app_label: str = ... + ) -> bool: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... \ No newline at end of file diff --git a/django/db/migrations/operations/special.pyi b/django/db/migrations/operations/special.pyi new file mode 100644 index 0000000..da9b3b1 --- /dev/null +++ b/django/db/migrations/operations/special.pyi @@ -0,0 +1,89 @@ +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.migrations.operations.fields import AddField +from django.db.migrations.operations.models import ( + CreateModel, + ModelOperation, +) +from django.db.migrations.state import ( + ProjectState, + StateApps, +) +from typing import ( + Callable, + Dict, + List, + Optional, + Union, +) + + +class RunPython: + def __init__( + self, + code: Union[str, Callable], + reverse_code: Optional[Callable] = ..., + atomic: None = ..., + hints: Optional[Dict[str, str]] = ..., + elidable: bool = ... + ) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def describe(self) -> str: ... + @staticmethod + def noop( + apps: StateApps, + schema_editor: DatabaseSchemaEditor + ) -> None: ... + @property + def reversible(self) -> bool: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + + +class RunSQL: + def _run_sql( + self, + schema_editor: DatabaseSchemaEditor, + sqls: Union[str, List[str]] + ) -> None: ... + def database_backwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + + +class SeparateDatabaseAndState: + def __init__( + self, + database_operations: List[ModelOperation] = ..., + state_operations: Union[List[AddField], List[CreateModel], List[ModelOperation]] = ... + ) -> None: ... + def database_forwards( + self, + app_label: str, + schema_editor: DatabaseSchemaEditor, + from_state: ProjectState, + to_state: ProjectState + ) -> None: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... \ No newline at end of file diff --git a/django/db/migrations/operations/utils.pyi b/django/db/migrations/operations/utils.pyi new file mode 100644 index 0000000..f6967dc --- /dev/null +++ b/django/db/migrations/operations/utils.pyi @@ -0,0 +1,10 @@ +from django.db.migrations.state import ProjectState +from django.db.models.fields import Field + + +def is_referenced_by_foreign_key( + state: ProjectState, + model_name_lower: str, + field: Field, + field_name: str +) -> bool: ... \ No newline at end of file diff --git a/django/db/migrations/optimizer.pyi b/django/db/migrations/optimizer.pyi new file mode 100644 index 0000000..35ef040 --- /dev/null +++ b/django/db/migrations/optimizer.pyi @@ -0,0 +1,9 @@ +from typing import ( + Any, + Optional, +) + + +class MigrationOptimizer: + def optimize(self, operations: Any, app_label: Optional[str] = ...) -> Any: ... + def optimize_inner(self, operations: Any, app_label: Optional[str] = ...) -> Any: ... \ No newline at end of file diff --git a/django/db/migrations/questioner.pyi b/django/db/migrations/questioner.pyi new file mode 100644 index 0000000..10a7d69 --- /dev/null +++ b/django/db/migrations/questioner.pyi @@ -0,0 +1,40 @@ +from django.db.migrations.state import ModelState +from django.db.models.fields import IntegerField +from django.db.models.fields.related import ForeignKey +from typing import ( + Dict, + Optional, + Set, + Union, +) + + +class InteractiveMigrationQuestioner: + def _ask_default(self, default: str = ...) -> int: ... + def _boolean_input(self, question: str, default: bool = ...) -> bool: ... + def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> int: ... + def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ... + + +class MigrationQuestioner: + def __init__( + self, + defaults: Optional[Dict[str, bool]] = ..., + specified_apps: Optional[Set[str]] = ..., + dry_run: Optional[bool] = ... + ) -> None: ... + def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ... + def ask_initial(self, app_label: str) -> bool: ... + def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ... + def ask_rename( + self, + model_name: str, + old_name: str, + new_name: str, + field_instance: Union[IntegerField, related.ForeignKey] + ) -> bool: ... + def ask_rename_model( + self, + old_model_state: ModelState, + new_model_state: ModelState + ) -> bool: ... \ No newline at end of file diff --git a/django/db/migrations/recorder.pyi b/django/db/migrations/recorder.pyi new file mode 100644 index 0000000..f631b46 --- /dev/null +++ b/django/db/migrations/recorder.pyi @@ -0,0 +1,24 @@ +from django.db import DefaultConnectionProxy +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.query import QuerySet +from typing import ( + Optional, + Set, + Tuple, + Union, +) + + +class MigrationRecorder: + def __init__( + self, + connection: Optional[Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper]] + ) -> None: ... + def applied_migrations(self) -> Set[Tuple[str, str]]: ... + def ensure_schema(self) -> None: ... + def flush(self) -> None: ... + def has_table(self) -> bool: ... + @property + def migration_qs(self) -> QuerySet: ... + def record_applied(self, app: str, name: str) -> None: ... + def record_unapplied(self, app: str, name: str) -> None: ... \ No newline at end of file diff --git a/django/db/migrations/serializer.pyi b/django/db/migrations/serializer.pyi new file mode 100644 index 0000000..4fcefb1 --- /dev/null +++ b/django/db/migrations/serializer.pyi @@ -0,0 +1,103 @@ +from typing import ( + Any, + Dict, + List, + Set, + Tuple, + Union, +) + + +def serializer_factory(value: Any) -> BaseSerializer: ... + + +class BaseSequenceSerializer: + def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ... + + +class BaseSerializer: + def __init__(self, value: Any) -> None: ... + + +class BaseSimpleSerializer: + def serialize(self) -> Tuple[str, Set[Any]]: ... + + +class DateSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class DatetimeSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class DeconstructableSerializer: + @staticmethod + def _serialize_path(path: str) -> Tuple[str, Set[str]]: ... + def serialize(self) -> Tuple[str, Set[str]]: ... + @staticmethod + def serialize_deconstructed( + path: str, + args: Union[Tuple, List[str]], + kwargs: Dict[str, Any] + ) -> Tuple[str, Set[str]]: ... + + +class DictionarySerializer: + def serialize(self) -> Tuple[str, Set[Any]]: ... + + +class EnumSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class FloatSerializer: + def serialize(self) -> Tuple[str, Set[Any]]: ... + + +class FrozensetSerializer: + def _format(self) -> str: ... + + +class FunctionTypeSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class ModelFieldSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class ModelManagerSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class OperationSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class RegexSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class SequenceSerializer: + def _format(self) -> str: ... + + +class SetSerializer: + def _format(self) -> str: ... + + +class TimedeltaSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... + + +class TupleSerializer: + def _format(self) -> str: ... + + +class TypeSerializer: + def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ... + + +class UUIDSerializer: + def serialize(self) -> Tuple[str, Set[str]]: ... \ No newline at end of file diff --git a/django/db/migrations/state.pyi b/django/db/migrations/state.pyi new file mode 100644 index 0000000..7962254 --- /dev/null +++ b/django/db/migrations/state.pyi @@ -0,0 +1,35 @@ +from django.apps.registry import Apps +from django.db.models.fields import Field +from django.db.models.indexes import Index +from typing import ( + Any, + Iterator, +) + + +class AppConfigStub: + def __init__(self, label: str) -> None: ... + def import_models(self) -> None: ... + + +class ModelState: + def __eq__(self, other: ModelState) -> bool: ... + def __init__( + self, + app_label: str, + name: str, + fields: Any, + options: Any = ..., + bases: Any = ..., + managers: Any = ... + ) -> None: ... + def __repr__(self) -> str: ... + def clone(self) -> ModelState: ... + def construct_managers(self) -> Iterator[Any]: ... + @classmethod + def from_model(cls, model: Any, exclude_rels: bool = ...) -> ModelState: ... + def get_field_by_name(self, name: str) -> Field: ... + def get_index_by_name(self, name: str) -> Index: ... + @cached_property + def name_lower(self) -> str: ... + def render(self, apps: Apps): ... \ No newline at end of file diff --git a/django/db/migrations/topological_sort.pyi b/django/db/migrations/topological_sort.pyi new file mode 100644 index 0000000..e0b7e72 --- /dev/null +++ b/django/db/migrations/topological_sort.pyi @@ -0,0 +1,10 @@ +from typing import ( + Any, + Iterator, +) + + +def stable_topological_sort(l: Any, dependency_graph: Any) -> Any: ... + + +def topological_sort_as_sets(dependency_graph: Any) -> Iterator[Any]: ... \ No newline at end of file diff --git a/django/db/migrations/utils.pyi b/django/db/migrations/utils.pyi new file mode 100644 index 0000000..12bdeee --- /dev/null +++ b/django/db/migrations/utils.pyi @@ -0,0 +1,9 @@ +from django.utils.functional import SimpleLazyObject + + +def get_migration_name_timestamp() -> str: ... + + +class RegexObject: + def __eq__(self, other: RegexObject) -> bool: ... + def __init__(self, obj: SimpleLazyObject) -> None: ... \ No newline at end of file diff --git a/django/db/migrations/writer.pyi b/django/db/migrations/writer.pyi new file mode 100644 index 0000000..fa6b639 --- /dev/null +++ b/django/db/migrations/writer.pyi @@ -0,0 +1,41 @@ +from django.db.migrations.migration import Migration +from django.db.migrations.operations.base import Operation +from typing import ( + Any, + Set, + Tuple, + Type, + Union, +) + + +class MigrationWriter: + def __init__(self, migration: Migration) -> None: ... + def as_string(self) -> str: ... + @property + def basedir(self) -> str: ... + @property + def filename(self) -> str: ... + @property + def path(self) -> str: ... + @classmethod + def serialize(cls, value: Any) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ... + + +class OperationWriter: + def __init__(self, operation: Operation, indentation: int = ...) -> None: ... + def feed(self, line: str) -> None: ... + def indent(self) -> None: ... + def render(self) -> str: ... + def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ... + def unindent(self) -> None: ... + + +class SettingsReference: + def __init__(self, value: str, setting_name: str) -> None: ... + @staticmethod + def __new__( + self: Type[SettingsReference], + value: str, + setting_name: str + ) -> SettingsReference: ... \ No newline at end of file diff --git a/django/db/models/aggregates.pyi b/django/db/models/aggregates.pyi new file mode 100644 index 0000000..1642f64 --- /dev/null +++ b/django/db/models/aggregates.pyi @@ -0,0 +1,66 @@ +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.fields import Field +from django.db.models.query_utils import Q +from django.db.models.sql.compiler import SQLCompiler +from django.db.models.sql.query import Query +from typing import ( + Any, + Dict, + List, + Optional, +) + + +class Aggregate: + def __init__(self, *args, filter = ..., **kwargs) -> None: ... + def _get_repr_options(self) -> Dict[str, Q]: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + **extra_context + ) -> Any: ... + @property + def default_alias(self) -> str: ... + def get_group_by_cols(self) -> List[Any]: ... + def get_source_expressions(self) -> Any: ... + def get_source_fields(self) -> Any: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: None = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> Aggregate: ... + def set_source_expressions(self, exprs: Any) -> None: ... + + +class Avg: + def _resolve_output_field(self) -> Field: ... + + +class Count: + def __init__( + self, + expression: str, + distinct: bool = ..., + filter: Optional[Q] = ..., + **extra + ) -> None: ... + def _get_repr_options(self) -> Dict[str, bool]: ... + def convert_value( + self, + value: Optional[int], + expression: Count, + connection: DatabaseWrapper + ) -> int: ... + + +class StdDev: + def __init__(self, expression: str, sample: bool = ..., **extra) -> None: ... + + +class Variance: + def __init__(self, expression: str, sample: bool = ..., **extra) -> None: ... + def _get_repr_options(self) -> Dict[str, bool]: ... \ No newline at end of file diff --git a/django/db/models/base.pyi b/django/db/models/base.pyi new file mode 100644 index 0000000..dc9c9cd --- /dev/null +++ b/django/db/models/base.pyi @@ -0,0 +1,18 @@ +from typing import ( + Any, + Dict, + List, +) + + +class Model: + def __eq__(self, other: object) -> bool: ... + def __getstate__(self) -> Dict[str, Any]: ... + def __hash__(self) -> int: ... + def __init__(self, *args, **kwargs) -> None: ... + def __reduce__(self) -> Any: ... + def __repr__(self) -> str: ... + def __setstate__(self, state: Dict[str, Any]) -> None: ... + def __str__(self) -> str: ... + @classmethod + def _check_column_name_clashes(cls) -> List[Any]: ... \ No newline at end of file diff --git a/django/db/models/deletion.pyi b/django/db/models/deletion.pyi new file mode 100644 index 0000000..a7e9565 --- /dev/null +++ b/django/db/models/deletion.pyi @@ -0,0 +1,94 @@ +from django.db.models.base import Model +from django.db.models.fields.related import ForeignKey +from django.db.models.fields.reverse_related import ManyToOneRel +from django.db.models.options import Options +from django.db.models.query import QuerySet +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Tuple, + Union, +) + + +def CASCADE( + collector: Collector, + field: ForeignKey, + sub_objs: QuerySet, + using: str +) -> None: ... + + +def SET(value: int) -> Callable: ... + + +def SET_DEFAULT( + collector: Collector, + field: ForeignKey, + sub_objs: QuerySet, + using: str +) -> None: ... + + +def SET_NULL( + collector: Collector, + field: ForeignKey, + sub_objs: QuerySet, + using: str +) -> None: ... + + +def get_candidate_relations_to_delete(opts: Options) -> Iterator[Any]: ... + + +class Collector: + def __init__(self, using: str) -> None: ... + def add( + self, + objs: Any, + source: Any = ..., + nullable: bool = ..., + reverse_dependency: bool = ... + ) -> Any: ... + def add_field_update( + self, + field: ForeignKey, + value: Optional[int], + objs: QuerySet + ) -> None: ... + def can_fast_delete( + self, + objs: Any, + from_field: Optional[ForeignKey] = ... + ) -> bool: ... + def collect( + self, + objs: Any, + source: Any = ..., + nullable: bool = ..., + collect_related: bool = ..., + source_attr: Optional[str] = ..., + reverse_dependency: bool = ..., + keep_parents: bool = ... + ) -> None: ... + def delete(self) -> Union[Tuple[int, Dict[Any, Any]], Tuple[int, Dict[str, int]]]: ... + def get_del_batches(self, objs: Any, field: ForeignKey) -> Any: ... + def instances_with_model(self) -> Iterator[Any]: ... + def related_objects( + self, + related: ManyToOneRel, + objs: Any + ) -> QuerySet: ... + def sort(self) -> None: ... + + +class ProtectedError: + def __init__( + self, + msg: str, + protected_objects: Union[QuerySet, List[Model]] + ) -> None: ... \ No newline at end of file diff --git a/django/db/models/expressions.pyi b/django/db/models/expressions.pyi new file mode 100644 index 0000000..182a4cb --- /dev/null +++ b/django/db/models/expressions.pyi @@ -0,0 +1,335 @@ +from collections import OrderedDict +from datetime import ( + datetime, + timedelta, +) +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.aggregates import Count +from django.db.models.fields import Field +from django.db.models.fields.related import ForeignKey +from django.db.models.fields.reverse_related import ForeignObjectRel +from django.db.models.functions.datetime import Trunc +from django.db.models.functions.text import BytesToCharFieldConversionMixin +from django.db.models.query_utils import Q +from django.db.models.sql.compiler import SQLCompiler +from django.db.models.sql.query import Query +from django.db.models.sql.where import WhereNode +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Set, + Tuple, + Union, +) + + +class BaseExpression: + def __eq__(self, other: Expression) -> bool: ... + def __getstate__(self) -> Dict[str, Any]: ... + def __hash__(self) -> int: ... + def __init__( + self, + output_field: Optional[Union[str, ForeignObjectRel, Field]] = ... + ) -> None: ... + @staticmethod + def _convert_value_noop( + value: str, + expression: BytesToCharFieldConversionMixin, + connection: DatabaseWrapper + ) -> str: ... + @cached_property + def _output_field_or_none(self) -> Any: ... + def _parse_expressions(self, *expressions) -> Any: ... + def _prepare(self, field: Any) -> Expression: ... + def _resolve_output_field(self) -> Any: ... + def asc(self, **kwargs) -> OrderBy: ... + @cached_property + def contains_aggregate(self) -> bool: ... + @cached_property + def contains_column_references(self) -> bool: ... + @cached_property + def contains_over_clause(self) -> bool: ... + @cached_property + def convert_value(self) -> Callable: ... + def copy(self) -> BaseExpression: ... + def desc(self, **kwargs) -> OrderBy: ... + @property + def field(self) -> Any: ... + def flatten(self) -> Iterator[Union[Value, Func]]: ... + def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ... + def get_group_by_cols( + self + ) -> Union[List[CombinedExpression], List[Trunc], List[Col]]: ... + def get_lookup(self, lookup: str) -> Any: ... + def get_source_expressions(self) -> List[Any]: ... + def get_source_fields(self) -> Any: ... + def get_transform(self, name: str) -> Any: ... + @cached_property + def output_field(self) -> Field: ... + def relabeled_clone( + self, + change_map: Union[OrderedDict, Dict[Union[str, None], str]] + ) -> Expression: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: Optional[Set[str]] = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> BaseExpression: ... + def set_source_expressions(self, exprs: List[Any]) -> None: ... + + +class Case: + def __init__(self, *cases, default = ..., output_field = ..., **extra) -> None: ... + def __repr__(self) -> str: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + template: None = ..., + case_joiner: None = ..., + **extra_context + ) -> Any: ... + def copy(self) -> Case: ... + def get_source_expressions(self) -> List[Expression]: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: None = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> Case: ... + def set_source_expressions(self, exprs: List[Expression]) -> None: ... + + +class Col: + def __init__(self, alias: str, target: Field, output_field: Any = ...) -> None: ... + def __repr__(self) -> str: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + def get_db_converters(self, connection: DatabaseWrapper) -> List[Callable]: ... + def get_group_by_cols(self) -> List[Col]: ... + def relabeled_clone( + self, + relabels: Union[OrderedDict, Dict[str, str]] + ) -> Col: ... + + +class Combinable: + def __add__(self, other: Any) -> CombinedExpression: ... + def __mod__(self, other: int) -> CombinedExpression: ... + def __mul__( + self, + other: Union[int, F, Value] + ) -> CombinedExpression: ... + def __radd__( + self, + other: Optional[Union[float, int, timedelta]] + ) -> CombinedExpression: ... + def __rand__(self, other: object): ... + def __rmul__(self, other: float) -> CombinedExpression: ... + def __ror__(self, other: object): ... + def __rsub__(self, other: Union[float, int]) -> CombinedExpression: ... + def __rtruediv__(self, other: int) -> CombinedExpression: ... + def __sub__( + self, + other: Union[float, timedelta, int, F] + ) -> CombinedExpression: ... + def __truediv__( + self, + other: Union[int, Count] + ) -> CombinedExpression: ... + def _combine(self, other: Any, connector: str, reversed: bool) -> CombinedExpression: ... + def bitleftshift(self, other: int) -> CombinedExpression: ... + + +class CombinedExpression: + def __init__( + self, + lhs: Combinable, + connector: str, + rhs: Combinable, + output_field: None = ... + ) -> None: ... + def __str__(self) -> str: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[datetime]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[float]]]: ... + def get_source_expressions(self) -> Any: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: Optional[Set[str]] = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> CombinedExpression: ... + def set_source_expressions(self, exprs: Any) -> None: ... + + +class DurationExpression: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + def compile( + self, + side: Expression, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ... + + +class DurationValue: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + + +class Exists: + def __init__(self, *args, negated = ..., **kwargs) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + template: None = ..., + **extra_context + ) -> Union[Tuple[str, Tuple[int]], Tuple[str, Tuple]]: ... + def resolve_expression( + self, + query: Query = ..., + *args, + **kwargs + ) -> Exists: ... + + +class ExpressionList: + def __init__(self, *expressions, **extra): ... + + +class ExpressionWrapper: + def __init__( + self, + expression: Union[Q, CombinedExpression], + output_field: Field + ) -> None: ... + def __repr__(self) -> str: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ... + def get_source_expressions( + self + ) -> Union[List[Q], List[CombinedExpression], List[WhereNode]]: ... + def set_source_expressions( + self, + exprs: Union[List[WhereNode], List[CombinedExpression]] + ) -> None: ... + + +class F: + def __eq__(self, other: F) -> bool: ... + def __hash__(self) -> int: ... + def __init__(self, name: Union[str, OuterRef]) -> None: ... + def __repr__(self) -> str: ... + def asc(self, **kwargs) -> OrderBy: ... + def desc(self, **kwargs) -> OrderBy: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: Optional[Set[str]] = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> Expression: ... + + +class Func: + def __init__(self, *expressions, output_field = ..., **extra) -> None: ... + def __repr__(self) -> str: ... + def _get_repr_options(self) -> Dict[Any, Any]: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + function: Optional[str] = ..., + template: Optional[str] = ..., + arg_joiner: Optional[str] = ..., + **extra_context + ) -> Any: ... + def copy(self) -> Func: ... + def get_source_expressions(self) -> Any: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: None = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> Func: ... + def set_source_expressions(self, exprs: Any) -> None: ... + + +class OrderBy: + def __init__( + self, + expression: Combinable, + descending: bool = ..., + nulls_first: bool = ..., + nulls_last: bool = ... + ) -> None: ... + def __repr__(self) -> str: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + template: Optional[str] = ..., + **extra_context + ) -> Union[Tuple[str, List[int]], Tuple[str, Tuple], Tuple[str, List[Any]]]: ... + def as_sqlite( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Any: ... + def get_source_expressions(self) -> Any: ... + def reverse_ordering(self) -> OrderBy: ... + def set_source_expressions(self, exprs: Any) -> None: ... + + +class OuterRef: + def _prepare( + self, + output_field: ForeignKey = ... + ) -> OuterRef: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: None = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> F: ... + + +class Random: + def __repr__(self) -> str: ... + + +class RawSQL: + def __init__(self, sql: str, params: List[int], output_field: None = ...) -> None: ... \ No newline at end of file diff --git a/django/db/models/fields/__init__.pyi b/django/db/models/fields/__init__.pyi new file mode 100644 index 0000000..9ab7c3b --- /dev/null +++ b/django/db/models/fields/__init__.pyi @@ -0,0 +1,117 @@ +from datetime import date +from django.core.checks.messages import ( + Error, + Warning, +) +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.base import Model +from django.db.models.expressions import OuterRef +from django.db.models.sql.compiler import SQLCompiler +from django.forms.fields import ( + BaseTemporalField, + BooleanField, + CharField, + IntegerField, + SplitDateTimeField, + TypedChoiceField, +) +from typing import ( + Any, + List, + Optional, + Union, +) + + +class AutoField: + def __init__(self, *args, **kwargs) -> None: ... + def _check_primary_key(self) -> List[Any]: ... + def check(self, **kwargs) -> List[Any]: ... + def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ... + def deconstruct(self) -> Any: ... + def formfield(self, **kwargs) -> None: ... + def get_db_prep_value( + self, + value: Union[str, int], + connection: DatabaseWrapper, + prepared: bool = ... + ) -> Union[str, int]: ... + def get_internal_type(self) -> str: ... + def get_prep_value(self, value: Any) -> Optional[Union[int, OuterRef]]: ... + def rel_db_type(self, connection: DatabaseWrapper) -> str: ... + def to_python(self, value: Optional[Union[str, int]]) -> Optional[int]: ... + def validate(self, value: int, model_instance: Model) -> None: ... + + +class BigAutoField: + def get_internal_type(self) -> str: ... + def rel_db_type(self, connection: DatabaseWrapper) -> str: ... + + +class BigIntegerField: + def formfield(self, **kwargs) -> IntegerField: ... + def get_internal_type(self) -> str: ... + + +class BinaryField: + def __init__(self, *args, **kwargs) -> None: ... + def deconstruct(self) -> Any: ... + def get_db_prep_value( + self, + value: Optional[Union[bytes, memoryview]], + connection: DatabaseWrapper, + prepared: bool = ... + ) -> Optional[memoryview]: ... + def get_default(self) -> Optional[bytes]: ... + def get_internal_type(self) -> str: ... + def get_placeholder( + self, + value: Optional[memoryview], + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> str: ... + def to_python(self, value: Optional[Union[str, bytes]]) -> Optional[Union[bytes, memoryview]]: ... + + +class BooleanField: + def formfield(self, **kwargs) -> BooleanField: ... + def get_internal_type(self) -> str: ... + def get_prep_value(self, value: Optional[Union[str, int]]) -> Optional[bool]: ... + def to_python(self, value: Optional[Union[str, int]]) -> bool: ... + + +class CharField: + def __init__(self, *args, **kwargs) -> None: ... + def _check_max_length_attribute(self, **kwargs) -> List[Error]: ... + def check(self, **kwargs) -> List[Error]: ... + def formfield(self, **kwargs) -> Union[CharField, TypedChoiceField]: ... + def get_internal_type(self) -> str: ... + def get_prep_value(self, value: Any) -> object: ... + def to_python(self, value: Optional[Union[int, str, Model]]) -> Optional[str]: ... + + +class DateField: + def __init__( + self, + verbose_name: Optional[str] = ..., + name: Optional[str] = ..., + auto_now: bool = ..., + auto_now_add: bool = ..., + **kwargs + ) -> None: ... + def _check_fix_default_value(self) -> List[Warning]: ... + def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ... + def deconstruct(self) -> Any: ... + def formfield( + self, + **kwargs + ) -> Union[SplitDateTimeField, BaseTemporalField]: ... + def get_db_prep_value( + self, + value: Optional[Union[date, str]], + connection: DatabaseWrapper, + prepared: bool = ... + ) -> Optional[str]: ... + def get_internal_type(self) -> str: ... + def get_prep_value(self, value: Optional[Union[str, date]]) -> Optional[date]: ... + def pre_save(self, model_instance: Model, add: bool) -> Optional[date]: ... \ No newline at end of file diff --git a/django/db/models/fields/files.pyi b/django/db/models/fields/files.pyi new file mode 100644 index 0000000..5673539 --- /dev/null +++ b/django/db/models/fields/files.pyi @@ -0,0 +1,92 @@ +from django.core.checks.messages import Error +from django.core.files.base import ( + ContentFile, + File, +) +from django.core.files.storage import Storage +from django.core.files.uploadedfile import ( + InMemoryUploadedFile, + SimpleUploadedFile, + UploadedFile, +) +from django.db.models.base import Model +from django.forms.fields import FileField +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) + + +class FieldFile: + def __eq__(self, other: Optional[Union[Tuple, str, FieldFile]]) -> bool: ... + def __getstate__(self) -> Dict[str, Union[str, bool, None]]: ... + def __init__( + self, + instance: Model, + field: FileField, + name: Optional[str] + ) -> None: ... + def _del_file(self) -> None: ... + def _get_file(self) -> File: ... + def _require_file(self) -> None: ... + def _set_file(self, file: Optional[File]) -> None: ... + def close(self) -> None: ... + def delete(self, save: bool = ...) -> None: ... + def open(self, mode: str = ...) -> FieldFile: ... + def save( + self, + name: str, + content: Union[ContentFile, UploadedFile], + save: bool = ... + ) -> None: ... + @property + def url(self) -> str: ... + + +class FileDescriptor: + def __get__( + self, + instance: Any, + cls: Any = ... + ) -> Union[FileDescriptor, FieldFile]: ... + def __init__(self, field: FileField) -> None: ... + def __set__( + self, + instance: Model, + value: Optional[Union[str, FieldFile, InMemoryUploadedFile]] + ) -> None: ... + + +class FileField: + def __init__( + self, + verbose_name: Optional[str] = ..., + name: None = ..., + upload_to: Union[str, Callable] = ..., + storage: Optional[Storage] = ..., + **kwargs + ) -> None: ... + def _check_primary_key(self) -> List[Error]: ... + def _check_upload_to(self) -> List[Any]: ... + def check(self, **kwargs) -> List[Any]: ... + def contribute_to_class(self, cls: Any, name: str, **kwargs) -> None: ... + def deconstruct(self) -> Any: ... + def formfield(self, **kwargs) -> FileField: ... + def generate_filename(self, instance: Any, filename: str) -> str: ... + def get_internal_type(self) -> str: ... + def get_prep_value(self, value: FieldFile) -> str: ... + def pre_save( + self, + model_instance: Model, + add: bool + ) -> FieldFile: ... + def save_form_data( + self, + instance: Model, + data: Optional[Union[bool, FieldFile, SimpleUploadedFile]] + ) -> None: ... \ No newline at end of file diff --git a/django/db/models/fields/mixins.pyi b/django/db/models/fields/mixins.pyi new file mode 100644 index 0000000..966265c --- /dev/null +++ b/django/db/models/fields/mixins.pyi @@ -0,0 +1,9 @@ +from django.db.models.base import Model +from typing import Any + + +class FieldCacheMixin: + def delete_cached_value(self, instance: Model) -> None: ... + def get_cached_value(self, instance: Model, default: object = ...) -> Any: ... + def is_cached(self, instance: Model) -> bool: ... + def set_cached_value(self, instance: Model, value: Any) -> None: ... \ No newline at end of file diff --git a/django/db/models/fields/proxy.pyi b/django/db/models/fields/proxy.pyi new file mode 100644 index 0000000..77177bf --- /dev/null +++ b/django/db/models/fields/proxy.pyi @@ -0,0 +1,2 @@ +class OrderWrt: + def __init__(self, *args, **kwargs) -> None: ... \ No newline at end of file diff --git a/django/db/models/fields/related.pyi b/django/db/models/fields/related.pyi new file mode 100644 index 0000000..c20ee9a --- /dev/null +++ b/django/db/models/fields/related.pyi @@ -0,0 +1,101 @@ +from django.core.checks.messages import ( + Error, + Warning, +) +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.expressions import Col +from django.db.models.fields import Field +from django.db.models.fields.reverse_related import ( + ForeignObjectRel, + ManyToOneRel, +) +from django.db.models.query_utils import ( + FilteredRelation, + PathInfo, +) +from django.forms.models import ModelChoiceField +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) +from uuid import UUID + + +class ForeignKey: + def __init__( + self, + to: Any, + on_delete: Callable, + related_name: Optional[str] = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: Any = ..., + parent_link: bool = ..., + to_field: Optional[str] = ..., + db_constraint: bool = ..., + **kwargs + ) -> None: ... + def _check_on_delete(self) -> List[Any]: ... + def _check_unique(self, **kwargs) -> List[Warning]: ... + def check( + self, + **kwargs + ) -> Union[List[Error], List[Warning]]: ... + def contribute_to_related_class( + self, + cls: Any, + related: ManyToOneRel + ) -> None: ... + def db_check(self, connection: DatabaseWrapper) -> List[Any]: ... + def db_parameters(self, connection: DatabaseWrapper) -> Dict[str, str]: ... + def db_type(self, connection: DatabaseWrapper) -> str: ... + def deconstruct(self) -> Any: ... + def formfield(self, *, using = ..., **kwargs) -> ModelChoiceField: ... + def get_attname(self) -> str: ... + def get_attname_column(self) -> Tuple[str, str]: ... + def get_col(self, alias: str, output_field: Any = ...) -> Col: ... + def get_db_converters(self, connection: DatabaseWrapper) -> List[Any]: ... + def get_db_prep_save( + self, + value: Any, + connection: DatabaseWrapper + ) -> Optional[Union[str, int]]: ... + def get_db_prep_value( + self, + value: Union[str, UUID, int], + connection: DatabaseWrapper, + prepared: bool = ... + ) -> Union[str, int]: ... + def get_default(self) -> Optional[int]: ... + def get_reverse_path_info( + self, + filtered_relation: Optional[FilteredRelation] = ... + ) -> List[PathInfo]: ... + @property + def target_field(self) -> Field: ... + def to_python(self, value: Union[str, int]) -> Union[str, int]: ... + def validate(self, value: int, model_instance: Any) -> None: ... + + +class ForeignObject: + def __init__( + self, + to: Any, + on_delete: Callable, + from_fields: Union[Tuple[str, str], List[str]], + to_fields: Union[List[str], List[None], Tuple[str, str]], + rel: Optional[ForeignObjectRel] = ..., + related_name: Optional[str] = ..., + related_query_name: None = ..., + limit_choices_to: None = ..., + parent_link: bool = ..., + swappable: bool = ..., + **kwargs + ) -> None: ... + def _check_to_fields_exist(self) -> List[Error]: ... + def _check_unique_target(self) -> List[Error]: ... + def check(self, **kwargs) -> List[Error]: ... \ No newline at end of file diff --git a/django/db/models/fields/related_descriptors.pyi b/django/db/models/fields/related_descriptors.pyi new file mode 100644 index 0000000..949b581 --- /dev/null +++ b/django/db/models/fields/related_descriptors.pyi @@ -0,0 +1,61 @@ +from django.core.exceptions import ObjectDoesNotExist +from django.db.models.base import Model +from django.db.models.fields.related import ForeignObject +from django.db.models.fields.reverse_related import ( + ForeignObjectRel, + ManyToManyRel, + OneToOneRel, +) +from django.db.models.query import QuerySet +from typing import ( + Any, + Callable, + Optional, + Tuple, + Type, +) + + +class ForwardManyToOneDescriptor: + @cached_property + def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ... + def __get__(self, instance: Any, cls: Any = ...) -> Any: ... + def __init__(self, field_with_rel: ForeignObject) -> None: ... + def __set__(self, instance: Model, value: Any) -> None: ... + def get_object(self, instance: Model) -> Model: ... + def get_prefetch_queryset( + self, + instances: Any, + queryset: Optional[QuerySet] = ... + ) -> Tuple[QuerySet, Callable, Callable, bool, str, bool]: ... + def get_queryset(self, **hints) -> QuerySet: ... + def is_cached(self, instance: Model) -> bool: ... + + +class ForwardOneToOneDescriptor: + def __set__(self, instance: Model, value: Any) -> None: ... + def get_object(self, instance: Model) -> Model: ... + + +class ManyToManyDescriptor: + def __init__(self, rel: ManyToManyRel, reverse: bool = ...) -> None: ... + + +class ReverseManyToOneDescriptor: + def __get__( + self, + instance: Optional[Model], + cls: Any = ... + ) -> ReverseManyToOneDescriptor: ... + def __init__(self, rel: ForeignObjectRel) -> None: ... + def _get_set_deprecation_msg_params(self) -> Tuple[str, str]: ... + + +class ReverseOneToOneDescriptor: + @cached_property + def RelatedObjectDoesNotExist(self) -> Type[ObjectDoesNotExist]: ... + def __get__(self, instance: Any, cls: Any = ...) -> Any: ... + def __init__(self, related: OneToOneRel) -> None: ... + def __set__(self, instance: Model, value: Optional[Model]) -> None: ... + def get_queryset(self, **hints) -> QuerySet: ... + def is_cached(self, instance: Model) -> bool: ... \ No newline at end of file diff --git a/django/db/models/fields/related_lookups.pyi b/django/db/models/fields/related_lookups.pyi new file mode 100644 index 0000000..3aa58a6 --- /dev/null +++ b/django/db/models/fields/related_lookups.pyi @@ -0,0 +1,63 @@ +from collections import OrderedDict +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.expressions import Col +from django.db.models.fields import ( + AutoField, + IntegerField, +) +from django.db.models.fields.related import ( + ForeignKey, + ForeignObject, +) +from django.db.models.sql.compiler import SQLCompiler +from django.db.models.sql.query import Query +from typing import ( + Any, + List, + Tuple, + Type, + Union, +) +from uuid import UUID + + +def get_normalized_value( + value: Any, + lhs: Union[MultiColSource, Col] +) -> Any: ... + + +class MultiColSource: + def __init__( + self, + alias: str, + targets: Union[Tuple[IntegerField, related.ForeignKey], Tuple[IntegerField, IntegerField]], + sources: Union[Tuple[AutoField, IntegerField], Tuple[IntegerField, AutoField]], + field: related.ForeignObject + ) -> None: ... + def get_lookup( + self, + lookup: str + ) -> Type[Union[RelatedIn, RelatedExact]]: ... + def relabeled_clone( + self, + relabels: OrderedDict + ) -> MultiColSource: ... + + +class RelatedIn: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + def get_prep_lookup(self) -> Union[List[UUID], Query, List[int], List[str]]: ... + + +class RelatedLookupMixin: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + def get_prep_lookup(self) -> Any: ... \ No newline at end of file diff --git a/django/db/models/fields/reverse_related.pyi b/django/db/models/fields/reverse_related.pyi new file mode 100644 index 0000000..3a464e7 --- /dev/null +++ b/django/db/models/fields/reverse_related.pyi @@ -0,0 +1,122 @@ +from django.db.models.base import Model +from django.db.models.fields import ( + AutoField, + Field, +) +from django.db.models.fields.related import ( + ForeignKey, + ManyToManyField, + RelatedField, +) +from django.db.models.fields.related_lookups import ( + RelatedExact, + RelatedIn, + RelatedIsNull, +) +from django.db.models.query_utils import ( + FilteredRelation, + PathInfo, +) +from django.db.models.sql.where import WhereNode +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +class ForeignObjectRel: + def __init__( + self, + field: RelatedField, + to: Any, + related_name: Optional[str] = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: Any = ..., + parent_link: bool = ..., + on_delete: Optional[Callable] = ... + ) -> None: ... + def __repr__(self) -> str: ... + @property + def db_type(self) -> Callable: ... + def get_accessor_name(self, model: Any = ...) -> Optional[str]: ... + def get_cache_name(self) -> str: ... + def get_choices( + self, + include_blank: bool = ..., + blank_choice: List[Tuple[str, str]] = ... + ) -> List[Tuple[int, str]]: ... + def get_extra_restriction( + self, + where_class: Type[WhereNode], + alias: str, + related_alias: str + ) -> Optional[WhereNode]: ... + def get_internal_type(self) -> str: ... + def get_joining_columns(self) -> Union[Tuple[Tuple[str, str]], Tuple[Tuple[str, str], Tuple[str, str]]]: ... + def get_lookup( + self, + lookup_name: str + ) -> Type[Union[RelatedIsNull, RelatedIn, RelatedExact]]: ... + def get_path_info( + self, + filtered_relation: Optional[FilteredRelation] = ... + ) -> List[PathInfo]: ... + @cached_property + def hidden(self) -> bool: ... + def is_hidden(self) -> bool: ... + @cached_property + def many_to_many(self) -> bool: ... + @cached_property + def many_to_one(self) -> bool: ... + @cached_property + def name(self) -> str: ... + @cached_property + def one_to_many(self) -> bool: ... + @cached_property + def one_to_one(self) -> bool: ... + @cached_property + def related_model(self) -> Any: ... + @property + def remote_field( + self + ) -> Union[ManyToManyField, ForeignKey]: ... + def set_field_name(self) -> None: ... + @property + def target_field(self) -> AutoField: ... + + +class ManyToManyRel: + def __init__( + self, + field: RelatedField, + to: Any, + related_name: Optional[str] = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: Optional[Callable] = ..., + symmetrical: bool = ..., + through: Optional[Union[str, Type[Model]]] = ..., + through_fields: Optional[Tuple[str, str]] = ..., + db_constraint: bool = ... + ) -> None: ... + def get_related_field(self) -> Field: ... + + +class ManyToOneRel: + def __getstate__(self) -> Dict[str, Any]: ... + def __init__( + self, + field: ForeignKey, + to: Any, + field_name: Optional[str], + related_name: Optional[str] = ..., + related_query_name: Optional[str] = ..., + limit_choices_to: Any = ..., + parent_link: bool = ..., + on_delete: Callable = ... + ) -> None: ... \ No newline at end of file diff --git a/django/db/models/functions/comparison.pyi b/django/db/models/functions/comparison.pyi new file mode 100644 index 0000000..bb944a1 --- /dev/null +++ b/django/db/models/functions/comparison.pyi @@ -0,0 +1,50 @@ +from datetime import ( + date, + datetime, +) +from decimal import Decimal +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.fields import Field +from django.db.models.sql.compiler import SQLCompiler +from typing import ( + Any, + List, + Tuple, + Union, +) + + +class Cast: + def __init__( + self, + expression: Union[str, date, Decimal], + output_field: Field + ) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + **extra_context + ) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ... + + +class Coalesce: + def __init__(self, *expressions, **extra) -> None: ... + + +class Greatest: + def __init__(self, *expressions, **extra) -> None: ... + def as_sqlite( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + + +class Least: + def __init__(self, *expressions, **extra) -> None: ... + def as_sqlite( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[datetime]], Tuple[str, List[Any]]]: ... \ No newline at end of file diff --git a/django/db/models/functions/datetime.pyi b/django/db/models/functions/datetime.pyi new file mode 100644 index 0000000..5670df1 --- /dev/null +++ b/django/db/models/functions/datetime.pyi @@ -0,0 +1,102 @@ +from datetime import ( + date, + time, +) +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.expressions import Col +from django.db.models.fields import ( + DateTimeCheckMixin, + IntegerField, +) +from django.db.models.sql.compiler import SQLCompiler +from django.db.models.sql.query import Query +from typing import ( + Any, + List, + Optional, + Tuple, + Union, +) + + +class Extract: + def __init__( + self, + expression: Union[str, Col, TruncDate], + lookup_name: Optional[str] = ..., + tzinfo: None = ..., + **extra + ) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: None = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> Extract: ... + + +class TimezoneMixin: + def get_tzname(self) -> Optional[str]: ... + + +class Trunc: + def __init__( + self, + expression: str, + kind: str, + output_field: Optional[Union[IntegerField, DateTimeCheckMixin]] = ..., + tzinfo: None = ..., + **extra + ) -> None: ... + + +class TruncBase: + def __init__( + self, + expression: Union[str, Col], + output_field: Optional[DateTimeCheckMixin] = ..., + tzinfo: None = ..., + **extra + ) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + def convert_value( + self, + value: Union[date, time], + expression: django.db.models.functions.TruncBase, + connection: DatabaseWrapper + ) -> Union[date, time]: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: None = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> TruncBase: ... + + +class TruncDate: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + + +class TruncTime: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... \ No newline at end of file diff --git a/django/db/models/functions/text.pyi b/django/db/models/functions/text.pyi new file mode 100644 index 0000000..fb600ae --- /dev/null +++ b/django/db/models/functions/text.pyi @@ -0,0 +1,112 @@ +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.expressions import ( + Col, + F, + Value, +) +from django.db.models.sql.compiler import SQLCompiler +from typing import ( + Any, + List, + Tuple, + Union, +) + + +class BytesToCharFieldConversionMixin: + def convert_value( + self, + value: str, + expression: LPad, + connection: DatabaseWrapper + ) -> str: ... + + +class Chr: + def as_sqlite( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + **extra_context + ) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ... + + +class Concat: + def __init__(self, *expressions, **extra) -> None: ... + def _paired( + self, + expressions: Union[Tuple[Value, str], Tuple[str, str], Tuple[Value, str, Value]] + ) -> ConcatPair: ... + + +class ConcatPair: + def as_sqlite( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[str]]: ... + def coalesce(self) -> ConcatPair: ... + + +class LPad: + def __init__( + self, + expression: str, + length: Union[int, Length], + fill_text: Value = ..., + **extra + ) -> None: ... + + +class Left: + def __init__(self, expression: str, length: int, **extra) -> None: ... + def get_substr(self) -> Substr: ... + def use_substr( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + **extra_context + ) -> Tuple[str, List[int]]: ... + + +class Ord: + def as_sqlite( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + **extra_context + ) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + + +class Replace: + def __init__( + self, + expression: F, + text: Value, + replacement: Value = ..., + **extra + ) -> None: ... + + +class Right: + def get_substr(self) -> Substr: ... + + +class Substr: + def __init__( + self, + expression: Union[str, Col], + pos: Union[int, Value], + length: Union[int, Value] = ..., + **extra + ) -> None: ... + def as_oracle( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[int]]: ... + def as_sqlite( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[int]], Tuple[str, List[Union[str, int]]]]: ... \ No newline at end of file diff --git a/django/db/models/functions/window.pyi b/django/db/models/functions/window.pyi new file mode 100644 index 0000000..57bdfaf --- /dev/null +++ b/django/db/models/functions/window.pyi @@ -0,0 +1,5 @@ +from typing import Optional + + +class LagLeadFunction: + def __init__(self, expression: Optional[str], offset: int = ..., default: None = ..., **extra): ... \ No newline at end of file diff --git a/django/db/models/indexes.pyi b/django/db/models/indexes.pyi new file mode 100644 index 0000000..b625fbc --- /dev/null +++ b/django/db/models/indexes.pyi @@ -0,0 +1,28 @@ +from django.db.backends.ddl_references import Statement +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.models.base import Model +from typing import ( + Any, + Dict, + List, + Tuple, + Type, + Union, +) + + +class Index: + def __eq__(self, other: Index) -> bool: ... + def __init__(self, *, fields = ..., name = ..., db_tablespace = ...) -> None: ... + @staticmethod + def _hash_generator(*args) -> str: ... + def check_name(self) -> List[Any]: ... + def clone(self) -> Index: ... + def create_sql( + self, + model: Type[Model], + schema_editor: DatabaseSchemaEditor, + using: str = ... + ) -> Statement: ... + def deconstruct(self) -> Tuple[str, Tuple, Dict[str, Union[List[str], str]]]: ... + def set_name_with_model(self, model: Type[Model]) -> None: ... \ No newline at end of file diff --git a/django/db/models/lookups.pyi b/django/db/models/lookups.pyi new file mode 100644 index 0000000..b06c5b4 --- /dev/null +++ b/django/db/models/lookups.pyi @@ -0,0 +1,217 @@ +from collections import OrderedDict +from datetime import datetime +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.expressions import ( + Col, + CombinedExpression, + Expression, + Ref, +) +from django.db.models.sql.compiler import SQLCompiler +from django.db.models.sql.query import Query +from django.utils.datastructures import OrderedSet +from django.utils.safestring import SafeText +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +class BuiltinLookup: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Any: ... + def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ... + def process_lhs( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + lhs: Optional[Col] = ... + ) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[str, int]]], Tuple[str, List[Any]]]: ... + + +class Exact: + def process_rhs( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Any: ... + + +class FieldGetDbPrepValueIterableMixin: + def batch_process_rhs( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + rhs: Optional[OrderedSet] = ... + ) -> Any: ... + def get_prep_lookup(self) -> Any: ... + def process_rhs( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Any: ... + def resolve_expression_parameter( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + sql: str, + param: Any + ) -> Union[Tuple[str, List[None]], Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + + +class FieldGetDbPrepValueMixin: + def get_db_prep_lookup(self, value: Any, connection: DatabaseWrapper) -> Any: ... + + +class IExact: + def process_rhs( + self, + qn: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + + +class In: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Any: ... + def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ... + def process_rhs( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Any: ... + + +class IntegerFieldFloatRounding: + def get_prep_lookup( + self + ) -> Union[Query, int, CombinedExpression]: ... + + +class IsNull: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + + +class Lookup: + def __init__(self, lhs: Any, rhs: Any) -> None: ... + def apply_bilateral_transforms( + self, + value: Expression + ) -> Transform: ... + def batch_process_rhs( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + rhs: Optional[OrderedSet] = ... + ) -> Any: ... + @cached_property + def contains_aggregate(self) -> bool: ... + @cached_property + def contains_over_clause(self) -> bool: ... + def get_db_prep_lookup( + self, + value: Union[str, int], + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[int]], Tuple[str, List[SafeText]], Tuple[str, List[str]]]: ... + def get_group_by_cols( + self + ) -> Union[List[Col], List[CombinedExpression]]: ... + def get_prep_lookup(self) -> Any: ... + def get_source_expressions(self) -> List[Col]: ... + def process_lhs( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper, + lhs: Optional[Col] = ... + ) -> Any: ... + def process_rhs( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Any: ... + def relabeled_clone( + self, + relabels: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]] + ) -> BuiltinLookup: ... + def rhs_is_direct_value(self) -> bool: ... + def set_source_expressions(self, new_exprs: List[Ref]) -> None: ... + + +class PatternLookup: + def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ... + def process_rhs( + self, + qn: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Any]]]: ... + + +class Range: + def get_rhs_op(self, connection: DatabaseWrapper, rhs: Tuple[str, str]) -> str: ... + + +class Regex: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[str]]: ... + + +class Transform: + def get_bilateral_transforms(self) -> List[Type[Transform]]: ... + @property + def lhs(self) -> Expression: ... + + +class YearComparisonLookup: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[str]]: ... + def get_bound(self, start: datetime, finish: datetime): ... + def get_rhs_op(self, connection: DatabaseWrapper, rhs: str) -> str: ... + + +class YearExact: + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + + +class YearGt: + def get_bound(self, start: str, finish: str) -> str: ... + + +class YearGte: + def get_bound(self, start: str, finish: str) -> str: ... + + +class YearLookup: + def year_lookup_bounds(self, connection: DatabaseWrapper, year: int) -> List[str]: ... + + +class YearLt: + def get_bound(self, start: str, finish: str) -> str: ... + + +class YearLte: + def get_bound(self, start: str, finish: str) -> str: ... \ No newline at end of file diff --git a/django/db/models/manager.pyi b/django/db/models/manager.pyi new file mode 100644 index 0000000..5323661 --- /dev/null +++ b/django/db/models/manager.pyi @@ -0,0 +1,36 @@ +from django.db.models.base import Model +from django.db.models.query import QuerySet +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +class BaseManager: + def __eq__(self, other: Optional[Manager]) -> bool: ... + def __init__(self) -> None: ... + @staticmethod + def __new__(cls: Any, *args, **kwargs) -> Manager: ... + @classmethod + def _get_queryset_methods(cls, queryset_class: Any) -> Dict[str, Callable]: ... + def _set_creation_counter(self) -> None: ... + def all(self) -> QuerySet: ... + def check(self, **kwargs) -> List[Any]: ... + def contribute_to_class(self, model: Any, name: str) -> None: ... + @property + def db(self) -> str: ... + def db_manager(self, using: Optional[str] = ..., hints: Any = ...) -> Manager: ... + def deconstruct( + self + ) -> Union[Tuple[bool, str, None, Tuple[str, str, int, int], Dict[Any, Any]], Tuple[bool, str, None, Tuple, Dict[Any, Any]]]: ... + def get_queryset(self) -> QuerySet: ... + + +class EmptyManager: + def __init__(self, model: Type[Model]) -> None: ... \ No newline at end of file diff --git a/django/db/models/options.pyi b/django/db/models/options.pyi new file mode 100644 index 0000000..d43dfb3 --- /dev/null +++ b/django/db/models/options.pyi @@ -0,0 +1,24 @@ +from django.utils.datastructures import ImmutableList +from typing import ( + Any, + Dict, +) + + +class Options: + def __init__(self, meta: Any, app_label: str = ...) -> None: ... + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def _expire_cache(self, forward: bool = ..., reverse: bool = ...) -> None: ... + @cached_property + def _forward_fields_map(self) -> Dict[str, Any]: ... + def _get_fields( + self, + forward: bool = ..., + reverse: bool = ..., + include_parents: object = ..., + include_hidden: bool = ..., + seen_models: Any = ... + ) -> ImmutableList: ... + def _populate_directed_relation_graph(self) -> Any: ... + def _prepare(self, model: Any) -> None: ... \ No newline at end of file diff --git a/django/db/models/query.pyi b/django/db/models/query.pyi new file mode 100644 index 0000000..72b45f5 --- /dev/null +++ b/django/db/models/query.pyi @@ -0,0 +1,65 @@ +from django.db.models.base import Model +from django.db.models.sql.query import Query +from typing import ( + Any, + Dict, + Iterator, + Optional, + Tuple, + Union, +) + + +class BaseIterable: + def __init__( + self, + queryset: QuerySet, + chunked_fetch: bool = ..., + chunk_size: int = ... + ) -> None: ... + + +class FlatValuesListIterable: + def __iter__(self) -> Iterator[Any]: ... + + +class InstanceCheckMeta: + def __instancecheck__(self, instance: Union[str, QuerySet]) -> bool: ... + + +class ModelIterable: + def __iter__(self) -> Iterator[Model]: ... + + +class NamedValuesListIterable: + def __iter__(self): ... + + +class Prefetch: + def __eq__(self, other: None) -> bool: ... + def __getstate__(self) -> Dict[str, Union[str, QuerySet, None]]: ... + def __hash__(self) -> int: ... + def __init__( + self, + lookup: str, + queryset: Optional[QuerySet] = ..., + to_attr: Optional[str] = ... + ) -> None: ... + def add_prefix(self, prefix: str) -> None: ... + def get_current_prefetch_to(self, level: int) -> str: ... + def get_current_queryset(self, level: int) -> Optional[QuerySet]: ... + def get_current_to_attr(self, level: int) -> Union[Tuple[str, None], Tuple[str, bool]]: ... + + +class QuerySet: + def __and__(self, other: QuerySet) -> QuerySet: ... + def __bool__(self) -> bool: ... + def __getitem__(self, k: Union[slice, int]) -> Any: ... + def __getstate__(self) -> Dict[str, Any]: ... + def __init__( + self, + model: Any = ..., + query: Optional[Query] = ..., + using: Optional[str] = ..., + hints: Dict[str, Model] = ... + ) -> None: ... \ No newline at end of file diff --git a/django/db/models/query_utils.pyi b/django/db/models/query_utils.pyi new file mode 100644 index 0000000..89227a8 --- /dev/null +++ b/django/db/models/query_utils.pyi @@ -0,0 +1,109 @@ +from collections import OrderedDict +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.base import Model +from django.db.models.expressions import F +from django.db.models.fields import Field +from django.db.models.fields.related import ForeignKey +from django.db.models.fields.reverse_related import ManyToOneRel +from django.db.models.options import Options +from django.db.models.sql.compiler import SQLCompiler +from django.db.models.sql.query import Query +from django.db.models.sql.where import WhereNode +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Set, + Tuple, + Union, +) + + +def check_rel_lookup_compatibility( + model: Any, + target_opts: Options, + field: Union[ManyToOneRel, ForeignKey] +) -> bool: ... + + +def refs_expression(lookup_parts: List[str], annotations: OrderedDict) -> Any: ... + + +def select_related_descend( + field: Field, + restricted: bool, + requested: Any, + load_fields: Optional[Set[str]], + reverse: bool = ... +) -> bool: ... + + +def subclasses(cls: Any) -> Iterator[Any]: ... + + +class DeferredAttribute: + def __get__( + self, + instance: Any, + cls: Any = ... + ) -> Optional[Union[DeferredAttribute, str, int]]: ... + def __init__(self, field_name: str) -> None: ... + def _check_parent_chain(self, instance: Model, name: str) -> None: ... + + +class FilteredRelation: + def __eq__(self, other: FilteredRelation) -> bool: ... + def __init__(self, relation_name: str, *, condition = ...) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[str]], Tuple[str, List[int]], Tuple[str, List[Union[int, str]]], Tuple[str, List[Any]]]: ... + def clone(self) -> FilteredRelation: ... + + +class Q: + def __and__(self, other: Q) -> Q: ... + def __init__(self, *args, **kwargs) -> None: ... + def __invert__(self) -> Q: ... + def __or__(self, other: Q) -> Q: ... + def _combine(self, other: Q, conn: str) -> Q: ... + def deconstruct( + self + ) -> Union[Tuple[str, Tuple, Dict[str, F]], Tuple[str, Tuple[Tuple[str, F], Tuple[str, F]], Dict[Any, Any]], Tuple[str, Tuple[Q], Dict[Any, Any]]]: ... + def resolve_expression( + self, + query: Query = ..., + allow_joins: bool = ..., + reuse: Optional[Set[str]] = ..., + summarize: bool = ..., + for_save: bool = ... + ) -> WhereNode: ... + + +class QueryWrapper: + def __init__(self, sql: str, params: List[Any]) -> None: ... + def as_sql( + self, + compiler: SQLCompiler = ..., + connection: DatabaseWrapper = ... + ) -> Tuple[str, List[Any]]: ... + + +class RegisterLookupMixin: + @classmethod + def _clear_cached_lookups(cls) -> None: ... + @classmethod + def _get_lookup(cls, lookup_name: str) -> Any: ... + @classmethod + def _unregister_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> None: ... + def get_lookup(self, lookup_name: str) -> Any: ... + @classmethod + def get_lookups(cls) -> Dict[str, Any]: ... + def get_transform(self, lookup_name: str) -> Any: ... + @staticmethod + def merge_dicts(dicts: Any) -> Dict[str, Any]: ... + @classmethod + def register_lookup(cls, lookup: Any, lookup_name: Optional[str] = ...) -> Any: ... \ No newline at end of file diff --git a/django/db/models/signals.pyi b/django/db/models/signals.pyi new file mode 100644 index 0000000..b68d1f5 --- /dev/null +++ b/django/db/models/signals.pyi @@ -0,0 +1,32 @@ +from django.apps.registry import Apps +from typing import ( + Any, + Callable, + Optional, +) + + +class ModelSignal: + def _lazy_method( + self, + method: Callable, + apps: Optional[Apps], + receiver: Callable, + sender: Any, + **kwargs + ) -> Optional[bool]: ... + def connect( + self, + receiver: Callable, + sender: Any = ..., + weak: bool = ..., + dispatch_uid: None = ..., + apps: None = ... + ) -> None: ... + def disconnect( + self, + receiver: Callable = ..., + sender: Any = ..., + dispatch_uid: None = ..., + apps: None = ... + ) -> bool: ... \ No newline at end of file diff --git a/django/db/models/sql/compiler.pyi b/django/db/models/sql/compiler.pyi new file mode 100644 index 0000000..8c3ee58 --- /dev/null +++ b/django/db/models/sql/compiler.pyi @@ -0,0 +1,116 @@ +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.backends.utils import CursorWrapper +from django.db.models.expressions import ( + Col, + CombinedExpression, + Expression, + OrderBy, +) +from django.db.models.functions.datetime import Trunc +from django.db.models.options import Options +from django.db.models.sql.query import ( + Query, + RawQuery, +) +from itertools import chain +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Set, + Tuple, + Union, +) + + +class SQLAggregateCompiler: + def as_sql(self) -> Any: ... + + +class SQLCompiler: + def __init__( + self, + query: Union[Query, RawQuery], + connection: DatabaseWrapper, + using: Optional[str] + ) -> None: ... + def _setup_joins(self, pieces: List[str], opts: Options, alias: Optional[str]) -> Any: ... + def apply_converters(self, rows: chain, converters: Dict[int, Any]) -> Iterator[Any]: ... + def as_sql(self, with_limits: bool = ..., with_col_aliases: bool = ...): ... + def as_subquery_condition( + self, + alias: str, + columns: List[str], + compiler: SQLCompiler + ) -> Union[Tuple[str, Tuple[str]], Tuple[str, Tuple]]: ... + def collapse_group_by( + self, + expressions: Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]], + having: Union[List[Col], Tuple, List[CombinedExpression]] + ) -> Union[List[Col], List[Union[Col, Trunc]], List[Expression], List[Union[Col, CombinedExpression]]]: ... + def compile(self, node: Any, select_format: object = ...) -> Any: ... + def deferred_to_columns(self) -> Any: ... + def execute_sql( + self, + result_type: str = ..., + chunked_fetch: bool = ..., + chunk_size: int = ... + ) -> Optional[CursorWrapper]: ... + def explain_query(self) -> Iterator[str]: ... + def find_ordering_name( + self, + name: str, + opts: Options, + alias: Optional[str] = ..., + default_order: str = ..., + already_seen: Optional[Union[Set[Tuple[None, Tuple[Tuple[str, str]]]], Set[Tuple[None, Tuple[Tuple[str, str]], Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]], Set[Union[Tuple[None, Tuple[Tuple[str, str]]], Tuple[Tuple[Tuple[str, str]], Tuple[Tuple[str, str]]]]]]] = ... + ) -> List[Tuple[OrderBy, bool]]: ... + def get_combinator_sql( + self, + combinator: str, + all: bool + ) -> Union[Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ... + def get_converters(self, expressions: Any) -> Dict[int, Any]: ... + def get_default_columns( + self, + start_alias: Optional[str] = ..., + opts: Optional[Options] = ..., + from_parent: Any = ... + ) -> List[Col]: ... + def get_distinct(self) -> Tuple[List[Any], List[Any]]: ... + def get_extra_select( + self, + order_by: Union[List[Tuple[OrderBy, Tuple[str, List[Any], bool]]], List[Union[Tuple[OrderBy, Tuple[str, List[int], bool]], Tuple[OrderBy, Tuple[str, List[Any], bool]]]], List[Tuple[OrderBy, Tuple[str, Tuple, bool]]]], + select: Any + ) -> List[Tuple[OrderBy, Tuple[str, List[Any]], None]]: ... + def get_from_clause( + self + ) -> Union[Tuple[List[str], List[Union[int, str]]], Tuple[List[str], List[Any]], Tuple[List[str], List[int]], Tuple[List[str], List[str]]]: ... + def get_group_by( + self, + select: Any, + order_by: Any + ) -> Union[List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[int]]]]]: ... + def get_order_by(self) -> Any: ... + def get_related_selections( + self, + select: Any, + opts: Optional[Options] = ..., + root_alias: Optional[str] = ..., + cur_depth: int = ..., + requested: Any = ..., + restricted: Optional[bool] = ... + ) -> Any: ... + def get_select(self) -> Any: ... + def has_results(self) -> bool: ... + def pre_sql_setup(self) -> Any: ... + def quote_name_unless_alias(self, name: str) -> str: ... + def results_iter( + self, + results: Any = ..., + tuple_expected: bool = ..., + chunked_fetch: bool = ..., + chunk_size: int = ... + ) -> chain: ... \ No newline at end of file diff --git a/django/db/models/sql/datastructures.pyi b/django/db/models/sql/datastructures.pyi new file mode 100644 index 0000000..affaddd --- /dev/null +++ b/django/db/models/sql/datastructures.pyi @@ -0,0 +1,69 @@ +from collections import OrderedDict +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.fields.related import ForeignObject +from django.db.models.fields.reverse_related import ForeignObjectRel +from django.db.models.query_utils import ( + FilteredRelation, + PathInfo, +) +from django.db.models.sql.compiler import SQLCompiler +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Union, +) + + +class BaseTable: + def __init__(self, table_name: str, alias: Optional[str]) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, List[Any]]: ... + def equals(self, other: Join, with_filtered_relation: bool) -> bool: ... + def relabeled_clone(self, change_map: OrderedDict) -> BaseTable: ... + + +class Join: + def __eq__( + self, + other: Union[Join, BaseTable] + ) -> bool: ... + def __init__( + self, + table_name: str, + parent_alias: str, + table_alias: Optional[str], + join_type: str, + join_field: Union[ForeignObjectRel, ForeignObject], + nullable: bool, + filtered_relation: Optional[FilteredRelation] = ... + ) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + def demote(self) -> Join: ... + def equals( + self, + other: Union[Join, BaseTable], + with_filtered_relation: bool + ) -> bool: ... + def promote(self) -> Join: ... + def relabeled_clone( + self, + change_map: Union[Dict[str, str], OrderedDict] + ) -> Join: ... + + +class MultiJoin: + def __init__( + self, + names_pos: int, + path_with_names: List[Tuple[str, List[PathInfo]]] + ) -> None: ... \ No newline at end of file diff --git a/django/db/models/sql/query.pyi b/django/db/models/sql/query.pyi new file mode 100644 index 0000000..170692b --- /dev/null +++ b/django/db/models/sql/query.pyi @@ -0,0 +1,18 @@ +from django.db.models.sql.where import WhereNode +from typing import ( + Any, + Set, + Tuple, + Type, + Union, +) + + +class JoinPromoter: + def __init__(self, connector: str, num_children: int, negated: bool) -> None: ... + def add_votes(self, votes: Union[Tuple, Set[str]]) -> None: ... + def update_join_types(self, query: Query) -> Set[str]: ... + + +class Query: + def __init__(self, model: Any, where: Type[WhereNode] = ...) -> None: ... \ No newline at end of file diff --git a/django/db/models/sql/subqueries.pyi b/django/db/models/sql/subqueries.pyi new file mode 100644 index 0000000..cebf397 --- /dev/null +++ b/django/db/models/sql/subqueries.pyi @@ -0,0 +1,44 @@ +from django.db.models.base import Model +from django.db.models.fields import CharField +from django.db.models.query import QuerySet +from django.db.models.sql.query import Query +from django.db.models.sql.where import WhereNode +from typing import ( + Any, + Dict, + List, + Optional, + Type, + Union, +) + + +class AggregateQuery: + def add_subquery(self, query: Query, using: str) -> None: ... + + +class DeleteQuery: + def delete_batch(self, pk_list: Union[List[int], List[str]], using: str) -> int: ... + def delete_qs(self, query: QuerySet, using: str) -> int: ... + def do_query(self, table: str, where: WhereNode, using: str) -> int: ... + + +class InsertQuery: + def __init__(self, *args, **kwargs) -> None: ... + def insert_values(self, fields: Any, objs: Any, raw: bool = ...) -> None: ... + + +class UpdateQuery: + def __init__(self, *args, **kwargs) -> None: ... + def _setup_query(self) -> None: ... + def add_related_update( + self, + model: Type[Model], + field: CharField, + value: str + ) -> None: ... + def add_update_fields(self, values_seq: Any) -> None: ... + def add_update_values(self, values: Dict[str, Any]) -> None: ... + def clone(self) -> UpdateQuery: ... + def get_related_updates(self) -> List[UpdateQuery]: ... + def update_batch(self, pk_list: List[int], values: Dict[str, Union[None, int]], using: str) -> None: ... \ No newline at end of file diff --git a/django/db/models/sql/where.pyi b/django/db/models/sql/where.pyi new file mode 100644 index 0000000..14173b1 --- /dev/null +++ b/django/db/models/sql/where.pyi @@ -0,0 +1,99 @@ +from collections import OrderedDict +from django.db import DefaultConnectionProxy +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.expressions import ( + Col, + CombinedExpression, +) +from django.db.models.lookups import ( + Exact, + FieldGetDbPrepValueMixin, + GreaterThan, + IntegerLessThan, + LessThanOrEqual, +) +from django.db.models.sql.compiler import SQLCompiler +from django.db.models.sql.query import Query +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Union, +) + + +class ExtraWhere: + def __init__(self, sqls: List[str], params: Optional[List[int]]) -> None: ... + def as_sql( + self, + compiler: SQLCompiler = ..., + connection: DatabaseWrapper = ... + ) -> Union[Tuple[str, List[int]], Tuple[str, List[Any]]]: ... + + +class NothingNode: + def as_sql( + self, + compiler: object = ..., + connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper] = ... + ): ... + + +class SubqueryConstraint: + def __init__( + self, + alias: str, + columns: List[str], + targets: List[str], + query_object: Query + ) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: DatabaseWrapper + ) -> Tuple[str, Tuple]: ... + + +class WhereNode: + @classmethod + def _contains_aggregate(cls, obj: Any) -> bool: ... + @classmethod + def _contains_over_clause( + cls, + obj: Union[WhereNode, FieldGetDbPrepValueMixin] + ) -> bool: ... + def as_sql( + self, + compiler: object, + connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper] + ) -> Any: ... + def clone(self) -> WhereNode: ... + @cached_property + def contains_aggregate(self) -> bool: ... + @cached_property + def contains_over_clause(self) -> bool: ... + def get_group_by_cols( + self + ) -> Union[List[CombinedExpression], List[Col]]: ... + def get_source_expressions( + self + ) -> Union[List[GreaterThan], List[IntegerLessThan], List[Exact], List[LessThanOrEqual]]: ... + def relabel_aliases( + self, + change_map: Union[OrderedDict, Dict[str, str], Dict[Union[str, None], str]] + ) -> None: ... + def relabeled_clone( + self, + change_map: Union[OrderedDict, Dict[Union[str, None], str]] + ) -> WhereNode: ... + def resolve_expression(self, *args, **kwargs) -> WhereNode: ... + def set_source_expressions( + self, + children: Union[List[GreaterThan], List[IntegerLessThan], List[Exact]] + ) -> None: ... + def split_having( + self, + negated: bool = ... + ) -> Union[Tuple[WhereNode, None], Tuple[None, WhereNode], Tuple[WhereNode, WhereNode]]: ... \ No newline at end of file diff --git a/django/db/models/utils.pyi b/django/db/models/utils.pyi new file mode 100644 index 0000000..18c3650 --- /dev/null +++ b/django/db/models/utils.pyi @@ -0,0 +1,7 @@ +from typing import ( + Any, + Tuple, +) + + +def make_model_tuple(model: Any) -> Tuple[str, str]: ... \ No newline at end of file diff --git a/django/db/transaction.pyi b/django/db/transaction.pyi new file mode 100644 index 0000000..5019586 --- /dev/null +++ b/django/db/transaction.pyi @@ -0,0 +1,39 @@ +from django.db.backends.sqlite3.base import DatabaseWrapper +from typing import ( + Callable, + Optional, + Union, +) + + +def atomic(using: Optional[Union[str, Callable]] = ..., savepoint: bool = ...) -> Callable: ... + + +def commit(using: None = ...): ... + + +def get_autocommit(using: str = ...) -> bool: ... + + +def get_connection(using: Optional[str] = ...) -> DatabaseWrapper: ... + + +def get_rollback(using: None = ...) -> bool: ... + + +def non_atomic_requests(using: Callable = ...) -> Callable: ... + + +def on_commit(func: Callable, using: None = ...) -> None: ... + + +def savepoint_rollback(sid: str, using: None = ...) -> None: ... + + +def set_rollback(rollback: bool, using: Optional[str] = ...) -> None: ... + + +class Atomic: + def __enter__(self) -> None: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + def __init__(self, using: Optional[str], savepoint: bool) -> None: ... \ No newline at end of file diff --git a/django/db/utils.pyi b/django/db/utils.pyi new file mode 100644 index 0000000..2330f26 --- /dev/null +++ b/django/db/utils.pyi @@ -0,0 +1,46 @@ +from django.apps.config import AppConfig +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.db.models.base import Model +from typing import ( + Any, + Callable, + Dict, + List, +) + + +def load_backend(backend_name: str) -> Any: ... + + +class ConnectionHandler: + def __getitem__(self, alias: str) -> BaseDatabaseWrapper: ... + def __init__(self, databases: Dict[str, Dict[str, str]] = ...) -> None: ... + def all(self) -> List[DatabaseWrapper]: ... + def close_all(self) -> None: ... + @cached_property + def databases(self) -> Dict[str, Dict[str, str]]: ... + def ensure_defaults(self, alias: str) -> None: ... + def prepare_test_settings(self, alias: str) -> None: ... + + +class ConnectionRouter: + def __init__(self, routers: None = ...) -> None: ... + def allow_migrate(self, db: str, app_label: str, **hints) -> bool: ... + def allow_migrate_model(self, db: str, model: Any) -> bool: ... + def allow_relation(self, obj1: Model, obj2: Model, **hints) -> bool: ... + def get_migratable_models( + self, + app_config: AppConfig, + db: str, + include_auto_created: bool = ... + ) -> Any: ... + @cached_property + def routers(self) -> Any: ... + + +class DatabaseErrorWrapper: + def __call__(self, func: Callable) -> Callable: ... + def __enter__(self) -> None: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + def __init__(self, wrapper: DatabaseWrapper) -> None: ... \ No newline at end of file diff --git a/django/dispatch/dispatcher.pyi b/django/dispatch/dispatcher.pyi new file mode 100644 index 0000000..6e6b022 --- /dev/null +++ b/django/dispatch/dispatcher.pyi @@ -0,0 +1,35 @@ +from dispatch.tests import Callable +from functools import partial +from typing import ( + Any, + Callable, + List, + Optional, + Tuple, + Union, +) + + +class Signal: + def __init__(self, providing_args: List[str] = ..., use_caching: bool = ...) -> None: ... + def _clear_dead_receivers(self) -> None: ... + def _live_receivers( + self, + sender: object + ) -> Union[List[Callable], List[object], List[Callable], List[partial]]: ... + def _remove_receiver(self, receiver: None = ...) -> None: ... + def connect( + self, + receiver: Callable, + sender: Any = ..., + weak: bool = ..., + dispatch_uid: Optional[str] = ... + ) -> None: ... + def disconnect( + self, + receiver: Optional[Callable] = ..., + sender: Any = ..., + dispatch_uid: Optional[str] = ... + ) -> bool: ... + def has_listeners(self, sender: object = ...) -> bool: ... + def send(self, sender: Any, **named) -> Union[List[Tuple[Callable, None]], List[Tuple[object, None]]]: ... \ No newline at end of file diff --git a/django/forms/boundfield.pyi b/django/forms/boundfield.pyi new file mode 100644 index 0000000..a5fba5b --- /dev/null +++ b/django/forms/boundfield.pyi @@ -0,0 +1,70 @@ +from django.forms.fields import Field +from django.forms.forms import BaseForm +from django.forms.renderers import DjangoTemplates +from django.forms.utils import ErrorList +from django.forms.widgets import ( + ChoiceWidget, + HiddenInput, + SplitHiddenDateTimeWidget, +) +from django.utils.safestring import SafeText +from typing import ( + Any, + Dict, + List, + Optional, + Union, +) + + +class BoundField: + def __getitem__( + self, + idx: Union[str, slice, int] + ) -> Union[BoundWidget, List[BoundWidget]]: ... + def __init__(self, form: BaseForm, field: Field, name: str) -> None: ... + def __len__(self) -> int: ... + def as_hidden(self, attrs: None = ..., **kwargs) -> SafeText: ... + def as_text(self, attrs: None = ..., **kwargs) -> SafeText: ... + def as_textarea(self, attrs: None = ..., **kwargs) -> SafeText: ... + def as_widget( + self, + widget: Optional[Union[HiddenInput, SplitHiddenDateTimeWidget]] = ..., + attrs: None = ..., + only_initial: bool = ... + ) -> SafeText: ... + @property + def auto_id(self) -> str: ... + def build_widget_attrs(self, attrs: Dict[str, str], widget: Any = ...) -> Dict[str, Union[bool, str]]: ... + def css_classes(self, extra_classes: None = ...) -> str: ... + @property + def data(self) -> Any: ... + @property + def errors(self) -> ErrorList: ... + @cached_property + def initial(self) -> Any: ... + @property + def is_hidden(self) -> bool: ... + def label_tag( + self, + contents: Optional[SafeText] = ..., + attrs: Optional[Dict[str, str]] = ..., + label_suffix: Optional[str] = ... + ) -> SafeText: ... + @cached_property + def subwidgets(self) -> List[BoundWidget]: ... + def value(self) -> Any: ... + + +class BoundWidget: + def __init__( + self, + parent_widget: ChoiceWidget, + data: Dict[str, Any], + renderer: DjangoTemplates + ) -> None: ... + @property + def choice_label(self) -> str: ... + def tag(self, wrap_label: bool = ...) -> SafeText: ... + @property + def template_name(self) -> str: ... \ No newline at end of file diff --git a/django/forms/fields.pyi b/django/forms/fields.pyi new file mode 100644 index 0000000..7d28556 --- /dev/null +++ b/django/forms/fields.pyi @@ -0,0 +1,255 @@ +from datetime import ( + date, + datetime, + time, + timedelta, +) +from decimal import Decimal +from django.core.files.uploadedfile import SimpleUploadedFile +from django.db.models.fields.files import FieldFile +from django.forms.boundfield import BoundField +from django.forms.forms import BaseForm +from django.forms.widgets import ( + ClearableFileInput, + Input, + Widget, +) +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) + + +class BaseTemporalField: + def __init__(self, *, input_formats = ..., **kwargs) -> None: ... + def to_python(self, value: str) -> Union[date, time]: ... + + +class BooleanField: + def has_changed(self, initial: Optional[bool], data: Optional[Union[bool, str]]) -> bool: ... + def to_python(self, value: Optional[Union[str, int]]) -> bool: ... + def validate(self, value: bool) -> None: ... + + +class CallableChoiceIterator: + def __init__(self, choices_func: Callable) -> None: ... + def __iter__(self) -> None: ... + + +class CharField: + def __init__( + self, + *, + max_length = ..., + min_length = ..., + strip = ..., + empty_value = ..., + **kwargs + ) -> None: ... + def to_python(self, value: Optional[Union[int, Tuple, str]]) -> Optional[str]: ... + def widget_attrs(self, widget: Widget) -> Dict[str, str]: ... + + +class ChoiceField: + def __deepcopy__(self, memo: Dict[int, Any]) -> ChoiceField: ... + def __init__(self, *, choices = ..., **kwargs) -> None: ... + def _get_choices(self) -> Any: ... + def _set_choices(self, value: Any) -> None: ... + def to_python(self, value: Optional[str]) -> str: ... + def valid_value(self, value: str) -> bool: ... + def validate(self, value: str) -> None: ... + + +class ComboField: + def __init__(self, fields: List[CharField], **kwargs) -> None: ... + def clean(self, value: Optional[str]) -> str: ... + + +class DateField: + def strptime(self, value: str, format: str) -> date: ... + def to_python(self, value: Optional[Union[date, str]]) -> Optional[date]: ... + + +class DateTimeField: + def prepare_value(self, value: Optional[datetime]) -> Optional[datetime]: ... + def strptime(self, value: str, format: str) -> datetime: ... + def to_python(self, value: Optional[Union[str, date]]) -> Optional[datetime]: ... + + +class DecimalField: + def __init__( + self, + *, + max_value = ..., + min_value = ..., + max_digits = ..., + decimal_places = ..., + **kwargs + ) -> None: ... + def to_python(self, value: Optional[Union[str, float]]) -> Optional[Decimal]: ... + def validate(self, value: Decimal) -> None: ... + def widget_attrs(self, widget: Widget) -> Dict[str, str]: ... + + +class DurationField: + def prepare_value(self, value: Optional[timedelta]) -> Optional[str]: ... + def to_python(self, value: Union[str, int]) -> timedelta: ... + + +class EmailField: + def __init__(self, **kwargs) -> None: ... + + +class Field: + def __deepcopy__(self, memo: Dict[int, Any]) -> Field: ... + def __init__( + self, + *, + required = ..., + widget = ..., + label = ..., + initial = ..., + help_text = ..., + error_messages = ..., + show_hidden_initial = ..., + validators = ..., + localize = ..., + disabled = ..., + label_suffix = ... + ) -> None: ... + def bound_data(self, data: Any, initial: Any) -> Any: ... + def clean(self, value: Any) -> Any: ... + def get_bound_field(self, form: BaseForm, field_name: str) -> BoundField: ... + def has_changed(self, initial: Any, data: Optional[str]) -> bool: ... + def prepare_value(self, value: Any) -> Any: ... + def run_validators(self, value: Any) -> None: ... + def to_python(self, value: Any) -> Any: ... + def validate(self, value: Any) -> None: ... + def widget_attrs(self, widget: Widget) -> Dict[Any, Any]: ... + + +class FileField: + def __init__(self, *, max_length = ..., allow_empty_file = ..., **kwargs) -> None: ... + def bound_data( + self, + data: Union[str, SimpleUploadedFile], + initial: None + ) -> Union[str, SimpleUploadedFile]: ... + def clean( + self, + data: Optional[Union[str, bool, SimpleUploadedFile]], + initial: Optional[Union[str, FieldFile]] = ... + ) -> Any: ... + def has_changed(self, initial: Union[str, FieldFile], data: Optional[str]) -> bool: ... + def to_python( + self, + data: Optional[Union[str, SimpleUploadedFile]] + ) -> Optional[SimpleUploadedFile]: ... + + +class FilePathField: + def __init__( + self, + path: str, + *, + match = ..., + recursive = ..., + allow_files = ..., + allow_folders = ..., + **kwargs + ) -> None: ... + + +class FloatField: + def to_python(self, value: str) -> Optional[float]: ... + def validate(self, value: Optional[float]) -> None: ... + def widget_attrs(self, widget: Input) -> Dict[str, Union[int, str]]: ... + + +class GenericIPAddressField: + def __init__(self, *, protocol = ..., unpack_ipv4 = ..., **kwargs) -> None: ... + def to_python(self, value: str) -> str: ... + + +class ImageField: + def widget_attrs(self, widget: ClearableFileInput) -> Dict[str, str]: ... + + +class IntegerField: + def __init__(self, *, max_value = ..., min_value = ..., **kwargs) -> None: ... + def to_python(self, value: Optional[Union[float, int, str]]) -> Optional[int]: ... + def widget_attrs(self, widget: Input) -> Dict[str, Union[Decimal, int]]: ... + + +class MultiValueField: + def __deepcopy__(self, memo: Dict[int, Any]) -> MultiValueField: ... + def __init__( + self, + fields: Union[Tuple[DateField, TimeField], Tuple[CharField, MultipleChoiceField, SplitDateTimeField], Tuple[CharField, CharField]], + *, + require_all_fields = ..., + **kwargs + ) -> None: ... + def clean( + self, + value: Union[str, List[Union[str, List[str]]], List[str]] + ) -> Optional[Union[str, datetime]]: ... + def has_changed( + self, + initial: Optional[Union[datetime, List[None], List[str]]], + data: Union[List[None], List[str]] + ) -> bool: ... + def validate(self, value: Union[str, datetime]) -> None: ... + + +class MultipleChoiceField: + def has_changed(self, initial: Optional[Union[str, List[int]]], data: Union[str, List[str]]) -> bool: ... + def to_python(self, value: Optional[Union[Tuple, str, List[str]]]) -> List[str]: ... + def validate(self, value: List[str]) -> None: ... + + +class NullBooleanField: + def to_python(self, value: Optional[Union[str, bool]]) -> Optional[bool]: ... + def validate(self, value: Optional[bool]) -> None: ... + + +class RegexField: + def __init__(self, regex: str, **kwargs) -> None: ... + def _set_regex(self, regex: str) -> None: ... + + +class SlugField: + def __init__(self, *, allow_unicode = ..., **kwargs) -> None: ... + + +class SplitDateTimeField: + def __init__(self, *, input_date_formats = ..., input_time_formats = ..., **kwargs) -> None: ... + def compress(self, data_list: List[Union[date, time]]) -> Optional[datetime]: ... + + +class TimeField: + def strptime(self, value: str, format: str) -> time: ... + def to_python(self, value: Optional[Union[str, time]]) -> Optional[time]: ... + + +class TypedChoiceField: + def __init__(self, *, coerce = ..., empty_value = ..., **kwargs) -> None: ... + def _coerce(self, value: Optional[Union[str, int]]) -> Optional[Union[int, str]]: ... + def clean(self, value: Optional[str]) -> Optional[Union[str, int]]: ... + + +class TypedMultipleChoiceField: + def __init__(self, *, coerce = ..., **kwargs) -> None: ... + def _coerce(self, value: List[str]) -> Optional[Union[List[Decimal], List[int]]]: ... + def clean(self, value: List[str]) -> Optional[Union[List[bool], List[int]]]: ... + def validate(self, value: List[str]) -> None: ... + + +class URLField: + def __init__(self, **kwargs) -> None: ... + def to_python(self, value: Optional[Union[str, int]]) -> Optional[str]: ... \ No newline at end of file diff --git a/django/forms/forms.pyi b/django/forms/forms.pyi new file mode 100644 index 0000000..873bdd1 --- /dev/null +++ b/django/forms/forms.pyi @@ -0,0 +1,61 @@ +from django.core.exceptions import ValidationError +from django.core.files.uploadedfile import SimpleUploadedFile +from django.forms.boundfield import BoundField +from django.forms.utils import ( + ErrorDict, + ErrorList, +) +from django.utils.datastructures import MultiValueDict +from django.utils.safestring import SafeText +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Type, + Union, +) + + +class BaseForm: + def __getitem__(self, name: str) -> BoundField: ... + def __init__( + self, + data: Any = ..., + files: Optional[Union[Dict[str, SimpleUploadedFile], MultiValueDict]] = ..., + auto_id: Optional[Union[str, bool]] = ..., + prefix: Optional[str] = ..., + initial: Any = ..., + error_class: Type[ErrorList] = ..., + label_suffix: None = ..., + empty_permitted: bool = ..., + field_order: None = ..., + use_required_attribute: Optional[bool] = ..., + renderer: object = ... + ) -> None: ... + def __iter__(self) -> Iterator[BoundField]: ... + def __repr__(self) -> str: ... + def _clean_fields(self) -> None: ... + def _clean_form(self) -> None: ... + def _html_output( + self, + normal_row: str, + error_row: str, + row_ender: str, + help_text_html: str, + errors_on_separate_row: bool + ) -> SafeText: ... + def _post_clean(self) -> None: ... + def add_error(self, field: Optional[str], error: Union[str, ValidationError]) -> None: ... + def add_initial_prefix(self, field_name: str) -> str: ... + def add_prefix(self, field_name: str) -> str: ... + def as_p(self) -> SafeText: ... + def as_table(self) -> SafeText: ... + def as_ul(self) -> SafeText: ... + @cached_property + def changed_data(self) -> List[str]: ... + def clean(self) -> Dict[str, Any]: ... + @property + def errors(self) -> ErrorDict: ... + def full_clean(self) -> None: ... \ No newline at end of file diff --git a/django/forms/formsets.pyi b/django/forms/formsets.pyi new file mode 100644 index 0000000..9083843 --- /dev/null +++ b/django/forms/formsets.pyi @@ -0,0 +1,11 @@ +from typing import ( + Any, + List, +) + + +def all_valid(formsets: List[Any]) -> bool: ... + + +class ManagementForm: + def __init__(self, *args, **kwargs) -> None: ... \ No newline at end of file diff --git a/django/forms/models.pyi b/django/forms/models.pyi new file mode 100644 index 0000000..f7bbea1 --- /dev/null +++ b/django/forms/models.pyi @@ -0,0 +1,132 @@ +from collections import OrderedDict +from django.core.exceptions import ValidationError +from django.core.files.uploadedfile import SimpleUploadedFile +from django.db.models.base import Model +from django.db.models.fields.related import ForeignKey +from django.db.models.manager import Manager +from django.db.models.query import QuerySet +from django.forms.fields import Field +from django.forms.utils import ErrorList +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Tuple, + Type, + Union, +) +from uuid import UUID + + +def _get_foreign_key( + parent_model: Any, + model: Any, + fk_name: Optional[str] = ..., + can_fail: bool = ... +) -> ForeignKey: ... + + +def apply_limit_choices_to_to_formfield(formfield: Field) -> None: ... + + +class BaseModelForm: + def __init__( + self, + data: Any = ..., + files: Optional[Dict[str, SimpleUploadedFile]] = ..., + auto_id: Union[str, bool] = ..., + prefix: None = ..., + initial: Optional[Dict[str, Union[Model, List[Model], QuerySet]]] = ..., + error_class: Type[ErrorList] = ..., + label_suffix: None = ..., + empty_permitted: bool = ..., + instance: Any = ..., + use_required_attribute: None = ..., + renderer: None = ... + ) -> None: ... + def _get_validation_exclusions(self) -> List[str]: ... + def _post_clean(self) -> None: ... + def _save_m2m(self) -> None: ... + def _update_errors(self, errors: ValidationError) -> None: ... + def clean(self) -> Dict[str, Any]: ... + def save(self, commit: bool = ...) -> Model: ... + def validate_unique(self) -> None: ... + + +class InlineForeignKeyField: + def __init__( + self, + parent_instance: Model, + *args, + pk_field = ..., + to_field = ..., + **kwargs + ) -> None: ... + def clean(self, value: Optional[Union[str, int]]) -> Model: ... + def has_changed(self, initial: Optional[Union[str, int]], data: Optional[Union[str, int]]) -> bool: ... + + +class ModelChoiceField: + def __deepcopy__(self, memo: Dict[int, Any]) -> ModelChoiceField: ... + def __init__( + self, + queryset: QuerySet, + *, + empty_label = ..., + required = ..., + widget = ..., + label = ..., + initial = ..., + help_text = ..., + to_field_name = ..., + limit_choices_to = ..., + **kwargs + ) -> None: ... + def _get_choices(self) -> ModelChoiceIterator: ... + def _get_queryset(self) -> QuerySet: ... + def _set_queryset(self, queryset: Union[QuerySet, Manager]) -> None: ... + def get_limit_choices_to(self) -> Any: ... + def has_changed(self, initial: Optional[Union[int, UUID]], data: Optional[Union[str, int]]) -> bool: ... + def label_from_instance(self, obj: Model) -> str: ... + def prepare_value(self, value: Any) -> Optional[Union[UUID, str, int]]: ... + def to_python(self, value: Optional[Union[str, List[List[str]], int]]) -> Any: ... + def validate(self, value: Any) -> None: ... + + +class ModelChoiceIterator: + def __bool__(self) -> bool: ... + def __init__(self, field: ModelChoiceField) -> None: ... + def __iter__(self) -> Iterator[Union[Tuple[int, str], Tuple[str, str]]]: ... + def __len__(self) -> int: ... + def choice(self, obj: Model) -> Tuple[int, str]: ... + + +class ModelFormMetaclass: + @staticmethod + def __new__( + mcs: Type[ModelFormMetaclass], + name: str, + bases: Tuple[Type[ModelForm]], + attrs: OrderedDict + ) -> Any: ... + + +class ModelFormOptions: + def __init__(self, options: Any = ...) -> None: ... + + +class ModelMultipleChoiceField: + def __init__(self, queryset: QuerySet, **kwargs) -> None: ... + def _check_values( + self, + value: Union[List[int], Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int], List[str]] + ) -> QuerySet: ... + def clean(self, value: Union[List[List[str]], str, List[int], List[str]]) -> QuerySet: ... + def has_changed(self, initial: List[Model], data: List[str]) -> bool: ... + def prepare_value(self, value: Any) -> Any: ... + def to_python( + self, + value: Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int] + ) -> List[Model]: ... \ No newline at end of file diff --git a/django/forms/renderers.pyi b/django/forms/renderers.pyi new file mode 100644 index 0000000..eaaf3e1 --- /dev/null +++ b/django/forms/renderers.pyi @@ -0,0 +1,21 @@ +from django.template.backends.django import ( + DjangoTemplates, + Template, +) +from typing import ( + Any, + Dict, +) + + +def get_default_renderer() -> DjangoTemplates: ... + + +class BaseRenderer: + def render(self, template_name: str, context: Dict[str, Any], request: None = ...) -> str: ... + + +class EngineMixin: + @cached_property + def engine(self) -> DjangoTemplates: ... + def get_template(self, template_name: str) -> Template: ... \ No newline at end of file diff --git a/django/forms/utils.pyi b/django/forms/utils.pyi new file mode 100644 index 0000000..4adffa9 --- /dev/null +++ b/django/forms/utils.pyi @@ -0,0 +1,52 @@ +from datetime import datetime +from django.core.exceptions import ValidationError +from django.utils.safestring import SafeText +from typing import ( + Callable, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +def flatatt(attrs: Dict[str, Union[str, None]]) -> SafeText: ... + + +def from_current_timezone(value: datetime) -> datetime: ... + + +def pretty_name(name: str) -> str: ... + + +def to_current_timezone(value: datetime) -> datetime: ... + + +class ErrorDict: + def as_data(self) -> Dict[str, List[ValidationError]]: ... + def as_json(self, escape_html: bool = ...) -> str: ... + def as_ul(self) -> SafeText: ... + def get_json_data(self, escape_html: bool = ...) -> Dict[str, List[Dict[str, str]]]: ... + + +class ErrorList: + def __contains__(self, item: str) -> bool: ... + def __eq__(self, other: Union[List[str], ErrorList]) -> bool: ... + def __getitem__(self, i: Union[str, int]) -> str: ... + def __init__( + self, + initlist: Optional[Union[List[ValidationError], ErrorList, List[str]]] = ..., + error_class: Optional[str] = ... + ) -> None: ... + def __reduce_ex__( + self, + *args, + **kwargs + ) -> Tuple[Callable, Tuple[Type[ErrorList]], Dict[str, Union[List[ValidationError], str]], None, None]: ... + def __repr__(self) -> str: ... + def as_data(self) -> List[ValidationError]: ... + def as_text(self) -> str: ... + def as_ul(self) -> str: ... + def get_json_data(self, escape_html: bool = ...) -> List[Dict[str, str]]: ... \ No newline at end of file diff --git a/django/forms/widgets.pyi b/django/forms/widgets.pyi new file mode 100644 index 0000000..17b0ba3 --- /dev/null +++ b/django/forms/widgets.pyi @@ -0,0 +1,312 @@ +from datetime import ( + date, + datetime, + time, +) +from django.core.files.uploadedfile import SimpleUploadedFile +from django.db.models.fields.files import FieldFile +from django.forms.renderers import DjangoTemplates +from django.http.request import QueryDict +from django.utils.datastructures import MultiValueDict +from django.utils.safestring import SafeText +from itertools import chain +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Set, + Tuple, + Type, + Union, +) + + +class CheckboxInput: + def __init__(self, attrs: Optional[Dict[str, str]] = ..., check_test: Optional[Callable] = ...) -> None: ... + def format_value(self, value: Optional[Union[str, int]]) -> Optional[str]: ... + def get_context( + self, + name: str, + value: Optional[Union[str, int]], + attrs: Optional[Union[Dict[str, bool], Dict[str, Union[bool, str]], Dict[str, str]]] + ) -> Dict[str, Any]: ... + def value_from_datadict( + self, + data: Any, + files: Union[Dict[str, SimpleUploadedFile], MultiValueDict], + name: str + ) -> bool: ... + def value_omitted_from_data( + self, + data: Union[Dict[str, str], Dict[str, Union[str, List[int]]], Dict[str, Union[int, str, None, datetime]], QueryDict], + files: MultiValueDict, + name: str + ) -> bool: ... + + +class CheckboxSelectMultiple: + def id_for_label(self, id_: str, index: Optional[str] = ...) -> str: ... + def use_required_attribute(self, initial: None) -> bool: ... + def value_omitted_from_data(self, data: Dict[Any, Any], files: Dict[Any, Any], name: str) -> bool: ... + + +class ChoiceWidget: + def __deepcopy__(self, memo: Dict[int, Any]) -> ChoiceWidget: ... + def __init__( + self, + attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, str]]] = ..., + choices: Any = ... + ) -> None: ... + def create_option( + self, + name: str, + value: Union[str, time, int], + label: Union[str, int], + selected: Union[bool, Set[str]], + index: int, + subindex: Optional[int] = ..., + attrs: Optional[Union[Dict[str, bool], Dict[str, Union[bool, str]], Dict[str, str]]] = ... + ) -> Dict[str, Any]: ... + def format_value(self, value: Any) -> List[str]: ... + def get_context( + self, + name: str, + value: Any, + attrs: Optional[Union[Dict[str, bool], Dict[str, Union[bool, str]], Dict[str, str]]] + ) -> Dict[str, Any]: ... + def id_for_label(self, id_: str, index: str = ...) -> str: ... + def optgroups( + self, + name: str, + value: List[str], + attrs: Optional[Union[Dict[str, bool], Dict[str, Union[bool, str]], Dict[str, str]]] = ... + ) -> Any: ... + def options(self, name: str, value: List[str], attrs: Dict[str, Union[bool, str]] = ...) -> None: ... + def subwidgets(self, name: str, value: Optional[List[str]], attrs: Dict[str, Union[bool, str]] = ...) -> None: ... + def value_from_datadict( + self, + data: Any, + files: MultiValueDict, + name: str + ) -> Optional[Union[str, int, List[str]]]: ... + + +class ClearableFileInput: + def clear_checkbox_id(self, name: str) -> str: ... + def clear_checkbox_name(self, name: str) -> str: ... + def format_value( + self, + value: Optional[Union[str, FieldFile]] + ) -> Optional[FieldFile]: ... + def is_initial(self, value: Any) -> bool: ... + def use_required_attribute(self, initial: Optional[FieldFile]) -> bool: ... + def value_from_datadict( + self, + data: Union[Dict[str, bool], Dict[str, str], Dict[str, None], QueryDict], + files: Dict[str, Union[str, SimpleUploadedFile]], + name: str + ) -> Optional[Union[str, SimpleUploadedFile]]: ... + def value_omitted_from_data(self, data: Dict[str, str], files: Dict[Any, Any], name: str) -> bool: ... + + +class DateTimeBaseInput: + def __init__(self, attrs: Optional[Dict[str, str]] = ..., format: Optional[str] = ...) -> None: ... + def format_value(self, value: Optional[Union[time, str, date]]) -> Optional[str]: ... + + +class FileInput: + def format_value(self, value: None) -> None: ... + def value_from_datadict( + self, + data: Union[Dict[str, bool], Dict[str, str], QueryDict], + files: Dict[str, SimpleUploadedFile], + name: str + ) -> Optional[SimpleUploadedFile]: ... + def value_omitted_from_data( + self, + data: Dict[Any, Any], + files: Dict[str, Union[str, SimpleUploadedFile]], + name: str + ) -> bool: ... + + +class Input: + def __init__(self, attrs: Optional[Union[Dict[str, str], Dict[str, bool], Dict[str, int]]] = ...) -> None: ... + def get_context( + self, + name: str, + value: Any, + attrs: Optional[Union[Dict[str, bool], Dict[str, Union[bool, str]], Dict[str, str]]] + ) -> Dict[str, Any]: ... + + +class Media: + def __add__(self, other: Media) -> Media: ... + def __getitem__(self, name: str) -> Media: ... + def __init__( + self, + media: Optional[Type[object]] = ..., + css: Optional[Union[Dict[str, Tuple[str, str]], Dict[str, Tuple[str]], Dict[str, List[str]]]] = ..., + js: Any = ... + ) -> None: ... + def __repr__(self) -> str: ... + def absolute_path(self, path: str) -> str: ... + @staticmethod + def merge(list_1: Union[List[str], Tuple[str], List[int]], list_2: Any) -> Union[List[int], List[str]]: ... + def render(self) -> SafeText: ... + def render_css(self) -> chain: ... + def render_js(self) -> List[SafeText]: ... + + +class MediaDefiningClass: + @staticmethod + def __new__(mcs: Type[MediaDefiningClass], name: str, bases: Tuple, attrs: Any) -> Any: ... + + +class MultiWidget: + def __deepcopy__(self, memo: Dict[int, Any]) -> MultiWidget: ... + def __init__(self, widgets: Any, attrs: Optional[Dict[str, str]] = ...) -> None: ... + def _get_media(self) -> Media: ... + def get_context( + self, + name: str, + value: Optional[Union[str, datetime, List[str]]], + attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, str]]] + ) -> Dict[str, Any]: ... + def id_for_label(self, id_: str) -> str: ... + @property + def is_hidden(self) -> bool: ... + @property + def needs_multipart_form(self) -> bool: ... + def value_from_datadict( + self, + data: Union[Dict[str, str], Dict[str, Union[str, List[str]]], QueryDict], + files: MultiValueDict, + name: str + ) -> Union[List[None], List[str]]: ... + def value_omitted_from_data( + self, + data: Union[Dict[str, str], QueryDict], + files: MultiValueDict, + name: str + ) -> bool: ... + + +class MultipleHiddenInput: + def format_value(self, value: Union[List[int], List[str]]) -> Union[List[int], List[str]]: ... + def get_context(self, name: str, value: List[str], attrs: Optional[Dict[str, str]]) -> Dict[str, Dict[str, Any]]: ... + def value_from_datadict( + self, + data: MultiValueDict, + files: Dict[Any, Any], + name: str + ) -> List[str]: ... + + +class NullBooleanSelect: + def __init__(self, attrs: None = ...) -> None: ... + def format_value(self, value: Optional[str]) -> str: ... + def value_from_datadict(self, data: Dict[str, Union[bool, str]], files: Dict[Any, Any], name: str) -> Optional[bool]: ... + + +class PasswordInput: + def __init__(self, attrs: Optional[Dict[str, bool]] = ..., render_value: bool = ...) -> None: ... + def get_context( + self, + name: str, + value: Optional[str], + attrs: Optional[Union[Dict[str, Union[bool, str]], Dict[str, bool]]] + ) -> Dict[str, Dict[str, Any]]: ... + + +class Select: + @staticmethod + def _choice_has_empty_value(choice: Union[Tuple[None, str], Tuple[str, str]]) -> bool: ... + def get_context( + self, + name: str, + value: Any, + attrs: Optional[Union[Dict[str, bool], Dict[str, Union[bool, str]], Dict[str, str]]] + ) -> Dict[str, Any]: ... + def use_required_attribute(self, initial: Any) -> bool: ... + + +class SelectDateWidget: + def __init__( + self, + attrs: None = ..., + years: Optional[Union[range, Tuple[str]]] = ..., + months: None = ..., + empty_label: Optional[Tuple[str, str, str]] = ... + ) -> None: ... + @staticmethod + def _parse_date_fmt() -> Iterator[str]: ... + def format_value(self, value: Optional[Union[str, date]]) -> Dict[str, Union[None, int, str]]: ... + def value_from_datadict(self, data: Dict[str, str], files: Dict[Any, Any], name: str) -> Optional[str]: ... + def value_omitted_from_data(self, data: Dict[str, str], files: Dict[Any, Any], name: str) -> bool: ... + + +class SelectMultiple: + def value_from_datadict( + self, + data: Any, + files: MultiValueDict, + name: str + ) -> Optional[Union[str, List[int], List[str]]]: ... + def value_omitted_from_data(self, data: Dict[Any, Any], files: Dict[Any, Any], name: str) -> bool: ... + + +class SplitDateTimeWidget: + def __init__( + self, + attrs: Optional[Dict[str, str]] = ..., + date_format: None = ..., + time_format: None = ..., + date_attrs: Optional[Dict[str, str]] = ..., + time_attrs: Optional[Dict[str, str]] = ... + ) -> None: ... + def decompress( + self, + value: Optional[datetime] + ) -> Union[List[None], List[Union[date, time]]]: ... + + +class SplitHiddenDateTimeWidget: + def __init__( + self, + attrs: None = ..., + date_format: None = ..., + time_format: None = ..., + date_attrs: None = ..., + time_attrs: None = ... + ) -> None: ... + + +class Textarea: + def __init__(self, attrs: Optional[Union[Dict[str, str], Dict[str, int]]] = ...) -> None: ... + + +class Widget: + def __deepcopy__(self, memo: Dict[int, Any]) -> Widget: ... + def __init__(self, attrs: Any = ...) -> None: ... + def _render( + self, + template_name: str, + context: Dict[str, Any], + renderer: Optional[DjangoTemplates] = ... + ) -> SafeText: ... + def build_attrs( + self, + base_attrs: Dict[str, Union[str, int, float]], + extra_attrs: Optional[Union[Dict[str, bool], Dict[str, Union[bool, str]], Dict[str, str]]] = ... + ) -> Dict[str, Union[str, int, float]]: ... + def format_value(self, value: Any) -> Optional[str]: ... + def get_context( + self, + name: str, + value: Any, + attrs: Optional[Union[Dict[str, bool], Dict[str, Union[bool, str]], Dict[str, str]]] + ) -> Dict[str, Any]: ... \ No newline at end of file diff --git a/django/http/cookie.pyi b/django/http/cookie.pyi new file mode 100644 index 0000000..26959c3 --- /dev/null +++ b/django/http/cookie.pyi @@ -0,0 +1,4 @@ +from typing import Dict + + +def parse_cookie(cookie: str) -> Dict[str, str]: ... \ No newline at end of file diff --git a/django/http/multipartparser.pyi b/django/http/multipartparser.pyi new file mode 100644 index 0000000..7e733b2 --- /dev/null +++ b/django/http/multipartparser.pyi @@ -0,0 +1,82 @@ +from io import BytesIO +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import QueryDict +from django.utils.datastructures import ( + ImmutableList, + MultiValueDict, +) +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Tuple, + Union, +) + + +def _parse_header_params(s: bytes) -> List[bytes]: ... + + +def exhaust(stream_or_iterable: Union[BytesIO, WSGIRequest]) -> None: ... + + +def parse_boundary_stream( + stream: LazyStream, + max_header_size: int +) -> Union[Tuple[str, Dict[Any, Any], LazyStream], Tuple[str, Dict[str, Tuple[str, Dict[str, bytes]]], LazyStream], Tuple[str, Dict[str, Union[Tuple[str, Dict[str, bytes]], Tuple[str, Dict[Any, Any]]]], LazyStream], Tuple[str, Dict[str, Union[Tuple[str, Dict[str, str]], Tuple[str, Dict[Any, Any]]]], LazyStream]]: ... + + +def parse_header(line: bytes) -> Union[Tuple[str, Dict[Any, Any]], Tuple[str, Dict[str, bytes]]]: ... + + +class BoundaryIter: + def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... + def __next__(self) -> bytes: ... + def _find_boundary(self, data: bytes) -> Optional[Tuple[int, int]]: ... + + +class ChunkIter: + def __init__(self, flo: WSGIRequest, chunk_size: int = ...) -> None: ... + def __next__(self) -> bytes: ... + + +class InterBoundaryIter: + def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... + def __iter__(self) -> InterBoundaryIter: ... + def __next__(self) -> LazyStream: ... + + +class LazyStream: + def __init__( + self, + producer: Union[BoundaryIter, ChunkIter], + length: None = ... + ) -> None: ... + def __iter__(self) -> LazyStream: ... + def __next__(self) -> bytes: ... + def _update_unget_history(self, num_bytes: int) -> None: ... + def read(self, size: Optional[int] = ...) -> bytes: ... + def unget(self, bytes: bytes) -> None: ... + + +class MultiPartParser: + def IE_sanitize(self, filename: str) -> str: ... + def __init__( + self, + META: Dict[str, Any], + input_data: WSGIRequest, + upload_handlers: ImmutableList, + encoding: None = ... + ) -> None: ... + def _close_files(self) -> None: ... + def handle_file_complete(self, old_field_name: str, counters: List[int]) -> None: ... + def parse(self) -> Tuple[QueryDict, MultiValueDict]: ... + + +class Parser: + def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... + def __iter__( + self + ) -> Iterator[Union[Tuple[str, Dict[Any, Any], LazyStream], Tuple[str, Dict[str, Tuple[str, Dict[str, bytes]]], LazyStream], Tuple[str, Dict[str, Union[Tuple[str, Dict[str, bytes]], Tuple[str, Dict[Any, Any]]]], LazyStream]]]: ... \ No newline at end of file diff --git a/django/http/request.pyi b/django/http/request.pyi new file mode 100644 index 0000000..25629bd --- /dev/null +++ b/django/http/request.pyi @@ -0,0 +1,92 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.utils.datastructures import MultiValueDict +from typing import ( + Any, + Dict, + Iterator, + List, + Optional, + Tuple, + Union, +) + + +def bytes_to_text(s: Optional[Union[str, bytes, int]], encoding: str) -> Optional[Union[str, int]]: ... + + +def split_domain_port(host: str) -> Tuple[str, str]: ... + + +def validate_host(host: str, allowed_hosts: Union[str, List[str]]) -> bool: ... + + +class HttpRequest: + def __init__(self) -> None: ... + def __iter__(self) -> Iterator[bytes]: ... + def __repr__(self) -> str: ... + @cached_property + def _current_scheme_host(self) -> str: ... + def _get_full_path(self, path: str, force_append_slash: bool) -> str: ... + def _get_raw_host(self) -> str: ... + def _get_scheme(self) -> str: ... + def _initialize_handlers(self) -> None: ... + def _load_post_and_files(self) -> None: ... + def _mark_post_parse_error(self) -> None: ... + @property + def body(self) -> bytes: ... + def build_absolute_uri(self, location: Optional[str] = ...) -> str: ... + def close(self) -> None: ... + def get_full_path(self, force_append_slash: bool = ...) -> str: ... + def get_full_path_info(self, force_append_slash: bool = ...) -> str: ... + def get_host(self) -> str: ... + def get_port(self) -> str: ... + def get_raw_uri(self) -> str: ... + def get_signed_cookie( + self, + key: str, + default: None = ..., + salt: str = ..., + max_age: None = ... + ) -> None: ... + def is_ajax(self) -> bool: ... + def is_secure(self) -> bool: ... + def parse_file_upload( + self, + META: Dict[str, Any], + post_data: WSGIRequest + ) -> Tuple[QueryDict, MultiValueDict]: ... + def read(self, *args, **kwargs) -> bytes: ... + def readline(self, *args, **kwargs) -> bytes: ... + @property + def scheme(self) -> Optional[str]: ... + + +class QueryDict: + def __copy__(self) -> QueryDict: ... + def __deepcopy__(self, memo: Dict[Any, Any]) -> QueryDict: ... + def __delitem__(self, key: str): ... + def __init__( + self, + query_string: Optional[Union[str, bytes]] = ..., + mutable: bool = ..., + encoding: Optional[str] = ... + ) -> None: ... + def __setitem__(self, key: str, value: Optional[Union[str, int]]) -> None: ... + def _assert_mutable(self) -> None: ... + def appendlist(self, key: str, value: Union[str, List[str]]) -> None: ... + def clear(self): ... + def copy(self) -> QueryDict: ... + @classmethod + def fromkeys( + cls, + iterable: Union[str, List[str]], + value: str = ..., + mutable: bool = ..., + encoding: None = ... + ) -> QueryDict: ... + def pop(self, key: str, *args) -> Optional[List[str]]: ... + def popitem(self): ... + def setdefault(self, key: str, default: str = ...) -> str: ... + def setlist(self, key: str, list_: List[str]) -> None: ... + def setlistdefault(self, key: str, default_list: None = ...) -> List[str]: ... + def urlencode(self, safe: Optional[str] = ...) -> str: ... \ No newline at end of file diff --git a/django/http/response.pyi b/django/http/response.pyi new file mode 100644 index 0000000..00d193c --- /dev/null +++ b/django/http/response.pyi @@ -0,0 +1,113 @@ +from io import ( + BufferedReader, + BytesIO, + TextIOWrapper, +) +from django.core.files.base import ContentFile +from django.core.serializers.json import DjangoJSONEncoder +from tempfile import _TemporaryFileWrapper +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Type, + Union, +) + + +class FileResponse: + def __init__(self, *args, as_attachment = ..., filename = ..., **kwargs) -> None: ... + def _set_streaming_content( + self, + value: Union[BufferedReader, _TemporaryFileWrapper, ContentFile] + ) -> None: ... + def set_headers(self, filelike: Union[BufferedReader, BytesIO, _TemporaryFileWrapper]) -> None: ... + + +class HttpResponse: + def __init__(self, content: Any = ..., *args, **kwargs) -> None: ... + def __repr__(self) -> str: ... + def getvalue(self) -> bytes: ... + def writable(self) -> bool: ... + def write(self, content: Union[str, bytes]) -> None: ... + def writelines(self, lines: List[str]) -> None: ... + + +class HttpResponseBase: + def __delitem__(self, header: str) -> None: ... + def __getitem__(self, header: str) -> str: ... + def __init__( + self, + content_type: Optional[str] = ..., + status: Optional[Union[str, int]] = ..., + reason: Optional[str] = ..., + charset: Optional[str] = ... + ) -> None: ... + def __setitem__(self, header: Union[str, bytes], value: Union[str, bytes, int]) -> None: ... + @property + def _content_type_for_repr(self) -> str: ... + def _convert_to_charset(self, value: Union[str, int], charset: str, mime_encode: bool = ...) -> str: ... + def close(self) -> None: ... + def delete_cookie(self, key: str, path: str = ..., domain: Optional[str] = ...) -> None: ... + def get(self, header: str, alternate: Optional[Union[str, Tuple]] = ...) -> Optional[Union[str, Tuple]]: ... + def has_header(self, header: str) -> bool: ... + def make_bytes(self, value: Union[str, bytes, int]) -> bytes: ... + def seekable(self) -> bool: ... + def serialize_headers(self) -> bytes: ... + def set_cookie( + self, + key: str, + value: str = ..., + max_age: Optional[int] = ..., + expires: Optional[str] = ..., + path: str = ..., + domain: Optional[str] = ..., + secure: Optional[bool] = ..., + httponly: bool = ..., + samesite: Optional[str] = ... + ) -> None: ... + def set_signed_cookie(self, key: str, value: str, salt: str = ..., **kwargs) -> None: ... + def setdefault(self, key: str, value: str) -> None: ... + def tell(self): ... + def write(self, content: str): ... + def writelines(self, lines: List[str]): ... + + +class HttpResponseNotAllowed: + def __init__(self, permitted_methods: List[str], *args, **kwargs) -> None: ... + def __repr__(self) -> str: ... + + +class HttpResponseNotModified: + def __init__(self, *args, **kwargs) -> None: ... + + +class HttpResponseRedirectBase: + def __init__(self, redirect_to: str, *args, **kwargs) -> None: ... + def __repr__(self) -> str: ... + + +class JsonResponse: + def __init__( + self, + data: Dict[str, Union[Dict[str, str], str, List[Dict[str, str]], Dict[str, bool]]], + encoder: Type[DjangoJSONEncoder] = ..., + safe: bool = ..., + json_dumps_params: None = ..., + **kwargs + ) -> None: ... + + +class StreamingHttpResponse: + def __init__( + self, + streaming_content: Union[List[str], BufferedReader, str, _TemporaryFileWrapper] = ..., + *args, + **kwargs + ) -> None: ... + def __iter__(self) -> map: ... + def _set_streaming_content(self, value: Union[TextIOWrapper, str, List[bytes], List[str]]) -> None: ... + @property + def content(self): ... \ No newline at end of file diff --git a/django/middleware/cache.pyi b/django/middleware/cache.pyi new file mode 100644 index 0000000..7c5d483 --- /dev/null +++ b/django/middleware/cache.pyi @@ -0,0 +1,33 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from django.http.response import ( + HttpResponse, + HttpResponseBase, +) +from typing import ( + Callable, + Optional, +) + + +class CacheMiddleware: + def __init__(self, get_response: None = ..., cache_timeout: Optional[int] = ..., **kwargs) -> None: ... + + +class FetchFromCacheMiddleware: + def __init__(self, get_response: Optional[Callable] = ...) -> None: ... + def process_request(self, request: HttpRequest) -> Optional[HttpResponse]: ... + + +class UpdateCacheMiddleware: + def __init__(self, get_response: None = ...) -> None: ... + def _should_update_cache( + self, + request: WSGIRequest, + response: HttpResponse + ) -> bool: ... + def process_response( + self, + request: WSGIRequest, + response: HttpResponseBase + ) -> HttpResponseBase: ... \ No newline at end of file diff --git a/django/middleware/clickjacking.pyi b/django/middleware/clickjacking.pyi new file mode 100644 index 0000000..bbe0c4b --- /dev/null +++ b/django/middleware/clickjacking.pyi @@ -0,0 +1,15 @@ +from django.http.request import HttpRequest +from django.http.response import HttpResponse + + +class XFrameOptionsMiddleware: + def get_xframe_options_value( + self, + request: HttpRequest, + response: HttpResponse + ) -> str: ... + def process_response( + self, + request: HttpRequest, + response: HttpResponse + ) -> HttpResponse: ... \ No newline at end of file diff --git a/django/middleware/common.pyi b/django/middleware/common.pyi new file mode 100644 index 0000000..4161fb0 --- /dev/null +++ b/django/middleware/common.pyi @@ -0,0 +1,38 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from django.http.response import ( + HttpResponseBase, + HttpResponseNotFound, + HttpResponsePermanentRedirect, +) +from typing import Optional + + +class BrokenLinkEmailsMiddleware: + def is_ignorable_request( + self, + request: WSGIRequest, + uri: str, + domain: str, + referer: str + ) -> bool: ... + def is_internal_request(self, domain: str, referer: str) -> bool: ... + def process_response( + self, + request: WSGIRequest, + response: HttpResponseNotFound + ) -> HttpResponseNotFound: ... + + +class CommonMiddleware: + def get_full_path_with_slash(self, request: WSGIRequest) -> str: ... + def process_request( + self, + request: WSGIRequest + ) -> Optional[HttpResponsePermanentRedirect]: ... + def process_response( + self, + request: HttpRequest, + response: HttpResponseBase + ) -> HttpResponseBase: ... + def should_redirect_with_slash(self, request: WSGIRequest) -> bool: ... \ No newline at end of file diff --git a/django/middleware/csrf.pyi b/django/middleware/csrf.pyi new file mode 100644 index 0000000..9f2b1a9 --- /dev/null +++ b/django/middleware/csrf.pyi @@ -0,0 +1,64 @@ +from django.http.request import HttpRequest +from django.http.response import ( + HttpResponse, + HttpResponseBase, + HttpResponseForbidden, +) +from typing import ( + Any, + Callable, + Dict, + Optional, + Tuple, +) + + +def _compare_salted_tokens(request_csrf_token: str, csrf_token: str) -> bool: ... + + +def _get_failure_view() -> Callable: ... + + +def _get_new_csrf_string() -> str: ... + + +def _get_new_csrf_token() -> str: ... + + +def _salt_cipher_secret(secret: str) -> str: ... + + +def _sanitize_token(token: str) -> str: ... + + +def _unsalt_cipher_token(token: str) -> str: ... + + +def get_token(request: HttpRequest) -> str: ... + + +def rotate_token(request: HttpRequest) -> None: ... + + +class CsrfViewMiddleware: + def _accept(self, request: HttpRequest) -> None: ... + def _get_token(self, request: HttpRequest) -> Optional[str]: ... + def _reject( + self, + request: HttpRequest, + reason: str + ) -> HttpResponseForbidden: ... + def _set_token(self, request: HttpRequest, response: HttpResponse) -> None: ... + def process_request(self, request: HttpRequest) -> None: ... + def process_response( + self, + request: HttpRequest, + response: HttpResponseBase + ) -> HttpResponseBase: ... + def process_view( + self, + request: HttpRequest, + callback: Callable, + callback_args: Tuple, + callback_kwargs: Dict[str, Any] + ) -> Optional[HttpResponseForbidden]: ... \ No newline at end of file diff --git a/django/middleware/gzip.pyi b/django/middleware/gzip.pyi new file mode 100644 index 0000000..1bd2b33 --- /dev/null +++ b/django/middleware/gzip.pyi @@ -0,0 +1,10 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import HttpResponseBase + + +class GZipMiddleware: + def process_response( + self, + request: WSGIRequest, + response: HttpResponseBase + ) -> HttpResponseBase: ... \ No newline at end of file diff --git a/django/middleware/http.pyi b/django/middleware/http.pyi new file mode 100644 index 0000000..4612de8 --- /dev/null +++ b/django/middleware/http.pyi @@ -0,0 +1,11 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import HttpResponse + + +class ConditionalGetMiddleware: + def needs_etag(self, response: HttpResponse) -> bool: ... + def process_response( + self, + request: WSGIRequest, + response: HttpResponse + ) -> HttpResponse: ... \ No newline at end of file diff --git a/django/middleware/locale.pyi b/django/middleware/locale.pyi new file mode 100644 index 0000000..df72f6f --- /dev/null +++ b/django/middleware/locale.pyi @@ -0,0 +1,11 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import HttpResponse + + +class LocaleMiddleware: + def process_request(self, request: WSGIRequest) -> None: ... + def process_response( + self, + request: WSGIRequest, + response: HttpResponse + ) -> HttpResponse: ... \ No newline at end of file diff --git a/django/middleware/security.pyi b/django/middleware/security.pyi new file mode 100644 index 0000000..7e4a9a3 --- /dev/null +++ b/django/middleware/security.pyi @@ -0,0 +1,19 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.response import ( + HttpResponse, + HttpResponsePermanentRedirect, +) +from typing import Optional + + +class SecurityMiddleware: + def __init__(self, get_response: None = ...) -> None: ... + def process_request( + self, + request: WSGIRequest + ) -> Optional[HttpResponsePermanentRedirect]: ... + def process_response( + self, + request: WSGIRequest, + response: HttpResponse + ) -> HttpResponse: ... \ No newline at end of file diff --git a/django/shortcuts.pyi b/django/shortcuts.pyi new file mode 100644 index 0000000..ab96948 --- /dev/null +++ b/django/shortcuts.pyi @@ -0,0 +1,57 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.db.models.base import Model +from django.db.models.manager import Manager +from django.db.models.query import QuerySet +from django.http.response import ( + HttpResponse, + HttpResponseRedirect, +) +from typing import ( + Callable, + Dict, + List, + Optional, + Type, + Union, +) + + +def _get_queryset( + klass: Union[Type[Model], QuerySet, Manager] +) -> Union[QuerySet, Manager]: ... + + +def get_list_or_404(klass: Manager, *args, **kwargs) -> List[Model]: ... + + +def get_object_or_404(klass: Type[Model], *args, **kwargs) -> Model: ... + + +def redirect( + to: Union[str, Callable], + *args, + permanent = ..., + **kwargs +) -> HttpResponseRedirect: ... + + +def render( + request: WSGIRequest, + template_name: str, + context: Optional[Union[Dict[str, bool], Dict[str, str], Dict[str, Union[str, None]]]] = ..., + content_type: None = ..., + status: Optional[int] = ..., + using: None = ... +) -> HttpResponse: ... + + +def render_to_response( + template_name: str, + context: Dict[str, str] = ..., + content_type: str = ..., + status: None = ..., + using: None = ... +) -> HttpResponse: ... + + +def resolve_url(to: Union[str, Callable], *args, **kwargs) -> str: ... \ No newline at end of file diff --git a/django/template/backends/base.pyi b/django/template/backends/base.pyi new file mode 100644 index 0000000..5391275 --- /dev/null +++ b/django/template/backends/base.pyi @@ -0,0 +1,14 @@ +from typing import ( + Dict, + Iterator, + List, + Tuple, + Union, +) + + +class BaseEngine: + def __init__(self, params: Dict[str, Union[str, bool, List[str]]]) -> None: ... + def iter_template_filenames(self, template_name: str) -> Iterator[str]: ... + @cached_property + def template_dirs(self) -> Tuple: ... \ No newline at end of file diff --git a/django/template/backends/django.pyi b/django/template/backends/django.pyi new file mode 100644 index 0000000..ba3edf7 --- /dev/null +++ b/django/template/backends/django.pyi @@ -0,0 +1,48 @@ +from django.http.request import HttpRequest +from django.template.base import Template +from django.template.exceptions import TemplateDoesNotExist +from django.utils.safestring import SafeText +from typing import ( + Any, + Dict, + Iterator, + Optional, +) + + +def copy_exception( + exc: TemplateDoesNotExist, + backend: Optional[DjangoTemplates] = ... +) -> TemplateDoesNotExist: ... + + +def get_installed_libraries() -> Dict[str, str]: ... + + +def get_package_libraries(pkg: Any) -> Iterator[str]: ... + + +def reraise( + exc: TemplateDoesNotExist, + backend: DjangoTemplates +): ... + + +class DjangoTemplates: + def __init__(self, params: Dict[str, Any]) -> None: ... + def from_string(self, template_code: str) -> Template: ... + def get_template(self, template_name: str) -> Template: ... + def get_templatetag_libraries(self, custom_libraries: Dict[str, str]) -> Dict[str, str]: ... + + +class Template: + def __init__( + self, + template: Template, + backend: DjangoTemplates + ) -> None: ... + def render( + self, + context: Any = ..., + request: Optional[HttpRequest] = ... + ) -> SafeText: ... \ No newline at end of file diff --git a/django/template/backends/dummy.pyi b/django/template/backends/dummy.pyi new file mode 100644 index 0000000..07c6d7c --- /dev/null +++ b/django/template/backends/dummy.pyi @@ -0,0 +1,19 @@ +from django.http.request import HttpRequest +from typing import ( + Dict, + Optional, + Union, +) + + +class Template: + def render( + self, + context: Optional[Dict[str, str]] = ..., + request: Optional[HttpRequest] = ... + ) -> str: ... + + +class TemplateStrings: + def __init__(self, params: Dict[str, Union[bool, str]]) -> None: ... + def get_template(self, template_name: str) -> Template: ... \ No newline at end of file diff --git a/django/template/backends/utils.pyi b/django/template/backends/utils.pyi new file mode 100644 index 0000000..bad46e3 --- /dev/null +++ b/django/template/backends/utils.pyi @@ -0,0 +1,5 @@ +from django.http.request import HttpRequest +from django.utils.safestring import SafeText + + +def csrf_input(request: HttpRequest) -> SafeText: ... \ No newline at end of file diff --git a/django/template/base.pyi b/django/template/base.pyi new file mode 100644 index 0000000..18f4e23 --- /dev/null +++ b/django/template/base.pyi @@ -0,0 +1,186 @@ +from django.template.backends.dummy import TemplateStrings +from django.template.context import Context +from django.template.defaulttags import LoadNode +from django.template.engine import Engine +from django.template.exceptions import TemplateSyntaxError +from django.template.library import Library +from django.template.loader_tags import ( + BlockNode, + ExtendsNode, +) +from django.template.loaders.base import Loader +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Tuple, + Type, + Union, +) + + +def linebreak_iter(template_source: str) -> Iterator[int]: ... + + +def render_value_in_context(value: Any, context: Context) -> str: ... + + +def token_kwargs( + bits: List[str], + parser: Parser, + support_legacy: bool = ... +) -> Dict[str, FilterExpression]: ... + + +class DebugLexer: + def tokenize(self) -> List[Token]: ... + + +class FilterExpression: + def __init__(self, token: str, parser: Parser) -> None: ... + def __str__(self) -> str: ... + @staticmethod + def args_check( + name: str, + func: Callable, + provided: Union[List[Tuple[bool, SafeText]], List[Tuple[bool, Variable]]] + ) -> bool: ... + def resolve( + self, + context: Union[Dict[str, Dict[str, str]], Context], + ignore_failures: bool = ... + ) -> Any: ... + + +class Lexer: + def __init__(self, template_string: str) -> None: ... + def create_token( + self, + token_string: str, + position: Optional[Tuple[int, int]], + lineno: int, + in_tag: bool + ) -> Token: ... + def tokenize(self) -> List[Token]: ... + + +class Node: + def get_nodes_by_type( + self, + nodetype: Type[Node] + ) -> Union[List[VariableNode], List[BlockNode], List[LoadNode], List[ExtendsNode]]: ... + def render_annotated(self, context: Context) -> Union[str, int]: ... + + +class NodeList: + def get_nodes_by_type( + self, + nodetype: Type[Node] + ) -> Union[List[BlockNode], List[VariableNode]]: ... + def render(self, context: Context) -> SafeText: ... + + +class Origin: + def __eq__(self, other: Origin) -> bool: ... + def __init__( + self, + name: str, + template_name: Optional[str] = ..., + loader: Optional[Union[Loader, TemplateStrings]] = ... + ) -> None: ... + @property + def loader_name(self) -> Optional[str]: ... + + +class Parser: + def __init__( + self, + tokens: Union[str, List[Token]], + libraries: Optional[Dict[str, Library]] = ..., + builtins: List[Library] = ..., + origin: Optional[Origin] = ... + ) -> None: ... + def add_library(self, lib: Library) -> None: ... + def compile_filter(self, token: str) -> FilterExpression: ... + def delete_first_token(self) -> None: ... + def error( + self, + token: Token, + e: Union[str, TemplateSyntaxError, RuntimeError] + ) -> Union[TemplateSyntaxError, RuntimeError]: ... + def extend_nodelist( + self, + nodelist: NodeList, + node: Node, + token: Token + ) -> None: ... + def find_filter(self, filter_name: str) -> Callable: ... + def invalid_block_tag( + self, + token: Token, + command: str, + parse_until: Union[Tuple[str], Tuple[str, str]] = ... + ): ... + def next_token(self) -> Token: ... + def parse( + self, + parse_until: Optional[Union[Tuple[str, str, str], Tuple[str], Tuple[str, str]]] = ... + ) -> NodeList: ... + def prepend_token(self, token: Token) -> None: ... + def skip_past(self, endtag: str) -> None: ... + def unclosed_block_tag(self, parse_until: Union[Tuple[str, str, str], Tuple[str]]): ... + + +class Template: + def __init__( + self, + template_string: str, + origin: Optional[Origin] = ..., + name: Optional[str] = ..., + engine: Optional[Engine] = ... + ) -> None: ... + def compile_nodelist(self) -> NodeList: ... + def get_exception_info( + self, + exception: Exception, + token: Token + ) -> Dict[str, Union[str, List[Tuple[int, SafeText]], int]]: ... + def render(self, context: Context): ... + + +class TextNode: + def __init__(self, s: str) -> None: ... + def __repr__(self) -> str: ... + def render(self, context: Context) -> str: ... + + +class Token: + def __init__( + self, + token_type: TokenType, + contents: str, + position: Optional[Tuple[int, int]] = ..., + lineno: Optional[int] = ... + ) -> None: ... + def split_contents(self) -> List[str]: ... + + +class Variable: + def __init__(self, var: str) -> None: ... + def _resolve_lookup(self, context: Any) -> Any: ... + def resolve(self, context: Any) -> Any: ... + + +class VariableDoesNotExist: + def __init__(self, msg: str, params: Any = ...) -> None: ... + def __str__(self) -> str: ... + + +class VariableNode: + def __init__(self, filter_expression: FilterExpression) -> None: ... + def __repr__(self) -> str: ... + def render(self, context: Context) -> str: ... \ No newline at end of file diff --git a/django/template/context.pyi b/django/template/context.pyi new file mode 100644 index 0000000..3f50692 --- /dev/null +++ b/django/template/context.pyi @@ -0,0 +1,102 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from django.template.base import ( + Origin, + Template, +) +from django.template.defaulttags import CycleNode +from django.template.library import InclusionNode +from django.template.loader_tags import BlockContext +from itertools import cycle +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Type, + Union, +) + + +def make_context( + context: Any, + request: Optional[WSGIRequest] = ..., + **kwargs +) -> Context: ... + + +class BaseContext: + def __contains__(self, key: str) -> bool: ... + def __copy__(self) -> BaseContext: ... + def __eq__(self, other: Context) -> bool: ... + def __getitem__(self, key: Union[str, int]) -> Any: ... + def __init__(self, dict_: Any = ...) -> None: ... + def __iter__(self) -> None: ... + def __repr__(self) -> str: ... + def __setitem__( + self, + key: Union[str, CycleNode, InclusionNode], + value: Any + ) -> None: ... + def _reset_dicts(self, value: Any = ...) -> None: ... + def flatten(self) -> Dict[str, Union[None, int, str, Dict[str, Union[Type[object], str]]]]: ... + def get(self, key: str, otherwise: Optional[int] = ...) -> Any: ... + def new(self, values: Any = ...) -> Context: ... + def pop(self) -> ContextDict: ... + def push(self, *args, **kwargs) -> ContextDict: ... + def set_upward(self, key: str, value: Union[str, int]) -> None: ... + def setdefault( + self, + key: str, + default: Union[List[Origin], int] = ... + ) -> Union[List[Origin], int]: ... + + +class Context: + def __copy__(self) -> Context: ... + def __init__( + self, + dict_: Any = ..., + autoescape: bool = ..., + use_l10n: Optional[bool] = ..., + use_tz: None = ... + ) -> None: ... + def bind_template(self, template: Template) -> Iterator[None]: ... + def update(self, other_dict: Dict[str, Any]) -> ContextDict: ... + + +class ContextDict: + def __enter__(self) -> ContextDict: ... + def __exit__(self, *args, **kwargs) -> None: ... + def __init__(self, context: BaseContext, *args, **kwargs) -> None: ... + + +class RenderContext: + def __contains__(self, key: Union[str, CycleNode]) -> bool: ... + def __getitem__( + self, + key: Union[str, CycleNode] + ) -> Union[List[Origin], BlockContext, cycle]: ... + def __iter__(self): ... + def get( + self, + key: Union[str, InclusionNode], + otherwise: None = ... + ) -> Optional[Union[BlockContext, Template]]: ... + def push_state(self, template: Template, isolated_context: bool = ...) -> Iterator[None]: ... + + +class RequestContext: + def __init__( + self, + request: HttpRequest, + dict_: None = ..., + processors: Optional[List[Callable]] = ..., + use_l10n: None = ..., + use_tz: None = ..., + autoescape: bool = ... + ) -> None: ... + def bind_template(self, template: Template) -> Iterator[None]: ... + def new(self, values: Any = ...) -> RequestContext: ... \ No newline at end of file diff --git a/django/template/context_processors.pyi b/django/template/context_processors.pyi new file mode 100644 index 0000000..d38cfc0 --- /dev/null +++ b/django/template/context_processors.pyi @@ -0,0 +1,22 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from django.utils.functional import SimpleLazyObject +from typing import ( + Callable, + Dict, + List, + Tuple, + Union, +) + + +def csrf(request: HttpRequest) -> Dict[str, SimpleLazyObject]: ... + + +def debug(request: HttpRequest) -> Dict[str, Union[bool, Callable]]: ... + + +def i18n(request: WSGIRequest) -> Dict[str, Union[List[Tuple[str, str]], str, bool]]: ... + + +def request(request: HttpRequest) -> Dict[str, HttpRequest]: ... \ No newline at end of file diff --git a/django/template/defaultfilters.pyi b/django/template/defaultfilters.pyi new file mode 100644 index 0000000..2ea3261 --- /dev/null +++ b/django/template/defaultfilters.pyi @@ -0,0 +1,199 @@ +from datetime import ( + date, + time, + timedelta, +) +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) + + +def _property_resolver(arg: Union[str, int]) -> Callable: ... + + +def add( + value: Union[str, Tuple[int, int], date, int], + arg: Union[int, timedelta, Tuple[int, int], SafeText] +) -> Union[str, Tuple[int, int, int, int], date, int]: ... + + +def addslashes(value: str) -> str: ... + + +def capfirst(value: str) -> str: ... + + +def center(value: str, arg: SafeText) -> str: ... + + +def cut(value: str, arg: str) -> str: ... + + +def date(value: Optional[Union[time, date, str]], arg: Optional[str] = ...) -> str: ... + + +def default(value: Optional[Union[str, int]], arg: Union[int, SafeText]) -> Union[str, int]: ... + + +def default_if_none(value: Optional[str], arg: Union[str, int]) -> Union[str, int]: ... + + +def dictsort( + value: Union[List[Dict[str, Union[str, int]]], List[Dict[str, str]], List[Tuple[str, str]]], + arg: Union[str, int] +) -> Union[List[Dict[str, Union[str, int]]], List[Dict[str, str]], List[Tuple[str, str]]]: ... + + +def dictsortreversed(value: str, arg: str) -> str: ... + + +def divisibleby(value: int, arg: int) -> bool: ... + + +def escape_filter(value: str) -> SafeText: ... + + +def escapejs_filter(value: str) -> SafeText: ... + + +def filesizeformat(bytes_: Union[str, int]) -> str: ... + + +def first(value: Union[str, List[str]]) -> str: ... + + +def floatformat(text: Any, arg: Union[str, int] = ...) -> str: ... + + +def force_escape(value: str) -> SafeText: ... + + +def get_digit(value: int, arg: int) -> int: ... + + +def iriencode(value: str) -> str: ... + + +def join(value: object, arg: str, autoescape: bool = ...) -> object: ... + + +def json_script(value: Dict[str, str], element_id: SafeText) -> SafeText: ... + + +def last(value: List[str]) -> str: ... + + +def length(value: Any) -> int: ... + + +def length_is(value: Any, arg: Union[int, SafeText]) -> Union[bool, str]: ... + + +def linebreaks_filter(value: str, autoescape: bool = ...) -> SafeText: ... + + +def linebreaksbr(value: str, autoescape: bool = ...) -> SafeText: ... + + +def linenumbers(value: str, autoescape: bool = ...) -> SafeText: ... + + +def ljust(value: str, arg: Union[int, SafeText]) -> str: ... + + +def lower(value: str) -> str: ... + + +def make_list(value: str) -> List[str]: ... + + +def phone2numeric_filter(value: str) -> str: ... + + +def pluralize(value: object, arg: str = ...) -> str: ... + + +def pprint(value: object) -> str: ... + + +def random(value: Union[List[SafeText], List[str]]) -> str: ... + + +def rjust(value: str, arg: Union[int, SafeText]) -> str: ... + + +def safe(value: str) -> SafeText: ... + + +def safeseq(value: List[str]) -> List[SafeText]: ... + + +def slice_filter(value: str, arg: str) -> str: ... + + +def slugify(value: str) -> SafeText: ... + + +def stringformat(value: object, arg: str) -> str: ... + + +def striptags(value: str) -> str: ... + + +def time(value: Optional[Union[time, str, date]], arg: Optional[str] = ...) -> str: ... + + +def timesince_filter(value: Optional[date], arg: Optional[date] = ...) -> str: ... + + +def timeuntil_filter(value: date, arg: Optional[date] = ...) -> str: ... + + +def title(value: str) -> str: ... + + +def truncatechars(value: str, arg: Union[int, SafeText]) -> str: ... + + +def truncatechars_html(value: str, arg: Union[str, int]) -> str: ... + + +def truncatewords(value: str, arg: Union[int, SafeText]) -> str: ... + + +def truncatewords_html(value: str, arg: int) -> str: ... + + +def unordered_list(value: Any, autoescape: bool = ...) -> SafeText: ... + + +def upper(value: str) -> str: ... + + +def urlencode(value: str, safe: None = ...) -> str: ... + + +def urlize(value: str, autoescape: bool = ...) -> SafeText: ... + + +def urlizetrunc( + value: str, + limit: Union[int, SafeText], + autoescape: bool = ... +) -> SafeText: ... + + +def wordcount(value: str) -> int: ... + + +def wordwrap(value: str, arg: Union[int, SafeText]) -> str: ... + + +def yesno(value: Optional[int], arg: Optional[str] = ...) -> Optional[str]: ... \ No newline at end of file diff --git a/django/template/defaulttags.pyi b/django/template/defaulttags.pyi new file mode 100644 index 0000000..8e3fa6e --- /dev/null +++ b/django/template/defaulttags.pyi @@ -0,0 +1,337 @@ +from datetime import date +from django.template.base import ( + FilterExpression, + NodeList, + Parser, + Token, +) +from django.template.context import ( + Context, + RequestContext, +) +from django.template.library import Library +from django.utils.safestring import SafeText +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Union, +) + + +def autoescape( + parser: Parser, + token: Token +) -> AutoEscapeControlNode: ... + + +def comment( + parser: Parser, + token: Token +) -> CommentNode: ... + + +def csrf_token( + parser: Parser, + token: Token +) -> CsrfTokenNode: ... + + +def cycle( + parser: Parser, + token: Token +) -> CycleNode: ... + + +def do_filter( + parser: Parser, + token: Token +) -> FilterNode: ... + + +def do_for( + parser: Parser, + token: Token +) -> ForNode: ... + + +def do_if(parser: Parser, token: Token) -> IfNode: ... + + +def do_ifequal( + parser: Parser, + token: Token, + negate: bool +) -> IfEqualNode: ... + + +def do_with( + parser: Parser, + token: Token +) -> WithNode: ... + + +def find_library(parser: Parser, name: str) -> Library: ... + + +def firstof( + parser: Parser, + token: Token +) -> FirstOfNode: ... + + +def ifchanged( + parser: Parser, + token: Token +) -> IfChangedNode: ... + + +def ifequal( + parser: Parser, + token: Token +) -> IfEqualNode: ... + + +def ifnotequal( + parser: Parser, + token: Token +) -> IfEqualNode: ... + + +def load(parser: Parser, token: Token) -> LoadNode: ... + + +def load_from_library( + library: Library, + label: str, + names: List[str] +) -> Library: ... + + +def lorem( + parser: Parser, + token: Token +) -> LoremNode: ... + + +def now(parser: Parser, token: Token) -> NowNode: ... + + +def regroup( + parser: Parser, + token: Token +) -> RegroupNode: ... + + +def resetcycle( + parser: Parser, + token: Token +) -> ResetCycleNode: ... + + +def spaceless( + parser: Parser, + token: Token +) -> SpacelessNode: ... + + +def templatetag( + parser: Parser, + token: Token +) -> TemplateTagNode: ... + + +def url(parser: Parser, token: Token) -> URLNode: ... + + +def verbatim( + parser: Parser, + token: Token +) -> VerbatimNode: ... + + +def widthratio( + parser: Parser, + token: Token +) -> WidthRatioNode: ... + + +class AutoEscapeControlNode: + def __init__(self, setting: bool, nodelist: NodeList) -> None: ... + def render(self, context: Context) -> SafeText: ... + + +class CommentNode: + def render(self, context: Context) -> str: ... + + +class CsrfTokenNode: + def render(self, context: RequestContext) -> SafeText: ... + + +class CycleNode: + def __init__( + self, + cyclevars: List[FilterExpression], + variable_name: Optional[str] = ..., + silent: bool = ... + ) -> None: ... + def render(self, context: Context) -> str: ... + def reset(self, context: Context) -> None: ... + + +class FilterNode: + def __init__( + self, + filter_expr: FilterExpression, + nodelist: NodeList + ) -> None: ... + def render(self, context: Context): ... + + +class FirstOfNode: + def __init__(self, variables: List[FilterExpression], asvar: Optional[str] = ...) -> None: ... + def render(self, context: Context) -> str: ... + + +class ForNode: + def __init__( + self, + loopvars: List[str], + sequence: FilterExpression, + is_reversed: bool, + nodelist_loop: NodeList, + nodelist_empty: Optional[NodeList] = ... + ) -> None: ... + def __repr__(self) -> str: ... + def render(self, context: Context) -> SafeText: ... + + +class IfChangedNode: + def __init__( + self, + nodelist_true: NodeList, + nodelist_false: NodeList, + *varlist + ) -> None: ... + def _get_context_stack_frame(self, context: Context) -> Any: ... + def render(self, context: Context) -> str: ... + + +class IfEqualNode: + def __init__( + self, + var1: FilterExpression, + var2: FilterExpression, + nodelist_true: NodeList, + nodelist_false: NodeList, + negate: bool + ) -> None: ... + def render(self, context: Context) -> SafeText: ... + + +class IfNode: + def __init__( + self, + conditions_nodelists: Union[List[Tuple[TemplateLiteral, NodeList]], List[Union[Tuple[TemplateLiteral, NodeList], Tuple[None, NodeList]]]] + ) -> None: ... + def __iter__(self) -> None: ... + def __repr__(self) -> str: ... + @property + def nodelist(self) -> NodeList: ... + def render(self, context: Context) -> str: ... + + +class LoadNode: + def render(self, context: Context) -> str: ... + + +class LoremNode: + def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ... + def render(self, context: Context) -> str: ... + + +class NowNode: + def __init__(self, format_string: str, asvar: None = ...) -> None: ... + def render(self, context: Context) -> str: ... + + +class RegroupNode: + def __init__( + self, + target: FilterExpression, + expression: FilterExpression, + var_name: str + ) -> None: ... + def render(self, context: Context) -> str: ... + def resolve_expression( + self, + obj: Dict[str, Union[date, str, int, List[str]]], + context: Context + ) -> Union[str, int]: ... + + +class ResetCycleNode: + def __init__(self, node: CycleNode) -> None: ... + def render(self, context: Context) -> str: ... + + +class SpacelessNode: + def __init__(self, nodelist: NodeList) -> None: ... + def render(self, context: Context) -> str: ... + + +class TemplateIfParser: + def __init__(self, parser: Parser, *args, **kwargs) -> None: ... + def create_var(self, value: str) -> TemplateLiteral: ... + + +class TemplateLiteral: + def __init__(self, value: FilterExpression, text: str) -> None: ... + def display(self) -> str: ... + def eval(self, context: Context) -> Any: ... + + +class TemplateTagNode: + def __init__(self, tagtype: str) -> None: ... + def render(self, context: Context) -> str: ... + + +class URLNode: + def __init__( + self, + view_name: FilterExpression, + args: List[FilterExpression], + kwargs: Dict[str, FilterExpression], + asvar: Optional[str] + ) -> None: ... + def render(self, context: Context) -> str: ... + + +class VerbatimNode: + def __init__(self, content: SafeText) -> None: ... + def render(self, context: Context) -> SafeText: ... + + +class WidthRatioNode: + def __init__( + self, + val_expr: FilterExpression, + max_expr: FilterExpression, + max_width: FilterExpression, + asvar: Optional[str] = ... + ) -> None: ... + def render(self, context: Context) -> str: ... + + +class WithNode: + def __init__( + self, + var: None, + name: None, + nodelist: NodeList, + extra_context: Dict[str, FilterExpression] = ... + ) -> None: ... + def render(self, context: Context): ... \ No newline at end of file diff --git a/django/template/engine.pyi b/django/template/engine.pyi new file mode 100644 index 0000000..08587f7 --- /dev/null +++ b/django/template/engine.pyi @@ -0,0 +1,62 @@ +from django.template.base import ( + Origin, + Template, +) +from django.template.library import Library +from django.template.loaders.base import Loader +from django.template.loaders.cached import Loader +from django.template.loaders.filesystem import Loader +from django.template.loaders.locmem import Loader +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) + + +class Engine: + def __init__( + self, + dirs: Optional[List[str]] = ..., + app_dirs: bool = ..., + context_processors: Optional[Union[Tuple[str, str], List[str]]] = ..., + debug: bool = ..., + loaders: Any = ..., + string_if_invalid: str = ..., + file_charset: str = ..., + libraries: Optional[Dict[str, str]] = ..., + builtins: Optional[List[str]] = ..., + autoescape: bool = ... + ) -> None: ... + def find_template( + self, + name: str, + dirs: None = ..., + skip: Optional[List[Origin]] = ... + ) -> Tuple[Template, Origin]: ... + def find_template_loader( + self, + loader: Union[str, Tuple[str, List[Tuple[str, Dict[str, str]]]], Tuple[str, Dict[str, str]], Tuple[str, List[str]]] + ) -> Loader: ... + def from_string(self, template_code: str) -> Template: ... + @staticmethod + def get_default() -> Engine: ... + def get_template(self, template_name: str) -> Template: ... + def get_template_builtins(self, builtins: List[str]) -> List[Library]: ... + def get_template_libraries(self, libraries: Dict[str, str]) -> Dict[str, Library]: ... + def get_template_loaders(self, template_loaders: Any) -> Any: ... + def render_to_string(self, template_name: str, context: Any = ...) -> SafeText: ... + def select_template(self, template_name_list: List[str]) -> Template: ... + @cached_property + def template_context_processors( + self + ) -> Union[Tuple[Callable, Callable, Callable], Tuple[Callable, Callable, Callable, Callable, Callable], Tuple[Callable, Callable], Tuple[Callable]]: ... + @cached_property + def template_loaders( + self + ) -> Union[List[Loader], List[Loader], List[Loader]]: ... \ No newline at end of file diff --git a/django/template/exceptions.pyi b/django/template/exceptions.pyi new file mode 100644 index 0000000..64ac355 --- /dev/null +++ b/django/template/exceptions.pyi @@ -0,0 +1,18 @@ +from django.template.backends.base import BaseEngine +from django.template.base import Origin +from typing import ( + List, + Optional, + Tuple, + Union, +) + + +class TemplateDoesNotExist: + def __init__( + self, + msg: Union[str, Origin], + tried: Optional[List[Tuple[Origin, str]]] = ..., + backend: Optional[BaseEngine] = ..., + chain: Optional[List[TemplateDoesNotExist]] = ... + ) -> None: ... \ No newline at end of file diff --git a/django/template/library.pyi b/django/template/library.pyi new file mode 100644 index 0000000..5a4b595 --- /dev/null +++ b/django/template/library.pyi @@ -0,0 +1,98 @@ +from django.template.base import ( + FilterExpression, + Parser, + Template, +) +from django.template.context import Context +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + Union, +) + + +def import_library(name: str) -> Library: ... + + +def parse_bits( + parser: Parser, + bits: List[str], + params: List[str], + varargs: Optional[str], + varkw: None, + defaults: Optional[Union[Tuple[bool, None], Tuple[str]]], + kwonly: List[str], + kwonly_defaults: Optional[Dict[str, int]], + takes_context: Optional[bool], + name: str +) -> Union[Tuple[List[Any], Dict[str, FilterExpression]], Tuple[List[FilterExpression], Dict[str, FilterExpression]], Tuple[List[FilterExpression], Dict[Any, Any]], Tuple[List[Any], Dict[Any, Any]]]: ... + + +class InclusionNode: + def __init__( + self, + func: Callable, + takes_context: Optional[bool], + args: List[FilterExpression], + kwargs: Dict[Any, Any], + filename: Optional[Union[str, Template]] + ) -> None: ... + def render(self, context: Context) -> SafeText: ... + + +class Library: + def __init__(self) -> None: ... + def filter( + self, + name: Optional[Union[str, Callable]] = ..., + filter_func: Optional[Callable] = ..., + **flags + ) -> Callable: ... + def filter_function(self, func: Callable, **flags) -> Callable: ... + def inclusion_tag( + self, + filename: Union[str, Template], + func: None = ..., + takes_context: Optional[bool] = ..., + name: Optional[str] = ... + ) -> Callable: ... + def simple_tag( + self, + func: Optional[Callable] = ..., + takes_context: Optional[bool] = ..., + name: Optional[str] = ... + ) -> Callable: ... + def tag( + self, + name: Optional[Union[str, Callable]] = ..., + compile_function: Optional[Union[str, Callable]] = ... + ) -> Callable: ... + def tag_function(self, func: Callable) -> Callable: ... + + +class SimpleNode: + def __init__( + self, + func: Callable, + takes_context: Optional[bool], + args: List[FilterExpression], + kwargs: Dict[str, FilterExpression], + target_var: Optional[str] + ) -> None: ... + def render(self, context: Context) -> str: ... + + +class TagHelperNode: + def __init__( + self, + func: Callable, + takes_context: Optional[bool], + args: List[FilterExpression], + kwargs: Dict[Any, Any] + ) -> None: ... + def get_resolved_arguments(self, context: Context) -> Any: ... \ No newline at end of file diff --git a/django/template/loader.pyi b/django/template/loader.pyi new file mode 100644 index 0000000..4b27cdd --- /dev/null +++ b/django/template/loader.pyi @@ -0,0 +1,31 @@ +from django.core.handlers.wsgi import WSGIRequest +from django.template.backends.base import BaseEngine +from django.template.backends.django import ( + DjangoTemplates, + Template, +) +from typing import ( + Any, + List, + Optional, + Union, +) + + +def _engine_list( + using: Optional[str] = ... +) -> Union[List[DjangoTemplates], List[BaseEngine]]: ... + + +def get_template(template_name: str, using: None = ...) -> Template: ... + + +def render_to_string( + template_name: Union[str, List[str]], + context: Any = ..., + request: Optional[WSGIRequest] = ..., + using: Optional[str] = ... +) -> str: ... + + +def select_template(template_name_list: List[str], using: None = ...) -> Template: ... \ No newline at end of file diff --git a/django/template/loader_tags.pyi b/django/template/loader_tags.pyi new file mode 100644 index 0000000..dafeb2c --- /dev/null +++ b/django/template/loader_tags.pyi @@ -0,0 +1,78 @@ +from django.template.base import ( + FilterExpression, + NodeList, + Parser, + Template, + Token, +) +from django.template.context import Context +from django.utils.safestring import SafeText +from typing import ( + Dict, + Optional, +) + + +def construct_relative_path(current_template_name: Optional[str], relative_name: str) -> str: ... + + +def do_block( + parser: Parser, + token: Token +) -> BlockNode: ... + + +def do_extends( + parser: Parser, + token: Token +) -> ExtendsNode: ... + + +def do_include( + parser: Parser, + token: Token +) -> IncludeNode: ... + + +class BlockContext: + def __init__(self) -> None: ... + def add_blocks(self, blocks: Dict[str, BlockNode]) -> None: ... + def get_block(self, name: str) -> BlockNode: ... + def pop(self, name: str) -> BlockNode: ... + def push(self, name: str, block: BlockNode) -> None: ... + + +class BlockNode: + def __init__(self, name: str, nodelist: NodeList, parent: None = ...) -> None: ... + def __repr__(self) -> str: ... + def render(self, context: Context) -> SafeText: ... + def super(self) -> SafeText: ... + + +class ExtendsNode: + def __init__( + self, + nodelist: NodeList, + parent_name: FilterExpression, + template_dirs: None = ... + ) -> None: ... + def __repr__(self) -> str: ... + def find_template( + self, + template_name: str, + context: Context + ) -> Template: ... + def get_parent(self, context: Context) -> Template: ... + def render(self, context: Context): ... + + +class IncludeNode: + def __init__( + self, + template: FilterExpression, + *args, + extra_context = ..., + isolated_context = ..., + **kwargs + ) -> None: ... + def render(self, context: Context) -> SafeText: ... \ No newline at end of file diff --git a/django/template/loaders/app_directories.pyi b/django/template/loaders/app_directories.pyi new file mode 100644 index 0000000..6a550a9 --- /dev/null +++ b/django/template/loaders/app_directories.pyi @@ -0,0 +1,8 @@ +from typing import ( + Tuple, + Union, +) + + +class Loader: + def get_dirs(self) -> Union[Tuple[str, str, str, str], Tuple[str, str, str], Tuple[str], Tuple[str, str]]: ... \ No newline at end of file diff --git a/django/template/loaders/base.pyi b/django/template/loaders/base.pyi new file mode 100644 index 0000000..36f9136 --- /dev/null +++ b/django/template/loaders/base.pyi @@ -0,0 +1,18 @@ +from django.template.base import ( + Origin, + Template, +) +from django.template.engine import Engine +from typing import ( + List, + Optional, +) + + +class Loader: + def __init__(self, engine: Engine) -> None: ... + def get_template( + self, + template_name: str, + skip: Optional[List[Origin]] = ... + ) -> Template: ... \ No newline at end of file diff --git a/django/template/loaders/cached.pyi b/django/template/loaders/cached.pyi new file mode 100644 index 0000000..7147722 --- /dev/null +++ b/django/template/loaders/cached.pyi @@ -0,0 +1,29 @@ +from django.template.base import ( + Origin, + Template, +) +from django.template.engine import Engine +from typing import ( + Dict, + List, + Optional, + Tuple, + Union, +) + + +class Loader: + def __init__( + self, + engine: Engine, + loaders: Union[List[Tuple[str, Dict[str, str]]], List[str]] + ) -> None: ... + def cache_key(self, template_name: str, skip: Optional[List[Origin]] = ...) -> str: ... + def generate_hash(self, values: List[str]) -> str: ... + def get_contents(self, origin: Origin) -> str: ... + def get_template( + self, + template_name: str, + skip: Optional[List[Origin]] = ... + ) -> Template: ... + def get_template_sources(self, template_name: str) -> None: ... \ No newline at end of file diff --git a/django/template/loaders/filesystem.pyi b/django/template/loaders/filesystem.pyi new file mode 100644 index 0000000..16443c9 --- /dev/null +++ b/django/template/loaders/filesystem.pyi @@ -0,0 +1,14 @@ +from django.template.base import Origin +from django.template.engine import Engine +from typing import ( + Iterator, + List, + Union, +) + + +class Loader: + def __init__(self, engine: Engine, dirs: None = ...) -> None: ... + def get_contents(self, origin: Origin): ... + def get_dirs(self) -> List[str]: ... + def get_template_sources(self, template_name: Union[str, bytes]) -> Iterator[Origin]: ... \ No newline at end of file diff --git a/django/template/loaders/locmem.pyi b/django/template/loaders/locmem.pyi new file mode 100644 index 0000000..453c1e2 --- /dev/null +++ b/django/template/loaders/locmem.pyi @@ -0,0 +1,12 @@ +from django.template.base import Origin +from django.template.engine import Engine +from typing import ( + Dict, + Iterator, +) + + +class Loader: + def __init__(self, engine: Engine, templates_dict: Dict[str, str]) -> None: ... + def get_contents(self, origin: Origin) -> str: ... + def get_template_sources(self, template_name: str) -> Iterator[Origin]: ... \ No newline at end of file diff --git a/django/template/response.pyi b/django/template/response.pyi new file mode 100644 index 0000000..e57e0f7 --- /dev/null +++ b/django/template/response.pyi @@ -0,0 +1,48 @@ +from django.http.request import HttpRequest +from django.template.backends.django import Template +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Union, +) + + +class SimpleTemplateResponse: + def __getstate__(self) -> Dict[str, Any]: ... + def __init__( + self, + template: Union[str, Template, List[str]], + context: Any = ..., + content_type: Optional[str] = ..., + status: Optional[int] = ..., + charset: Optional[str] = ..., + using: None = ... + ) -> None: ... + def add_post_render_callback(self, callback: Callable) -> None: ... + @property + def is_rendered(self) -> bool: ... + def render(self) -> SimpleTemplateResponse: ... + @property + def rendered_content(self) -> SafeText: ... + def resolve_context(self, context: Any) -> Any: ... + def resolve_template( + self, + template: Union[str, Template, List[str]] + ) -> Template: ... + + +class TemplateResponse: + def __init__( + self, + request: HttpRequest, + template: Union[str, Template, List[str]], + context: Any = ..., + content_type: Optional[str] = ..., + status: Optional[int] = ..., + charset: None = ..., + using: None = ... + ) -> None: ... \ No newline at end of file diff --git a/django/template/smartif.pyi b/django/template/smartif.pyi new file mode 100644 index 0000000..13f5445 --- /dev/null +++ b/django/template/smartif.pyi @@ -0,0 +1,24 @@ +from django.template.defaulttags import TemplateLiteral +from typing import ( + Any, + Dict, + List, + Optional, + Union, +) + + +class IfParser: + def __init__(self, tokens: Any) -> None: ... + def create_var(self, value: Optional[Union[List[int], int]]) -> Literal: ... + def expression(self, rbp: int = ...) -> Literal: ... + def next_token(self) -> Literal: ... + def parse(self) -> TemplateLiteral: ... + def translate_token(self, token: Union[List[int], str, int]) -> Literal: ... + + +class Literal: + def __init__(self, value: Optional[int]) -> None: ... + def __repr__(self) -> str: ... + def eval(self, context: Dict[Any, Any]) -> Optional[Union[int, List[int]]]: ... + def nud(self, parser: IfParser) -> Literal: ... \ No newline at end of file diff --git a/django/template/utils.pyi b/django/template/utils.pyi new file mode 100644 index 0000000..4ac22f2 --- /dev/null +++ b/django/template/utils.pyi @@ -0,0 +1,22 @@ +from collections import OrderedDict +from django.template.backends.base import BaseEngine +from django.template.backends.django import DjangoTemplates +from django.template.backends.dummy import TemplateStrings +from typing import ( + List, + Tuple, + Union, +) + + +def get_app_template_dirs(dirname: str) -> Tuple: ... + + +class EngineHandler: + def __getitem__(self, alias: str) -> BaseEngine: ... + def __iter__(self): ... + def all( + self + ) -> Union[List[DjangoTemplates], List[TemplateStrings], List[BaseEngine]]: ... + @cached_property + def templates(self) -> OrderedDict: ... \ No newline at end of file diff --git a/django/templatetags/cache.pyi b/django/templatetags/cache.pyi new file mode 100644 index 0000000..3156853 --- /dev/null +++ b/django/templatetags/cache.pyi @@ -0,0 +1,27 @@ +from django.template.base import ( + FilterExpression, + NodeList, + Parser, + Token, +) +from django.template.context import Context +from django.utils.safestring import SafeText +from typing import List + + +def do_cache( + parser: Parser, + token: Token +) -> CacheNode: ... + + +class CacheNode: + def __init__( + self, + nodelist: NodeList, + expire_time_var: FilterExpression, + fragment_name: str, + vary_on: List[FilterExpression], + cache_name: None + ) -> None: ... + def render(self, context: Context) -> SafeText: ... \ No newline at end of file diff --git a/django/templatetags/i18n.pyi b/django/templatetags/i18n.pyi new file mode 100644 index 0000000..e47bd95 --- /dev/null +++ b/django/templatetags/i18n.pyi @@ -0,0 +1,139 @@ +from django.template.base import ( + FilterExpression, + NodeList, + Parser, + Token, +) +from django.template.context import ( + Context, + RequestContext, +) +from django.utils.safestring import SafeText +from typing import ( + Any, + Dict, + List, + Optional, + Tuple, + Union, +) + + +def do_block_translate( + parser: Parser, + token: Token +) -> BlockTranslateNode: ... + + +def do_get_available_languages( + parser: Parser, + token: Token +) -> GetAvailableLanguagesNode: ... + + +def do_get_current_language( + parser: Parser, + token: Token +) -> GetCurrentLanguageNode: ... + + +def do_get_current_language_bidi( + parser: Parser, + token: Token +) -> GetCurrentLanguageBidiNode: ... + + +def do_get_language_info( + parser: Parser, + token: Token +) -> GetLanguageInfoNode: ... + + +def do_get_language_info_list( + parser: Parser, + token: Token +) -> GetLanguageInfoListNode: ... + + +def do_translate( + parser: Parser, + token: Token +) -> TranslateNode: ... + + +def language( + parser: Parser, + token: Token +) -> LanguageNode: ... + + +def language_bidi(lang_code: str) -> bool: ... + + +def language_name(lang_code: str) -> str: ... + + +def language_name_local(lang_code: str) -> str: ... + + +def language_name_translated(lang_code: str) -> str: ... + + +class BlockTranslateNode: + def __init__( + self, + extra_context: Dict[str, FilterExpression], + singular: List[Token], + plural: List[Token] = ..., + countervar: Optional[str] = ..., + counter: Optional[FilterExpression] = ..., + message_context: Optional[FilterExpression] = ..., + trimmed: bool = ..., + asvar: Optional[str] = ... + ) -> None: ... + def render(self, context: Context, nested: bool = ...) -> str: ... + def render_token_list( + self, + tokens: List[Token] + ) -> Union[Tuple[str, List[Any]], Tuple[str, List[str]]]: ... + + +class GetAvailableLanguagesNode: + def __init__(self, variable: str) -> None: ... + def render(self, context: Context) -> str: ... + + +class GetCurrentLanguageBidiNode: + def __init__(self, variable: str) -> None: ... + def render(self, context: RequestContext) -> str: ... + + +class GetCurrentLanguageNode: + def __init__(self, variable: str) -> None: ... + def render(self, context: RequestContext) -> str: ... + + +class GetLanguageInfoListNode: + def __init__(self, languages: FilterExpression, variable: str) -> None: ... + def render(self, context: Context) -> str: ... + + +class GetLanguageInfoNode: + def __init__(self, lang_code: FilterExpression, variable: str) -> None: ... + def render(self, context: Context) -> str: ... + + +class LanguageNode: + def __init__(self, nodelist: NodeList, language: FilterExpression) -> None: ... + def render(self, context: Context) -> SafeText: ... + + +class TranslateNode: + def __init__( + self, + filter_expression: FilterExpression, + noop: bool, + asvar: Optional[str] = ..., + message_context: Optional[FilterExpression] = ... + ) -> None: ... + def render(self, context: Context) -> str: ... \ No newline at end of file diff --git a/django/templatetags/l10n.pyi b/django/templatetags/l10n.pyi new file mode 100644 index 0000000..bcce609 --- /dev/null +++ b/django/templatetags/l10n.pyi @@ -0,0 +1,12 @@ +from datetime import date +from django.template.base import NodeList +from django.template.context import Context +from django.utils.safestring import SafeText + + +def unlocalize(value: date) -> str: ... + + +class LocalizeNode: + def __init__(self, nodelist: NodeList, use_l10n: bool) -> None: ... + def render(self, context: Context) -> SafeText: ... \ No newline at end of file diff --git a/django/templatetags/static.pyi b/django/templatetags/static.pyi new file mode 100644 index 0000000..a47b047 --- /dev/null +++ b/django/templatetags/static.pyi @@ -0,0 +1,60 @@ +from django.template.base import ( + FilterExpression, + Parser, + Token, +) +from django.template.context import Context +from typing import Optional + + +def do_static( + parser: Parser, + token: Token +) -> StaticNode: ... + + +def get_media_prefix( + parser: Parser, + token: Token +) -> PrefixNode: ... + + +def get_static_prefix( + parser: Parser, + token: Token +) -> PrefixNode: ... + + +def static(path: str) -> str: ... + + +class PrefixNode: + def __init__(self, varname: None = ..., name: str = ...) -> None: ... + @classmethod + def handle_simple(cls, name: str) -> str: ... + @classmethod + def handle_token( + cls, + parser: Parser, + token: Token, + name: str + ) -> PrefixNode: ... + def render(self, context: Context) -> str: ... + + +class StaticNode: + def __init__( + self, + varname: Optional[str] = ..., + path: FilterExpression = ... + ) -> None: ... + @classmethod + def handle_simple(cls, path: str) -> str: ... + @classmethod + def handle_token( + cls, + parser: Parser, + token: Token + ) -> StaticNode: ... + def render(self, context: Context) -> str: ... + def url(self, context: Context) -> str: ... \ No newline at end of file diff --git a/django/templatetags/tz.pyi b/django/templatetags/tz.pyi new file mode 100644 index 0000000..91eac0a --- /dev/null +++ b/django/templatetags/tz.pyi @@ -0,0 +1,59 @@ +from datetime import datetime +from django.template.base import ( + FilterExpression, + NodeList, + Parser, + Token, +) +from django.template.context import Context +from django.utils.safestring import SafeText +from django.utils.timezone import FixedOffset +from typing import ( + Optional, + Union, +) + + +def do_timezone( + value: datetime, + arg: FixedOffset +) -> datetimeobject: ... + + +def get_current_timezone_tag( + parser: Parser, + token: Token +) -> GetCurrentTimezoneNode: ... + + +def localtime(value: Optional[Union[str, datetime]]) -> Union[str, datetimeobject]: ... + + +def localtime_tag( + parser: Parser, + token: Token +) -> LocalTimeNode: ... + + +def timezone_tag( + parser: Parser, + token: Token +) -> TimezoneNode: ... + + +def utc(value: Optional[Union[str, datetime]]) -> Union[str, datetimeobject]: ... + + +class GetCurrentTimezoneNode: + def __init__(self, variable: str) -> None: ... + def render(self, context: Context) -> str: ... + + +class LocalTimeNode: + def __init__(self, nodelist: NodeList, use_tz: bool) -> None: ... + def render(self, context: Context) -> SafeText: ... + + +class TimezoneNode: + def __init__(self, nodelist: NodeList, tz: FilterExpression) -> None: ... + def render(self, context: Context) -> SafeText: ... \ No newline at end of file diff --git a/django/test/client.pyi b/django/test/client.pyi new file mode 100644 index 0000000..a3c244c --- /dev/null +++ b/django/test/client.pyi @@ -0,0 +1,232 @@ +from django.contrib.auth.base_user import AbstractBaseUser +from django.contrib.auth.models import User +from django.contrib.sessions.backends.base import SessionBase +from django.core.handlers.wsgi import WSGIRequest +from django.dispatch.dispatcher import Signal +from django.http.request import ( + HttpRequest, + QueryDict, +) +from django.http.response import ( + FileResponse, + HttpResponse, + HttpResponseBase, + HttpResponseForbidden, + HttpResponseRedirect, +) +from django.template.base import Template +from django.template.context import Context +from django.test.utils import ContextList +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Union, +) +from urllib.parse import ParseResult + + +def closing_iterator_wrapper(iterable: map, close: Callable) -> None: ... + + +def conditional_content_removal( + request: HttpRequest, + response: HttpResponseBase +) -> HttpResponseBase: ... + + +def encode_file(boundary: str, key: str, file: Any) -> List[bytes]: ... + + +def encode_multipart(boundary: str, data: Dict[str, Any]) -> bytes: ... + + +def store_rendered_templates( + store: Dict[str, Union[List[Template], ContextList]], + signal: Signal, + sender: Template, + template: Template, + context: Context, + **kwargs +) -> None: ... + + +class Client: + def __init__(self, enforce_csrf_checks: bool = ..., **defaults) -> None: ... + def _handle_redirects( + self, + response: Union[HttpResponseForbidden, HttpResponseRedirect], + data: Any = ..., + content_type: str = ..., + **extra + ) -> HttpResponse: ... + def _login(self, user: AbstractBaseUser, backend: Optional[str] = ...) -> None: ... + def _parse_json(self, response: HttpResponse, **extra) -> Dict[str, Union[int, str]]: ... + def delete( + self, + path: str, + data: Union[str, Dict[str, str]] = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + def force_login(self, user: User, backend: Optional[str] = ...) -> None: ... + def get( + self, + path: str, + data: Optional[Union[Dict[str, str], QueryDict]] = ..., + follow: bool = ..., + secure: bool = ..., + **extra + ) -> HttpResponseBase: ... + def head( + self, + path: str, + data: Optional[Dict[str, str]] = ..., + follow: bool = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + def login(self, **credentials) -> bool: ... + def logout(self) -> None: ... + def options( + self, + path: str, + data: Union[str, Dict[str, str]] = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + def patch( + self, + path: str, + data: Union[str, Dict[str, str]] = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + def post( + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + def put( + self, + path: str, + data: Union[str, bytes] = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + def request(self, **request): ... + @property + def session(self) -> SessionBase: ... + def store_exc_info(self, **kwargs) -> None: ... + def trace( + self, + path: str, + data: Dict[str, str] = ..., + follow: bool = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + + +class ClientHandler: + def __call__(self, environ: Dict[str, Any]) -> HttpResponseBase: ... + def __init__(self, enforce_csrf_checks: bool = ..., *args, **kwargs) -> None: ... + + +class FakePayload: + def __init__(self, content: Optional[Union[str, bytes]] = ...) -> None: ... + def __len__(self) -> int: ... + def read(self, num_bytes: int = ...) -> bytes: ... + def write(self, content: Union[str, bytes]) -> None: ... + + +class RequestFactory: + def __init__(self, *, json_encoder = ..., **defaults) -> None: ... + def _base_environ(self, **request) -> Dict[str, Any]: ... + def _encode_data(self, data: Any, content_type: str) -> bytes: ... + def _encode_json(self, data: Any, content_type: str) -> Any: ... + def _get_path(self, parsed: ParseResult) -> str: ... + def delete( + self, + path: str, + data: Union[str, Dict[str, int]] = ..., + content_type: str = ..., + secure: bool = ..., + **extra + ) -> Union[WSGIRequest, HttpResponse]: ... + def generic( + self, + method: str, + path: str, + data: Union[str, bytes, Dict[str, str]] = ..., + content_type: Optional[str] = ..., + secure: bool = ..., + **extra + ) -> Union[WSGIRequest, HttpResponseBase]: ... + def get( + self, + path: str, + data: Any = ..., + secure: bool = ..., + **extra + ) -> Union[WSGIRequest, HttpResponse, FileResponse]: ... + def head( + self, + path: str, + data: Optional[Dict[str, str]] = ..., + secure: bool = ..., + **extra + ) -> Union[WSGIRequest, HttpResponse]: ... + def options( + self, + path: str, + data: Dict[str, str] = ..., + content_type: str = ..., + secure: bool = ..., + **extra + ) -> HttpResponseRedirect: ... + def patch( + self, + path: str, + data: str = ..., + content_type: str = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + def post( + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + **extra + ) -> Union[WSGIRequest, HttpResponseBase]: ... + def put( + self, + path: str, + data: Union[str, Dict[str, str]] = ..., + content_type: str = ..., + secure: bool = ..., + **extra + ) -> HttpResponse: ... + def request(self, **request) -> WSGIRequest: ... + def trace( + self, + path: str, + secure: bool = ..., + **extra + ) -> Union[WSGIRequest, HttpResponse]: ... \ No newline at end of file diff --git a/django/test/html.pyi b/django/test/html.pyi new file mode 100644 index 0000000..e79a4ba --- /dev/null +++ b/django/test/html.pyi @@ -0,0 +1,51 @@ +from typing import ( + List, + Optional, + Tuple, + Union, +) + + +def normalize_whitespace(string: str) -> str: ... + + +def parse_html(html: str) -> Element: ... + + +class Element: + def __contains__(self, element: Element) -> bool: ... + def __eq__(self, element: Union[str, Element]) -> bool: ... + def __getitem__(self, key: int) -> Union[str, Element]: ... + def __hash__(self) -> int: ... + def __init__( + self, + name: Optional[str], + attributes: Union[Tuple, List[Tuple[str, None]], List[Tuple[str, str]], List[Union[Tuple[str, str], Tuple[str, None]]]] + ) -> None: ... + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def _count(self, element: Union[str, Element], count: bool = ...) -> int: ... + def append(self, element: Union[str, Element]) -> None: ... + def count(self, element: Element) -> int: ... + def finalize(self) -> None: ... + + +class Parser: + def __init__(self) -> None: ... + @property + def current(self) -> Element: ... + def handle_charref(self, name: str) -> None: ... + def handle_data(self, data: str) -> None: ... + def handle_endtag(self, tag: str) -> None: ... + def handle_entityref(self, name: str) -> None: ... + def handle_startendtag(self, tag: str, attrs: List[Tuple[str, str]]) -> None: ... + def handle_starttag( + self, + tag: str, + attrs: Union[List[Union[Tuple[str, str], Tuple[str, None]]], List[Tuple[str, str]]] + ) -> None: ... + + +class RootElement: + def __init__(self) -> None: ... + def __str__(self) -> str: ... \ No newline at end of file diff --git a/django/test/runner.pyi b/django/test/runner.pyi new file mode 100644 index 0000000..6ff6adf --- /dev/null +++ b/django/test/runner.pyi @@ -0,0 +1,101 @@ +from django.db.backends.dummy.base import DatabaseWrapper +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.test.testcases import ( + SimpleTestCase, + TestCase, +) +from django.utils.datastructures import OrderedSet +from typing import ( + Any, + Dict, + List, + Optional, + Set, + Tuple, + Type, + Union, +) +from unittest.case import _SubTest +from unittest.runner import TextTestResult +from unittest.suite import TestSuite + + +def default_test_processes() -> int: ... + + +def filter_tests_by_tags( + suite: TestSuite, + tags: Set[str], + exclude_tags: Set[str] +) -> TestSuite: ... + + +def is_discoverable(label: str) -> bool: ... + + +def partition_suite_by_type( + suite: TestSuite, + classes: Tuple[Type[TestCase], Type[SimpleTestCase]], + bins: List[OrderedSet], + reverse: bool = ... +) -> None: ... + + +def reorder_suite( + suite: TestSuite, + classes: Tuple[Type[TestCase], Type[SimpleTestCase]], + reverse: bool = ... +) -> TestSuite: ... + + +class DebugSQLTextTestResult: + def addSubTest(self, test: TestCase, subtest: _SubTest, err: None) -> None: ... + def printErrorList( + self, + flavour: str, + errors: List[Union[Tuple[TestCase, str, str], Tuple[_SubTest, str, str]]] + ) -> None: ... + def startTest(self, test: TestCase) -> None: ... + def stopTest(self, test: TestCase) -> None: ... + + +class DiscoverRunner: + def __init__( + self, + pattern: None = ..., + top_level: None = ..., + verbosity: int = ..., + interactive: bool = ..., + failfast: bool = ..., + keepdb: bool = ..., + reverse: bool = ..., + debug_mode: bool = ..., + debug_sql: bool = ..., + parallel: int = ..., + tags: Optional[List[str]] = ..., + exclude_tags: None = ..., + **kwargs + ) -> None: ... + def build_suite( + self, + test_labels: Union[List[str], Tuple[str], Tuple[str, str]] = ..., + extra_tests: None = ..., + **kwargs + ) -> TestSuite: ... + def get_resultclass(self) -> None: ... + def get_test_runner_kwargs(self) -> Dict[str, Union[None, int]]: ... + def run_checks(self) -> None: ... + def run_suite(self, suite: TestSuite, **kwargs) -> TextTestResult: ... + def run_tests(self, test_labels: List[str], extra_tests: List[Any] = ..., **kwargs) -> int: ... + def setup_databases( + self, + **kwargs + ) -> Union[List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]]: ... + def setup_test_environment(self, **kwargs) -> None: ... + def suite_result(self, suite: TestSuite, result: TextTestResult, **kwargs) -> int: ... + def teardown_databases( + self, + old_config: Union[List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]], + **kwargs + ) -> None: ... + def teardown_test_environment(self, **kwargs) -> None: ... \ No newline at end of file diff --git a/django/test/selenium.pyi b/django/test/selenium.pyi new file mode 100644 index 0000000..91fc21d --- /dev/null +++ b/django/test/selenium.pyi @@ -0,0 +1,20 @@ +from django.contrib.admin.tests import AdminSeleniumTestCase +from django.contrib.staticfiles.testing import StaticLiveServerTestCase +from typing import ( + Callable, + Dict, + List, + Tuple, + Type, + Union, +) + + +class SeleniumTestCaseBase: + @staticmethod + def __new__( + cls: Type[SeleniumTestCaseBase], + name: str, + bases: Union[Tuple[Type[SeleniumTestCase], Type[StaticLiveServerTestCase]], Tuple[Type[AdminSeleniumTestCase]]], + attrs: Dict[str, Union[str, List[str], Callable]] + ) -> Type[AdminSeleniumTestCase]: ... \ No newline at end of file diff --git a/django/test/signals.pyi b/django/test/signals.pyi new file mode 100644 index 0000000..bacf6fb --- /dev/null +++ b/django/test/signals.pyi @@ -0,0 +1,43 @@ +def auth_password_validators_changed(**kwargs) -> None: ... + + +def clear_cache_handlers(**kwargs) -> None: ... + + +def clear_routers_cache(**kwargs) -> None: ... + + +def clear_serializers_cache(**kwargs) -> None: ... + + +def complex_setting_changed(**kwargs) -> None: ... + + +def file_storage_changed(**kwargs) -> None: ... + + +def language_changed(**kwargs) -> None: ... + + +def localize_settings_changed(**kwargs) -> None: ... + + +def reset_template_engines(**kwargs) -> None: ... + + +def root_urlconf_changed(**kwargs) -> None: ... + + +def static_finders_changed(**kwargs) -> None: ... + + +def static_storage_changed(**kwargs) -> None: ... + + +def update_connections_time_zone(**kwargs) -> None: ... + + +def update_installed_apps(**kwargs) -> None: ... + + +def user_model_swapped(**kwargs) -> None: ... \ No newline at end of file diff --git a/django/test/testcases.pyi b/django/test/testcases.pyi new file mode 100644 index 0000000..2a97b75 --- /dev/null +++ b/django/test/testcases.pyi @@ -0,0 +1,85 @@ +from contextlib import _GeneratorContextManager +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.http.response import ( + HttpResponse, + HttpResponseBase, +) +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Tuple, + Type, + Union, +) +from unittest.case import ( + _AssertRaisesContext, + _AssertWarnsContext, +) +from unittest.runner import TextTestResult + + +class CheckCondition: + def __get__(self, instance: None, cls: Any = ...) -> bool: ... + def __init__(self, *conditions) -> None: ... + + +class LiveServerTestCase: + @classmethod + def _create_server_thread( + cls, + connections_override: Dict[str, DatabaseWrapper] + ) -> LiveServerThread: ... + @classmethod + def _tearDownClassInternal(cls) -> None: ... + @classmethod + def tearDownClass(cls) -> None: ... + + +class LiveServerThread: + def __init__( + self, + host: str, + static_handler: Type[_StaticFilesHandler], + connections_override: Dict[str, DatabaseWrapper] = ..., + port: int = ... + ) -> None: ... + def terminate(self) -> None: ... + + +class SimpleTestCase: + def __call__(self, result: TextTestResult = ...) -> None: ... + def _assertFooMessage( + self, + func: Callable, + cm_attr: str, + expected_exception: Any, + expected_message: str, + *args, + **kwargs + ) -> _GeneratorContextManager: ... + def _assert_contains( + self, + response: HttpResponseBase, + text: Union[str, bytes, int], + status_code: int, + msg_prefix: str, + html: bool + ) -> Tuple[str, int, str]: ... + def _assert_raises_or_warns_cm( + self, + func: Callable, + cm_attr: str, + expected_exception: Any, + expected_message: str + ) -> Iterator[Union[_AssertRaisesContext, _AssertWarnsContext]]: ... + def _assert_template_used( + self, + response: Optional[Union[str, HttpResponse]], + template_name: Optional[str], + msg_prefix: str + ) -> Union[Tuple[None, List[Any], str], Tuple[str, None, str], Tuple[None, List[str], str]]: ... + def _post_teardown(self) -> None: ... \ No newline at end of file diff --git a/django/test/utils.pyi b/django/test/utils.pyi new file mode 100644 index 0000000..9b0332d --- /dev/null +++ b/django/test/utils.pyi @@ -0,0 +1,169 @@ +from io import StringIO +from collections import OrderedDict +from contextlib import _GeneratorContextManager +from decimal import Decimal +from django.apps.registry import Apps +from django.conf import LazySettings +from django.db import DefaultConnectionProxy +from django.db.backends.dummy.base import DatabaseWrapper +from django.db.backends.sqlite3.base import DatabaseWrapper +from django.template.base import Template +from django.template.context import Context +from django.test.runner import DiscoverRunner +from django.utils.safestring import SafeText +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Tuple, + Type, + Union, +) + + +def captured_output(stream_name: str) -> Iterator[StringIO]: ... + + +def captured_stderr() -> _GeneratorContextManager: ... + + +def captured_stdout() -> _GeneratorContextManager: ... + + +def compare_xml(want: str, got: str) -> bool: ... + + +def dependency_ordered( + test_databases: List[Tuple[str, Tuple[str, List[str]]]], + dependencies: Dict[str, List[str]] +) -> List[Tuple[str, Tuple[str, List[str]]]]: ... + + +def extend_sys_path(*paths) -> Iterator[None]: ... + + +def freeze_time(t: int) -> Iterator[None]: ... + + +def get_runner( + settings: LazySettings, + test_runner_class: Optional[str] = ... +) -> Type[DiscoverRunner]: ... + + +def get_unique_databases_and_mirrors() -> Tuple[OrderedDict, Dict[Any, Any]]: ... + + +def instrumented_test_render( + self: Template, + context: Context +) -> SafeText: ... + + +def require_jinja2(test_func: Callable) -> Callable: ... + + +def setup_databases( + verbosity: int, + interactive: bool, + keepdb: bool = ..., + debug_sql: bool = ..., + parallel: int = ..., + **kwargs +) -> Union[List[Tuple[DatabaseWrapper, str, bool]], List[Tuple[DatabaseWrapper, str, bool]]]: ... + + +def setup_test_environment(debug: bool = ...) -> None: ... + + +def tag(*tags) -> Callable: ... + + +def teardown_databases( + old_config: List[Tuple[DatabaseWrapper, str, bool]], + verbosity: int, + parallel: int = ..., + keepdb: bool = ... +) -> None: ... + + +def teardown_test_environment() -> None: ... + + +class Approximate: + def __eq__(self, other: Union[float, Decimal]) -> bool: ... + def __init__(self, val: Union[float, Decimal], places: int = ...) -> None: ... + + +class CaptureQueriesContext: + def __enter__(self) -> CaptureQueriesContext: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + def __getitem__(self, index: int) -> Dict[str, str]: ... + def __init__( + self, + connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper] + ) -> None: ... + def __len__(self) -> int: ... + @property + def captured_queries(self) -> List[Dict[str, str]]: ... + + +class ContextList: + def __contains__(self, key: str) -> bool: ... + def __getitem__(self, key: Union[str, int]) -> Any: ... + def get(self, key: str, default: None = ...) -> str: ... + + +class LoggingCaptureMixin: + def setUp(self) -> None: ... + def tearDown(self) -> None: ... + + +class TestContextDecorator: + def __call__(self, decorated: Any) -> Any: ... + def __enter__(self) -> Optional[Apps]: ... + def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: ... + def __init__(self, attr_name: Optional[str] = ..., kwarg_name: Optional[str] = ...) -> None: ... + def decorate_callable(self, func: Callable) -> Callable: ... + def decorate_class(self, cls: Any) -> Any: ... + + +class ignore_warnings: + def __init__(self, **kwargs) -> None: ... + def disable(self) -> None: ... + def enable(self) -> None: ... + + +class isolate_apps: + def __init__(self, *installed_apps, **kwargs) -> None: ... + def disable(self) -> None: ... + def enable(self) -> Apps: ... + + +class modify_settings: + def __init__(self, *args, **kwargs) -> None: ... + def enable(self) -> None: ... + def save_options(self, test_func: Any) -> None: ... + + +class override_script_prefix: + def __init__(self, prefix: str) -> None: ... + def disable(self) -> None: ... + def enable(self) -> None: ... + + +class override_settings: + def __init__(self, **kwargs) -> None: ... + def decorate_class(self, cls: Any) -> Any: ... + def disable(self) -> None: ... + def enable(self) -> None: ... + def save_options(self, test_func: Any) -> None: ... + + +class override_system_checks: + def __init__(self, new_checks: List[Callable], deployment_checks: Optional[List[Callable]] = ...) -> None: ... + def disable(self) -> None: ... + def enable(self) -> None: ... \ No newline at end of file diff --git a/django/urls/base.pyi b/django/urls/base.pyi new file mode 100644 index 0000000..4074676 --- /dev/null +++ b/django/urls/base.pyi @@ -0,0 +1,41 @@ +from django.urls.resolvers import ResolverMatch +from typing import ( + Any, + Callable, + Optional, + Type, + Union, +) + + +def clear_url_caches() -> None: ... + + +def get_script_prefix() -> str: ... + + +def get_urlconf(default: None = ...) -> Optional[Union[str, Type[object]]]: ... + + +def is_valid_path(path: str, urlconf: Optional[str] = ...) -> bool: ... + + +def resolve(path: str, urlconf: Optional[str] = ...) -> ResolverMatch: ... + + +def reverse( + viewname: Optional[Union[str, Callable]], + urlconf: Optional[str] = ..., + args: Any = ..., + kwargs: Any = ..., + current_app: Optional[str] = ... +) -> str: ... + + +def set_script_prefix(prefix: str) -> None: ... + + +def set_urlconf(urlconf_name: Any) -> None: ... + + +def translate_url(url: str, lang_code: str) -> str: ... \ No newline at end of file diff --git a/django/urls/conf.pyi b/django/urls/conf.pyi new file mode 100644 index 0000000..35d17ea --- /dev/null +++ b/django/urls/conf.pyi @@ -0,0 +1,23 @@ +from django.urls.resolvers import ( + CheckURLMixin, + URLPattern, + URLResolver, +) +from typing import ( + Any, + Optional, + Type, + Union, +) + + +def _path( + route: str, + view: Any, + kwargs: Any = ..., + name: Optional[str] = ..., + Pattern: Type[CheckURLMixin] = ... +) -> Union[URLPattern, URLResolver]: ... + + +def include(arg: Any, namespace: Optional[str] = ...) -> Any: ... \ No newline at end of file diff --git a/django/urls/converters.pyi b/django/urls/converters.pyi new file mode 100644 index 0000000..d3cc714 --- /dev/null +++ b/django/urls/converters.pyi @@ -0,0 +1,24 @@ +from typing import ( + Any, + Dict, + Union, +) +from urlpatterns.converters import DynamicConverter +from uuid import UUID + + +def get_converter(raw_converter: str) -> Any: ... + + +def get_converters( +) -> Dict[str, Union[IntConverter, StringConverter, UUIDConverter, DynamicConverter]]: ... + + +class IntConverter: + def to_python(self, value: str) -> int: ... + def to_url(self, value: Union[str, int]) -> str: ... + + +class StringConverter: + def to_python(self, value: str) -> str: ... + def to_url(self, value: Union[str, UUID, int]) -> Union[str, UUID, int]: ... \ No newline at end of file