From b15197f93556546495fea1e83124f63f5782eba3 Mon Sep 17 00:00:00 2001 From: Morgan Bartholomew Date: Wed, 4 Jun 2025 17:29:03 +1000 Subject: [PATCH] [python] move bundled django stubs for free mode GitOrigin-RevId: 2c4b350f4ca7a0e4dec920eb6848d0962c58ba62 --- .../Django/django-stubs/__init__.pyi | 8 + .../Django/django-stubs/apps/__init__.pyi | 2 + .../Django/django-stubs/apps/config.pyi | 32 + .../Django/django-stubs/apps/registry.pyi | 41 ++ .../Django/django-stubs/conf/__init__.pyi | 44 ++ .../django-stubs/conf/global_settings.pyi | 519 ++++++++++++++ .../django-stubs/conf/locale/__init__.pyi | 3 + .../django-stubs/conf/urls/__init__.pyi | 32 + .../Django/django-stubs/conf/urls/i18n.pyi | 6 + .../Django/django-stubs/conf/urls/static.pyi | 6 + .../Django/django-stubs/contrib/__init__.pyi | 0 .../django-stubs/contrib/admin/__init__.pyi | 24 + .../django-stubs/contrib/admin/actions.pyi | 6 + .../django-stubs/contrib/admin/apps.pyi | 6 + .../django-stubs/contrib/admin/checks.pyi | 22 + .../django-stubs/contrib/admin/decorators.pyi | 43 ++ .../django-stubs/contrib/admin/exceptions.pyi | 6 + .../django-stubs/contrib/admin/filters.pyi | 126 ++++ .../django-stubs/contrib/admin/forms.pyi | 7 + .../django-stubs/contrib/admin/helpers.pyi | 181 +++++ .../contrib/admin/migrations/__init__.pyi | 0 .../django-stubs/contrib/admin/models.pyi | 37 + .../django-stubs/contrib/admin/options.pyi | 331 +++++++++ .../django-stubs/contrib/admin/sites.pyi | 93 +++ .../contrib/admin/templatetags/__init__.pyi | 0 .../contrib/admin/templatetags/admin_list.pyi | 41 ++ .../admin/templatetags/admin_modify.pyi | 16 + .../contrib/admin/templatetags/admin_urls.pyi | 17 + .../contrib/admin/templatetags/base.pyi | 18 + .../contrib/admin/templatetags/log.pyi | 16 + .../django-stubs/contrib/admin/tests.pyi | 27 + .../django-stubs/contrib/admin/utils.pyi | 104 +++ .../contrib/admin/views/__init__.pyi | 0 .../contrib/admin/views/autocomplete.pyi | 11 + .../contrib/admin/views/decorators.pyi | 11 + .../django-stubs/contrib/admin/views/main.pyi | 96 +++ .../django-stubs/contrib/admin/widgets.pyi | 159 +++++ .../contrib/admindocs/__init__.pyi | 0 .../django-stubs/contrib/admindocs/apps.pyi | 7 + .../contrib/admindocs/middleware.pyi | 15 + .../django-stubs/contrib/admindocs/urls.pyi | 3 + .../django-stubs/contrib/admindocs/utils.pyi | 29 + .../django-stubs/contrib/admindocs/views.pyi | 26 + .../django-stubs/contrib/auth/__init__.pyi | 34 + .../django-stubs/contrib/auth/admin.pyi | 20 + .../Django/django-stubs/contrib/auth/apps.pyi | 3 + .../django-stubs/contrib/auth/backends.pyi | 44 ++ .../django-stubs/contrib/auth/base_user.pyi | 49 ++ .../django-stubs/contrib/auth/checks.pyi | 10 + .../contrib/auth/context_processors.pyi | 21 + .../django-stubs/contrib/auth/decorators.pyi | 24 + .../django-stubs/contrib/auth/forms.pyi | 111 +++ .../contrib/auth/handlers/__init__.pyi | 0 .../contrib/auth/handlers/modwsgi.pyi | 6 + .../django-stubs/contrib/auth/hashers.pyi | 61 ++ .../contrib/auth/management/__init__.pyi | 15 + .../auth/management/commands/__init__.pyi | 0 .../management/commands/changepassword.pyi | 7 + .../management/commands/createsuperuser.pyi | 9 + .../django-stubs/contrib/auth/middleware.pyi | 19 + .../contrib/auth/migrations/__init__.pyi | 0 .../django-stubs/contrib/auth/mixins.pyi | 30 + .../django-stubs/contrib/auth/models.pyi | 120 ++++ .../contrib/auth/password_validation.pyi | 47 ++ .../django-stubs/contrib/auth/signals.pyi | 5 + .../django-stubs/contrib/auth/tokens.pyi | 18 + .../Django/django-stubs/contrib/auth/urls.pyi | 3 + .../django-stubs/contrib/auth/validators.pyi | 4 + .../django-stubs/contrib/auth/views.pyi | 78 +++ .../contrib/contenttypes/__init__.pyi | 0 .../contrib/contenttypes/admin.pyi | 15 + .../contrib/contenttypes/apps.pyi | 3 + .../contrib/contenttypes/checks.pyi | 12 + .../contrib/contenttypes/fields.pyi | 96 +++ .../contrib/contenttypes/forms.pyi | 47 ++ .../contenttypes/management/__init__.pyi | 33 + .../management/commands/__init__.pyi | 0 .../commands/remove_stale_contenttypes.pyi | 11 + .../contenttypes/migrations/__init__.pyi | 0 .../contrib/contenttypes/models.pyi | 24 + .../contrib/contenttypes/prefetch.pyi | 9 + .../contrib/contenttypes/views.pyi | 4 + .../contrib/flatpages/__init__.pyi | 0 .../django-stubs/contrib/flatpages/admin.pyi | 11 + .../django-stubs/contrib/flatpages/apps.pyi | 7 + .../django-stubs/contrib/flatpages/forms.pyi | 7 + .../contrib/flatpages/middleware.pyi | 6 + .../contrib/flatpages/migrations/__init__.pyi | 0 .../django-stubs/contrib/flatpages/models.pyi | 12 + .../contrib/flatpages/sitemaps.pyi | 3 + .../flatpages/templatetags/__init__.pyi | 0 .../flatpages/templatetags/flatpages.pyi | 16 + .../django-stubs/contrib/flatpages/urls.pyi | 3 + .../django-stubs/contrib/flatpages/views.pyi | 8 + .../django-stubs/contrib/gis/__init__.pyi | 0 .../contrib/gis/admin/__init__.pyi | 11 + .../contrib/gis/admin/options.pyi | 8 + .../Django/django-stubs/contrib/gis/apps.pyi | 3 + .../django-stubs/contrib/gis/db/__init__.pyi | 0 .../contrib/gis/db/backends/__init__.pyi | 0 .../contrib/gis/db/backends/base/__init__.pyi | 0 .../contrib/gis/db/backends/base/adapter.pyi | 8 + .../contrib/gis/db/backends/base/features.pyi | 44 ++ .../contrib/gis/db/backends/base/models.pyi | 33 + .../gis/db/backends/base/operations.pyi | 36 + .../gis/db/backends/mysql/__init__.pyi | 0 .../contrib/gis/db/backends/mysql/base.pyi | 9 + .../gis/db/backends/mysql/features.pyi | 21 + .../gis/db/backends/mysql/introspection.pyi | 8 + .../gis/db/backends/mysql/operations.pyi | 29 + .../contrib/gis/db/backends/mysql/schema.pyi | 22 + .../gis/db/backends/oracle/__init__.pyi | 0 .../gis/db/backends/oracle/adapter.pyi | 9 + .../contrib/gis/db/backends/oracle/base.pyi | 9 + .../gis/db/backends/oracle/features.pyi | 14 + .../gis/db/backends/oracle/introspection.pyi | 8 + .../contrib/gis/db/backends/oracle/models.pyi | 29 + .../gis/db/backends/oracle/operations.pyi | 42 ++ .../contrib/gis/db/backends/oracle/schema.pyi | 23 + .../gis/db/backends/postgis/__init__.pyi | 0 .../gis/db/backends/postgis/adapter.pyi | 13 + .../contrib/gis/db/backends/postgis/base.pyi | 11 + .../contrib/gis/db/backends/postgis/const.pyi | 9 + .../gis/db/backends/postgis/features.pyi | 9 + .../gis/db/backends/postgis/introspection.pyi | 9 + .../gis/db/backends/postgis/models.pyi | 31 + .../gis/db/backends/postgis/operations.pyi | 67 ++ .../gis/db/backends/postgis/pgraster.pyi | 7 + .../gis/db/backends/postgis/schema.pyi | 11 + .../gis/db/backends/spatialite/__init__.pyi | 0 .../gis/db/backends/spatialite/adapter.pyi | 6 + .../gis/db/backends/spatialite/base.pyi | 21 + .../gis/db/backends/spatialite/client.pyi | 4 + .../gis/db/backends/spatialite/features.pyi | 8 + .../db/backends/spatialite/introspection.pyi | 11 + .../gis/db/backends/spatialite/models.pyi | 31 + .../gis/db/backends/spatialite/operations.pyi | 36 + .../gis/db/backends/spatialite/schema.pyi | 32 + .../contrib/gis/db/backends/utils.pyi | 21 + .../contrib/gis/db/models/__init__.pyi | 11 + .../contrib/gis/db/models/aggregates.pyi | 29 + .../contrib/gis/db/models/fields.pyi | 189 ++++++ .../contrib/gis/db/models/functions.pyi | 197 ++++++ .../contrib/gis/db/models/lookups.pyi | 125 ++++ .../contrib/gis/db/models/proxy.pyi | 8 + .../contrib/gis/db/models/sql/__init__.pyi | 2 + .../contrib/gis/db/models/sql/conversion.pyi | 19 + .../Django/django-stubs/contrib/gis/feeds.pyi | 21 + .../contrib/gis/forms/__init__.pyi | 13 + .../django-stubs/contrib/gis/forms/fields.pyi | 33 + .../contrib/gis/forms/widgets.pyi | 38 ++ .../contrib/gis/gdal/__init__.pyi | 15 + .../django-stubs/contrib/gis/gdal/base.pyi | 6 + .../contrib/gis/gdal/datasource.pyi | 18 + .../django-stubs/contrib/gis/gdal/driver.pyi | 13 + .../contrib/gis/gdal/envelope.pyi | 25 + .../django-stubs/contrib/gis/gdal/error.pyi | 10 + .../django-stubs/contrib/gis/gdal/feature.pyi | 30 + .../django-stubs/contrib/gis/gdal/field.pyi | 61 ++ .../contrib/gis/gdal/geometries.pyi | 145 ++++ .../contrib/gis/gdal/geomtype.pyi | 12 + .../django-stubs/contrib/gis/gdal/layer.pyi | 48 ++ .../django-stubs/contrib/gis/gdal/libgdal.pyi | 34 + .../contrib/gis/gdal/prototypes/__init__.pyi | 0 .../contrib/gis/gdal/prototypes/ds.pyi | 51 ++ .../contrib/gis/gdal/prototypes/errcheck.pyi | 14 + .../gis/gdal/prototypes/generation.pyi | 20 + .../contrib/gis/gdal/prototypes/geom.pyi | 56 ++ .../contrib/gis/gdal/prototypes/raster.pyi | 48 ++ .../contrib/gis/gdal/prototypes/srs.pyi | 36 + .../contrib/gis/gdal/raster/__init__.pyi | 0 .../contrib/gis/gdal/raster/band.pyi | 50 ++ .../contrib/gis/gdal/raster/base.pyi | 9 + .../contrib/gis/gdal/raster/const.pyi | 8 + .../contrib/gis/gdal/raster/source.pyi | 73 ++ .../django-stubs/contrib/gis/gdal/srs.pyi | 68 ++ .../contrib/gis/geoip2/__init__.pyi | 4 + .../django-stubs/contrib/gis/geoip2/base.pyi | 33 + .../contrib/gis/geoip2/resources.pyi | 4 + .../django-stubs/contrib/gis/geometry.pyi | 5 + .../contrib/gis/geos/__init__.pyi | 19 + .../django-stubs/contrib/gis/geos/base.pyi | 5 + .../contrib/gis/geos/collections.pyi | 17 + .../contrib/gis/geos/coordseq.pyi | 34 + .../django-stubs/contrib/gis/geos/error.pyi | 1 + .../django-stubs/contrib/gis/geos/factory.pyi | 10 + .../contrib/gis/geos/geometry.pyi | 147 ++++ .../django-stubs/contrib/gis/geos/io.pyi | 10 + .../django-stubs/contrib/gis/geos/libgeos.pyi | 41 ++ .../contrib/gis/geos/linestring.pyi | 26 + .../contrib/gis/geos/mutable_list.pyi | 26 + .../django-stubs/contrib/gis/geos/point.pyi | 28 + .../django-stubs/contrib/gis/geos/polygon.pyi | 20 + .../contrib/gis/geos/prepared.pyi | 19 + .../contrib/gis/geos/prototypes/__init__.pyi | 51 ++ .../contrib/gis/geos/prototypes/coordseq.pyi | 35 + .../contrib/gis/geos/prototypes/errcheck.pyi | 11 + .../contrib/gis/geos/prototypes/geom.pyi | 43 ++ .../contrib/gis/geos/prototypes/io.pyi | 126 ++++ .../contrib/gis/geos/prototypes/misc.pyi | 12 + .../gis/geos/prototypes/predicates.pyi | 30 + .../contrib/gis/geos/prototypes/prepared.pyi | 21 + .../gis/geos/prototypes/threadsafe.pyi | 24 + .../contrib/gis/geos/prototypes/topology.pyi | 29 + .../django-stubs/contrib/gis/measure.pyi | 40 ++ .../Django/django-stubs/contrib/gis/ptr.pyi | 11 + .../contrib/gis/serializers/__init__.pyi | 0 .../contrib/gis/serializers/geojson.pyi | 14 + .../django-stubs/contrib/gis/shortcuts.pyi | 7 + .../contrib/gis/sitemaps/__init__.pyi | 2 + .../django-stubs/contrib/gis/sitemaps/kml.pyi | 13 + .../contrib/gis/sitemaps/views.pyi | 13 + .../contrib/gis/utils/__init__.pyi | 6 + .../contrib/gis/utils/layermapping.pyi | 74 ++ .../contrib/gis/utils/ogrinfo.pyi | 3 + .../contrib/gis/utils/ogrinspect.pyi | 8 + .../django-stubs/contrib/gis/utils/srs.pyi | 9 + .../Django/django-stubs/contrib/gis/views.pyi | 4 + .../contrib/humanize/__init__.pyi | 0 .../django-stubs/contrib/humanize/apps.pyi | 7 + .../humanize/templatetags/__init__.pyi | 0 .../humanize/templatetags/humanize.pyi | 24 + .../contrib/messages/__init__.pyi | 17 + .../django-stubs/contrib/messages/api.pyi | 48 ++ .../django-stubs/contrib/messages/apps.pyi | 9 + .../contrib/messages/constants.pyi | 9 + .../contrib/messages/context_processors.pyi | 6 + .../contrib/messages/middleware.pyi | 7 + .../contrib/messages/storage/__init__.pyi | 4 + .../contrib/messages/storage/base.pyi | 29 + .../contrib/messages/storage/cookie.pyi | 33 + .../contrib/messages/storage/fallback.pyi | 8 + .../contrib/messages/storage/session.pyi | 11 + .../django-stubs/contrib/messages/test.pyi | 9 + .../django-stubs/contrib/messages/utils.pyi | 1 + .../django-stubs/contrib/messages/views.pyi | 12 + .../contrib/postgres/__init__.pyi | 0 .../contrib/postgres/aggregates/__init__.pyi | 20 + .../contrib/postgres/aggregates/general.pyi | 61 ++ .../contrib/postgres/aggregates/mixins.pyi | 17 + .../postgres/aggregates/statistics.pyi | 29 + .../django-stubs/contrib/postgres/apps.pyi | 12 + .../contrib/postgres/constraints.pyi | 34 + .../contrib/postgres/expressions.pyi | 14 + .../contrib/postgres/fields/__init__.pyi | 15 + .../contrib/postgres/fields/array.pyi | 63 ++ .../contrib/postgres/fields/citext.pyi | 10 + .../contrib/postgres/fields/hstore.pyi | 26 + .../contrib/postgres/fields/jsonb.pyi | 3 + .../contrib/postgres/fields/ranges.pyi | 91 +++ .../contrib/postgres/fields/utils.pyi | 4 + .../contrib/postgres/forms/__init__.pyi | 11 + .../contrib/postgres/forms/array.pyi | 58 ++ .../contrib/postgres/forms/hstore.pyi | 12 + .../contrib/postgres/forms/ranges.pyi | 42 ++ .../contrib/postgres/functions.pyi | 9 + .../django-stubs/contrib/postgres/indexes.pyi | 121 ++++ .../django-stubs/contrib/postgres/lookups.pyi | 21 + .../contrib/postgres/operations.pyi | 62 ++ .../django-stubs/contrib/postgres/search.pyi | 144 ++++ .../contrib/postgres/serializers.pyi | 4 + .../django-stubs/contrib/postgres/signals.pyi | 6 + .../django-stubs/contrib/postgres/utils.pyi | 5 + .../contrib/postgres/validators.pyi | 19 + .../contrib/redirects/__init__.pyi | 0 .../django-stubs/contrib/redirects/admin.pyi | 9 + .../django-stubs/contrib/redirects/apps.pyi | 7 + .../contrib/redirects/middleware.pyi | 10 + .../contrib/redirects/migrations/__init__.pyi | 0 .../django-stubs/contrib/redirects/models.pyi | 6 + .../contrib/sessions/__init__.pyi | 0 .../django-stubs/contrib/sessions/apps.pyi | 7 + .../contrib/sessions/backends/__init__.pyi | 0 .../contrib/sessions/backends/base.pyi | 89 +++ .../contrib/sessions/backends/cache.pyi | 12 + .../contrib/sessions/backends/cached_db.pyi | 15 + .../contrib/sessions/backends/db.pyi | 14 + .../contrib/sessions/backends/file.pyi | 6 + .../sessions/backends/signed_cookies.pyi | 4 + .../contrib/sessions/base_session.pyi | 22 + .../contrib/sessions/exceptions.pyi | 5 + .../contrib/sessions/management/__init__.pyi | 0 .../sessions/management/commands/__init__.pyi | 0 .../management/commands/clearsessions.pyi | 6 + .../contrib/sessions/middleware.pyi | 9 + .../contrib/sessions/migrations/__init__.pyi | 0 .../django-stubs/contrib/sessions/models.pyi | 8 + .../contrib/sessions/serializers.pyi | 4 + .../contrib/sitemaps/__init__.pyi | 49 ++ .../django-stubs/contrib/sitemaps/apps.pyi | 7 + .../django-stubs/contrib/sitemaps/views.pyi | 24 + .../django-stubs/contrib/sites/__init__.pyi | 0 .../django-stubs/contrib/sites/admin.pyi | 7 + .../django-stubs/contrib/sites/apps.pyi | 3 + .../django-stubs/contrib/sites/checks.pyi | 7 + .../django-stubs/contrib/sites/management.pyi | 13 + .../django-stubs/contrib/sites/managers.pyi | 8 + .../django-stubs/contrib/sites/middleware.pyi | 5 + .../contrib/sites/migrations/__init__.pyi | 0 .../django-stubs/contrib/sites/models.pyi | 20 + .../django-stubs/contrib/sites/requests.pyi | 11 + .../django-stubs/contrib/sites/shortcuts.pyi | 5 + .../contrib/staticfiles/__init__.pyi | 0 .../django-stubs/contrib/staticfiles/apps.pyi | 6 + .../contrib/staticfiles/checks.pyi | 10 + .../contrib/staticfiles/finders.pyi | 59 ++ .../contrib/staticfiles/handlers.pyi | 48 ++ .../staticfiles/management/__init__.pyi | 0 .../management/commands/__init__.pyi | 0 .../management/commands/collectstatic.pyi | 31 + .../management/commands/findstatic.pyi | 6 + .../management/commands/runserver.pyi | 3 + .../contrib/staticfiles/storage.pyi | 56 ++ .../contrib/staticfiles/testing.pyi | 3 + .../django-stubs/contrib/staticfiles/urls.pyi | 5 + .../contrib/staticfiles/utils.pyi | 7 + .../contrib/staticfiles/views.pyi | 6 + .../contrib/syndication/__init__.pyi | 0 .../django-stubs/contrib/syndication/apps.pyi | 7 + .../contrib/syndication/views.pyi | 56 ++ .../Django/django-stubs/core/__init__.pyi | 0 .../Django/django-stubs/core/asgi.pyi | 3 + .../django-stubs/core/cache/__init__.pyi | 22 + .../core/cache/backends/__init__.pyi | 0 .../django-stubs/core/cache/backends/base.pyi | 72 ++ .../django-stubs/core/cache/backends/db.pyi | 24 + .../core/cache/backends/dummy.pyi | 6 + .../core/cache/backends/filebased.pyi | 8 + .../core/cache/backends/locmem.pyi | 8 + .../core/cache/backends/memcached.pyi | 24 + .../core/cache/backends/redis.pyi | 55 ++ .../Django/django-stubs/core/cache/utils.pyi | 6 + .../django-stubs/core/checks/__init__.pyi | 16 + .../django-stubs/core/checks/async_checks.pyi | 9 + .../django-stubs/core/checks/caches.pyi | 11 + .../core/checks/compatibility/__init__.pyi | 0 .../core/checks/compatibility/django_4_0.pyi | 7 + .../django-stubs/core/checks/database.pyi | 6 + .../Django/django-stubs/core/checks/files.pyi | 7 + .../django-stubs/core/checks/messages.pyi | 34 + .../django-stubs/core/checks/model_checks.pyi | 8 + .../django-stubs/core/checks/registry.pyi | 64 ++ .../core/checks/security/__init__.pyi | 0 .../core/checks/security/base.pyi | 42 ++ .../core/checks/security/csrf.pyi | 12 + .../core/checks/security/sessions.pyi | 20 + .../django-stubs/core/checks/templates.pyi | 15 + .../django-stubs/core/checks/translation.pyi | 16 + .../Django/django-stubs/core/checks/urls.pyi | 13 + .../Django/django-stubs/core/exceptions.pyi | 53 ++ .../django-stubs/core/files/__init__.pyi | 3 + .../Django/django-stubs/core/files/base.pyi | 53 ++ .../Django/django-stubs/core/files/images.pyi | 14 + .../Django/django-stubs/core/files/locks.pyi | 15 + .../Django/django-stubs/core/files/move.pyi | 3 + .../core/files/storage/__init__.pyi | 28 + .../django-stubs/core/files/storage/base.pyi | 22 + .../core/files/storage/filesystem.pyi | 27 + .../core/files/storage/handler.pyi | 15 + .../core/files/storage/memory.pyi | 25 + .../core/files/storage/mixins.pyi | 9 + .../Django/django-stubs/core/files/temp.pyi | 5 + .../django-stubs/core/files/uploadedfile.pyi | 50 ++ .../django-stubs/core/files/uploadhandler.pyi | 88 +++ .../Django/django-stubs/core/files/utils.pyi | 29 + .../django-stubs/core/handlers/__init__.pyi | 0 .../django-stubs/core/handlers/asgi.pyi | 64 ++ .../django-stubs/core/handlers/base.pyi | 29 + .../django-stubs/core/handlers/exception.pyi | 15 + .../django-stubs/core/handlers/wsgi.pyi | 36 + .../django-stubs/core/mail/__init__.pyi | 50 ++ .../core/mail/backends/__init__.pyi | 0 .../django-stubs/core/mail/backends/base.pyi | 20 + .../core/mail/backends/console.pyi | 10 + .../django-stubs/core/mail/backends/dummy.pyi | 3 + .../core/mail/backends/filebased.pyi | 3 + .../core/mail/backends/locmem.pyi | 3 + .../django-stubs/core/mail/backends/smtp.pyi | 18 + .../Django/django-stubs/core/mail/message.pyi | 111 +++ .../Django/django-stubs/core/mail/utils.pyi | 6 + .../django-stubs/core/management/__init__.pyi | 23 + .../django-stubs/core/management/base.pyi | 96 +++ .../django-stubs/core/management/color.pyi | 28 + .../core/management/commands/__init__.pyi | 0 .../core/management/commands/check.pyi | 6 + .../management/commands/compilemessages.pyi | 16 + .../management/commands/createcachetable.pyi | 8 + .../core/management/commands/dbshell.pyi | 6 + .../core/management/commands/diffsettings.pyi | 15 + .../core/management/commands/dumpdata.pyi | 7 + .../core/management/commands/flush.pyi | 9 + .../core/management/commands/inspectdb.pyi | 27 + .../core/management/commands/loaddata.pyi | 60 ++ .../core/management/commands/makemessages.pyi | 70 ++ .../management/commands/makemigrations.pyi | 25 + .../core/management/commands/migrate.pyi | 15 + .../management/commands/optimizemigration.pyi | 3 + .../core/management/commands/runserver.pyi | 19 + .../management/commands/sendtestemail.pyi | 4 + .../core/management/commands/shell.pyi | 11 + .../management/commands/showmigrations.pyi | 7 + .../core/management/commands/sqlflush.pyi | 8 + .../core/management/commands/sqlmigrate.pyi | 7 + .../management/commands/sqlsequencereset.pyi | 3 + .../management/commands/squashmigrations.pyi | 12 + .../core/management/commands/startapp.pyi | 8 + .../core/management/commands/startproject.pyi | 8 + .../core/management/commands/test.pyi | 8 + .../core/management/commands/testserver.pyi | 3 + .../django-stubs/core/management/sql.pyi | 13 + .../core/management/templates.pyi | 23 + .../django-stubs/core/management/utils.pyi | 21 + .../Django/django-stubs/core/paginator.pyi | 72 ++ .../core/serializers/__init__.pyi | 25 + .../django-stubs/core/serializers/base.pyi | 89 +++ .../django-stubs/core/serializers/json.pyi | 21 + .../django-stubs/core/serializers/jsonl.pyi | 12 + .../django-stubs/core/serializers/python.pyi | 14 + .../django-stubs/core/serializers/pyyaml.pyi | 22 + .../core/serializers/xml_serializer.pyi | 66 ++ .../django-stubs/core/servers/__init__.pyi | 0 .../django-stubs/core/servers/basehttp.pyi | 46 ++ .../Django/django-stubs/core/signals.pyi | 6 + .../Django/django-stubs/core/signing.pyi | 88 +++ .../Django/django-stubs/core/validators.pyi | 140 ++++ .../Django/django-stubs/core/wsgi.pyi | 3 + .../Django/django-stubs/db/__init__.pyi | 23 + .../django-stubs/db/backends/__init__.pyi | 0 .../db/backends/base/__init__.pyi | 0 .../django-stubs/db/backends/base/base.pyi | 130 ++++ .../django-stubs/db/backends/base/client.pyi | 16 + .../db/backends/base/creation.pyi | 31 + .../db/backends/base/features.pyi | 153 +++++ .../db/backends/base/introspection.pyi | 33 + .../db/backends/base/operations.pyi | 118 ++++ .../django-stubs/db/backends/base/schema.pyi | 110 +++ .../db/backends/base/validation.pyi | 10 + .../db/backends/ddl_references.pyi | 85 +++ .../db/backends/dummy/__init__.pyi | 0 .../django-stubs/db/backends/dummy/base.pyi | 29 + .../db/backends/dummy/features.pyi | 5 + .../db/backends/mysql/__init__.pyi | 0 .../django-stubs/db/backends/mysql/base.pyi | 72 ++ .../django-stubs/db/backends/mysql/client.pyi | 15 + .../db/backends/mysql/compiler.pyi | 16 + .../db/backends/mysql/creation.pyi | 6 + .../db/backends/mysql/features.pyi | 88 +++ .../db/backends/mysql/introspection.pyi | 25 + .../db/backends/mysql/operations.pyi | 44 ++ .../django-stubs/db/backends/mysql/schema.pyi | 28 + .../db/backends/mysql/validation.pyi | 9 + .../db/backends/oracle/__init__.pyi | 0 .../django-stubs/db/backends/oracle/base.pyi | 77 +++ .../db/backends/oracle/client.pyi | 16 + .../db/backends/oracle/creation.pyi | 11 + .../db/backends/oracle/features.pyi | 50 ++ .../db/backends/oracle/functions.pyi | 13 + .../db/backends/oracle/introspection.pyi | 12 + .../db/backends/oracle/operations.pyi | 59 ++ .../db/backends/oracle/schema.pyi | 25 + .../django-stubs/db/backends/oracle/utils.pyi | 24 + .../db/backends/oracle/validation.pyi | 8 + .../db/backends/postgresql/__init__.pyi | 0 .../db/backends/postgresql/base.pyi | 43 ++ .../db/backends/postgresql/client.pyi | 14 + .../db/backends/postgresql/creation.pyi | 5 + .../db/backends/postgresql/features.pyi | 61 ++ .../db/backends/postgresql/introspection.pyi | 9 + .../db/backends/postgresql/operations.pyi | 13 + .../db/backends/postgresql/schema.pyi | 23 + .../django-stubs/db/backends/signals.pyi | 3 + .../db/backends/sqlite3/__init__.pyi | 0 .../django-stubs/db/backends/sqlite3/base.pyi | 36 + .../db/backends/sqlite3/client.pyi | 13 + .../db/backends/sqlite3/creation.pyi | 10 + .../db/backends/sqlite3/features.pyi | 5 + .../db/backends/sqlite3/introspection.pyi | 15 + .../db/backends/sqlite3/operations.pyi | 19 + .../db/backends/sqlite3/schema.pyi | 5 + .../Django/django-stubs/db/backends/utils.pyi | 89 +++ .../django-stubs/db/migrations/__init__.pyi | 7 + .../db/migrations/autodetector.pyi | 71 ++ .../django-stubs/db/migrations/exceptions.pyi | 18 + .../django-stubs/db/migrations/executor.pyi | 44 ++ .../django-stubs/db/migrations/graph.pyi | 56 ++ .../django-stubs/db/migrations/loader.pyi | 44 ++ .../django-stubs/db/migrations/migration.pyi | 30 + .../db/migrations/operations/__init__.pyi | 22 + .../db/migrations/operations/base.pyi | 32 + .../db/migrations/operations/fields.pyi | 36 + .../db/migrations/operations/models.pyi | 147 ++++ .../db/migrations/operations/special.pyi | 59 ++ .../db/migrations/operations/utils.pyi | 26 + .../django-stubs/db/migrations/optimizer.pyi | 5 + .../django-stubs/db/migrations/questioner.pyi | 25 + .../django-stubs/db/migrations/recorder.pyi | 25 + .../django-stubs/db/migrations/serializer.pyi | 50 ++ .../django-stubs/db/migrations/state.pyi | 100 +++ .../django-stubs/db/migrations/utils.pyi | 10 + .../django-stubs/db/migrations/writer.pyi | 37 + .../django-stubs/db/models/__init__.pyi | 96 +++ .../django-stubs/db/models/aggregates.pyi | 23 + .../Django/django-stubs/db/models/base.pyi | 114 ++++ .../django-stubs/db/models/constants.pyi | 7 + .../django-stubs/db/models/constraints.pyi | 103 +++ .../django-stubs/db/models/deletion.pyi | 100 +++ .../Django/django-stubs/db/models/enums.pyi | 85 +++ .../django-stubs/db/models/expressions.pyi | 309 +++++++++ .../db/models/fields/__init__.pyi | 631 ++++++++++++++++++ .../django-stubs/db/models/fields/files.pyi | 120 ++++ .../db/models/fields/generated.pyi | 48 ++ .../django-stubs/db/models/fields/json.pyi | 97 +++ .../django-stubs/db/models/fields/mixins.pyi | 18 + .../django-stubs/db/models/fields/proxy.pyi | 6 + .../django-stubs/db/models/fields/related.pyi | 310 +++++++++ .../db/models/fields/related_descriptors.pyi | 171 +++++ .../db/models/fields/related_lookups.pyi | 46 ++ .../db/models/fields/reverse_related.pyi | 136 ++++ .../db/models/functions/__init__.pyi | 90 +++ .../db/models/functions/comparison.pyi | 23 + .../db/models/functions/datetime.pyi | 76 +++ .../django-stubs/db/models/functions/math.pyi | 32 + .../db/models/functions/mixins.pyi | 3 + .../django-stubs/db/models/functions/text.pyi | 100 +++ .../db/models/functions/window.pyi | 35 + .../Django/django-stubs/db/models/indexes.pyi | 58 ++ .../Django/django-stubs/db/models/lookups.pyi | 143 ++++ .../Django/django-stubs/db/models/manager.pyi | 159 +++++ .../Django/django-stubs/db/models/options.pyi | 136 ++++ .../Django/django-stubs/db/models/query.pyi | 251 +++++++ .../django-stubs/db/models/query_utils.pyi | 95 +++ .../Django/django-stubs/db/models/signals.pyi | 34 + .../django-stubs/db/models/sql/__init__.pyi | 6 + .../django-stubs/db/models/sql/compiler.pyi | 156 +++++ .../django-stubs/db/models/sql/constants.pyi | 13 + .../db/models/sql/datastructures.pyi | 47 ++ .../django-stubs/db/models/sql/query.pyi | 232 +++++++ .../django-stubs/db/models/sql/subqueries.pyi | 42 ++ .../django-stubs/db/models/sql/where.pyi | 59 ++ .../Django/django-stubs/db/models/utils.pyi | 12 + .../Django/django-stubs/db/transaction.pyi | 56 ++ .../Django/django-stubs/db/utils.pyi | 55 ++ .../Django/django-stubs/dispatch/__init__.pyi | 2 + .../django-stubs/dispatch/dispatcher.pyi | 40 ++ .../Django/django-stubs/forms/__init__.pyi | 79 +++ .../Django/django-stubs/forms/boundfield.pyi | 85 +++ .../Django/django-stubs/forms/fields.pyi | 558 ++++++++++++++++ .../Django/django-stubs/forms/forms.pyi | 76 +++ .../Django/django-stubs/forms/formsets.pyi | 126 ++++ .../Django/django-stubs/forms/models.pyi | 315 +++++++++ .../Django/django-stubs/forms/renderers.pyi | 36 + .../Django/django-stubs/forms/utils.pyi | 76 +++ .../Django/django-stubs/forms/widgets.pyi | 286 ++++++++ .../Django/django-stubs/http/__init__.pyi | 23 + .../Django/django-stubs/http/cookie.pyi | 3 + .../django-stubs/http/multipartparser.pyi | 60 ++ .../Django/django-stubs/http/request.pyi | 216 ++++++ .../Django/django-stubs/http/response.pyi | 157 +++++ .../django-stubs/middleware/__init__.pyi | 0 .../Django/django-stubs/middleware/cache.pyi | 33 + .../django-stubs/middleware/clickjacking.pyi | 7 + .../Django/django-stubs/middleware/common.pyi | 17 + .../Django/django-stubs/middleware/csrf.pyi | 57 ++ .../Django/django-stubs/middleware/gzip.pyi | 11 + .../Django/django-stubs/middleware/http.pyi | 7 + .../Django/django-stubs/middleware/locale.pyi | 10 + .../django-stubs/middleware/security.pyi | 17 + .../Django/django-stubs/shortcuts.pyi | 40 ++ .../Django/django-stubs/template/__init__.pyi | 19 + .../template/backends/__init__.pyi | 0 .../django-stubs/template/backends/base.pyi | 26 + .../django-stubs/template/backends/django.pyi | 29 + .../django-stubs/template/backends/dummy.pyi | 15 + .../django-stubs/template/backends/jinja2.pyi | 32 + .../django-stubs/template/backends/utils.pyi | 9 + .../Django/django-stubs/template/base.pyi | 168 +++++ .../Django/django-stubs/template/context.pyi | 91 +++ .../template/context_processors.pyi | 15 + .../django-stubs/template/defaultfilters.pyi | 69 ++ .../django-stubs/template/defaulttags.pyi | 205 ++++++ .../Django/django-stubs/template/engine.pyi | 58 ++ .../django-stubs/template/exceptions.pyi | 16 + .../Django/django-stubs/template/library.pyi | 103 +++ .../Django/django-stubs/template/loader.pyi | 17 + .../django-stubs/template/loader_tags.pyi | 68 ++ .../template/loaders/__init__.pyi | 0 .../template/loaders/app_directories.pyi | 3 + .../django-stubs/template/loaders/base.pyi | 13 + .../django-stubs/template/loaders/cached.pyi | 15 + .../template/loaders/filesystem.pyi | 14 + .../django-stubs/template/loaders/locmem.pyi | 9 + .../Django/django-stubs/template/response.pyi | 73 ++ .../Django/django-stubs/template/smartif.pyi | 44 ++ .../Django/django-stubs/template/utils.pyi | 19 + .../django-stubs/templatetags/__init__.pyi | 0 .../django-stubs/templatetags/cache.pyi | 23 + .../Django/django-stubs/templatetags/i18n.pyi | 92 +++ .../Django/django-stubs/templatetags/l10n.pyi | 16 + .../django-stubs/templatetags/static.pyi | 32 + .../Django/django-stubs/templatetags/tz.pyi | 31 + .../Django/django-stubs/test/__init__.pyi | 16 + .../Django/django-stubs/test/client.pyi | 421 ++++++++++++ .../Django/django-stubs/test/html.pyi | 42 ++ .../Django/django-stubs/test/runner.pyi | 171 +++++ .../Django/django-stubs/test/selenium.pyi | 18 + .../Django/django-stubs/test/signals.pyi | 23 + .../Django/django-stubs/test/testcases.pyi | 269 ++++++++ .../Django/django-stubs/test/utils.pyi | 177 +++++ .../Django/django-stubs/urls/__init__.pyi | 40 ++ .../Django/django-stubs/urls/base.pyi | 25 + .../Django/django-stubs/urls/conf.pyi | 56 ++ .../Django/django-stubs/urls/converters.pyi | 33 + .../Django/django-stubs/urls/exceptions.pyi | 4 + .../Django/django-stubs/urls/resolvers.pyi | 136 ++++ .../Django/django-stubs/urls/utils.pyi | 4 + .../Django/django-stubs/utils/__init__.pyi | 0 .../Django/django-stubs/utils/_os.pyi | 10 + .../Django/django-stubs/utils/archive.pyi | 44 ++ .../Django/django-stubs/utils/asyncio.pyi | 9 + .../Django/django-stubs/utils/autoreload.pyi | 76 +++ .../Django/django-stubs/utils/cache.pyi | 32 + .../Django/django-stubs/utils/choices.pyi | 31 + .../Django/django-stubs/utils/connection.pyi | 32 + .../Django/django-stubs/utils/crypto.pyi | 19 + .../django-stubs/utils/datastructures.pyi | 118 ++++ .../Django/django-stubs/utils/dateformat.pyi | 64 ++ .../Django/django-stubs/utils/dateparse.pyi | 15 + .../Django/django-stubs/utils/dates.pyi | 6 + .../Django/django-stubs/utils/deconstruct.pyi | 18 + .../Django/django-stubs/utils/decorators.pyi | 23 + .../Django/django-stubs/utils/deprecation.pyi | 47 ++ .../Django/django-stubs/utils/duration.pyi | 5 + .../Django/django-stubs/utils/encoding.pyi | 75 +++ .../django-stubs/utils/feedgenerator.pyi | 84 +++ .../Django/django-stubs/utils/formats.pyi | 47 ++ .../Django/django-stubs/utils/functional.pyi | 109 +++ .../Django/django-stubs/utils/hashable.pyi | 3 + .../Django/django-stubs/utils/html.pyi | 79 +++ .../Django/django-stubs/utils/http.pyi | 35 + .../Django/django-stubs/utils/inspect.pyi | 12 + .../Django/django-stubs/utils/ipv6.pyi | 4 + .../Django/django-stubs/utils/itercompat.pyi | 3 + .../Django/django-stubs/utils/jslex.pyi | 27 + .../Django/django-stubs/utils/log.pyi | 53 ++ .../Django/django-stubs/utils/lorem_ipsum.pyi | 10 + .../django-stubs/utils/module_loading.pyi | 7 + .../django-stubs/utils/numberformat.pyi | 12 + .../django-stubs/utils/regex_helper.pyi | 23 + .../Django/django-stubs/utils/safestring.pyi | 26 + .../Django/django-stubs/utils/termcolors.pyi | 19 + .../Django/django-stubs/utils/text.pyi | 62 ++ .../Django/django-stubs/utils/timesince.pyi | 15 + .../Django/django-stubs/utils/timezone.pyi | 40 ++ .../utils/translation/__init__.pyi | 49 ++ .../utils/translation/reloader.pyi | 7 + .../utils/translation/template.pyi | 16 + .../utils/translation/trans_null.pyi | 25 + .../utils/translation/trans_real.pyi | 70 ++ .../Django/django-stubs/utils/tree.pyi | 29 + .../Django/django-stubs/utils/version.pyi | 19 + .../Django/django-stubs/utils/xmlutils.pyi | 9 + .../Django/django-stubs/views/__init__.pyi | 1 + .../Django/django-stubs/views/csrf.pyi | 9 + .../Django/django-stubs/views/debug.pyi | 76 +++ .../views/decorators/__init__.pyi | 0 .../django-stubs/views/decorators/cache.pyi | 10 + .../views/decorators/clickjacking.pyi | 8 + .../django-stubs/views/decorators/common.pyi | 6 + .../django-stubs/views/decorators/csrf.pyi | 18 + .../django-stubs/views/decorators/debug.pyi | 9 + .../django-stubs/views/decorators/gzip.pyi | 6 + .../django-stubs/views/decorators/http.pyi | 19 + .../django-stubs/views/decorators/vary.pyi | 7 + .../Django/django-stubs/views/defaults.pyi | 22 + .../django-stubs/views/generic/__init__.pyi | 18 + .../django-stubs/views/generic/base.pyi | 53 ++ .../django-stubs/views/generic/dates.pyi | 115 ++++ .../django-stubs/views/generic/detail.pyi | 33 + .../django-stubs/views/generic/edit.pyi | 73 ++ .../django-stubs/views/generic/list.pyi | 57 ++ .../Django/django-stubs/views/i18n.pyi | 28 + .../Django/django-stubs/views/static.pyi | 15 + 682 files changed, 24917 insertions(+) create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/apps/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/apps/config.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/apps/registry.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/conf/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/conf/global_settings.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/conf/locale/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/conf/urls/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/conf/urls/i18n.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/conf/urls/static.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/actions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/checks.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/decorators.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/exceptions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/filters.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/forms.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/helpers.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/migrations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/options.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/sites.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_list.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_modify.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_urls.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/log.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/tests.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/autocomplete.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/decorators.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/main.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/widgets.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/middleware.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/urls.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/admin.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/backends.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/base_user.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/checks.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/context_processors.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/decorators.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/forms.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/handlers/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/handlers/modwsgi.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/hashers.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/changepassword.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/createsuperuser.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/middleware.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/migrations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/mixins.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/password_validation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/signals.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/tokens.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/urls.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/validators.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/admin.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/checks.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/fields.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/forms.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/migrations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/prefetch.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/admin.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/forms.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/middleware.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/migrations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/sitemaps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/templatetags/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/templatetags/flatpages.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/urls.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/admin/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/admin/options.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/adapter.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/const.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/client.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/aggregates.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/fields.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/functions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/lookups.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/proxy.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/conversion.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/feeds.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/fields.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/widgets.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/datasource.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/driver.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/envelope.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/error.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/feature.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/field.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/geometries.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/geomtype.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/layer.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/libgdal.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/ds.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/generation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/geom.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/raster.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/srs.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/band.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/const.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/source.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/srs.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/resources.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geometry.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/collections.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/coordseq.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/error.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/factory.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/geometry.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/io.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/libgeos.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/linestring.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/mutable_list.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/point.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/polygon.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prepared.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/geom.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/io.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/misc.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/predicates.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/prepared.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/topology.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/measure.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/ptr.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/serializers/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/serializers/geojson.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/shortcuts.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/kml.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/layermapping.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/ogrinfo.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/ogrinspect.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/srs.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/templatetags/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/templatetags/humanize.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/api.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/constants.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/context_processors.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/middleware.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/cookie.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/fallback.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/session.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/test.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/general.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/mixins.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/statistics.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/constraints.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/expressions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/array.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/citext.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/hstore.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/jsonb.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/ranges.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/array.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/hstore.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/ranges.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/functions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/indexes.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/lookups.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/search.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/serializers.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/signals.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/validators.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/admin.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/middleware.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/migrations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/cache.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/cached_db.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/db.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/file.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/signed_cookies.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/base_session.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/exceptions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/commands/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/commands/clearsessions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/middleware.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/migrations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/serializers.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/admin.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/checks.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/management.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/managers.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/middleware.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/migrations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/requests.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/shortcuts.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/checks.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/finders.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/handlers.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/findstatic.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/runserver.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/storage.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/testing.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/urls.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/apps.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/views.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/asgi.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/db.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/dummy.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/filebased.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/locmem.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/memcached.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/redis.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/cache/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/async_checks.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/caches.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/django_4_0.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/database.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/files.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/messages.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/model_checks.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/registry.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/csrf.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/sessions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/templates.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/translation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/checks/urls.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/exceptions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/images.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/locks.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/move.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/filesystem.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/handler.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/memory.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/mixins.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/temp.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadedfile.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadhandler.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/files/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/handlers/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/handlers/asgi.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/handlers/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/handlers/exception.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/handlers/wsgi.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/console.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/dummy.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/filebased.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/locmem.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/smtp.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/message.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/mail/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/color.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/check.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/compilemessages.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/createcachetable.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/dbshell.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/diffsettings.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/dumpdata.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/flush.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/inspectdb.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/loaddata.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/makemessages.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/makemigrations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/migrate.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/optimizemigration.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/runserver.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sendtestemail.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/shell.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/showmigrations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlflush.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlmigrate.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlsequencereset.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/squashmigrations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/startapp.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/startproject.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/test.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/testserver.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/sql.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/templates.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/management/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/paginator.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/serializers/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/serializers/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/serializers/json.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/serializers/jsonl.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/serializers/python.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/serializers/pyyaml.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/serializers/xml_serializer.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/servers/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/servers/basehttp.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/signals.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/signing.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/validators.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/core/wsgi.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/client.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/creation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/validation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/ddl_references.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/client.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/compiler.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/creation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/validation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/client.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/creation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/functions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/validation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/client.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/creation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/signals.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/client.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/creation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/features.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/introspection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/operations.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/schema.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/backends/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/autodetector.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/exceptions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/executor.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/graph.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/loader.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/migration.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/fields.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/special.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/optimizer.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/questioner.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/recorder.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/serializer.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/state.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/migrations/writer.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/aggregates.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/constants.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/constraints.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/enums.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/expressions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/files.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/generated.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/json.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/mixins.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/proxy.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_descriptors.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_lookups.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/reverse_related.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/comparison.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/datetime.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/math.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/mixins.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/text.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/window.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/indexes.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/lookups.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/manager.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/options.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/query.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/query_utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/signals.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/compiler.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/constants.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/datastructures.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/query.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/subqueries.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/where.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/models/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/db/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/dispatch/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/dispatch/dispatcher.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/boundfield.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/forms.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/formsets.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/renderers.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/http/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/http/cookie.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/http/multipartparser.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/http/response.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/cache.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/clickjacking.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/common.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/csrf.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/gzip.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/http.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/locale.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/middleware/security.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/backends/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/backends/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/backends/django.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/backends/dummy.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/backends/jinja2.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/backends/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/context_processors.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/defaultfilters.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/defaulttags.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/engine.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/exceptions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/library.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/loader.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/loader_tags.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/loaders/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/loaders/app_directories.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/loaders/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/loaders/cached.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/loaders/filesystem.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/loaders/locmem.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/response.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/smartif.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/template/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/templatetags/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/templatetags/cache.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/templatetags/i18n.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/templatetags/l10n.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/templatetags/static.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/templatetags/tz.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/test/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/test/client.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/test/html.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/test/runner.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/test/signals.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/urls/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/urls/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/urls/conf.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/urls/converters.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/urls/exceptions.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/urls/resolvers.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/urls/utils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/_os.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/archive.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/asyncio.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/autoreload.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/choices.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/connection.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/crypto.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/datastructures.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/dateformat.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/dateparse.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/dates.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/deconstruct.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/decorators.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/duration.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/encoding.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/feedgenerator.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/formats.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/functional.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/hashable.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/html.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/http.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/inspect.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/ipv6.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/itercompat.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/jslex.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/log.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/lorem_ipsum.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/module_loading.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/numberformat.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/regex_helper.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/safestring.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/termcolors.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/text.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/timesince.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/timezone.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/translation/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/translation/reloader.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/translation/template.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_null.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_real.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/tree.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/version.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/utils/xmlutils.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/csrf.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/debug.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/cache.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/clickjacking.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/common.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/csrf.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/debug.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/gzip.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/http.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/decorators/vary.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/defaults.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/generic/__init__.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/generic/base.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/generic/dates.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/generic/detail.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/generic/edit.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/generic/list.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/i18n.pyi create mode 100644 python/helpers/bundled_stubs/Django/django-stubs/views/static.pyi diff --git a/python/helpers/bundled_stubs/Django/django-stubs/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/__init__.pyi new file mode 100644 index 000000000000..320ba1fc89fe --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/__init__.pyi @@ -0,0 +1,8 @@ +from typing import Literal + +from .utils.version import get_version as get_version + +VERSION: tuple[int, int, int, Literal["alpha", "beta", "rc", "final"], int] +__version__: str + +def setup(set_prefix: bool = ...) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/apps/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/apps/__init__.pyi new file mode 100644 index 000000000000..8270abf933a2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/apps/__init__.pyi @@ -0,0 +1,2 @@ +from .config import AppConfig as AppConfig +from .registry import apps as apps diff --git a/python/helpers/bundled_stubs/Django/django-stubs/apps/config.pyi b/python/helpers/bundled_stubs/Django/django-stubs/apps/config.pyi new file mode 100644 index 000000000000..9f31754e0a05 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/apps/config.pyi @@ -0,0 +1,32 @@ +import types +from collections.abc import Iterator + +from django.apps.registry import Apps +from django.db.models.base import Model +from django.utils.functional import _Getter, _StrOrPromise + +APPS_MODULE_NAME: str +MODELS_MODULE_NAME: str + +class AppConfig: + name: str + module: types.ModuleType | None + apps: Apps | None + label: str + verbose_name: _StrOrPromise + path: str + models_module: types.ModuleType | None + # Default auto_field is a cached_property on the base, but is usually subclassed as a str + # If not subclassing with a str, a type ignore[override] is needed + models: dict[str, type[Model]] + default: bool + default_auto_field: str | _Getter[str] + def __init__(self, app_name: str, app_module: types.ModuleType | None) -> None: ... + @classmethod + def create(cls, entry: str) -> AppConfig: ... + def get_model(self, model_name: str, require_ready: bool = True) -> type[Model]: ... + def get_models( + self, include_auto_created: bool = False, include_swapped: bool = False + ) -> Iterator[type[Model]]: ... + def import_models(self) -> None: ... + def ready(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/apps/registry.pyi b/python/helpers/bundled_stubs/Django/django-stubs/apps/registry.pyi new file mode 100644 index 000000000000..7da72a7cf04c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/apps/registry.pyi @@ -0,0 +1,41 @@ +import threading +from collections.abc import Callable, Iterable +from typing import Any + +from django.db.models.base import Model + +from .config import AppConfig + +class Apps: + all_models: dict[str, dict[str, type[Model]]] + app_configs: dict[str, AppConfig] + stored_app_configs: list[Any] + apps_ready: bool + ready_event: threading.Event + loading: bool + _pending_operations: dict[tuple[str, str], list] + models_ready: bool + ready: bool + def __init__(self, installed_apps: Iterable[AppConfig | str] | None = ()) -> None: ... + def populate(self, installed_apps: Iterable[AppConfig | str] | None = None) -> None: ... + def check_apps_ready(self) -> None: ... + def check_models_ready(self) -> None: ... + def get_app_configs(self) -> Iterable[AppConfig]: ... + def get_app_config(self, app_label: str) -> AppConfig: ... + # it's not possible to support it in plugin properly now + def get_models(self, include_auto_created: bool = False, include_swapped: bool = False) -> list[type[Model]]: ... + def get_model(self, app_label: str, model_name: str | None = None, require_ready: bool = True) -> type[Any]: ... + def register_model(self, app_label: str, model: type[Model]) -> None: ... + def is_installed(self, app_name: str) -> bool: ... + def get_containing_app_config(self, object_name: str) -> AppConfig | None: ... + def get_registered_model(self, app_label: str, model_name: str) -> type[Model]: ... + def get_swappable_settings_name(self, to_string: str) -> str | None: ... + def set_available_apps(self, available: Iterable[str]) -> None: ... + def unset_available_apps(self) -> None: ... + def set_installed_apps(self, installed: Iterable[str]) -> None: ... + def unset_installed_apps(self) -> None: ... + def clear_cache(self) -> None: ... + def lazy_model_operation(self, function: Callable, *model_keys: Any) -> None: ... + def do_pending_operations(self, model: type[Model]) -> None: ... + +apps: Apps diff --git a/python/helpers/bundled_stubs/Django/django-stubs/conf/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/conf/__init__.pyi new file mode 100644 index 000000000000..397a8f42f552 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/conf/__init__.pyi @@ -0,0 +1,44 @@ +from typing import Any, Literal, type_check_only + +from django.utils.functional import LazyObject +from typing_extensions import Self + +# explicit dependency on standard settings to make it loaded +from . import global_settings # noqa: F401 + +ENVIRONMENT_VARIABLE: Literal["DJANGO_SETTINGS_MODULE"] +DEFAULT_STORAGE_ALIAS: Literal["default"] +STATICFILES_STORAGE_ALIAS: Literal["staticfiles"] + +# RemovedInDjango60Warning. +FORMS_URLFIELD_ASSUME_HTTPS_DEPRECATED_MSG: str + +# required for plugin to be able to distinguish this specific instance of LazySettings from others +@type_check_only +class _DjangoConfLazyObject(LazyObject): + def __getattr__(self, item: Any) -> Any: ... + +class LazySettings(_DjangoConfLazyObject): + SETTINGS_MODULE: str + @property + def configured(self) -> bool: ... + def configure(self, default_settings: Any = ..., **options: Any) -> None: ... + +settings: LazySettings + +class Settings: + SETTINGS_MODULE: str + def __init__(self, settings_module: str) -> None: ... + def is_overridden(self, setting: str) -> bool: ... + +class UserSettingsHolder: + SETTINGS_MODULE: None + def __init__(self, default_settings: Any) -> None: ... + def __getattr__(self, name: str) -> Any: ... + def __setattr__(self, name: str, value: Any) -> None: ... + def __delattr__(self, name: str) -> None: ... + def is_overridden(self, setting: str) -> bool: ... + +class SettingsReference(str): + def __new__(self, value: Any, setting_name: str) -> Self: ... + def __init__(self, value: str, setting_name: str) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/conf/global_settings.pyi b/python/helpers/bundled_stubs/Django/django-stubs/conf/global_settings.pyi new file mode 100644 index 000000000000..324be535b90e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/conf/global_settings.pyi @@ -0,0 +1,519 @@ +from collections.abc import Sequence +from re import Pattern + +# This is defined here as a do-nothing function because we can't import +# django.utils.translation -- that module depends on the settings. +from typing import Any, Literal, Protocol, type_check_only + +from typing_extensions import TypeAlias + +_Admins: TypeAlias = list[tuple[str, str]] + +#################### +# CORE # +#################### +DEBUG: bool + +# Whether the framework should propagate raw exceptions rather than catching +# them. This is useful under some testing situations and should never be used +# on a live site. +DEBUG_PROPAGATE_EXCEPTIONS: bool + +# People who get code error notifications. +# In the format [('Full Name', 'email@example.com'), ('Full Name', 'anotheremail@example.com')] +ADMINS: _Admins + +# List of IP addresses, as strings, that: +# * See debug comments, when DEBUG is true +# * Receive x-headers +INTERNAL_IPS: list[str] + +# Hosts/domain names that are valid for this site. +# "*" matches anything, ".example.com" matches example.com and all subdomains +ALLOWED_HOSTS: list[str] + +# Local time zone for this installation. All choices can be found here: +# https://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all +# systems may support all possibilities). When USE_TZ is True, this is +# interpreted as the default user time zone. +TIME_ZONE: str + +# If you set this to True, Django will use timezone-aware datetimes. +USE_TZ: bool + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE: str + +# Languages we provide translations for, out of the box. +LANGUAGES: list[tuple[str, str]] + +# Languages using BiDi (right-to-left) layout +LANGUAGES_BIDI: list[str] + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N: bool +LOCALE_PATHS: list[str] + +# Settings for language cookie +LANGUAGE_COOKIE_NAME: str +LANGUAGE_COOKIE_AGE: int | None +LANGUAGE_COOKIE_DOMAIN: str | None +LANGUAGE_COOKIE_PATH: str +LANGUAGE_COOKIE_HTTPONLY: bool +LANGUAGE_COOKIE_SAMESITE: Literal["Lax", "Strict", "None", False] | None +LANGUAGE_COOKIE_SECURE: bool + +# Not-necessarily-technical managers of the site. They get broken link +# notifications and other various emails. +MANAGERS: _Admins + +# Default charset to use for all HttpResponse objects, if a +# MIME type isn't manually specified. These are used to construct the +# Content-Type header. +DEFAULT_CHARSET: str + +# Email address that error messages come from. +SERVER_EMAIL: str + +# Database connection info. If left empty, will default to the dummy backend. +DATABASES: dict[str, dict[str, Any]] + +# Classes used to implement DB routing behavior. +@type_check_only +class Router(Protocol): + def allow_migrate(self, db: str, app_label: str, **hints: Any) -> bool | None: ... + +DATABASE_ROUTERS: list[str | Router] + +# The email backend to use. For possible shortcuts see django.core.mail. +# The default is to use the SMTP backend. +# Third-party backends can be specified by providing a Python path +# to a module that defines an EmailBackend class. +EMAIL_BACKEND: str + +# Host for sending email. +EMAIL_HOST: str + +# Port for sending email. +EMAIL_PORT: int + +# Whether to send SMTP 'Date' header in the local time zone or in UTC. +EMAIL_USE_LOCALTIME: bool + +# Optional SMTP authentication information for EMAIL_HOST. +EMAIL_HOST_USER: str +EMAIL_HOST_PASSWORD: str +EMAIL_USE_TLS: bool +EMAIL_USE_SSL: bool +EMAIL_SSL_CERTFILE: str | None +EMAIL_SSL_KEYFILE: str | None +EMAIL_TIMEOUT: int | None + +# List of strings representing installed apps. +INSTALLED_APPS: list[str] + +TEMPLATES: list[dict[str, Any]] + +# Default form rendering class. +FORM_RENDERER: str + +# RemovedInDjango60Warning: It's a transitional setting helpful in early +# adoption of "https" as the new default value of forms.URLField.assume_scheme. +# Set to True to assume "https" during the Django 5.x release cycle. +FORMS_URLFIELD_ASSUME_HTTPS: bool + +# Default email address to use for various automated correspondence from +# the site managers. +DEFAULT_FROM_EMAIL: str + +# Subject-line prefix for email messages send with django.core.mail.mail_admins +# or ...mail_managers. Make sure to include the trailing space. +EMAIL_SUBJECT_PREFIX: str + +# Whether to append trailing slashes to URLs. +APPEND_SLASH: bool + +# Whether to prepend the "www." subdomain to URLs that don't have it. +PREPEND_WWW: bool + +# Override the server-derived value of SCRIPT_NAME +FORCE_SCRIPT_NAME: str | None + +# List of compiled regular expression objects representing User-Agent strings +# that are not allowed to visit any page, systemwide. Use this for bad +# robots/crawlers. Here are a few examples: +# import re +# DISALLOWED_USER_AGENTS = [ +# re.compile(r'^NaverBot.*'), +# re.compile(r'^EmailSiphon.*'), +# re.compile(r'^SiteSucker.*'), +# re.compile(r'^sohu-search'), +# ] +DISALLOWED_USER_AGENTS: list[Pattern[str]] + +ABSOLUTE_URL_OVERRIDES: dict[str, Any] + +# List of compiled regular expression objects representing URLs that need not +# be reported by BrokenLinkEmailsMiddleware. Here are a few examples: +# import re +# IGNORABLE_404_URLS = [ +# re.compile(r'^/apple-touch-icon.*\.png$'), +# re.compile(r'^/favicon.ico$'), +# re.compile(r'^/robots.txt$'), +# re.compile(r'^/phpmyadmin/'), +# re.compile(r'\.(cgi|php|pl)$'), +# ] +IGNORABLE_404_URLS: list[Pattern[str]] + +# A secret key for this particular Django installation. Used in secret-key +# hashing algorithms. Set this in your settings, or Django will complain +# loudly. +SECRET_KEY: str | bytes + +# A list of fallback secret keys for a particular Django installation. These +# are used to allow rotation of the SECRET_KEY. +SECRET_KEY_FALLBACKS: list[str | bytes] + +STORAGES: dict[str, dict[str, Any]] + +# Absolute filesystem path to the directory that will hold user-uploaded files. +# Example: "/var/www/example.com/media/" +MEDIA_ROOT: str + +# URL that handles the media served from MEDIA_ROOT. +# Examples: "http://example.com/media/", "http://media.example.com/" +MEDIA_URL: str + +# Absolute path to the directory static files should be collected to. +# Example: "/var/www/example.com/static/" +STATIC_ROOT: str | None + +# URL that handles the static files served from STATIC_ROOT. +# Example: "http://example.com/static/", "http://static.example.com/" +STATIC_URL: str | None + +# List of upload handler classes to be applied in order. +FILE_UPLOAD_HANDLERS: list[str] + +# Maximum size, in bytes, of a request before it will be streamed to the +# file system instead of into memory. +FILE_UPLOAD_MAX_MEMORY_SIZE: int # i.e. 2.5 MB + +# Maximum size in bytes of request data (excluding file uploads) that will be +# read before a SuspiciousOperation (RequestDataTooBig) is raised. +DATA_UPLOAD_MAX_MEMORY_SIZE: int # i.e. 2.5 MB + +# Maximum number of GET/POST parameters that will be read before a +# SuspiciousOperation (TooManyFieldsSent) is raised. +DATA_UPLOAD_MAX_NUMBER_FIELDS: int + +# Maximum number of files encoded in a multipart upload that will be read +# before a SuspiciousOperation (TooManyFilesSent) is raised. +DATA_UPLOAD_MAX_NUMBER_FILES: int + +# Directory in which upload streamed files will be temporarily saved. A value of +# `None` will make Django use the operating system's default temporary directory +# (i.e. "/tmp" on *nix systems). +FILE_UPLOAD_TEMP_DIR: str | None + +# The numeric mode to set newly-uploaded files to. The value should be a mode +# you'd pass directly to os.chmod; see https://docs.python.org/library/os.html#files-and-directories. +FILE_UPLOAD_PERMISSIONS: int + +# The numeric mode to assign to newly-created directories, when uploading files. +# The value should be a mode as you'd pass to os.chmod; +# see https://docs.python.org/library/os.html#files-and-directories. +FILE_UPLOAD_DIRECTORY_PERMISSIONS: int | None + +# Python module path where user will place custom format definition. +# The directory where this setting is pointing should contain subdirectories +# named as the locales, containing a formats.py file +# (i.e. "myproject.locale" for myproject/locale/en/formats.py etc. use) +FORMAT_MODULE_PATH: str | None + +# Default formatting for date objects. See all available format strings here: +# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date +DATE_FORMAT: str + +# Default formatting for datetime objects. See all available format strings here: +# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date +DATETIME_FORMAT: str + +# Default formatting for time objects. See all available format strings here: +# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date +TIME_FORMAT: str + +# Default formatting for date objects when only the year and month are relevant. +# See all available format strings here: +# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date +YEAR_MONTH_FORMAT: str + +# Default formatting for date objects when only the month and day are relevant. +# See all available format strings here: +# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date +MONTH_DAY_FORMAT: str + +# Default short formatting for date objects. See all available format strings here: +# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date +SHORT_DATE_FORMAT: str + +# Default short formatting for datetime objects. +# See all available format strings here: +# https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date +SHORT_DATETIME_FORMAT: str + +# Default formats to be used when parsing dates from input boxes, in order +# See all available format string here: +# https://docs.python.org/library/datetime.html#strftime-behavior +# * Note that these format strings are different from the ones to display dates +DATE_INPUT_FORMATS: list[str] + +# Default formats to be used when parsing times from input boxes, in order +# See all available format string here: +# https://docs.python.org/library/datetime.html#strftime-behavior +# * Note that these format strings are different from the ones to display dates +TIME_INPUT_FORMATS: list[str] # '14:30:59' # '14:30:59.000200' # '14:30' + +# Default formats to be used when parsing dates and times from input boxes, +# in order +# See all available format string here: +# https://docs.python.org/library/datetime.html#strftime-behavior +# * Note that these format strings are different from the ones to display dates +DATETIME_INPUT_FORMATS: list[str] + +# First day of week, to be used on calendars +# 0 means Sunday, 1 means Monday... +FIRST_DAY_OF_WEEK: int + +# Decimal separator symbol +DECIMAL_SEPARATOR: str + +# Boolean that sets whether to add thousand separator when formatting numbers +USE_THOUSAND_SEPARATOR: bool + +# Number of digits that will be together, when splitting them by +# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands... +NUMBER_GROUPING: int + +# Thousand separator symbol +THOUSAND_SEPARATOR: str + +# The tablespaces to use for each model when not specified otherwise. +DEFAULT_TABLESPACE: str +DEFAULT_INDEX_TABLESPACE: str + +# Default primary key field type. +DEFAULT_AUTO_FIELD: str + +# Default X-Frame-Options header value +X_FRAME_OPTIONS: str + +USE_X_FORWARDED_HOST: bool +USE_X_FORWARDED_PORT: bool + +# The Python dotted path to the WSGI application that Django's internal server +# (runserver) will use. If `None`, the return value of +# 'django.core.wsgi.get_wsgi_application' is used, thus preserving the same +# behavior as previous versions of Django. Otherwise this should point to an +# actual WSGI application object. +WSGI_APPLICATION: str | None + +# If your Django app is behind a proxy that sets a header to specify secure +# connections, AND that proxy ensures that user-submitted headers with the +# same name are ignored (so that people can't spoof it), set this value to +# a tuple of (header_name, header_value). For any requests that come in with +# that header/value, request.is_secure() will return True. +# WARNING! Only set this if you fully understand what you're doing. Otherwise, +# you may be opening yourself up to a security risk. +SECURE_PROXY_SSL_HEADER: tuple[str, str] | None + +############## +# MIDDLEWARE # +############## + +# List of middleware to use. Order is important; in the request phase, these +# middleware will be applied in the order given, and in the response +# phase the middleware will be applied in reverse order. +MIDDLEWARE: list[str] + +############ +# SESSIONS # +############ + +# Cache to store session data if using the cache session backend. +SESSION_CACHE_ALIAS: str +# Cookie name. This can be whatever you want. +SESSION_COOKIE_NAME: str +# Age of cookie, in seconds (default: 2 weeks). +SESSION_COOKIE_AGE: int +# A string like "example.com", or None for standard domain cookie. +SESSION_COOKIE_DOMAIN: str | None +# Whether the session cookie should be secure (https:// only). +SESSION_COOKIE_SECURE: bool +# The path of the session cookie. +SESSION_COOKIE_PATH: str +# Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others) +SESSION_COOKIE_HTTPONLY: bool +# Whether to set the flag restricting cookie leaks on cross-site requests. +# This can be 'Lax', 'Strict', 'None', or False to disable the flag. +SESSION_COOKIE_SAMESITE: Literal["Lax", "Strict", "None", False] +# Whether to save the session data on every request. +SESSION_SAVE_EVERY_REQUEST: bool +# Whether a user's session cookie expires when the Web browser is closed. +SESSION_EXPIRE_AT_BROWSER_CLOSE: bool +# The module to store session data +SESSION_ENGINE: str +# Directory to store session files if using the file session module. If None, +# the backend will use a sensible default. +SESSION_FILE_PATH: str | None +# class to serialize session data +SESSION_SERIALIZER: str + +######### +# CACHE # +######### + +# The cache backends to use. +CACHES: dict[str, dict[str, Any]] +CACHE_MIDDLEWARE_KEY_PREFIX: str +CACHE_MIDDLEWARE_SECONDS: int +CACHE_MIDDLEWARE_ALIAS: str + +################## +# AUTHENTICATION # +################## + +AUTH_USER_MODEL: str + +AUTHENTICATION_BACKENDS: Sequence[str] + +LOGIN_URL: str + +LOGIN_REDIRECT_URL: str + +LOGOUT_REDIRECT_URL: str | None + +# The number of seconds a password reset link is valid for +PASSWORD_RESET_TIMEOUT: int + +# the first hasher in this list is the preferred algorithm. any +# password using different algorithms will be converted automatically +# upon login +PASSWORD_HASHERS: list[str] + +AUTH_PASSWORD_VALIDATORS: list[dict[str, str]] + +########### +# SIGNING # +########### + +SIGNING_BACKEND: str + +######## +# CSRF # +######## + +# Dotted path to callable to be used as view when a request is +# rejected by the CSRF middleware. +CSRF_FAILURE_VIEW: str + +# Settings for CSRF cookie. +CSRF_COOKIE_NAME: str +CSRF_COOKIE_AGE: int +CSRF_COOKIE_DOMAIN: str | None +CSRF_COOKIE_PATH: str +CSRF_COOKIE_SECURE: bool +CSRF_COOKIE_HTTPONLY: bool +CSRF_COOKIE_SAMESITE: Literal["Lax", "Strict", "None", False] +CSRF_HEADER_NAME: str +CSRF_TRUSTED_ORIGINS: list[str] +CSRF_USE_SESSIONS: bool + +############ +# MESSAGES # +############ + +# Class to use as messages backend +MESSAGE_STORAGE: str + +# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within +# django.contrib.messages to avoid imports in this settings file. + +########### +# LOGGING # +########### + +# The callable to use to configure logging +LOGGING_CONFIG: str + +# Custom logging configuration. +LOGGING: dict[str, Any] + +# Default exception reporter class used in case none has been +# specifically assigned to the HttpRequest instance. +DEFAULT_EXCEPTION_REPORTER: str + +# Default exception reporter filter class used in case none has been +# specifically assigned to the HttpRequest instance. +DEFAULT_EXCEPTION_REPORTER_FILTER: str + +########### +# TESTING # +########### + +# The name of the class to use to run the test suite +TEST_RUNNER: str + +# Apps that don't need to be serialized at test database creation time +# (only apps with migrations are to start with) +TEST_NON_SERIALIZED_APPS: list[str] + +############ +# FIXTURES # +############ + +# The list of directories to search for fixtures +FIXTURE_DIRS: list[str] + +############### +# STATICFILES # +############### + +# A list of locations of additional static files +STATICFILES_DIRS: list[str] + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS: list[str] + +############## +# MIGRATIONS # +############## + +# Migration module overrides for apps, by app label. +MIGRATION_MODULES: dict[str, str | None] + +################# +# SYSTEM CHECKS # +################# + +# List of all issues generated by system checks that should be silenced. Light +# issues like warnings, infos or debugs will not generate a message. Silencing +# serious issues like errors and criticals does not result in hiding the +# message, but Django will not stop you from e.g. running server. +SILENCED_SYSTEM_CHECKS: list[str] + +####################### +# SECURITY MIDDLEWARE # +####################### +SECURE_CONTENT_TYPE_NOSNIFF: bool +SECURE_CROSS_ORIGIN_OPENER_POLICY: str +SECURE_HSTS_INCLUDE_SUBDOMAINS: bool +SECURE_HSTS_PRELOAD: bool +SECURE_HSTS_SECONDS: int +SECURE_REDIRECT_EXEMPT: list[str] +SECURE_REFERRER_POLICY: str +SECURE_SSL_HOST: str | None +SECURE_SSL_REDIRECT: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/conf/locale/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/conf/locale/__init__.pyi new file mode 100644 index 000000000000..285cc8198cba --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/conf/locale/__init__.pyi @@ -0,0 +1,3 @@ +from typing import Any + +LANG_INFO: dict[str, Any] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/__init__.pyi new file mode 100644 index 000000000000..611a96344343 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/__init__.pyi @@ -0,0 +1,32 @@ +# Stubs for django.conf.urls (Python 3.5) +from collections.abc import Callable, Sequence +from typing import Any, overload + +from django.http.response import HttpResponse, HttpResponseBase +from django.urls import URLPattern, URLResolver +from django.urls import include as include +from typing_extensions import TypeAlias + +handler400: str | Callable[..., HttpResponse] +handler403: str | Callable[..., HttpResponse] +handler404: str | Callable[..., HttpResponse] +handler500: str | Callable[..., HttpResponse] + +_IncludedURLConf: TypeAlias = tuple[Sequence[URLResolver | URLPattern], str | None, str | None] + +# Deprecated +@overload +def url( + regex: str, view: Callable[..., HttpResponseBase], kwargs: dict[str, Any] | None = ..., name: str | None = ... +) -> URLPattern: ... +@overload +def url( + regex: str, view: _IncludedURLConf, kwargs: dict[str, Any] | None = ..., name: str | None = ... +) -> URLResolver: ... +@overload +def url( + regex: str, + view: Sequence[URLResolver | str], + kwargs: dict[str, Any] | None = ..., + name: str | None = ..., +) -> URLResolver: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/i18n.pyi b/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/i18n.pyi new file mode 100644 index 000000000000..5e7b3b6196cb --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/i18n.pyi @@ -0,0 +1,6 @@ +from django.urls import _AnyURL + +def i18n_patterns(*urls: _AnyURL, prefix_default_language: bool = ...) -> list[_AnyURL]: ... +def is_language_prefix_patterns_used(urlconf: str) -> tuple[bool, bool]: ... + +urlpatterns: list[_AnyURL] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/static.pyi b/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/static.pyi new file mode 100644 index 000000000000..f658cace7f3f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/conf/urls/static.pyi @@ -0,0 +1,6 @@ +from collections.abc import Callable +from typing import Any + +from django.urls.resolvers import URLPattern + +def static(prefix: str, view: Callable = ..., **kwargs: Any) -> list[URLPattern]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/__init__.pyi new file mode 100644 index 000000000000..a7cded02e83e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/__init__.pyi @@ -0,0 +1,24 @@ +from . import checks as checks +from .decorators import action as action +from .decorators import display as display +from .decorators import register as register +from .filters import AllValuesFieldListFilter as AllValuesFieldListFilter +from .filters import BooleanFieldListFilter as BooleanFieldListFilter +from .filters import ChoicesFieldListFilter as ChoicesFieldListFilter +from .filters import DateFieldListFilter as DateFieldListFilter +from .filters import EmptyFieldListFilter as EmptyFieldListFilter +from .filters import FieldListFilter as FieldListFilter +from .filters import ListFilter as ListFilter +from .filters import RelatedFieldListFilter as RelatedFieldListFilter +from .filters import RelatedOnlyFieldListFilter as RelatedOnlyFieldListFilter +from .filters import SimpleListFilter as SimpleListFilter +from .options import HORIZONTAL as HORIZONTAL +from .options import VERTICAL as VERTICAL +from .options import ModelAdmin as ModelAdmin +from .options import ShowFacets as ShowFacets +from .options import StackedInline as StackedInline +from .options import TabularInline as TabularInline +from .sites import AdminSite as AdminSite +from .sites import site as site + +def autodiscover() -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/actions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/actions.pyi new file mode 100644 index 000000000000..767fc7100d58 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/actions.pyi @@ -0,0 +1,6 @@ +from django.contrib.admin.options import ModelAdmin +from django.db.models.query import QuerySet +from django.http.request import HttpRequest +from django.template.response import TemplateResponse + +def delete_selected(modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet) -> TemplateResponse | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/apps.pyi new file mode 100644 index 000000000000..d23665bd1b02 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/apps.pyi @@ -0,0 +1,6 @@ +from django.apps import AppConfig + +class SimpleAdminConfig(AppConfig): + default_site: str + +class AdminConfig(SimpleAdminConfig): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/checks.pyi new file mode 100644 index 000000000000..ccbcc7526fb3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/checks.pyi @@ -0,0 +1,22 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.contrib.admin.options import BaseModelAdmin +from django.core.checks.messages import CheckMessage + +def check_admin_app(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[CheckMessage]: ... +def check_dependencies(**kwargs: Any) -> list[CheckMessage]: ... + +class BaseModelAdminChecks: + def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... + +class ModelAdminChecks(BaseModelAdminChecks): + def check(self, admin_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... + +class InlineModelAdminChecks(BaseModelAdminChecks): + def check(self, inline_obj: BaseModelAdmin, **kwargs: Any) -> list[CheckMessage]: ... # type: ignore[override] + +def must_be(type: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ... +def must_inherit_from(parent: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ... +def refer_to_missing_field(field: Any, option: Any, obj: Any, id: Any) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/decorators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/decorators.pyi new file mode 100644 index 000000000000..ef15b8eac948 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/decorators.pyi @@ -0,0 +1,43 @@ +from collections.abc import Callable, Sequence +from typing import Any, TypeVar, overload + +from django.contrib.admin import ModelAdmin +from django.contrib.admin.sites import AdminSite +from django.db.models.base import Model +from django.db.models.expressions import BaseExpression, Combinable +from django.utils.functional import _StrOrPromise + +_ModelAdmin = TypeVar("_ModelAdmin", bound=ModelAdmin[Any]) +_F = TypeVar("_F", bound=Callable[..., Any]) + +@overload +def action( + function: _F, + permissions: Sequence[str] | None = ..., + description: _StrOrPromise | None = ..., +) -> _F: ... +@overload +def action( + *, + permissions: Sequence[str] | None = ..., + description: _StrOrPromise | None = ..., +) -> Callable[[_F], _F]: ... +@overload +def display( + function: _F, + boolean: bool | None = ..., + ordering: str | Combinable | BaseExpression | None = ..., + description: _StrOrPromise | None = ..., + empty_value: str | None = ..., +) -> _F: ... +@overload +def display( + *, + boolean: bool | None = ..., + ordering: str | Combinable | BaseExpression | None = ..., + description: _StrOrPromise | None = ..., + empty_value: str | None = ..., +) -> Callable[[_F], _F]: ... +def register( + *models: type[Model], site: AdminSite | None = ... +) -> Callable[[type[_ModelAdmin]], type[_ModelAdmin]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/exceptions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/exceptions.pyi new file mode 100644 index 000000000000..22e1287648c1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/exceptions.pyi @@ -0,0 +1,6 @@ +from django.core.exceptions import SuspiciousOperation + +class DisallowedModelAdminLookup(SuspiciousOperation): ... +class DisallowedModelAdminToField(SuspiciousOperation): ... +class AlreadyRegistered(Exception): ... +class NotRegistered(Exception): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/filters.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/filters.pyi new file mode 100644 index 000000000000..6502ae210823 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/filters.pyi @@ -0,0 +1,126 @@ +from collections.abc import Callable, Iterable, Iterator +from datetime import date, datetime +from typing import Any, ClassVar + +from django.contrib.admin.options import ModelAdmin +from django.contrib.admin.views.main import ChangeList +from django.db.models.aggregates import Count +from django.db.models.base import Model +from django.db.models.fields import Field +from django.db.models.fields.related import RelatedField +from django.db.models.query import QuerySet +from django.db.models.query_utils import Q +from django.http.request import HttpRequest +from django.utils.datastructures import _ListOrTuple +from django.utils.functional import _StrOrPromise +from django.utils.safestring import SafeString +from typing_extensions import TypedDict + +class _ListFilterChoices(TypedDict): + selected: bool + query_string: str + display: _StrOrPromise + +class ListFilter: + title: _StrOrPromise | None + template: str + request: HttpRequest + used_parameters: dict[str, bool | datetime | str] + def __init__( + self, request: HttpRequest, params: dict[str, str], model: type[Model], model_admin: ModelAdmin + ) -> None: ... + def has_output(self) -> bool: ... + def choices(self, changelist: ChangeList) -> Iterator[_ListFilterChoices]: ... + def queryset(self, request: HttpRequest, queryset: QuerySet) -> QuerySet | None: ... + def expected_parameters(self) -> list[str | None]: ... + +class FacetsMixin: + def get_facet_counts(self, pk_attname: str, filtered_qs: QuerySet[Model]) -> dict[str, Count]: ... + def get_facet_queryset(self, changelist: ChangeList) -> dict[str, int]: ... + +class SimpleListFilter(FacetsMixin, ListFilter): + parameter_name: str | None + lookup_choices: list[tuple[str, _StrOrPromise]] + def value(self) -> str | None: ... + def lookups(self, request: HttpRequest, model_admin: ModelAdmin) -> Iterable[tuple[str, _StrOrPromise]] | None: ... + +class FieldListFilter(FacetsMixin, ListFilter): + list_separator: ClassVar[str] + field: Field + field_path: str + title: _StrOrPromise + def __init__( + self, + field: Field, + request: HttpRequest, + params: dict[str, str], + model: type[Model], + model_admin: ModelAdmin, + field_path: str, + ) -> None: ... + @classmethod + def register( + cls, test: Callable[[Field], Any], list_filter_class: type[FieldListFilter], take_priority: bool = ... + ) -> None: ... + @classmethod + def create( + cls, + field: Field, + request: HttpRequest, + params: dict[str, str], + model: type[Model], + model_admin: ModelAdmin, + field_path: str, + ) -> FieldListFilter: ... + +class RelatedFieldListFilter(FieldListFilter): + lookup_kwarg: str + lookup_kwarg_isnull: str + lookup_val: str | None + lookup_val_isnull: str | None + lookup_choices: list[tuple[str, _StrOrPromise]] + lookup_title: _StrOrPromise + empty_value_display: SafeString + @property + def include_empty_choice(self) -> bool: ... + def field_admin_ordering( + self, field: RelatedField, request: HttpRequest, model_admin: ModelAdmin + ) -> _ListOrTuple[str]: ... + def field_choices( + self, field: RelatedField, request: HttpRequest, model_admin: ModelAdmin + ) -> list[tuple[str, _StrOrPromise]]: ... + +class BooleanFieldListFilter(FieldListFilter): + lookup_kwarg: str + lookup_kwarg2: str + lookup_val: str | None + lookup_val2: str | None + +class ChoicesFieldListFilter(FieldListFilter): + lookup_kwarg: str + lookup_kwarg_isnull: str + lookup_val: str | None + lookup_val_isnull: str | None + +class DateFieldListFilter(FieldListFilter): + field_generic: str + date_params: dict[str, str] + lookup_kwarg_since: str + lookup_kwarg_until: str + links: tuple[tuple[_StrOrPromise, dict[str, bool | date | datetime]], ...] + lookup_kwarg_isnull: str + +class AllValuesFieldListFilter(FieldListFilter): + lookup_kwarg: str + lookup_kwarg_isnull: str + lookup_val: str | None + lookup_val_isnull: str | None + empty_value_display: SafeString + lookup_choices: QuerySet + +class RelatedOnlyFieldListFilter(RelatedFieldListFilter): ... + +class EmptyFieldListFilter(FieldListFilter): + lookup_kwarg: str + lookup_val: str | None + def get_lookup_condition(self) -> Q: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/forms.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/forms.pyi new file mode 100644 index 000000000000..930c5e132f3b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/forms.pyi @@ -0,0 +1,7 @@ +from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm + +class AdminAuthenticationForm(AuthenticationForm): + required_css_class: str + +class AdminPasswordChangeForm(PasswordChangeForm): + required_css_class: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/helpers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/helpers.pyi new file mode 100644 index 000000000000..6a2a86ed9674 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/helpers.pyi @@ -0,0 +1,181 @@ +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence +from typing import Any, type_check_only + +from django import forms +from django.contrib.admin.options import ModelAdmin +from django.db.models import Model +from django.db.models.fields import AutoField +from django.forms import BaseForm +from django.forms.boundfield import BoundField +from django.forms.models import ModelForm +from django.forms.utils import ErrorDict, ErrorList +from django.forms.widgets import Media, Widget +from django.utils.safestring import SafeString +from typing_extensions import TypedDict + +ACTION_CHECKBOX_NAME: str + +class ActionForm(forms.Form): + action: Any + select_across: Any + +@type_check_only +class _PrepopulatedDict(TypedDict): + field: BoundField + dependencies: list[BoundField] + +class AdminForm: + prepopulated_fields: list[_PrepopulatedDict] + model_admin: ModelAdmin | None + readonly_fields: Sequence[str] + form: ModelForm + fieldsets: list[tuple[Any, dict[str, list[str]]]] + def __init__( + self, + form: ModelForm, + fieldsets: list[tuple[Any, dict[str, list[str]]]], + prepopulated_fields: Mapping[str, Iterable[str]], + readonly_fields: Sequence[str] | None = ..., + model_admin: ModelAdmin | None = ..., + ) -> None: ... + def __iter__(self) -> Iterator[Fieldset]: ... + @property + def errors(self) -> ErrorDict: ... + @property + def non_field_errors(self) -> Callable[[], ErrorList]: ... + @property + def media(self) -> Media: ... + +class Fieldset: + form: ModelForm + classes: str + description: str | None + model_admin: ModelAdmin | None + readonly_fields: Sequence[str] + def __init__( + self, + form: ModelForm, + name: Any | None = ..., + readonly_fields: Sequence[str] = ..., + fields: Sequence[str] = ..., + classes: Iterable[str] = ..., + description: str | None = ..., + model_admin: ModelAdmin | None = ..., + ) -> None: ... + @property + def media(self) -> Media: ... + def __iter__(self) -> Iterator[Fieldline]: ... + +class Fieldline: + form: ModelForm + fields: Sequence[str] + has_visible_field: bool + model_admin: ModelAdmin | None + readonly_fields: Sequence[str] + def __init__( + self, + form: ModelForm, + field: str | Sequence[str], + readonly_fields: Sequence[str] | None = ..., + model_admin: ModelAdmin | None = ..., + ) -> None: ... + def __iter__(self) -> Iterator[AdminField | AdminReadonlyField]: ... + def errors(self) -> SafeString: ... + +class AdminField: + field: BoundField + is_first: bool + is_checkbox: bool + is_readonly: bool + def __init__(self, form: ModelForm, field: str, is_first: bool) -> None: ... + def label_tag(self) -> SafeString: ... + def errors(self) -> SafeString: ... + +@type_check_only +class _FieldDictT(TypedDict): + name: str + label: str + help_text: str + field: Callable[[Model], Any] | str + +class AdminReadonlyField: + field: _FieldDictT + form: ModelForm + model_admin: ModelAdmin | None + is_first: bool + is_checkbox: bool + is_readonly: bool + empty_value_display: Any + def __init__( + self, + form: ModelForm, + field: Callable[[Model], Any] | str, + is_first: bool, + model_admin: ModelAdmin | None = ..., + ) -> None: ... + def label_tag(self) -> SafeString: ... + def contents(self) -> SafeString: ... + +class InlineAdminFormSet: + opts: Any + formset: Any + fieldsets: Any + model_admin: ModelAdmin | None + readonly_fields: Sequence[str] + prepopulated_fields: dict[str, Any] + classes: str + has_add_permission: bool + has_change_permission: bool + has_delete_permission: bool + has_view_permission: bool + def __init__( + self, + inline: Any, + formset: Any, + fieldsets: Any, + prepopulated_fields: dict[str, Any] | None = ..., + readonly_fields: Sequence[str] | None = ..., + model_admin: ModelAdmin | None = ..., + has_add_permission: bool = ..., + has_change_permission: bool = ..., + has_delete_permission: bool = ..., + has_view_permission: bool = ..., + ) -> None: ... + def __iter__(self) -> Iterator[InlineAdminForm]: ... + def fields(self) -> Iterator[dict[str, dict[str, bool] | bool | Widget | str]]: ... + def inline_formset_data(self) -> str: ... + @property + def forms(self) -> list[BaseForm]: ... + def non_form_errors(self) -> ErrorList: ... + @property + def media(self) -> Media: ... + +class InlineAdminForm(AdminForm): + formset: Any + original: bool | None + show_url: bool + absolute_url: str | None + def __init__( + self, + formset: Any, + form: ModelForm, + fieldsets: Any, + prepopulated_fields: Any, + original: bool | None, + readonly_fields: Sequence[str] | None = ..., + model_admin: ModelAdmin | None = ..., + view_on_site_url: str | None = ..., + ) -> None: ... + def __iter__(self) -> Iterator[InlineFieldset]: ... + def needs_explicit_pk_field(self) -> bool | AutoField: ... + def pk_field(self) -> AdminField: ... + def fk_field(self) -> AdminField: ... + def deletion_field(self) -> AdminField: ... + +class InlineFieldset(Fieldset): + formset: Any + def __init__(self, formset: Any, *args: Any, **kwargs: Any) -> None: ... + def __iter__(self) -> Iterator[Fieldline]: ... + +class AdminErrorList(forms.utils.ErrorList): + def __init__(self, form: ModelForm, inline_formsets: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/migrations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/migrations/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/models.pyi new file mode 100644 index 000000000000..a1ac77b49d24 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/models.pyi @@ -0,0 +1,37 @@ +from typing import Any, ClassVar +from uuid import UUID + +from django.db import models +from django.db.models.base import Model + +ADDITION: int +CHANGE: int +DELETION: int +ACTION_FLAG_CHOICES: Any + +class LogEntryManager(models.Manager[LogEntry]): + def log_action( + self, + user_id: int, + content_type_id: int, + object_id: int | str | UUID, + object_repr: str, + action_flag: int, + change_message: Any = ..., + ) -> LogEntry: ... + +class LogEntry(models.Model): + action_time: models.DateTimeField + user: models.ForeignKey + content_type: models.ForeignKey + object_id: models.TextField + object_repr: models.CharField + action_flag: models.PositiveSmallIntegerField + change_message: models.TextField + objects: ClassVar[LogEntryManager] + def is_addition(self) -> bool: ... + def is_change(self) -> bool: ... + def is_deletion(self) -> bool: ... + def get_change_message(self) -> str: ... + def get_edited_object(self) -> Model: ... + def get_admin_url(self) -> str | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/options.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/options.pyi new file mode 100644 index 000000000000..3a5ca8ab819d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/options.pyi @@ -0,0 +1,331 @@ +import enum +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence +from typing import Any, Generic, Literal, TypeVar, type_check_only + +from django import forms +from django.contrib.admin.filters import FieldListFilter, ListFilter +from django.contrib.admin.models import LogEntry +from django.contrib.admin.sites import AdminSite +from django.contrib.admin.views.main import ChangeList +from django.contrib.auth.forms import AdminPasswordChangeForm +from django.contrib.contenttypes.models import ContentType +from django.core.checks.messages import CheckMessage +from django.core.paginator import Paginator +from django.db.models.base import Model +from django.db.models.fields import Field +from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField +from django.db.models.options import Options +from django.db.models.query import QuerySet +from django.forms.fields import Field as FormField +from django.forms.fields import TypedChoiceField +from django.forms.formsets import BaseFormSet +from django.forms.models import ( + BaseInlineFormSet, + BaseModelFormSet, + ModelChoiceField, + ModelForm, + ModelMultipleChoiceField, +) +from django.forms.widgets import Media +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseBase, HttpResponseRedirect +from django.template.response import _TemplateForResponseT +from django.urls.resolvers import URLPattern +from django.utils.datastructures import _ListOrTuple +from django.utils.functional import _StrOrPromise +from django.utils.safestring import SafeString +from typing_extensions import Self, TypeAlias, TypedDict + +IS_POPUP_VAR: str +TO_FIELD_VAR: str +IS_FACETS_VAR: str +HORIZONTAL: Literal[1] +VERTICAL: Literal[2] + +_Direction: TypeAlias = Literal[1, 2] + +class ShowFacets(enum.Enum): + NEVER: str + ALLOW: str + ALWAYS: str + +def get_content_type_for_model(obj: type[Model] | Model) -> ContentType: ... +def get_ul_class(radio_style: int) -> str: ... + +class IncorrectLookupParameters(Exception): ... + +FORMFIELD_FOR_DBFIELD_DEFAULTS: Any +csrf_protect_m: Any + +_FieldGroups: TypeAlias = Sequence[str | Sequence[str]] + +@type_check_only +class _OptionalFieldOpts(TypedDict, total=False): + classes: Sequence[str] + description: _StrOrPromise + +@type_check_only +class _FieldOpts(_OptionalFieldOpts, total=True): + fields: _FieldGroups + +# Workaround for mypy issue, a Sequence type should be preferred here. +# https://github.com/python/mypy/issues/8921 +# _FieldsetSpec = Sequence[Tuple[Optional[str], _FieldOpts]] +_FieldsetSpec: TypeAlias = _ListOrTuple[tuple[_StrOrPromise | None, _FieldOpts]] +_ListFilterT: TypeAlias = ( + type[ListFilter] + | Field[Any, Any] + | str + | tuple[Field[Any, Any] | str, type[FieldListFilter]] + | list[Field[Any, Any] | str | type[FieldListFilter]] +) + +# Generic type specifically for models, for use in BaseModelAdmin and subclasses +# https://github.com/typeddjango/django-stubs/issues/482 +_ModelT = TypeVar("_ModelT", bound=Model) +_DisplayT: TypeAlias = _ListOrTuple[str | Callable[[_ModelT], str | bool]] + +class BaseModelAdmin(Generic[_ModelT]): + autocomplete_fields: _ListOrTuple[str] + raw_id_fields: _ListOrTuple[str] + fields: _FieldGroups | None + exclude: _ListOrTuple[str] | None + fieldsets: _FieldsetSpec | None + form: type[forms.ModelForm[_ModelT]] + filter_vertical: _ListOrTuple[str] + filter_horizontal: _ListOrTuple[str] + radio_fields: Mapping[str, _Direction] + prepopulated_fields: dict[str, Sequence[str]] + formfield_overrides: Mapping[type[Field], Mapping[str, Any]] + readonly_fields: _ListOrTuple[str] + ordering: _ListOrTuple[str] | None + sortable_by: _ListOrTuple[str] | None + show_full_result_count: bool + checks_class: Any + model: type[_ModelT] + opts: Options[_ModelT] + admin_site: AdminSite + def __init__(self) -> None: ... + def check(self, **kwargs: Any) -> list[CheckMessage]: ... + def formfield_for_dbfield(self, db_field: Field, request: HttpRequest, **kwargs: Any) -> FormField | None: ... + def formfield_for_choice_field( + self, db_field: Field, request: HttpRequest, **kwargs: Any + ) -> TypedChoiceField | None: ... + def get_field_queryset(self, db: str | None, db_field: RelatedField, request: HttpRequest) -> QuerySet | None: ... + def formfield_for_foreignkey( + self, db_field: ForeignKey, request: HttpRequest, **kwargs: Any + ) -> ModelChoiceField | None: ... + def formfield_for_manytomany( + self, db_field: ManyToManyField, request: HttpRequest, **kwargs: Any + ) -> ModelMultipleChoiceField | None: ... + def get_autocomplete_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ... + def get_view_on_site_url(self, obj: _ModelT | None = ...) -> str | None: ... + def get_empty_value_display(self) -> SafeString: ... + def get_exclude(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str] | None: ... + def get_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _FieldGroups: ... + def get_fieldsets(self, request: HttpRequest, obj: _ModelT | None = ...) -> _FieldsetSpec: ... + def get_inlines(self, request: HttpRequest, obj: _ModelT | None) -> list[type[InlineModelAdmin]]: ... + def get_ordering(self, request: HttpRequest) -> _ListOrTuple[str]: ... + def get_readonly_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str]: ... + def get_prepopulated_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> dict[str, Sequence[str]]: ... + def get_queryset(self, request: HttpRequest) -> QuerySet[_ModelT]: ... + def get_sortable_by(self, request: HttpRequest) -> _DisplayT[_ModelT]: ... + def lookup_allowed(self, lookup: str, value: str, request: HttpRequest | None = ...) -> bool: ... + def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ... + def has_add_permission(self, request: HttpRequest) -> bool: ... + def has_change_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ... + def has_delete_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ... + def has_view_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ... + def has_view_or_change_permission(self, request: HttpRequest, obj: _ModelT | None = ...) -> bool: ... + def has_module_permission(self, request: HttpRequest) -> bool: ... + @property + def view_on_site(self) -> Callable[[_ModelT], str | None] | bool: ... + +_ModelAdmin = TypeVar("_ModelAdmin", bound=ModelAdmin[Any]) +_ActionCallable: TypeAlias = Callable[[_ModelAdmin, HttpRequest, QuerySet[_ModelT]], HttpResponseBase | None] + +class ModelAdmin(BaseModelAdmin[_ModelT]): + list_display: _DisplayT[_ModelT] + list_display_links: _DisplayT[_ModelT] | None + list_filter: _ListOrTuple[_ListFilterT] + list_select_related: bool | _ListOrTuple[str] + list_per_page: int + list_max_show_all: int + list_editable: _ListOrTuple[str] + search_fields: _ListOrTuple[str] + search_help_text: _StrOrPromise | None + date_hierarchy: str | None + save_as: bool + save_as_continue: bool + save_on_top: bool + paginator: type + preserve_filters: bool + show_facets: ShowFacets + inlines: _ListOrTuple[type[InlineModelAdmin]] + add_form_template: _TemplateForResponseT | None + change_form_template: _TemplateForResponseT | None + change_list_template: _TemplateForResponseT | None + delete_confirmation_template: _TemplateForResponseT | None + delete_selected_confirmation_template: _TemplateForResponseT | None + object_history_template: _TemplateForResponseT | None + popup_response_template: _TemplateForResponseT | None + actions: Sequence[_ActionCallable[Self, _ModelT] | str] | None + action_form: Any + actions_on_top: bool + actions_on_bottom: bool + actions_selection_counter: bool + model: type[_ModelT] + opts: Options[_ModelT] + admin_site: AdminSite + def __init__(self, model: type[_ModelT], admin_site: AdminSite) -> None: ... + def get_inline_instances(self, request: HttpRequest, obj: _ModelT | None = ...) -> list[InlineModelAdmin]: ... + def get_urls(self) -> list[URLPattern]: ... + @property + def urls(self) -> list[URLPattern]: ... + @property + def media(self) -> Media: ... + def get_model_perms(self, request: HttpRequest) -> dict[str, bool]: ... + def get_form( + self, request: HttpRequest, obj: _ModelT | None = ..., change: bool = ..., **kwargs: Any + ) -> type[forms.ModelForm[_ModelT]]: ... + def get_changelist(self, request: HttpRequest, **kwargs: Any) -> type[ChangeList]: ... + def get_changelist_instance(self, request: HttpRequest) -> ChangeList: ... + def get_object(self, request: HttpRequest, object_id: str, from_field: str | None = ...) -> _ModelT | None: ... + def get_changelist_form(self, request: HttpRequest, **kwargs: Any) -> type[ModelForm[_ModelT]]: ... + def get_changelist_formset( + self, request: HttpRequest, **kwargs: Any + ) -> type[BaseModelFormSet[_ModelT, ModelForm[_ModelT]]]: ... + def get_formsets_with_inlines(self, request: HttpRequest, obj: _ModelT | None = ...) -> Iterator[Any]: ... + def get_paginator( + self, + request: HttpRequest, + queryset: QuerySet, + per_page: int, + orphans: int = ..., + allow_empty_first_page: bool = ..., + ) -> Paginator: ... + def log_addition(self, request: HttpRequest, obj: _ModelT, message: Any) -> LogEntry: ... + def log_change(self, request: HttpRequest, obj: _ModelT, message: Any) -> LogEntry: ... + def log_deletion(self, request: HttpRequest, obj: _ModelT, object_repr: str) -> LogEntry: ... + def action_checkbox(self, obj: _ModelT) -> SafeString: ... + def get_actions(self, request: HttpRequest) -> dict[str, tuple[Callable[..., str], str, str] | None]: ... + def get_action_choices( + self, request: HttpRequest, default_choices: list[tuple[str, str]] = ... + ) -> list[tuple[str, str]]: ... + def get_action(self, action: Callable | str) -> tuple[Callable[..., str], str, str] | None: ... + def get_list_display(self, request: HttpRequest) -> _DisplayT[_ModelT]: ... + def get_list_display_links(self, request: HttpRequest, list_display: _DisplayT[_ModelT]) -> _DisplayT[_ModelT]: ... + def get_list_filter(self, request: HttpRequest) -> _ListOrTuple[_ListFilterT]: ... + def get_list_select_related(self, request: HttpRequest) -> bool | _ListOrTuple[str]: ... + def get_search_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ... + def get_search_results( + self, request: HttpRequest, queryset: QuerySet, search_term: str + ) -> tuple[QuerySet[_ModelT], bool]: ... + def get_preserved_filters(self, request: HttpRequest) -> str: ... + def _get_edited_object_pks(self, request: HttpRequest, prefix: str) -> list[str]: ... + def _get_list_editable_queryset(self, request: HttpRequest, prefix: str) -> QuerySet[_ModelT]: ... + def construct_change_message( + self, request: HttpRequest, form: AdminPasswordChangeForm, formsets: Iterable[BaseFormSet], add: bool = ... + ) -> list[dict[str, dict[str, list[str]]]]: ... + def message_user( + self, + request: HttpRequest, + message: _StrOrPromise, + level: int | str = ..., + extra_tags: str = ..., + fail_silently: bool = ..., + ) -> None: ... + def save_form(self, request: HttpRequest, form: Any, change: Any) -> Any: ... + def save_model(self, request: HttpRequest, obj: _ModelT, form: Any, change: Any) -> None: ... + def delete_model(self, request: HttpRequest, obj: _ModelT) -> None: ... + def delete_queryset(self, request: HttpRequest, queryset: QuerySet) -> None: ... + def save_formset(self, request: HttpRequest, form: Any, formset: Any, change: Any) -> None: ... + def save_related(self, request: HttpRequest, form: Any, formsets: Any, change: Any) -> None: ... + def render_change_form( + self, + request: HttpRequest, + context: dict[str, Any], + add: bool = ..., + change: bool = ..., + form_url: str = ..., + obj: _ModelT | None = ..., + ) -> HttpResponse: ... + def response_add(self, request: HttpRequest, obj: _ModelT, post_url_continue: str | None = ...) -> HttpResponse: ... + def response_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponse: ... + def response_post_save_add(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ... + def response_post_save_change(self, request: HttpRequest, obj: _ModelT) -> HttpResponseRedirect: ... + # Probably FileResponse cannot come from ModelAdmin views + def response_action(self, request: HttpRequest, queryset: QuerySet) -> HttpResponse | None: ... + def response_delete(self, request: HttpRequest, obj_display: str, obj_id: int) -> HttpResponse: ... + def render_delete_form(self, request: HttpRequest, context: dict[str, Any]) -> HttpResponse: ... + def get_inline_formsets( + self, request: HttpRequest, formsets: list[Any], inline_instances: list[Any], obj: _ModelT | None = ... + ) -> list[Any]: ... + def get_changeform_initial_data(self, request: HttpRequest) -> dict[str, str | list[str]]: ... + def changeform_view( + self, + request: HttpRequest, + object_id: str | None = ..., + form_url: str = ..., + extra_context: dict[str, Any] | None = ..., + ) -> HttpResponse: ... + def add_view( + self, request: HttpRequest, form_url: str = ..., extra_context: dict[str, Any] | None = ... + ) -> HttpResponse: ... + def change_view( + self, request: HttpRequest, object_id: str, form_url: str = ..., extra_context: dict[str, Any] | None = ... + ) -> HttpResponse: ... + def changelist_view(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> HttpResponse: ... + def get_deleted_objects( + self, objs: Sequence[_ModelT] | QuerySet[_ModelT], request: HttpRequest + ) -> tuple[list[str], dict[str, int], set[str], list[str]]: ... + def delete_view( + self, request: HttpRequest, object_id: str, extra_context: dict[str, Any] | None = ... + ) -> HttpResponse: ... + def history_view( + self, request: HttpRequest, object_id: str, extra_context: dict[str, Any] | None = ... + ) -> HttpResponse: ... + def get_formset_kwargs( + self, request: HttpRequest, obj: _ModelT, inline: InlineModelAdmin[Any, _ModelT], prefix: str + ) -> dict[str, Any]: ... + +_ChildModelT = TypeVar("_ChildModelT", bound=Model) +_ParentModelT = TypeVar("_ParentModelT", bound=Model) + +class InlineModelAdmin(Generic[_ChildModelT, _ParentModelT], BaseModelAdmin[_ChildModelT]): + model: type[_ChildModelT] + fk_name: str | None + formset: type[BaseInlineFormSet[_ChildModelT, _ParentModelT, forms.ModelForm[_ChildModelT]]] + extra: int + min_num: int | None + max_num: int | None + template: str + verbose_name: _StrOrPromise | None + verbose_name_plural: _StrOrPromise | None + can_delete: bool + show_change_link: bool + classes: Sequence[str] | None + admin_site: AdminSite + parent_model: type[_ParentModelT] + opts: Options[_ChildModelT] + has_registered_model: bool + def __init__(self, parent_model: type[_ParentModelT], admin_site: AdminSite) -> None: ... + @property + def media(self) -> Media: ... + def get_extra(self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any) -> int: ... + def get_min_num(self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any) -> int | None: ... + def get_max_num(self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any) -> int | None: ... + def get_formset( + self, request: HttpRequest, obj: _ParentModelT | None = ..., **kwargs: Any + ) -> type[BaseInlineFormSet[_ChildModelT, _ParentModelT, forms.ModelForm[_ChildModelT]]]: ... + def get_queryset(self, request: HttpRequest) -> QuerySet[_ChildModelT]: ... + def has_add_permission(self, request: HttpRequest, obj: _ParentModelT | None) -> bool: ... # type: ignore[override] + def has_change_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override] + def has_delete_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override] + def has_view_permission(self, request: HttpRequest, obj: _ParentModelT | None = ...) -> bool: ... # type: ignore[override] + +class StackedInline(InlineModelAdmin[_ChildModelT, _ParentModelT]): + template: str + +class TabularInline(InlineModelAdmin[_ChildModelT, _ParentModelT]): + template: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/sites.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/sites.pyi new file mode 100644 index 000000000000..cb7b1963d7c5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/sites.pyi @@ -0,0 +1,93 @@ +import sys +from collections.abc import Callable, Iterable +from typing import Any, TypeVar + +from django.apps.config import AppConfig +from django.contrib.admin.models import LogEntry +from django.contrib.admin.options import ModelAdmin +from django.contrib.auth.forms import AuthenticationForm +from django.core.checks import CheckMessage +from django.db.models.base import Model +from django.db.models.query import QuerySet +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseBase +from django.template.response import TemplateResponse +from django.urls import URLPattern, URLResolver +from django.utils.functional import LazyObject, _StrOrPromise +from typing_extensions import TypeAlias + +if sys.version_info >= (3, 9): + from weakref import WeakSet + + all_sites: WeakSet[AdminSite] +else: + from collections.abc import MutableSet + + all_sites: MutableSet[AdminSite] + +_ViewType = TypeVar("_ViewType", bound=Callable[..., HttpResponseBase]) +_ModelT = TypeVar("_ModelT", bound=Model) +_ActionCallback: TypeAlias = Callable[[ModelAdmin, HttpRequest, QuerySet], TemplateResponse | None] + +class AdminSite: + site_title: _StrOrPromise + site_header: _StrOrPromise + index_title: _StrOrPromise + site_url: str | None + login_form: type[AuthenticationForm] | None + index_template: str | None + app_index_template: str | None + login_template: str | None + logout_template: str | None + password_change_template: str | None + password_change_done_template: str | None + name: str + enable_nav_sidebar: bool + empty_value_display: str + final_catch_all_view: bool + _empty_value_display: str + _registry: dict[type[Model], ModelAdmin] + _global_actions: dict[str, _ActionCallback] + _actions: dict[str, _ActionCallback] + def __init__(self, name: str = ...) -> None: ... + def check(self, app_configs: Iterable[AppConfig] | None) -> list[CheckMessage]: ... + def register( + self, + model_or_iterable: type[Model] | Iterable[type[Model]], + admin_class: type[ModelAdmin] | None = ..., + **options: Any, + ) -> None: ... + def unregister(self, model_or_iterable: type[Model] | Iterable[type[Model]]) -> None: ... + def is_registered(self, model: type[Model]) -> bool: ... + def get_model_admin(self, model: type[_ModelT]) -> ModelAdmin[_ModelT]: ... + def add_action(self, action: _ActionCallback, name: str | None = ...) -> None: ... + def disable_action(self, name: str) -> None: ... + def get_action(self, name: str) -> _ActionCallback: ... + @property + def actions(self) -> Iterable[tuple[str, _ActionCallback]]: ... + def has_permission(self, request: HttpRequest) -> bool: ... + def admin_view(self, view: _ViewType, cacheable: bool = ...) -> _ViewType: ... + def get_urls(self) -> list[URLResolver | URLPattern]: ... + @property + def urls(self) -> tuple[list[URLResolver | URLPattern], str, str]: ... + def each_context(self, request: HttpRequest) -> dict[str, Any]: ... + def password_change(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> TemplateResponse: ... + def password_change_done( + self, request: HttpRequest, extra_context: dict[str, Any] | None = ... + ) -> TemplateResponse: ... + def i18n_javascript(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> HttpResponse: ... + def logout(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> TemplateResponse: ... + def login(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> HttpResponse: ... + def _build_app_dict(self, request: HttpRequest, label: _StrOrPromise | None = ...) -> dict[str, Any]: ... + def get_app_list(self, request: HttpRequest, app_label: str | None = ...) -> list[Any]: ... + def index(self, request: HttpRequest, extra_context: dict[str, Any] | None = ...) -> TemplateResponse: ... + def app_index( + self, request: HttpRequest, app_label: str, extra_context: dict[str, Any] | None = ... + ) -> TemplateResponse: ... + def autocomplete_view(self, request: HttpRequest) -> HttpResponse: ... + def catch_all_view(self, request: HttpRequest, url: str) -> HttpResponse: ... + def get_log_entries(self, request: HttpRequest) -> QuerySet[LogEntry]: ... + +class DefaultAdminSite(LazyObject): ... + +site: AdminSite diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_list.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_list.pyi new file mode 100644 index 000000000000..8eb51c31cab4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_list.pyi @@ -0,0 +1,41 @@ +from collections.abc import Iterator +from typing import Any + +from django.contrib.admin.filters import FieldListFilter +from django.contrib.admin.views.main import ChangeList +from django.db.models.base import Model +from django.forms.boundfield import BoundField +from django.forms.models import ModelForm +from django.template.base import Parser, Token +from django.template.context import RequestContext +from django.utils.safestring import SafeString + +from .base import InclusionAdminNode + +register: Any +DOT: str + +def paginator_number(cl: ChangeList, i: int) -> SafeString: ... +def pagination(cl: ChangeList) -> dict[str, Any]: ... +def pagination_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... +def result_headers(cl: ChangeList) -> Iterator[dict[str, int | str | None]]: ... +def items_for_result(cl: ChangeList, result: Model, form: ModelForm | None) -> Iterator[SafeString]: ... + +class ResultList(list): + form: ModelForm | None + def __init__(self, form: ModelForm | None, *items: Any) -> None: ... + +def results(cl: ChangeList) -> Iterator[ResultList]: ... +def result_hidden_fields(cl: ChangeList) -> Iterator[BoundField]: ... +def result_list( + cl: ChangeList, +) -> dict[str, list[dict[str, int | str | None]] | list[ResultList] | list[BoundField] | ChangeList | int]: ... +def result_list_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... +def date_hierarchy(cl: ChangeList) -> dict[str, Any] | None: ... +def date_hierarchy_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... +def search_form(cl: ChangeList) -> dict[str, bool | ChangeList | str]: ... +def search_form_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... +def admin_list_filter(cl: ChangeList, spec: FieldListFilter) -> SafeString: ... +def admin_actions(context: RequestContext) -> RequestContext: ... +def admin_actions_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... +def change_list_object_tools_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_modify.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_modify.pyi new file mode 100644 index 000000000000..67ee4c6783f7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_modify.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from django.contrib.admin.helpers import InlineAdminForm +from django.template.base import Parser, Token +from django.template.context import Context, RequestContext + +from .base import InclusionAdminNode + +register: Any + +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: ... +def change_form_object_tools_tag(parser: Parser, token: Token) -> InclusionAdminNode: ... +def cell_count(inline_admin_form: InlineAdminForm) -> int: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_urls.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_urls.pyi new file mode 100644 index 000000000000..02b0351be98c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/admin_urls.pyi @@ -0,0 +1,17 @@ +from typing import Any +from uuid import UUID + +from django.db.models.options import Options +from django.template.context import RequestContext +from django.utils.safestring import SafeString + +register: Any + +def admin_urlname(value: Options, arg: SafeString) -> str: ... +def admin_urlquote(value: int | str | UUID) -> int | str | UUID: ... +def add_preserved_filters( + context: dict[str, Options | str] | RequestContext, + url: str, + popup: bool = ..., + to_field: str | None = ..., +) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/base.pyi new file mode 100644 index 000000000000..d0edf2cfd424 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/base.pyi @@ -0,0 +1,18 @@ +from collections.abc import Callable +from typing import Any + +from django.template.base import Parser, Token +from django.template.context import Context +from django.template.library import InclusionNode +from django.utils.safestring import SafeString + +class InclusionAdminNode(InclusionNode): + args: list[Any] + func: Callable + kwargs: dict[str, Any] + takes_context: bool + template_name: str + def __init__( + self, parser: Parser, token: Token, func: Callable, template_name: str, takes_context: bool = ... + ) -> None: ... + def render(self, context: Context) -> SafeString: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/log.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/log.pyi new file mode 100644 index 000000000000..5978f1a12153 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/templatetags/log.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from django import template +from django.template.base import Parser, Token +from django.template.context import Context + +register: Any + +class AdminLogNode(template.Node): + limit: str + user: str + varname: str + def __init__(self, limit: str, varname: str, user: str | None) -> None: ... + def render(self, context: Context) -> str: ... + +def get_admin_log(parser: Parser, token: Token) -> AdminLogNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/tests.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/tests.pyi new file mode 100644 index 000000000000..3a9a532321c8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/tests.pyi @@ -0,0 +1,27 @@ +from collections.abc import Callable, Generator +from contextlib import contextmanager +from typing import Any + +from django.contrib.staticfiles.testing import StaticLiveServerTestCase +from django.test.selenium import SeleniumTestCase +from django.utils.deprecation import MiddlewareMixin + +class CSPMiddleware(MiddlewareMixin): ... + +class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): + def wait_until(self, callback: Callable, timeout: int = ...) -> None: ... + def wait_for_and_switch_to_popup(self, num_windows: int = ..., timeout: int = ...) -> None: ... + def wait_for(self, css_selector: str, timeout: int = ...) -> None: ... + def wait_for_text(self, css_selector: str, text: str, timeout: int = ...) -> None: ... + def wait_for_value(self, css_selector: str, text: str, timeout: int = ...) -> None: ... + def wait_until_visible(self, css_selector: str, timeout: int = ...) -> None: ... + def wait_until_invisible(self, css_selector: str, timeout: int = ...) -> None: ... + def wait_page_ready(self, timeout: int = ...) -> None: ... + @contextmanager + def wait_page_loaded(self, timeout: int = ...) -> Generator[None, None, None]: ... + def admin_login(self, username: str, password: str, login_url: str = ...) -> None: ... + def select_option(self, selector: str, value: Any) -> None: ... + def deselect_option(self, selector: str, value: Any) -> None: ... + def assertSelectOptions(self, selector: str, values: Any) -> None: ... + def assertSelectedOptions(self, selector: str, values: Any) -> None: ... + def has_css_class(self, selector: str, klass: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/utils.pyi new file mode 100644 index 000000000000..fd3a303980b7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/utils.pyi @@ -0,0 +1,104 @@ +import datetime +from collections import defaultdict +from collections.abc import Callable, Iterable, Sequence +from typing import Any, Literal, TypeVar, overload, type_check_only +from uuid import UUID + +from _typeshed import Unused +from django.contrib.admin.options import BaseModelAdmin +from django.contrib.admin.sites import AdminSite +from django.contrib.auth.forms import AdminPasswordChangeForm +from django.db.models.base import Model +from django.db.models.deletion import Collector +from django.db.models.fields import Field, reverse_related +from django.db.models.options import Options +from django.db.models.query import QuerySet +from django.db.models.query_utils import Q +from django.forms.forms import BaseForm +from django.forms.formsets import BaseFormSet +from django.http.request import HttpRequest +from django.utils.datastructures import _IndexableCollection +from typing_extensions import TypedDict + +_T = TypeVar("_T") + +class FieldIsAForeignKeyColumnName(Exception): ... + +def lookup_spawns_duplicates(opts: Options, lookup_path: str) -> bool: ... +def get_last_value_from_parameters(parameters: dict[str, list[str] | str], key: str) -> str | None: ... +def prepare_lookup_value( + key: str, value: list[bool | datetime.datetime | str] | datetime.datetime | str, separator: str +) -> list[bool | datetime.datetime | str] | bool | datetime.datetime | str: ... +def build_q_object_from_lookup_parameters(parameters: dict[str, list[str]]) -> Q: ... +def quote(s: int | str | UUID) -> str: ... +def unquote(s: str) -> str: ... +def flatten(fields: Any) -> list[Callable | str]: ... +def flatten_fieldsets(fieldsets: Any) -> list[Callable | str]: ... +def get_deleted_objects( + objs: Sequence[Model | None] | QuerySet[Model], request: HttpRequest, admin_site: AdminSite +) -> tuple[list[str], dict[str, int], set[str], list[str]]: ... + +class NestedObjects(Collector): + edges: dict[Model, list[Model]] + protected: set[Model] + model_objs: defaultdict[str, set[Model]] + def add_edge(self, source: Model | None, target: Model) -> None: ... + def collect( # type: ignore[override] + self, + objs: _IndexableCollection[Model | None], + source: type[Model] | None = ..., + source_attr: str | None = ..., + *, + nullable: bool = ..., + collect_related: bool = ..., + reverse_dependency: bool = ..., + keep_parents: bool = ..., + fail_on_restricted: bool = ..., + ) -> None: ... + def related_objects( + self, related_model: type[Model], related_fields: Iterable[Field], objs: _IndexableCollection[Model] + ) -> QuerySet[Model]: ... + @overload + def nested(self, format_callback: None = None) -> list[Model]: ... + @overload + def nested(self, format_callback: Callable[[Model], _T]) -> list[_T]: ... + def can_fast_delete(self, *args: Unused, **kwargs: Unused) -> Literal[False]: ... + +@type_check_only +class _ModelFormatDict(TypedDict): + verbose_name: str + verbose_name_plural: str + +def model_format_dict(obj: Model | type[Model] | QuerySet | Options[Model]) -> _ModelFormatDict: ... +def model_ngettext(obj: Options | QuerySet, n: int | None = ...) -> str: ... +def lookup_field( + name: Callable | str, obj: Model, model_admin: BaseModelAdmin | None = ... +) -> tuple[Field | None, str | None, Any]: ... +@overload +def label_for_field( + name: Callable | str, + model: type[Model], + model_admin: BaseModelAdmin | None = ..., + return_attr: Literal[True] = True, + form: BaseForm | None = ..., +) -> tuple[str, Callable | str | None]: ... +@overload +def label_for_field( + name: Callable | str, + model: type[Model], + model_admin: BaseModelAdmin | None = ..., + return_attr: Literal[False] = False, + form: BaseForm | None = ..., +) -> str: ... +def help_text_for_field(name: str, model: type[Model]) -> str: ... +def display_for_field(value: Any, field: Field, empty_value_display: str) -> str: ... +def display_for_value(value: Any, empty_value_display: str, boolean: bool = ...) -> str: ... + +class NotRelationField(Exception): ... + +def get_model_from_relation(field: Field | reverse_related.ForeignObjectRel) -> type[Model]: ... +def reverse_field_path(model: type[Model], path: str) -> tuple[type[Model], str]: ... +def get_fields_from_path(model: type[Model], path: str) -> list[Field]: ... +def construct_change_message( + form: AdminPasswordChangeForm, formsets: Iterable[BaseFormSet], add: bool +) -> list[dict[str, dict[str, list[str]]]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/autocomplete.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/autocomplete.pyi new file mode 100644 index 000000000000..fc036b91a687 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/autocomplete.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from django.contrib.admin.options import ModelAdmin +from django.db.models import Model +from django.http.request import HttpRequest +from django.views.generic.list import BaseListView + +class AutocompleteJsonView(BaseListView): + model_admin: ModelAdmin + term: Any + def has_perm(self, request: HttpRequest, obj: Model | None = ...) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/decorators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/decorators.pyi new file mode 100644 index 000000000000..38c74ecb1e3a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/decorators.pyi @@ -0,0 +1,11 @@ +from collections.abc import Callable +from typing import TypeVar, overload + +_C = TypeVar("_C", bound=Callable) + +@overload +def staff_member_required(view_func: _C = ..., redirect_field_name: str | None = ..., login_url: str = ...) -> _C: ... +@overload +def staff_member_required( + view_func: None = None, redirect_field_name: str | None = ..., login_url: str = ... +) -> Callable: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/main.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/main.pyi new file mode 100644 index 000000000000..881b3dbf4c7d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/views/main.pyi @@ -0,0 +1,96 @@ +from collections.abc import Callable, Iterable, Sequence +from typing import Any, Literal + +from django import forms +from django.contrib.admin.filters import ListFilter +from django.contrib.admin.options import ModelAdmin, _DisplayT, _ListFilterT +from django.db.models.base import Model +from django.db.models.expressions import Expression +from django.db.models.options import Options +from django.db.models.query import QuerySet +from django.forms.formsets import BaseFormSet +from django.http.request import HttpRequest + +ALL_VAR: str +ORDER_VAR: str +PAGE_VAR: str +SEARCH_VAR: str +ERROR_FLAG: str +IGNORED_PARAMS: tuple[str, ...] + +class ChangeListSearchForm(forms.Form): ... + +class ChangeList: + search_form_class: type[forms.Form] + model: type[Model] + opts: Options + lookup_opts: Options + root_queryset: QuerySet + list_display: _DisplayT + list_display_links: _DisplayT + list_filter: Sequence[_ListFilterT] + date_hierarchy: Any + search_fields: Sequence[str] + search_help_text: str | None + list_select_related: bool | Sequence[str] + list_per_page: int + list_max_show_all: int + model_admin: ModelAdmin + preserved_filters: str + sortable_by: Sequence[str] | None + page_num: int + show_all: bool + is_popup: bool + add_facets: bool + is_facets_optional: bool + to_field: Any + params: dict[str, Any] + filter_params: dict[str, list[str]] + remove_facet_link: str + add_facet_link: str + list_editable: Sequence[str] + query: str + queryset: Any + title: str + pk_attname: str + formset: BaseFormSet | None + def __init__( + self, + request: HttpRequest, + model: type[Model], + list_display: _DisplayT, + list_display_links: _DisplayT, + list_filter: Sequence[_ListFilterT], + date_hierarchy: str | None, + search_fields: Sequence[str], + list_select_related: bool | Sequence[str], + list_per_page: int, + list_max_show_all: int, + list_editable: Sequence[str], + model_admin: ModelAdmin, + sortable_by: Sequence[str] | None, + search_help_text: str | None, + ) -> None: ... + def get_filters_params(self, params: dict[str, Any] | None = ...) -> dict[str, Any]: ... + def get_filters(self, request: HttpRequest) -> tuple[list[ListFilter], bool, dict[str, bool | str], bool, bool]: ... + def get_query_string(self, new_params: dict[str, Any] | None = ..., remove: Iterable[str] | None = ...) -> str: ... + result_count: int + show_full_result_count: bool + show_admin_actions: bool + full_result_count: int | None + result_list: Any + can_show_all: bool + multi_page: bool + paginator: Any + def get_results(self, request: HttpRequest) -> None: ... + def get_ordering_field(self, field_name: Callable | str) -> Expression | str | None: ... + def get_ordering(self, request: HttpRequest, queryset: QuerySet) -> list[Expression | str]: ... + def get_ordering_field_columns(self) -> dict[int, Literal["desc", "asc"]]: ... + def get_queryset(self, request: HttpRequest, exclude_parameters: list[str | None] | None = ...) -> QuerySet: ... + filter_specs: list[ListFilter] + has_filters: bool + has_active_filters: bool + clear_all_filters_qs: str + def apply_select_related(self, qs: QuerySet) -> QuerySet: ... + def has_related_field_in_list_display(self) -> bool: ... + def url_for_result(self, result: Model) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/widgets.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/widgets.pyi new file mode 100644 index 000000000000..cf27e965eebe --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admin/widgets.pyi @@ -0,0 +1,159 @@ +from collections.abc import Iterable, Mapping, Sequence +from typing import Any + +from django import forms +from django.contrib.admin.sites import AdminSite +from django.core.files.base import File +from django.db.models.fields.reverse_related import ManyToManyRel, ManyToOneRel +from django.forms.models import ModelChoiceIterator +from django.forms.widgets import ChoiceWidget, _OptAttrs +from django.utils.choices import _Choices +from django.utils.functional import _StrOrPromise + +class FilteredSelectMultiple(forms.SelectMultiple): + verbose_name: _StrOrPromise + is_stacked: bool + def __init__( + self, + verbose_name: _StrOrPromise, + is_stacked: bool, + attrs: _OptAttrs | None = ..., + choices: _Choices = ..., + ) -> None: ... + +class BaseAdminDateWidget(forms.DateInput): + def __init__(self, attrs: _OptAttrs | None = ..., format: str | None = ...) -> None: ... + +class AdminDateWidget(BaseAdminDateWidget): + template_name: str + +class BaseAdminTimeWidget(forms.TimeInput): + def __init__(self, attrs: _OptAttrs | None = ..., format: str | None = ...) -> None: ... + +class AdminTimeWidget(BaseAdminTimeWidget): + template_name: str + +class AdminSplitDateTime(forms.SplitDateTimeWidget): + template_name: str + def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + +class AdminRadioSelect(forms.RadioSelect): ... +class AdminFileWidget(forms.ClearableFileInput): ... + +def url_params_from_lookup_dict(lookups: Any) -> dict[str, str]: ... + +class ForeignKeyRawIdWidget(forms.TextInput): + rel: ManyToOneRel + admin_site: AdminSite + db: str | None + def __init__( + self, + rel: ManyToOneRel, + admin_site: AdminSite, + attrs: _OptAttrs | None = ..., + using: str | None = ..., + ) -> None: ... + def base_url_parameters(self) -> dict[str, str]: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def url_parameters(self) -> dict[str, str]: ... + def label_and_url_for_value(self, value: Any) -> tuple[str, str]: ... + +class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): + rel: ManyToManyRel # type: ignore[assignment] + def __init__( + self, + rel: ManyToManyRel, + admin_site: AdminSite, + attrs: _OptAttrs | None = ..., + using: str | None = ..., + ) -> None: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def url_parameters(self) -> dict[str, str]: ... + def label_and_url_for_value(self, value: Any) -> tuple[str, str]: ... + def format_value(self, value: Any) -> str | None: ... + def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ... + +class RelatedFieldWidgetWrapper(forms.Widget): + template_name: str + widget: ChoiceWidget + rel: ManyToOneRel + can_add_related: bool + can_change_related: bool + can_delete_related: bool + can_view_related: bool + admin_site: AdminSite + def __init__( + self, + widget: ChoiceWidget, + rel: ManyToOneRel, + admin_site: AdminSite, + can_add_related: bool | None = ..., + can_change_related: bool = ..., + can_delete_related: bool = ..., + can_view_related: bool = ..., + ) -> None: ... + @property + def is_hidden(self) -> bool: ... + @property + def choices(self) -> ModelChoiceIterator: ... + @choices.setter + def choices(self, value: ModelChoiceIterator) -> None: ... + def get_related_url(self, info: tuple[str, str], action: str, *args: Any) -> str: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def value_from_datadict(self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str) -> Any: ... + def value_omitted_from_data( + self, data: Mapping[str, Any], files: Mapping[str, Iterable[File]], name: str + ) -> bool: ... + def id_for_label(self, id_: str) -> str: ... + +class AdminTextareaWidget(forms.Textarea): + def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + +class AdminTextInputWidget(forms.TextInput): + def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + +class AdminEmailInputWidget(forms.EmailInput): + def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + +class AdminURLFieldWidget(forms.URLInput): + template_name: str + def __init__(self, attrs: _OptAttrs | None = ..., validator_class: Any = ...) -> None: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + +class AdminIntegerFieldWidget(forms.NumberInput): + def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + class_name: str + +class AdminBigIntegerFieldWidget(AdminIntegerFieldWidget): + class_name: str + +class AdminUUIDInputWidget(forms.TextInput): + def __init__(self, attrs: _OptAttrs | None = ...) -> None: ... + +SELECT2_TRANSLATIONS: dict[str, str] + +class AutocompleteMixin: + url_name: str + field: Any + admin_site: AdminSite + db: str | None + choices: Any + attrs: _OptAttrs + def __init__( + self, + field: Any, + admin_site: AdminSite, + attrs: _OptAttrs | None = ..., + choices: Any = ..., + using: str | None = ..., + ) -> None: ... + def get_url(self) -> str: ... + def build_attrs(self, base_attrs: _OptAttrs, extra_attrs: _OptAttrs | None = ...) -> dict[str, Any]: ... + # typo in source: `attr` instead of `attrs` + def optgroups( + self, name: str, value: Sequence[str], attr: _OptAttrs | None = ... + ) -> list[tuple[str | None, list[dict[str, Any]], int | None]]: ... + +class AutocompleteSelect(AutocompleteMixin, forms.Select): ... +class AutocompleteSelectMultiple(AutocompleteMixin, forms.SelectMultiple): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/apps.pyi new file mode 100644 index 000000000000..b631b70226a2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/apps.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.apps import AppConfig + +class AdminDocsConfig(AppConfig): + name: str + verbose_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/middleware.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/middleware.pyi new file mode 100644 index 000000000000..d065145d7cda --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/middleware.pyi @@ -0,0 +1,15 @@ +from collections.abc import Callable +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseBase +from django.utils.deprecation import MiddlewareMixin + +class XViewMiddleware(MiddlewareMixin): + def process_view( + self, + request: HttpRequest, + view_func: Callable[..., HttpResponseBase], + view_args: tuple, + view_kwargs: dict[Any, Any], + ) -> HttpResponse | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/urls.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/urls.pyi new file mode 100644 index 000000000000..df4275ee2b00 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/urls.pyi @@ -0,0 +1,3 @@ +from django.urls import _AnyURL + +urlpatterns: list[_AnyURL] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/utils.pyi new file mode 100644 index 000000000000..9c7f5d2fb0ce --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/utils.pyi @@ -0,0 +1,29 @@ +from collections.abc import Callable +from typing import Any + +from django.utils.safestring import SafeString + +docutils_is_available: bool + +def get_view_name(view_func: Callable) -> str: ... +def parse_docstring(docstring: str) -> tuple[str, str, dict[str, str]]: ... +def parse_rst(text: str, default_reference_context: Any, thing_being_parsed: Any | None = ...) -> SafeString: ... + +ROLES: dict[str, str] + +def create_reference_role(rolename: str, urlbase: str) -> None: ... +def default_reference_role( + name: str, + rawtext: str, + text: str, + lineno: Any, + inliner: Any, + options: Any | None = ..., + content: Any | None = ..., +) -> tuple[list[Any], list[Any]]: ... + +named_group_matcher: Any +unnamed_group_matcher: Any + +def replace_named_groups(pattern: str) -> str: ... +def replace_unnamed_groups(pattern: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/views.pyi new file mode 100644 index 000000000000..0c19bb5d75b9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/admindocs/views.pyi @@ -0,0 +1,26 @@ +from collections.abc import Callable, Iterable +from re import Pattern +from typing import Any + +from django.db.models.fields import Field +from django.urls import _AnyURL +from django.views.generic import TemplateView + +MODEL_METHODS_EXCLUDE: Any + +class BaseAdminDocsView(TemplateView): ... +class BookmarkletsView(BaseAdminDocsView): ... +class TemplateTagIndexView(BaseAdminDocsView): ... +class TemplateFilterIndexView(BaseAdminDocsView): ... +class ViewIndexView(BaseAdminDocsView): ... +class ViewDetailView(BaseAdminDocsView): ... +class ModelIndexView(BaseAdminDocsView): ... +class ModelDetailView(BaseAdminDocsView): ... +class TemplateDetailView(BaseAdminDocsView): ... + +def get_return_data_type(func_name: Any) -> str: ... +def get_readable_field_data_type(field: Field | str) -> str: ... +def extract_views_from_urlpatterns( + urlpatterns: Iterable[_AnyURL], base: str = ..., namespace: str | None = ... +) -> list[tuple[Callable, Pattern[str], str | None, str | None]]: ... +def simplify_regex(pattern: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/__init__.pyi new file mode 100644 index 000000000000..1e9413413d0b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/__init__.pyi @@ -0,0 +1,34 @@ +from typing import Any + +from django.contrib.auth.backends import BaseBackend +from django.contrib.auth.base_user import _UserModel +from django.contrib.auth.models import AnonymousUser +from django.db.models.options import Options +from django.http.request import HttpRequest +from django.test.client import Client + +from .signals import user_logged_in as user_logged_in +from .signals import user_logged_out as user_logged_out +from .signals import user_login_failed as user_login_failed + +SESSION_KEY: str +BACKEND_SESSION_KEY: str +HASH_SESSION_KEY: str +REDIRECT_FIELD_NAME: str + +def load_backend(path: str) -> BaseBackend: ... +def get_backends() -> list[BaseBackend]: ... +def authenticate(request: HttpRequest | None = ..., **credentials: Any) -> _UserModel | None: ... +async def aauthenticate(request: HttpRequest | None = ..., **credentials: Any) -> _UserModel | None: ... +def login(request: HttpRequest, user: _UserModel | None, backend: type[BaseBackend] | str | None = ...) -> None: ... +async def alogin( + request: HttpRequest, user: _UserModel | None, backend: type[BaseBackend] | str | None = ... +) -> None: ... +def logout(request: HttpRequest) -> None: ... +async def alogout(request: HttpRequest) -> None: ... +def get_user_model() -> type[_UserModel]: ... +def get_user(request: HttpRequest | Client) -> _UserModel | AnonymousUser: ... +async def aget_user(request: HttpRequest | Client) -> _UserModel | AnonymousUser: ... +def get_permission_codename(action: str, opts: Options) -> str: ... +def update_session_auth_hash(request: HttpRequest, user: _UserModel) -> None: ... +async def aupdate_session_auth_hash(request: HttpRequest, user: _UserModel) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/admin.pyi new file mode 100644 index 000000000000..1e0c37e9f427 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/admin.pyi @@ -0,0 +1,20 @@ +from typing import Any, TypeVar + +from django.contrib import admin +from django.contrib.auth.models import AbstractUser, Group +from django.http.request import HttpRequest +from django.http.response import HttpResponse + +_AbstractUserT = TypeVar("_AbstractUserT", bound=AbstractUser) + +csrf_protect_m: Any +sensitive_post_parameters_m: Any + +class GroupAdmin(admin.ModelAdmin[Group]): ... + +class UserAdmin(admin.ModelAdmin[_AbstractUserT]): + change_user_password_template: Any + add_fieldsets: Any + add_form: Any + change_password_form: Any + def user_change_password(self, request: HttpRequest, id: str, form_url: str = ...) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/apps.pyi new file mode 100644 index 000000000000..7764c9ffb138 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/apps.pyi @@ -0,0 +1,3 @@ +from django.apps import AppConfig + +class AuthConfig(AppConfig): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/backends.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/backends.pyi new file mode 100644 index 000000000000..c63628db4b10 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/backends.pyi @@ -0,0 +1,44 @@ +from typing import Any, TypeVar + +from django.contrib.auth.base_user import AbstractBaseUser, _UserModel +from django.contrib.auth.models import AnonymousUser, Permission +from django.db.models import QuerySet +from django.db.models.base import Model +from django.http.request import HttpRequest +from typing_extensions import TypeAlias + +UserModel: TypeAlias = type[_UserModel] +_AnyUser: TypeAlias = _UserModel | AnonymousUser + +class BaseBackend: + def authenticate(self, request: HttpRequest | None, **kwargs: Any) -> _UserModel | None: ... + def get_user(self, user_id: Any) -> _UserModel | None: ... + def get_user_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ... + def get_group_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ... + def get_all_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ... + def has_perm(self, user_obj: _AnyUser, perm: str, obj: Model | None = ...) -> bool: ... + +class ModelBackend(BaseBackend): + def authenticate( + self, request: HttpRequest | None, username: str | None = ..., password: str | None = ..., **kwargs: Any + ) -> _UserModel | None: ... + def has_module_perms(self, user_obj: _AnyUser, app_label: str) -> bool: ... + def user_can_authenticate(self, user: _AnyUser | None) -> bool: ... + def with_perm( + self, + perm: str | Permission, + is_active: bool = ..., + include_superusers: bool = ..., + obj: Model | None = ..., + ) -> QuerySet[_UserModel]: ... + +class AllowAllUsersModelBackend(ModelBackend): ... + +_U = TypeVar("_U", bound=AbstractBaseUser) + +class RemoteUserBackend(ModelBackend): + create_unknown_user: bool + def clean_username(self, username: str) -> str: ... + def configure_user(self, request: HttpRequest, user: _U, created: bool = ...) -> _U: ... + +class AllowAllUsersRemoteUserBackend(RemoteUserBackend): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/base_user.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/base_user.pyi new file mode 100644 index 000000000000..c7616c402309 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/base_user.pyi @@ -0,0 +1,49 @@ +from typing import Any, ClassVar, Iterable, Literal, TypeVar, overload + +from django.db import models +from django.db.models.base import Model +from django.db.models.expressions import Combinable +from django.db.models.fields import BooleanField +from typing_extensions import TypeAlias + +_T = TypeVar("_T", bound=Model) + +class BaseUserManager(models.Manager[_T]): + @classmethod + def normalize_email(cls, email: str | None) -> str: ... + def make_random_password(self, length: int = ..., allowed_chars: str = ...) -> str: ... + def get_by_natural_key(self, username: str | None) -> _T: ... + +class AbstractBaseUser(models.Model): + REQUIRED_FIELDS: ClassVar[list[str]] + + password = models.CharField(max_length=128) + last_login = models.DateTimeField(blank=True, null=True) + is_active: bool | BooleanField[bool | Combinable, bool] + + def get_username(self) -> str: ... + def natural_key(self) -> tuple[str]: ... + @property + def is_anonymous(self) -> Literal[False]: ... + @property + def is_authenticated(self) -> Literal[True]: ... + def set_password(self, raw_password: str | None) -> None: ... + def check_password(self, raw_password: str) -> bool: ... + async def acheck_password(self, raw_password: str) -> bool: ... + def set_unusable_password(self) -> None: ... + def has_usable_password(self) -> bool: ... + def get_session_auth_hash(self) -> str: ... + def get_session_auth_fallback_hash(self) -> Iterable[str]: ... + @classmethod + def get_email_field_name(cls) -> str: ... + @classmethod + @overload + def normalize_username(cls, username: str) -> str: ... + @classmethod + @overload + def normalize_username(cls, username: Any) -> Any: ... + +# This is our "placeholder" type the mypy plugin refines to configured 'AUTH_USER_MODEL' +# wherever it is used as a type. The most recognised example of this is (probably) +# `HttpRequest.user` +_UserModel: TypeAlias = AbstractBaseUser # noqa: PYI047 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/checks.pyi new file mode 100644 index 000000000000..fcf0253e6f0d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/checks.pyi @@ -0,0 +1,10 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import CheckMessage + +def check_user_model(app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any) -> Sequence[CheckMessage]: ... +def check_models_permissions( + app_configs: Sequence[AppConfig] | None = ..., **kwargs: Any +) -> Sequence[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/context_processors.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/context_processors.pyi new file mode 100644 index 000000000000..50a7ef637f57 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/context_processors.pyi @@ -0,0 +1,21 @@ +from collections.abc import Iterator +from typing import Any + +from django.http.request import HttpRequest + +class PermLookupDict: + app_label: str + user: Any + def __init__(self, user: Any, app_label: str) -> None: ... + def __getitem__(self, perm_name: str) -> bool: ... + def __iter__(self) -> Iterator[Any]: ... + def __bool__(self) -> bool: ... + +class PermWrapper: + user: Any + def __init__(self, user: Any) -> None: ... + def __getitem__(self, app_label: str) -> PermLookupDict: ... + def __iter__(self) -> Iterator[Any]: ... + def __contains__(self, perm_name: Any) -> bool: ... + +def auth(request: HttpRequest) -> dict[str, Any]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/decorators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/decorators.pyi new file mode 100644 index 000000000000..a17f5bd45547 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/decorators.pyi @@ -0,0 +1,24 @@ +from collections.abc import Callable, Iterable +from typing import TypeVar, overload + +from django.contrib.auth.base_user import _UserModel +from django.contrib.auth.models import AnonymousUser +from django.http.response import HttpResponseBase + +_VIEW = TypeVar("_VIEW", bound=Callable[..., HttpResponseBase]) + +def user_passes_test( + test_func: Callable[[_UserModel | AnonymousUser], bool], + login_url: str | None = ..., + redirect_field_name: str | None = ..., +) -> Callable[[_VIEW], _VIEW]: ... + +# There are two ways of calling @login_required: @with(arguments) and @bare +@overload +def login_required(redirect_field_name: str | None = ..., login_url: str | None = ...) -> Callable[[_VIEW], _VIEW]: ... +@overload +def login_required(function: _VIEW, redirect_field_name: str | None = ..., login_url: str | None = ...) -> _VIEW: ... +def login_not_required(view_func: _VIEW) -> _VIEW: ... +def permission_required( + perm: Iterable[str] | str, login_url: str | None = ..., raise_exception: bool = ... +) -> Callable[[_VIEW], _VIEW]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/forms.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/forms.pyi new file mode 100644 index 000000000000..37aea5444c28 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/forms.pyi @@ -0,0 +1,111 @@ +from collections.abc import Iterable +from logging import Logger +from typing import Any, TypeVar + +from django import forms +from django.contrib.auth.base_user import AbstractBaseUser, _UserModel +from django.contrib.auth.tokens import PasswordResetTokenGenerator +from django.core.exceptions import ValidationError +from django.db import models +from django.db.models.fields import _ErrorMessagesDict +from django.forms.fields import _ClassLevelWidgetT +from django.forms.widgets import Widget +from django.http.request import HttpRequest +from typing_extensions import TypeAlias + +logger: Logger + +UserModel: TypeAlias = type[_UserModel] +_User = TypeVar("_User", bound=AbstractBaseUser) + +class ReadOnlyPasswordHashWidget(forms.Widget): + template_name: str + read_only: bool + def get_context(self, name: str, value: Any, attrs: dict[str, Any] | None) -> dict[str, Any]: ... + +class ReadOnlyPasswordHashField(forms.Field): + widget: _ClassLevelWidgetT + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + +class UsernameField(forms.CharField): + def to_python(self, value: Any | None) -> Any | None: ... + def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... + +class BaseUserCreationForm(forms.ModelForm[_User]): + error_messages: _ErrorMessagesDict + password1: forms.Field + password2: forms.Field + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def clean_password2(self) -> str: ... + def save(self, commit: bool = ...) -> _User: ... + +class UserCreationForm(BaseUserCreationForm[_User]): + def clean_username(self) -> str: ... + +class UserChangeForm(forms.ModelForm[_User]): + password: forms.Field + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + +class AuthenticationForm(forms.Form): + username: forms.Field + password: forms.Field + error_messages: _ErrorMessagesDict + request: HttpRequest | None + user_cache: _UserModel | None + username_field: models.Field + def __init__(self, request: HttpRequest | None = ..., *args: Any, **kwargs: Any) -> None: ... + def confirm_login_allowed(self, user: AbstractBaseUser) -> None: ... + def get_user(self) -> _UserModel: ... + def get_invalid_login_error(self) -> ValidationError: ... + def clean(self) -> dict[str, Any]: ... + +class PasswordResetForm(forms.Form): + email: forms.Field + def send_mail( + self, + subject_template_name: str, + email_template_name: str, + context: dict[str, Any], + from_email: str | None, + to_email: str, + html_email_template_name: str | None = ..., + ) -> None: ... + def get_users(self, email: str) -> Iterable[_UserModel]: ... + def save( + self, + domain_override: str | None = ..., + subject_template_name: str = ..., + email_template_name: str = ..., + use_https: bool = ..., + token_generator: PasswordResetTokenGenerator = ..., + from_email: str | None = ..., + request: HttpRequest | None = ..., + html_email_template_name: str | None = ..., + extra_email_context: dict[str, str] | None = ..., + ) -> None: ... + +class SetPasswordForm(forms.Form): + error_messages: _ErrorMessagesDict + new_password1: forms.Field + new_password2: forms.Field + user: AbstractBaseUser + def __init__(self, user: AbstractBaseUser, *args: Any, **kwargs: Any) -> None: ... + def clean_new_password2(self) -> str: ... + def save(self, commit: bool = ...) -> AbstractBaseUser: ... + +class PasswordChangeForm(SetPasswordForm): + error_messages: _ErrorMessagesDict + old_password: forms.Field + def clean_old_password(self) -> str: ... + +class AdminPasswordChangeForm(forms.Form): + error_messages: _ErrorMessagesDict + required_css_class: str + password1: forms.Field + password2: forms.Field + user: AbstractBaseUser + def __init__(self, user: AbstractBaseUser, *args: Any, **kwargs: Any) -> None: ... + def clean_password2(self) -> str: ... + def save(self, commit: bool = ...) -> AbstractBaseUser: ... + @property + def changed_data(self) -> list[str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/handlers/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/handlers/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/handlers/modwsgi.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/handlers/modwsgi.pyi new file mode 100644 index 000000000000..e9845da568b8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/handlers/modwsgi.pyi @@ -0,0 +1,6 @@ +from typing import Any + +UserModel: Any + +def check_password(environ: dict[Any, Any], username: str, password: str) -> Any: ... +def groups_for_user(environ: dict[Any, Any], username: str) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/hashers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/hashers.pyi new file mode 100644 index 000000000000..a80045fa94bf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/hashers.pyi @@ -0,0 +1,61 @@ +from collections.abc import Callable +from typing import Any + +UNUSABLE_PASSWORD_PREFIX: str +UNUSABLE_PASSWORD_SUFFIX_LENGTH: int + +def is_password_usable(encoded: str | None) -> bool: ... +def verify_password(password: str | None, encoded: str, preferred: str = ...) -> tuple[bool, bool]: ... +def check_password(password: str | None, encoded: str, setter: Callable | None = ..., preferred: str = ...) -> bool: ... +async def acheck_password( + password: str | None, encoded: str, setter: Callable | None = ..., preferred: str = ... +) -> bool: ... +def make_password(password: str | None, salt: str | None = ..., hasher: str | BasePasswordHasher = ...) -> str: ... +def get_hashers() -> list[BasePasswordHasher]: ... +def get_hashers_by_algorithm() -> dict[str, BasePasswordHasher]: ... +def reset_hashers(**kwargs: Any) -> None: ... +def get_hasher(algorithm: str | BasePasswordHasher = ...) -> BasePasswordHasher: ... +def identify_hasher(encoded: str) -> BasePasswordHasher: ... +def mask_hash(hash: str, show: int = ..., char: str = ...) -> str: ... + +class BasePasswordHasher: + algorithm: str | None + library: str | tuple[str, str] | None + rounds: int + time_cost: int + memory_cost: int + parallelism: int + digest: Any + iterations: int + salt_entropy: int + def salt(self) -> str: ... + def verify(self, password: str, encoded: str) -> bool: ... + def encode(self, password: str, salt: str) -> str: ... + def decode(self, encoded: str) -> dict[str, Any]: ... + def safe_summary(self, encoded: str) -> dict[str, Any]: ... + def must_update(self, encoded: str) -> bool: ... + def harden_runtime(self, password: str, encoded: str) -> None: ... + +class PBKDF2PasswordHasher(BasePasswordHasher): + def encode(self, password: str, salt: str, iterations: int | None = ...) -> str: ... + def decode(self, encoded: str) -> dict[str, str | int]: ... + +class PBKDF2SHA1PasswordHasher(PBKDF2PasswordHasher): ... +class Argon2PasswordHasher(BasePasswordHasher): ... + +class BCryptSHA256PasswordHasher(BasePasswordHasher): + def decode(self, encoded: str) -> dict[str, str | int]: ... + +class BCryptPasswordHasher(BCryptSHA256PasswordHasher): ... + +class SHA1PasswordHasher(BasePasswordHasher): + def decode(self, encoded: str) -> dict[str, str]: ... + +class MD5PasswordHasher(BasePasswordHasher): + def decode(self, encoded: str) -> dict[str, str]: ... + +class UnsaltedSHA1PasswordHasher(BasePasswordHasher): + def decode(self, encoded: str) -> dict[str, str | None]: ... + +class UnsaltedMD5PasswordHasher(BasePasswordHasher): + def decode(self, encoded: str) -> dict[str, str | None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/__init__.pyi new file mode 100644 index 000000000000..82fac24c07d7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/__init__.pyi @@ -0,0 +1,15 @@ +from typing import Any + +from django.apps.config import AppConfig +from django.apps.registry import Apps + +def create_permissions( + app_config: AppConfig, + verbosity: int = ..., + interactive: bool = ..., + using: str = ..., + apps: Apps = ..., + **kwargs: Any, +) -> None: ... +def get_system_username() -> str: ... +def get_default_username(check_db: bool = ..., database: str = ...) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/changepassword.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/changepassword.pyi new file mode 100644 index 000000000000..0998c2dd5e41 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/changepassword.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.core.management.base import BaseCommand + +UserModel: Any + +class Command(BaseCommand): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/createsuperuser.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/createsuperuser.pyi new file mode 100644 index 000000000000..57d205de2e03 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/management/commands/createsuperuser.pyi @@ -0,0 +1,9 @@ +import getpass as getpass +from typing import Any + +from django.core.management.base import BaseCommand + +class NotRunningInTTYException(Exception): ... + +class Command(BaseCommand): + stdin: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/middleware.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/middleware.pyi new file mode 100644 index 000000000000..0465dccf5d44 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/middleware.pyi @@ -0,0 +1,19 @@ +from django.contrib.auth.base_user import _UserModel +from django.contrib.auth.models import AnonymousUser +from django.http.request import HttpRequest +from django.utils.deprecation import MiddlewareMixin + +def get_user(request: HttpRequest) -> AnonymousUser | _UserModel: ... +async def auser(request: HttpRequest) -> AnonymousUser | _UserModel: ... + +class AuthenticationMiddleware(MiddlewareMixin): + def process_request(self, request: HttpRequest) -> None: ... + +class RemoteUserMiddleware(MiddlewareMixin): + header: str + force_logout_if_no_header: bool + def process_request(self, request: HttpRequest) -> None: ... + def clean_username(self, username: str, request: HttpRequest) -> str: ... + +class PersistentRemoteUserMiddleware(RemoteUserMiddleware): + force_logout_if_no_header: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/migrations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/migrations/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/mixins.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/mixins.pyi new file mode 100644 index 000000000000..d344dfa5c1da --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/mixins.pyi @@ -0,0 +1,30 @@ +from collections.abc import Callable, Sequence +from typing import Any + +from django import http +from django.http.response import HttpResponseBase, HttpResponseRedirect +from django.utils.functional import _StrOrPromise + +class AccessMixin: + login_url: Any + permission_denied_message: _StrOrPromise + raise_exception: bool + redirect_field_name: Any + def get_login_url(self) -> str: ... + def get_permission_denied_message(self) -> _StrOrPromise: ... + def get_redirect_field_name(self) -> str: ... + def handle_no_permission(self) -> HttpResponseRedirect: ... + +class LoginRequiredMixin(AccessMixin): + def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + +class PermissionRequiredMixin(AccessMixin): + permission_required: Any + def get_permission_required(self) -> Sequence[str]: ... + def has_permission(self) -> bool: ... + def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + +class UserPassesTestMixin(AccessMixin): + def test_func(self) -> bool | None: ... + def get_test_func(self) -> Callable: ... + def dispatch(self, request: http.HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/models.pyi new file mode 100644 index 000000000000..78702f1e78fd --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/models.pyi @@ -0,0 +1,120 @@ +from collections.abc import Iterable +from typing import Any, ClassVar, Literal, TypeVar + +from django.contrib.auth.base_user import AbstractBaseUser as AbstractBaseUser +from django.contrib.auth.base_user import BaseUserManager as BaseUserManager +from django.contrib.auth.validators import UnicodeUsernameValidator +from django.contrib.contenttypes.models import ContentType +from django.db import models +from django.db.models import QuerySet +from django.db.models.base import Model +from django.db.models.manager import EmptyManager +from django.utils.functional import _StrOrPromise +from typing_extensions import Self, TypeAlias + +_AnyUser: TypeAlias = Model | AnonymousUser + +def update_last_login(sender: type[AbstractBaseUser], user: AbstractBaseUser, **kwargs: Any) -> None: ... + +class PermissionManager(models.Manager[Permission]): + def get_by_natural_key(self, codename: str, app_label: str, model: str) -> Permission: ... + +class Permission(models.Model): + content_type_id: int + objects: ClassVar[PermissionManager] + + name = models.CharField(max_length=255) + content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) + codename = models.CharField(max_length=100) + def natural_key(self) -> tuple[str, str, str]: ... + +class GroupManager(models.Manager[Group]): + def get_by_natural_key(self, name: str) -> Group: ... + +class Group(models.Model): + objects: ClassVar[GroupManager] + + name = models.CharField(max_length=150) + permissions = models.ManyToManyField(Permission) + def natural_key(self) -> tuple[str]: ... + +_T = TypeVar("_T", bound=Model) + +class UserManager(BaseUserManager[_T]): + def create_user( + self, username: str, email: str | None = ..., password: str | None = ..., **extra_fields: Any + ) -> _T: ... + def create_superuser( + self, username: str, email: str | None = ..., password: str | None = ..., **extra_fields: Any + ) -> _T: ... + def with_perm( + self, + perm: str | Permission, + is_active: bool = ..., + include_superusers: bool = ..., + backend: str | None = ..., + obj: Model | None = ..., + ) -> QuerySet[_T]: ... + +class PermissionsMixin(models.Model): + is_superuser = models.BooleanField() + groups = models.ManyToManyField(Group) + user_permissions = models.ManyToManyField(Permission) + + def get_user_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ... + def get_group_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ... + def get_all_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ... + def has_perm(self, perm: str, obj: _AnyUser | None = ...) -> bool: ... + def has_perms(self, perm_list: Iterable[str], obj: _AnyUser | None = ...) -> bool: ... + def has_module_perms(self, app_label: str) -> bool: ... + +class AbstractUser(AbstractBaseUser, PermissionsMixin): + username_validator: UnicodeUsernameValidator + + username = models.CharField(max_length=150) + first_name = models.CharField(max_length=30, blank=True) + last_name = models.CharField(max_length=150, blank=True) + email = models.EmailField(blank=True) + is_staff = models.BooleanField() + is_active = models.BooleanField() + date_joined = models.DateTimeField() + + objects: ClassVar[UserManager[Self]] + + EMAIL_FIELD: str + USERNAME_FIELD: str + + def get_full_name(self) -> str: ... + def get_short_name(self) -> str: ... + def email_user( + self, subject: _StrOrPromise, message: _StrOrPromise, from_email: str = ..., **kwargs: Any + ) -> None: ... + +class User(AbstractUser): ... + +class AnonymousUser: + id: Any + pk: Any + username: Literal[""] + is_staff: Literal[False] + is_active: Literal[False] + is_superuser: Literal[False] + def save(self) -> None: ... + def delete(self) -> None: ... + def set_password(self, raw_password: str) -> None: ... + def check_password(self, raw_password: str) -> Any: ... + @property + def groups(self) -> EmptyManager[Group]: ... + @property + def user_permissions(self) -> EmptyManager[Permission]: ... + def get_user_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ... + def get_group_permissions(self, obj: _AnyUser | None = ...) -> set[Any]: ... + def get_all_permissions(self, obj: _AnyUser | None = ...) -> set[str]: ... + def has_perm(self, perm: str, obj: _AnyUser | None = ...) -> bool: ... + def has_perms(self, perm_list: Iterable[str], obj: _AnyUser | None = ...) -> bool: ... + def has_module_perms(self, module: str) -> bool: ... + @property + def is_anonymous(self) -> Literal[True]: ... + @property + def is_authenticated(self) -> Literal[False]: ... + def get_username(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/password_validation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/password_validation.pyi new file mode 100644 index 000000000000..b9318e934435 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/password_validation.pyi @@ -0,0 +1,47 @@ +from collections.abc import Mapping, Sequence +from pathlib import Path, PosixPath +from typing import Any, Protocol, type_check_only + +from django.contrib.auth.base_user import _UserModel + +@type_check_only +class PasswordValidator(Protocol): + def validate(self, password: str, user: _UserModel | None = ..., /) -> None: ... + def get_help_text(self) -> str: ... + +def get_default_password_validators() -> list[PasswordValidator]: ... +def get_password_validators(validator_config: Sequence[Mapping[str, Any]]) -> list[PasswordValidator]: ... +def validate_password( + password: str, user: _UserModel | None = ..., password_validators: Sequence[PasswordValidator] | None = ... +) -> None: ... +def password_changed( + password: str, user: _UserModel | None = ..., password_validators: Sequence[PasswordValidator] | None = ... +) -> None: ... +def password_validators_help_texts(password_validators: Sequence[PasswordValidator] | None = ...) -> list[str]: ... + +password_validators_help_text_html: Any + +class MinimumLengthValidator: + min_length: int + def __init__(self, min_length: int = ...) -> None: ... + def validate(self, password: str, user: _UserModel | None = ...) -> None: ... + def get_help_text(self) -> str: ... + +class UserAttributeSimilarityValidator: + DEFAULT_USER_ATTRIBUTES: Sequence[str] + user_attributes: Sequence[str] + max_similarity: float + def __init__(self, user_attributes: Sequence[str] = ..., max_similarity: float = ...) -> None: ... + def validate(self, password: str, user: _UserModel | None = ...) -> None: ... + def get_help_text(self) -> str: ... + +class CommonPasswordValidator: + DEFAULT_PASSWORD_LIST_PATH: Path + passwords: set[str] + def __init__(self, password_list_path: Path | PosixPath | str = ...) -> None: ... + def validate(self, password: str, user: _UserModel | None = ...) -> None: ... + def get_help_text(self) -> str: ... + +class NumericPasswordValidator: + def validate(self, password: str, user: _UserModel | None = ...) -> None: ... + def get_help_text(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/signals.pyi new file mode 100644 index 000000000000..d50af4345d9f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/signals.pyi @@ -0,0 +1,5 @@ +from django.dispatch.dispatcher import Signal + +user_logged_in: Signal +user_login_failed: Signal +user_logged_out: Signal diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/tokens.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/tokens.pyi new file mode 100644 index 000000000000..05f05b5e08fd --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/tokens.pyi @@ -0,0 +1,18 @@ +from datetime import date, datetime +from typing import Any + +from django.contrib.auth.base_user import _UserModel + +class PasswordResetTokenGenerator: + key_salt: str + secret: str | bytes + secret_fallbacks: list[str | bytes] + algorithm: str + def make_token(self, user: _UserModel) -> str: ... + def check_token(self, user: _UserModel | None, token: str | None) -> bool: ... + def _make_token_with_timestamp(self, user: _UserModel, timestamp: int, secret: str | bytes = ...) -> str: ... + def _make_hash_value(self, user: _UserModel, timestamp: int) -> str: ... + def _num_seconds(self, dt: datetime | date) -> int: ... + def _now(self) -> datetime: ... + +default_token_generator: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/urls.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/urls.pyi new file mode 100644 index 000000000000..df4275ee2b00 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/urls.pyi @@ -0,0 +1,3 @@ +from django.urls import _AnyURL + +urlpatterns: list[_AnyURL] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/validators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/validators.pyi new file mode 100644 index 000000000000..bb7c913de182 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/validators.pyi @@ -0,0 +1,4 @@ +from django.core.validators import RegexValidator + +class ASCIIUsernameValidator(RegexValidator): ... +class UnicodeUsernameValidator(RegexValidator): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/views.pyi new file mode 100644 index 000000000000..443a7855a1f7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/auth/views.pyi @@ -0,0 +1,78 @@ +from typing import Any + +from django.contrib.auth.base_user import _UserModel +from django.contrib.auth.forms import AuthenticationForm +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseRedirect +from django.views.generic.base import TemplateView +from django.views.generic.edit import FormView +from typing_extensions import TypeAlias + +UserModel: TypeAlias = type[_UserModel] + +class RedirectURLMixin: + next_page: str | None + redirect_field_name: str + success_url_allowed_hosts: set[str] + def get_success_url(self) -> str: ... + def get_redirect_url(self) -> str: ... + def get_success_url_allowed_hosts(self) -> set[str]: ... + def get_default_redirect_url(self) -> str: ... + +class LoginView(RedirectURLMixin, FormView[AuthenticationForm]): + authentication_form: Any + redirect_field_name: Any + redirect_authenticated_user: bool + extra_context: Any + def get_redirect_url(self) -> str: ... + +class LogoutView(RedirectURLMixin, TemplateView): + next_page: str | None + redirect_field_name: str + extra_context: Any + def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def get_next_page(self) -> str | None: ... + +def logout_then_login(request: HttpRequest, login_url: str | None = ...) -> HttpResponseRedirect: ... +def redirect_to_login( + next: str, login_url: str | None = ..., redirect_field_name: str | None = ... +) -> HttpResponseRedirect: ... + +class PasswordContextMixin: + extra_context: Any + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + +class PasswordResetView(PasswordContextMixin, FormView): + email_template_name: str + extra_email_context: Any + from_email: Any + html_email_template_name: Any + subject_template_name: str + title: Any + token_generator: Any + +INTERNAL_RESET_URL_TOKEN: str +INTERNAL_RESET_SESSION_TOKEN: str + +class PasswordResetDoneView(PasswordContextMixin, TemplateView): + title: Any + +class PasswordResetConfirmView(PasswordContextMixin, FormView): + post_reset_login: bool + post_reset_login_backend: Any + reset_url_token: str + title: Any + token_generator: Any + validlink: bool + user: Any + def get_user(self, uidb64: str) -> _UserModel | None: ... + +class PasswordResetCompleteView(PasswordContextMixin, TemplateView): + title: Any + +class PasswordChangeView(PasswordContextMixin, FormView): + title: Any + +class PasswordChangeDoneView(PasswordContextMixin, TemplateView): + title: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/admin.pyi new file mode 100644 index 000000000000..d19318806632 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/admin.pyi @@ -0,0 +1,15 @@ +from typing import Any + +from django.contrib.admin.checks import InlineModelAdminChecks +from django.contrib.admin.options import InlineModelAdmin +from django.db.models.base import Model + +class GenericInlineModelAdminChecks(InlineModelAdminChecks): + def _check_exclude_of_parent_model(self, obj: GenericInlineModelAdmin, parent_model: type[Model]) -> list[Any]: ... + def _check_relation(self, obj: GenericInlineModelAdmin, parent_model: type[Model]) -> list[Any]: ... + +class GenericInlineModelAdmin(InlineModelAdmin): + template: str + +class GenericStackedInline(GenericInlineModelAdmin): ... +class GenericTabularInline(GenericInlineModelAdmin): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/apps.pyi new file mode 100644 index 000000000000..cff43d9effc5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/apps.pyi @@ -0,0 +1,3 @@ +from django.apps import AppConfig + +class ContentTypesConfig(AppConfig): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/checks.pyi new file mode 100644 index 000000000000..1a4e38012904 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/checks.pyi @@ -0,0 +1,12 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import CheckMessage + +def check_generic_foreign_keys( + app_configs: Sequence[AppConfig] | None = None, **kwargs: Any +) -> Sequence[CheckMessage]: ... +def check_model_name_lengths( + app_configs: Sequence[AppConfig] | None = None, **kwargs: Any +) -> Sequence[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/fields.pyi new file mode 100644 index 000000000000..27661d6f7f6c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/fields.pyi @@ -0,0 +1,96 @@ +from collections.abc import Callable +from typing import Any + +from django.contrib.contenttypes.models import ContentType +from django.core.checks.messages import CheckMessage +from django.db.models.base import Model +from django.db.models.expressions import Combinable +from django.db.models.fields import Field +from django.db.models.fields.mixins import FieldCacheMixin +from django.db.models.fields.related import ForeignObject +from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor +from django.db.models.fields.reverse_related import ForeignObjectRel +from django.db.models.query import QuerySet +from django.db.models.query_utils import FilteredRelation, PathInfo +from django.db.models.sql.where import WhereNode + +class GenericForeignKey(FieldCacheMixin): + # django-stubs implementation only fields + _pyi_private_set_type: Any | Combinable + _pyi_private_get_type: Any + # attributes + auto_created: bool + concrete: bool + editable: bool + hidden: bool + is_relation: bool + many_to_many: bool + many_to_one: bool + one_to_many: bool + one_to_one: bool + related_model: Any + remote_field: Any + ct_field: str + fk_field: str + for_concrete_model: bool + rel: None + column: None + def __init__(self, ct_field: str = ..., fk_field: str = ..., for_concrete_model: bool = ...) -> None: ... + name: Any + model: Any + def contribute_to_class(self, cls: type[Model], name: str, **kwargs: Any) -> None: ... + def get_filter_kwargs_for_object(self, obj: Model) -> dict[str, ContentType | None]: ... + def get_forward_related_filter(self, obj: Model) -> dict[str, int]: ... + def check(self, **kwargs: Any) -> list[CheckMessage]: ... + def get_content_type( + self, obj: Model | None = ..., id: int | None = ..., using: str | None = ..., model: type[Model] | None = ... + ) -> ContentType: ... + def get_prefetch_queryset( + self, instances: list[Model] | QuerySet, queryset: QuerySet | None = ... + ) -> tuple[list[Model], Callable, Callable, bool, str, bool]: ... + def get_prefetch_querysets( + self, instances: list[Model] | QuerySet, querysets: list[QuerySet] | None = ... + ) -> tuple[list[Model], Callable, Callable, bool, str, bool]: ... + def __get__(self, instance: Model | None, cls: type[Model] | None = ...) -> Any | None: ... + def __set__(self, instance: Model, value: Any | None) -> None: ... + +class GenericRel(ForeignObjectRel): + field: GenericRelation + def __init__( + self, + field: GenericRelation, + to: type[Model] | str, + related_name: str | None = ..., + related_query_name: str | None = ..., + limit_choices_to: dict[str, Any] | Callable[[], Any] | None = ..., + ) -> None: ... + +class GenericRelation(ForeignObject[Any, Any]): + rel_class: Any + mti_inherited: bool + object_id_field_name: str + content_type_field_name: str + for_concrete_model: bool + to_fields: Any + def __init__( + self, + to: type[Model] | str, + object_id_field: str = ..., + content_type_field: str = ..., + for_concrete_model: bool = ..., + related_query_name: str | None = ..., + limit_choices_to: dict[str, Any] | Callable[[], Any] | None = ..., + **kwargs: Any, + ) -> None: ... + def resolve_related_fields(self) -> list[tuple[Field, Field]]: ... + def get_path_info(self, filtered_relation: FilteredRelation | None = ...) -> list[PathInfo]: ... + def get_reverse_path_info(self, filtered_relation: FilteredRelation | None = ...) -> list[PathInfo]: ... + def get_content_type(self) -> ContentType: ... + def get_extra_restriction( + self, where_class: type[WhereNode], alias: str | None, remote_alias: str + ) -> WhereNode: ... + def bulk_related_objects(self, objs: list[Model], using: str = ...) -> QuerySet: ... + +class ReverseGenericManyToOneDescriptor(ReverseManyToOneDescriptor): ... + +def create_generic_related_manager(superclass: Any, rel: Any) -> type[Any]: ... # GenericRelatedObjectManager diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/forms.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/forms.pyi new file mode 100644 index 000000000000..8943940b4dff --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/forms.pyi @@ -0,0 +1,47 @@ +from typing import Any, TypeVar + +from django.db.models import Model +from django.forms.models import BaseModelFormSet, ModelForm + +_M = TypeVar("_M", bound=Model) +_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm) + +class BaseGenericInlineFormSet(BaseModelFormSet[_M, _ModelFormT]): + instance: Any + rel_name: Any + save_as_new: Any + def __init__( + self, + data: Any | None = ..., + files: Any | None = ..., + instance: Any | None = ..., + save_as_new: bool = ..., + prefix: Any | None = ..., + queryset: Any | None = ..., + **kwargs: Any, + ) -> None: ... + def initial_form_count(self) -> int: ... + @classmethod + def get_default_prefix(cls) -> str: ... + def save_new(self, form: Any, commit: bool = ...) -> _M: ... + +def generic_inlineformset_factory( + model: type[_M], + form: type[_ModelFormT] = ..., + formset: Any = ..., + ct_field: str = ..., + fk_field: str = ..., + fields: Any | None = ..., + exclude: Any | None = ..., + extra: int = ..., + can_order: bool = ..., + can_delete: bool = ..., + max_num: Any | None = ..., + formfield_callback: Any | None = ..., + validate_max: bool = ..., + for_concrete_model: bool = ..., + min_num: Any | None = ..., + validate_min: bool = ..., + absolute_max: int | None = ..., + can_delete_extra: bool = ..., +) -> type[BaseGenericInlineFormSet[_M, _ModelFormT]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/__init__.pyi new file mode 100644 index 000000000000..9e5a7c928c12 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/__init__.pyi @@ -0,0 +1,33 @@ +from typing import Any + +from django.apps.config import AppConfig +from django.apps.registry import Apps +from django.contrib.contenttypes.models import ContentType +from django.db import migrations +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.migrations.migration import Migration +from django.db.migrations.state import StateApps +from django.db.models.base import Model + +class RenameContentType(migrations.RunPython): + app_label: str + old_model: str + new_model: str + def __init__(self, app_label: str, old_model: str, new_model: str) -> None: ... + def rename_forward(self, apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: ... + def rename_backward(self, apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: ... + +def inject_rename_contenttypes_operations( + plan: list[tuple[Migration, bool]] | None = None, apps: StateApps = ..., using: str = "default", **kwargs: Any +) -> None: ... +def get_contenttypes_and_models( + app_config: AppConfig, using: str, ContentType: type[ContentType] +) -> tuple[dict[str, ContentType], dict[str, type[Model]]]: ... +def create_contenttypes( + app_config: AppConfig, + verbosity: int = 2, + interactive: bool = True, + using: str = "default", + apps: Apps = ..., + **kwargs: Any, +) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi new file mode 100644 index 000000000000..4e0641634c0c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/management/commands/remove_stale_contenttypes.pyi @@ -0,0 +1,11 @@ +from typing import Any, Literal + +from _typeshed import Unused +from django.core.management import BaseCommand +from django.db.models.deletion import Collector + +class Command(BaseCommand): + def handle(self, **options: Any) -> None: ... + +class NoFastDeleteCollector(Collector): + def can_fast_delete(self, *args: Unused, **kwargs: Unused) -> Literal[False]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/migrations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/migrations/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/models.pyi new file mode 100644 index 000000000000..e7206aed0a3a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/models.pyi @@ -0,0 +1,24 @@ +from typing import Any, ClassVar + +from django.db import models +from django.db.models.base import Model +from django.db.models.query import QuerySet + +class ContentTypeManager(models.Manager[ContentType]): + def get_by_natural_key(self, app_label: str, model: str) -> ContentType: ... + def get_for_model(self, model: type[Model] | Model, for_concrete_model: bool = ...) -> ContentType: ... + def get_for_models(self, *models: Any, for_concrete_models: bool = ...) -> dict[type[Model], ContentType]: ... + def get_for_id(self, id: int) -> ContentType: ... + def clear_cache(self) -> None: ... + +class ContentType(models.Model): + id: int + app_label: models.CharField + model: models.CharField + objects: ClassVar[ContentTypeManager] + @property + def name(self) -> str: ... + def model_class(self) -> type[Model] | None: ... + def get_object_for_this_type(self, **kwargs: Any) -> Model: ... + def get_all_objects_for_this_type(self, **kwargs: Any) -> QuerySet: ... + def natural_key(self) -> tuple[str, str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/prefetch.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/prefetch.pyi new file mode 100644 index 000000000000..a444150acee1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/prefetch.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.db.models import Prefetch +from django.db.models.query import QuerySet + +class GenericPrefetch(Prefetch): + def __init__(self, lookup: str, querysets: list[QuerySet], to_attr: str | None = None) -> None: ... + def __getstate__(self) -> dict[str, Any]: ... + def get_current_querysets(self, level: int) -> list[QuerySet] | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/views.pyi new file mode 100644 index 000000000000..0897864fe67a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/contenttypes/views.pyi @@ -0,0 +1,4 @@ +from django.http.request import HttpRequest +from django.http.response import HttpResponseRedirect + +def shortcut(request: HttpRequest, content_type_id: int | str, object_id: int | str) -> HttpResponseRedirect: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/admin.pyi new file mode 100644 index 000000000000..2df0631f63e4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/admin.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from django.contrib import admin +from django.contrib.flatpages.models import FlatPage + +class FlatPageAdmin(admin.ModelAdmin[FlatPage]): + form: Any + fieldsets: Any + list_display: Any + list_filter: Any + search_fields: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/apps.pyi new file mode 100644 index 000000000000..4cd1a037bd90 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/apps.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.apps import AppConfig + +class FlatPagesConfig(AppConfig): + name: str + verbose_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/forms.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/forms.pyi new file mode 100644 index 000000000000..a33fa2309775 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/forms.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django import forms + +class FlatpageForm(forms.ModelForm): + url: Any + def clean_url(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/middleware.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/middleware.pyi new file mode 100644 index 000000000000..79938e1376f2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/middleware.pyi @@ -0,0 +1,6 @@ +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.utils.deprecation import MiddlewareMixin + +class FlatpageFallbackMiddleware(MiddlewareMixin): + def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/migrations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/migrations/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/models.pyi new file mode 100644 index 000000000000..4b578fe03540 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/models.pyi @@ -0,0 +1,12 @@ +from django.contrib.sites.models import Site +from django.db import models + +class FlatPage(models.Model): + url: models.CharField + title: models.CharField + content: models.TextField + enable_comments: models.BooleanField + template_name: models.CharField + registration_required: models.BooleanField + sites: models.ManyToManyField[Site, Site] + def get_absolute_url(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/sitemaps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/sitemaps.pyi new file mode 100644 index 000000000000..e67408371817 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/sitemaps.pyi @@ -0,0 +1,3 @@ +from django.contrib.sitemaps import Sitemap + +class FlatPageSitemap(Sitemap): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/templatetags/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/templatetags/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/templatetags/flatpages.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/templatetags/flatpages.pyi new file mode 100644 index 000000000000..32b45b0ef4aa --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/templatetags/flatpages.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from django import template +from django.template.base import Parser, Token +from django.template.context import Context + +register: Any + +class FlatpageNode(template.Node): + context_name: str + starts_with: None + user: None + def __init__(self, context_name: str, starts_with: str | None = ..., user: str | None = ...) -> None: ... + def render(self, context: Context) -> str: ... + +def get_flatpages(parser: Parser, token: Token) -> FlatpageNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/urls.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/urls.pyi new file mode 100644 index 000000000000..df4275ee2b00 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/urls.pyi @@ -0,0 +1,3 @@ +from django.urls import _AnyURL + +urlpatterns: list[_AnyURL] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/views.pyi new file mode 100644 index 000000000000..bd63e39b4cb8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/flatpages/views.pyi @@ -0,0 +1,8 @@ +from django.contrib.flatpages.models import FlatPage +from django.http.request import HttpRequest +from django.http.response import HttpResponse + +DEFAULT_TEMPLATE: str + +def flatpage(request: HttpRequest, url: str) -> HttpResponse: ... +def render_flatpage(request: HttpRequest, f: FlatPage) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/admin/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/admin/__init__.pyi new file mode 100644 index 000000000000..d9e2dfceedaf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/admin/__init__.pyi @@ -0,0 +1,11 @@ +from django.contrib.admin import HORIZONTAL as HORIZONTAL +from django.contrib.admin import VERTICAL as VERTICAL +from django.contrib.admin import AdminSite as AdminSite +from django.contrib.admin import ModelAdmin as ModelAdmin +from django.contrib.admin import StackedInline as StackedInline +from django.contrib.admin import TabularInline as TabularInline +from django.contrib.admin import action as action +from django.contrib.admin import autodiscover as autodiscover +from django.contrib.admin import register as register +from django.contrib.admin import site as site +from django.contrib.gis.admin.options import GISModelAdmin as GISModelAdmin diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/admin/options.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/admin/options.pyi new file mode 100644 index 000000000000..233aa93ff2e1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/admin/options.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.contrib.admin import ModelAdmin +from django.contrib.gis.forms import BaseGeometryWidget + +class GISModelAdmin(ModelAdmin): + gis_widget: BaseGeometryWidget + gis_widget_kwargs: dict[str, Any] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/apps.pyi new file mode 100644 index 000000000000..ffef1b725bf4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/apps.pyi @@ -0,0 +1,3 @@ +from django.apps import AppConfig + +class GISConfig(AppConfig): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/adapter.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/adapter.pyi new file mode 100644 index 000000000000..0f6cffc29790 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/adapter.pyi @@ -0,0 +1,8 @@ +from typing import Any + +class WKTAdapter: + wkt: Any + srid: Any + def __init__(self, geom: Any) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/features.pyi new file mode 100644 index 000000000000..d51f9488c60f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/features.pyi @@ -0,0 +1,44 @@ +from typing import Any + +class BaseSpatialFeatures: + gis_enabled: bool + has_spatialrefsys_table: bool + supports_add_srs_entry: bool + supports_geometry_field_introspection: bool + supports_3d_storage: bool + supports_3d_functions: bool + supports_transform: bool + supports_null_geometries: bool + supports_empty_geometries: bool + supports_distance_geodetic: bool + supports_length_geodetic: bool + supports_perimeter_geodetic: bool + supports_area_geodetic: bool + supports_num_points_poly: bool + supports_left_right_lookups: bool + supports_dwithin_distance_expr: bool + supports_raster: bool + supports_geometry_field_unique_index: bool + @property + def supports_bbcontains_lookup(self) -> bool: ... + @property + def supports_contained_lookup(self) -> bool: ... + @property + def supports_crosses_lookup(self) -> bool: ... + @property + def supports_distances_lookups(self) -> bool: ... + @property + def supports_dwithin_lookup(self) -> bool: ... + @property + def supports_relate_lookup(self) -> bool: ... + @property + def supports_isvalid_lookup(self) -> bool: ... + @property + def supports_collect_aggr(self) -> bool: ... + @property + def supports_extent_aggr(self) -> bool: ... + @property + def supports_make_line_aggr(self) -> bool: ... + @property + def supports_union_aggr(self) -> bool: ... + def __getattr__(self, name: Any) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/models.pyi new file mode 100644 index 000000000000..40eccde1ce73 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/models.pyi @@ -0,0 +1,33 @@ +from typing import Any + +class SpatialRefSysMixin: + @property + def srs(self) -> Any: ... + @property + def ellipsoid(self) -> Any: ... + @property + def name(self) -> Any: ... + @property + def spheroid(self) -> Any: ... + @property + def datum(self) -> Any: ... + @property + def projected(self) -> Any: ... + @property + def local(self) -> Any: ... + @property + def geographic(self) -> Any: ... + @property + def linear_name(self) -> Any: ... + @property + def linear_units(self) -> Any: ... + @property + def angular_name(self) -> Any: ... + @property + def angular_units(self) -> Any: ... + @property + def units(self) -> Any: ... + @classmethod + def get_units(cls, wkt: Any) -> Any: ... + @classmethod + def get_spheroid(cls, wkt: Any, string: bool = ...) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/operations.pyi new file mode 100644 index 000000000000..bf6aa10d35d0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/base/operations.pyi @@ -0,0 +1,36 @@ +from typing import Any + +from django.utils.functional import cached_property + +class BaseSpatialOperations: + postgis: bool + spatialite: bool + mysql: bool + oracle: bool + spatial_version: Any + select: str + @cached_property + def select_extent(self) -> str: ... + geography: bool + geometry: bool + disallowed_aggregates: Any + geom_func_prefix: str + function_names: Any + unsupported_functions: set[str] + from_text: bool + def convert_extent(self, box: Any, srid: Any) -> Any: ... + def convert_extent3d(self, box: Any, srid: Any) -> Any: ... + def geo_quote_name(self, name: Any) -> Any: ... + def geo_db_type(self, f: Any) -> Any: ... + def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ... + def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... + def check_expression_support(self, expression: Any) -> None: ... + def spatial_aggregate_name(self, agg_name: Any) -> Any: ... + def spatial_function_name(self, func_name: Any) -> Any: ... + def geometry_columns(self) -> Any: ... + def spatial_ref_sys(self) -> Any: ... + distance_expr_for_lookup: Any + def get_db_converters(self, expression: Any) -> Any: ... + def get_geometry_converter(self, expression: Any) -> Any: ... + def get_area_att_for_field(self, field: Any) -> Any: ... + def get_distance_att_for_field(self, field: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/base.pyi new file mode 100644 index 000000000000..a33fce3299ac --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/base.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper + +class DatabaseWrapper(MySQLDatabaseWrapper): + SchemaEditorClass: Any + features_class: Any + introspection_class: Any + ops_class: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/features.pyi new file mode 100644 index 000000000000..f430f6a8e196 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/features.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures +from django.db.backends.mysql.features import DatabaseFeatures as MySQLDatabaseFeatures +from django.utils.functional import cached_property + +class DatabaseFeatures(BaseSpatialFeatures, MySQLDatabaseFeatures): + has_spatialrefsys_table: bool + supports_add_srs_entry: bool + supports_distance_geodetic: bool + supports_length_geodetic: bool + supports_area_geodetic: bool + supports_transform: bool + supports_null_geometries: bool + supports_num_points_poly: bool + @property + def empty_intersection_returns_none(self) -> bool: ... + @cached_property + def supports_geometry_field_unique_index(self) -> bool: ... # type: ignore[override] + @cached_property + def django_test_skips(self) -> dict[str, Any]: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi new file mode 100644 index 000000000000..4f7c44c64ced --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/introspection.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.db.backends.mysql.introspection import DatabaseIntrospection + +class MySQLIntrospection(DatabaseIntrospection): + data_types_reverse: Any + def get_geometry_type(self, table_name: Any, description: Any) -> Any: ... + def supports_spatial_index(self, cursor: Any, table_name: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/operations.pyi new file mode 100644 index 000000000000..4e8c8fda62b0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/operations.pyi @@ -0,0 +1,29 @@ +from collections.abc import Callable +from typing import Any + +from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations +from django.contrib.gis.db.backends.utils import SpatialOperator +from django.contrib.gis.geos.geometry import GEOSGeometryBase +from django.db.backends.mysql.operations import DatabaseOperations +from django.utils.functional import cached_property + +class MySQLOperations(BaseSpatialOperations, DatabaseOperations): + name: str + geom_func_prefix: str + Adapter: Any + @cached_property + def mariadb(self) -> bool: ... + @cached_property + def mysql(self) -> bool: ... # type: ignore[override] + @cached_property + def select(self) -> str: ... # type: ignore[override] + @cached_property + def from_text(self) -> str: ... # type: ignore[override] + @cached_property + def gis_operators(self) -> dict[str, SpatialOperator]: ... + disallowed_aggregates: Any + @cached_property + def unsupported_functions(self) -> set[str]: ... # type: ignore[override] + def geo_db_type(self, f: Any) -> Any: ... + def get_distance(self, f: Any, value: Any, lookup_type: Any) -> list[Any]: ... + def get_geometry_converter(self, expression: Any) -> Callable[[Any, Any, Any], GEOSGeometryBase | None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/schema.pyi new file mode 100644 index 000000000000..c93f1286a8da --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/mysql/schema.pyi @@ -0,0 +1,22 @@ +from logging import Logger +from typing import Any + +from django.db.backends.mysql.schema import DatabaseSchemaEditor +from django.db.models.base import Model +from django.db.models.fields import Field + +logger: Logger + +class MySQLGISSchemaEditor(DatabaseSchemaEditor): + sql_add_spatial_index: str + sql_drop_spatial_index: str + geometry_sql: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def skip_default(self, field: Field) -> bool: ... + def column_sql( + self, model: type[Model], field: Field, include_default: bool = ... + ) -> tuple[None, None] | tuple[str, list[Any]]: ... + def create_model(self, model: type[Model]) -> None: ... + def add_field(self, model: type[Model], field: Field) -> None: ... + def remove_field(self, model: type[Model], field: Field) -> None: ... + def create_spatial_indexes(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi new file mode 100644 index 000000000000..1a0c905ae2b7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/adapter.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.contrib.gis.db.backends.base.adapter import WKTAdapter + +class OracleSpatialAdapter(WKTAdapter): + input_size: Any + wkt: Any + srid: Any + def __init__(self, geom: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/base.pyi new file mode 100644 index 000000000000..80e58f618604 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/base.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.db.backends.oracle.base import DatabaseWrapper as OracleDatabaseWrapper + +class DatabaseWrapper(OracleDatabaseWrapper): + SchemaEditorClass: Any + features_class: Any + introspection_class: Any + ops_class: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/features.pyi new file mode 100644 index 000000000000..9785b6e1b9d7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/features.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures +from django.db.backends.oracle.features import DatabaseFeatures as OracleDatabaseFeatures +from django.utils.functional import cached_property + +class DatabaseFeatures(BaseSpatialFeatures, OracleDatabaseFeatures): + supports_add_srs_entry: bool + supports_geometry_field_introspection: bool + supports_geometry_field_unique_index: bool + supports_perimeter_geodetic: bool + supports_dwithin_distance_expr: bool + @cached_property + def django_test_skips(self) -> dict[str, Any]: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi new file mode 100644 index 000000000000..5235c35255d0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/introspection.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.db.backends.oracle.introspection import DatabaseIntrospection + +class OracleIntrospection(DatabaseIntrospection): + @property + def data_types_reverse(self) -> Any: ... + def get_geometry_type(self, table_name: Any, description: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/models.pyi new file mode 100644 index 000000000000..7b002731bd93 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/models.pyi @@ -0,0 +1,29 @@ +from typing import Any, ClassVar + +from django.contrib.gis.db import models +from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin +from django.db.models.manager import Manager +from typing_extensions import Self + +class OracleGeometryColumns(models.Model): + table_name: Any + column_name: Any + srid: Any + objects: ClassVar[Manager[Self]] + + @classmethod + def table_name_col(cls) -> Any: ... + @classmethod + def geom_col_name(cls) -> Any: ... + +class OracleSpatialRefSys(models.Model, SpatialRefSysMixin): + cs_name: Any + srid: Any + auth_srid: Any + auth_name: Any + wktext: Any + cs_bounds: Any + objects: ClassVar[Manager[Self]] + + @property + def wkt(self) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/operations.pyi new file mode 100644 index 000000000000..a1254ed7b4cc --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/operations.pyi @@ -0,0 +1,42 @@ +from typing import Any + +from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations +from django.contrib.gis.db.backends.utils import SpatialOperator +from django.db.backends.oracle.operations import DatabaseOperations + +DEFAULT_TOLERANCE: str + +class SDOOperator(SpatialOperator): + sql_template: str + +class SDODWithin(SpatialOperator): + sql_template: str + +class SDODisjoint(SpatialOperator): + sql_template: Any + +class SDORelate(SpatialOperator): + sql_template: str + def check_relate_argument(self, arg: Any) -> None: ... + +class OracleOperations(BaseSpatialOperations, DatabaseOperations): + name: str + oracle: bool + disallowed_aggregates: Any + Adapter: Any + extent: str + unionagg: str + function_names: Any + select: str + gis_operators: Any + unsupported_functions: Any + def geo_quote_name(self, name: Any) -> Any: ... + def geo_db_type(self, f: Any) -> Any: ... + def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ... + def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... + def spatial_aggregate_name(self, agg_name: Any) -> Any: ... + def geometry_columns(self) -> Any: ... + def spatial_ref_sys(self) -> Any: ... + def modify_insert_params(self, placeholder: Any, params: Any) -> Any: ... + def get_geometry_converter(self, expression: Any) -> Any: ... + def get_area_att_for_field(self, field: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/schema.pyi new file mode 100644 index 000000000000..76a89677feb4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/oracle/schema.pyi @@ -0,0 +1,23 @@ +from typing import Any + +from django.db.backends.oracle.schema import DatabaseSchemaEditor +from django.db.models.base import Model +from django.db.models.fields import Field + +class OracleGISSchemaEditor(DatabaseSchemaEditor): + sql_add_geometry_metadata: str + sql_add_spatial_index: str + sql_drop_spatial_index: str + sql_clear_geometry_table_metadata: str + sql_clear_geometry_field_metadata: str + geometry_sql: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def geo_quote_name(self, name: Any) -> Any: ... + def column_sql( + self, model: type[Model], field: Field, include_default: bool = ... + ) -> tuple[None, None] | tuple[str, list[Any]]: ... + def create_model(self, model: type[Model]) -> None: ... + def delete_model(self, model: type[Model]) -> None: ... + def add_field(self, model: type[Model], field: Field) -> None: ... + def remove_field(self, model: type[Model], field: Field) -> None: ... + def run_geometry_sql(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi new file mode 100644 index 000000000000..32cc806a1c83 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi @@ -0,0 +1,13 @@ +from typing import Any + +class PostGISAdapter: + is_geometry: Any + ewkb: Any + srid: Any + geography: Any + def __init__(self, obj: Any, geography: bool = ...) -> None: ... + def __conform__(self, proto: Any) -> Any: ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... + def prepare(self, conn: Any) -> None: ... + def getquoted(self) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/base.pyi new file mode 100644 index 000000000000..3456b4547a07 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/base.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from django.db.backends.postgresql.base import DatabaseWrapper as Psycopg2DatabaseWrapper + +class DatabaseWrapper(Psycopg2DatabaseWrapper): + SchemaEditorClass: Any + features: Any + ops: Any + introspection: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def prepare_database(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/const.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/const.pyi new file mode 100644 index 000000000000..0d8bfe72c753 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/const.pyi @@ -0,0 +1,9 @@ +from typing import Any + +GDAL_TO_POSTGIS: Any +POSTGIS_TO_GDAL: Any +POSTGIS_HEADER_STRUCTURE: str +GDAL_TO_STRUCT: Any +STRUCT_SIZE: Any +BANDTYPE_PIXTYPE_MASK: int +BANDTYPE_FLAG_HASNODATA: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/features.pyi new file mode 100644 index 000000000000..61595a0ac415 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/features.pyi @@ -0,0 +1,9 @@ +from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures +from django.db.backends.postgresql.features import DatabaseFeatures as Psycopg2DatabaseFeatures + +class DatabaseFeatures(BaseSpatialFeatures, Psycopg2DatabaseFeatures): + supports_3d_storage: bool + supports_3d_functions: bool + supports_left_right_lookups: bool + supports_raster: bool + supports_empty_geometries: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi new file mode 100644 index 000000000000..f957a2f64ce9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/introspection.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.db.backends.postgresql.introspection import DatabaseIntrospection + +class PostGISIntrospection(DatabaseIntrospection): + postgis_oid_lookup: Any + ignored_tables: Any + def get_field_type(self, data_type: Any, description: Any) -> Any: ... + def get_geometry_type(self, table_name: Any, description: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/models.pyi new file mode 100644 index 000000000000..4bd4da16ff02 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/models.pyi @@ -0,0 +1,31 @@ +from typing import Any, ClassVar + +from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin +from django.db import models +from typing_extensions import Self + +class PostGISGeometryColumns(models.Model): + f_table_catalog: Any + f_table_schema: Any + f_table_name: Any + f_geometry_column: Any + coord_dimension: Any + srid: Any + type: Any + objects: ClassVar[models.Manager[Self]] + + @classmethod + def table_name_col(cls) -> Any: ... + @classmethod + def geom_col_name(cls) -> Any: ... + +class PostGISSpatialRefSys(models.Model, SpatialRefSysMixin): + srid: Any + auth_name: Any + auth_srid: Any + srtext: Any + proj4text: Any + objects: ClassVar[models.Manager[Self]] + + @property + def wkt(self) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/operations.pyi new file mode 100644 index 000000000000..0f2c95b776ba --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/operations.pyi @@ -0,0 +1,67 @@ +from typing import Any, Literal, MutableMapping + +from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations +from django.contrib.gis.db.backends.utils import SpatialOperator +from django.contrib.gis.db.models.fields import GeometryField +from django.contrib.gis.db.models.lookups import GISLookup +from django.db.backends.postgresql.operations import DatabaseOperations +from django.db.models import Func +from django.utils.functional import cached_property + +BILATERAL: Literal["bilateral"] + +class PostGISOperator(SpatialOperator): + geography: Any + raster: bool | Literal["bilateral"] + def __init__(self, geography: bool = ..., raster: bool | Literal["bilateral"] = ..., **kwargs: Any) -> None: ... + def check_raster(self, lookup: Any, template_params: Any) -> Any: ... + def check_geography( + self, + lookup: GISLookup, + template_params: MutableMapping[str, Any], + ) -> MutableMapping[str, Any]: ... + +class ST_Polygon(Func): + function: str + def __init__(self, expr: Any) -> None: ... + @cached_property + def output_field(self) -> GeometryField: ... + +class PostGISOperations(BaseSpatialOperations, DatabaseOperations): + name: str + postgis: bool + geography: bool + geom_func_prefix: str + Adapter: Any + collect: Any + extent: Any + extent3d: Any + length3d: Any + makeline: Any + perimeter3d: Any + unionagg: Any + gis_operators: Any + unsupported_functions: Any + select: str + select_extent: Any + @property + def function_names(self) -> Any: ... + @property + def spatial_version(self) -> Any: ... + def geo_db_type(self, f: Any) -> Any: ... + def get_distance(self, f: Any, dist_val: Any, lookup_type: Any) -> Any: ... + def get_geom_placeholder(self, f: Any, value: Any, compiler: Any) -> Any: ... + def postgis_geos_version(self) -> Any: ... + def postgis_lib_version(self) -> Any: ... + def postgis_proj_version(self) -> Any: ... + def postgis_version(self) -> Any: ... + def postgis_full_version(self) -> Any: ... + def postgis_version_tuple(self) -> Any: ... + def proj_version_tuple(self) -> Any: ... + def spatial_aggregate_name(self, agg_name: Any) -> Any: ... + def geometry_columns(self) -> Any: ... + def spatial_ref_sys(self) -> Any: ... + def parse_raster(self, value: Any) -> Any: ... + def distance_expr_for_lookup(self, lhs: Any, rhs: Any, **kwargs: Any) -> Any: ... + def get_geometry_converter(self, expression: Any) -> Any: ... + def get_area_att_for_field(self, field: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi new file mode 100644 index 000000000000..80d80b4f0c73 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/pgraster.pyi @@ -0,0 +1,7 @@ +from typing import Any + +def pack(structure: Any, data: Any) -> Any: ... +def unpack(structure: Any, data: Any) -> Any: ... +def chunk(data: Any, index: Any) -> Any: ... +def from_pgraster(data: Any) -> Any: ... +def to_pgraster(rast: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/schema.pyi new file mode 100644 index 000000000000..7fc85d73d815 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/postgis/schema.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from django.db.backends.postgresql.schema import DatabaseSchemaEditor + +class PostGISSchemaEditor(DatabaseSchemaEditor): + geom_index_type: str + geom_index_ops_nd: str + rast_index_wrapper: str + sql_alter_column_to_3d: str + sql_alter_column_to_2d: str + def geo_quote_name(self, name: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi new file mode 100644 index 000000000000..348141b2d511 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/adapter.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.contrib.gis.db.backends.base.adapter import WKTAdapter + +class SpatiaLiteAdapter(WKTAdapter): + def __conform__(self, protocol: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/base.pyi new file mode 100644 index 000000000000..f5e1a1a75d3e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/base.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from django.db.backends.sqlite3.base import DatabaseWrapper as SQLiteDatabaseWrapper + +from .client import SpatiaLiteClient +from .features import DatabaseFeatures +from .introspection import SpatiaLiteIntrospection +from .operations import SpatiaLiteOperations +from .schema import SpatialiteSchemaEditor + +class DatabaseWrapper(SQLiteDatabaseWrapper): + SchemaEditorClass: type[SpatialiteSchemaEditor] + client_class: type[SpatiaLiteClient] + features_class: type[DatabaseFeatures] + introspection_class: type[SpatiaLiteIntrospection] + ops_class: type[SpatiaLiteOperations] + lib_spatialite_paths: str + ops: SpatiaLiteOperations + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def get_new_connection(self, conn_params: Any) -> Any: ... + def prepare_database(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/client.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/client.pyi new file mode 100644 index 000000000000..3f53149e0c4d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/client.pyi @@ -0,0 +1,4 @@ +from django.db.backends.sqlite3.client import DatabaseClient + +class SpatiaLiteClient(DatabaseClient): + executable_name: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/features.pyi new file mode 100644 index 000000000000..97a3a1e85b27 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/features.pyi @@ -0,0 +1,8 @@ +from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures +from django.db.backends.sqlite3.features import DatabaseFeatures as SQLiteDatabaseFeatures +from django.utils.functional import cached_property + +class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures): + supports_3d_storage: bool + @cached_property + def supports_area_geodetic(self) -> bool: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi new file mode 100644 index 000000000000..cc7fad24f179 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/introspection.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict + +class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict): + base_data_types_reverse: Any + +class SpatiaLiteIntrospection(DatabaseIntrospection): + data_types_reverse: Any + def get_geometry_type(self, table_name: Any, description: Any) -> Any: ... + def get_constraints(self, cursor: Any, table_name: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/models.pyi new file mode 100644 index 000000000000..5585d2e17bd0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/models.pyi @@ -0,0 +1,31 @@ +from typing import Any, ClassVar + +from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin +from django.db import models +from typing_extensions import Self + +class SpatialiteGeometryColumns(models.Model): + f_table_name: Any + f_geometry_column: Any + coord_dimension: Any + srid: Any + spatial_index_enabled: Any + type: Any + objects: ClassVar[models.Manager[Self]] + + @classmethod + def table_name_col(cls) -> Any: ... + @classmethod + def geom_col_name(cls) -> Any: ... + +class SpatialiteSpatialRefSys(models.Model, SpatialRefSysMixin): + srid: Any + auth_name: Any + auth_srid: Any + ref_sys_name: Any + proj4text: Any + srtext: Any + objects: ClassVar[models.Manager[Self]] + + @property + def wkt(self) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi new file mode 100644 index 000000000000..28e1512255cb --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/operations.pyi @@ -0,0 +1,36 @@ +from typing import Any + +from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations +from django.contrib.gis.db.backends.utils import SpatialOperator +from django.db.backends.sqlite3.operations import DatabaseOperations +from django.utils.functional import cached_property + +class SpatialiteNullCheckOperator(SpatialOperator): ... + +class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): + name: str + spatialite: bool + Adapter: Any + collect: str + extent: str + makeline: str + unionagg: str + gis_operators: Any + disallowed_aggregates: Any + select: str + function_names: Any + @cached_property + def unsupported_functions(self) -> set[str]: ... # type: ignore[override] + @property + def spatial_version(self) -> Any: ... + def geo_db_type(self, f: Any) -> None: ... + def get_distance(self, f: Any, value: Any, lookup_type: Any) -> Any: ... + def geos_version(self) -> Any: ... + def proj_version(self) -> Any: ... + def lwgeom_version(self) -> Any: ... + def spatialite_version(self) -> Any: ... + def spatialite_version_tuple(self) -> Any: ... + def spatial_aggregate_name(self, agg_name: Any) -> Any: ... + def geometry_columns(self) -> Any: ... + def spatial_ref_sys(self) -> Any: ... + def get_geometry_converter(self, expression: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi new file mode 100644 index 000000000000..4a3416b73343 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/spatialite/schema.pyi @@ -0,0 +1,32 @@ +from typing import Any + +from django.db.backends.sqlite3.schema import DatabaseSchemaEditor +from django.db.models.base import Model +from django.db.models.fields import Field + +class SpatialiteSchemaEditor(DatabaseSchemaEditor): + sql_add_geometry_column: str + sql_add_spatial_index: str + sql_drop_spatial_index: str + sql_recover_geometry_metadata: str + sql_remove_geometry_metadata: str + sql_discard_geometry_columns: str + sql_update_geometry_columns: str + geometry_tables: Any + geometry_sql: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def geo_quote_name(self, name: Any) -> Any: ... + def column_sql( + self, model: type[Model], field: Field, include_default: bool = False + ) -> tuple[None, None] | tuple[str, list[Any]]: ... + def remove_geometry_metadata(self, model: type[Model], field: Field) -> None: ... + def create_model(self, model: type[Model]) -> None: ... + def delete_model(self, model: type[Model], **kwargs: Any) -> None: ... + def add_field(self, model: type[Model], field: Field) -> None: ... + def remove_field(self, model: type[Model], field: Field) -> None: ... + def alter_db_table( + self, + model: type[Model], + old_db_table: str, + new_db_table: str, + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/utils.pyi new file mode 100644 index 000000000000..1632d5bab416 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/backends/utils.pyi @@ -0,0 +1,21 @@ +from collections.abc import Sequence +from typing import Any, MutableMapping + +from django.contrib.gis.db.models.lookups import GISLookup +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.sql.compiler import _AsSqlType + +class SpatialOperator: + sql_template: Any + op: Any + func: Any + def __init__(self, op: Any | None = None, func: Any | None = None) -> None: ... + @property + def default_template(self) -> Any: ... + def as_sql( + self, + connection: BaseDatabaseWrapper, + lookup: GISLookup, + template_params: MutableMapping[str, Any], + sql_params: Sequence[Any], + ) -> _AsSqlType: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/__init__.pyi new file mode 100644 index 000000000000..bc6770aaea59 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/__init__.pyi @@ -0,0 +1,11 @@ +from django.contrib.gis.db.models.aggregates import * +from django.contrib.gis.db.models.fields import GeometryCollectionField as GeometryCollectionField +from django.contrib.gis.db.models.fields import GeometryField as GeometryField +from django.contrib.gis.db.models.fields import LineStringField as LineStringField +from django.contrib.gis.db.models.fields import MultiLineStringField as MultiLineStringField +from django.contrib.gis.db.models.fields import MultiPointField as MultiPointField +from django.contrib.gis.db.models.fields import MultiPolygonField as MultiPolygonField +from django.contrib.gis.db.models.fields import PointField as PointField +from django.contrib.gis.db.models.fields import PolygonField as PolygonField +from django.contrib.gis.db.models.fields import RasterField as RasterField +from django.db.models import * diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/aggregates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/aggregates.pyi new file mode 100644 index 000000000000..88497cfc684e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/aggregates.pyi @@ -0,0 +1,29 @@ +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Aggregate +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType + +class GeoAggregate(Aggregate): + is_extent: bool + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Collect(GeoAggregate): + name: str + output_field_class: Any + +class Extent(GeoAggregate): + name: str + def __init__(self, expression: Any, **extra: Any) -> None: ... + +class Extent3D(GeoAggregate): + name: str + def __init__(self, expression: Any, **extra: Any) -> None: ... + +class MakeLine(GeoAggregate): + name: str + output_field_class: Any + +class Union(GeoAggregate): + name: str + output_field_class: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/fields.pyi new file mode 100644 index 000000000000..88bc48e19664 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/fields.pyi @@ -0,0 +1,189 @@ +from collections.abc import Iterable +from typing import Any, NamedTuple, TypeVar + +from django.contrib.gis import forms +from django.contrib.gis.geos import ( + GeometryCollection, + GEOSGeometry, + LineString, + MultiLineString, + MultiPoint, + MultiPolygon, + Point, + Polygon, +) +from django.core.validators import _ValidatorCallable +from django.db.models.expressions import Combinable, Expression +from django.db.models.fields import NOT_PROVIDED, Field, _ErrorMessagesMapping +from django.utils.choices import _Choices +from django.utils.functional import _StrOrPromise + +# __set__ value type +_ST = TypeVar("_ST") +# __get__ return type +_GT = TypeVar("_GT") + +class SRIDCacheEntry(NamedTuple): + units: Any + units_name: str + spheroid: str + geodetic: bool + +def get_srid_info(srid: int, connection: Any) -> SRIDCacheEntry: ... + +class BaseSpatialField(Field[_ST, _GT]): + form_class: type[forms.GeometryField] + geom_type: str + geom_class: type[GEOSGeometry] | None + geography: bool + spatial_index: bool + srid: int + def __init__( + self, + verbose_name: _StrOrPromise | None = ..., + srid: int = ..., + spatial_index: bool = ..., + *, + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + def db_type(self, connection: Any) -> Any: ... + def spheroid(self, connection: Any) -> Any: ... + def units(self, connection: Any) -> Any: ... + def units_name(self, connection: Any) -> Any: ... + def geodetic(self, connection: Any) -> Any: ... + def get_placeholder(self, value: Any, compiler: Any, connection: Any) -> Any: ... + def get_srid(self, obj: Any) -> Any: ... + def get_db_prep_value(self, value: Any, connection: Any, *args: Any, **kwargs: Any) -> Any: ... + def get_raster_prep_value(self, value: Any, is_candidate: Any) -> Any: ... + def get_prep_value(self, value: Any) -> Any: ... + +class GeometryField(BaseSpatialField[_ST, _GT]): + dim: int + def __init__( + self, + verbose_name: _StrOrPromise | None = ..., + dim: int = ..., + geography: bool = ..., + *, + extent: tuple[float, float, float, float] = ..., + tolerance: float = ..., + srid: int = ..., + spatial_index: bool = ..., + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + def formfield( # type: ignore[override] + self, + *, + form_class: type[forms.GeometryField] | None = ..., + geom_type: str = ..., + srid: Any = ..., + **kwargs: Any, + ) -> forms.GeometryField: ... + def select_format(self, compiler: Any, sql: Any, params: Any) -> Any: ... + +class PointField(GeometryField[_ST, _GT]): + _pyi_private_set_type: Point | Combinable + _pyi_private_get_type: Point + _pyi_lookup_exact_type: Point + + geom_class: type[Point] + form_class: type[forms.PointField] + +class LineStringField(GeometryField[_ST, _GT]): + _pyi_private_set_type: LineString | Combinable + _pyi_private_get_type: LineString + _pyi_lookup_exact_type: LineString + + geom_class: type[LineString] + form_class: type[forms.LineStringField] + +class PolygonField(GeometryField[_ST, _GT]): + _pyi_private_set_type: Polygon | Combinable + _pyi_private_get_type: Polygon + _pyi_lookup_exact_type: Polygon + + geom_class: type[Polygon] + form_class: type[forms.PolygonField] + +class MultiPointField(GeometryField[_ST, _GT]): + _pyi_private_set_type: MultiPoint | Combinable + _pyi_private_get_type: MultiPoint + _pyi_lookup_exact_type: MultiPoint + + geom_class: type[MultiPoint] + form_class: type[forms.MultiPointField] + +class MultiLineStringField(GeometryField[_ST, _GT]): + _pyi_private_set_type: MultiLineString | Combinable + _pyi_private_get_type: MultiLineString + _pyi_lookup_exact_type: MultiLineString + + geom_class: type[MultiLineString] + form_class: type[forms.MultiLineStringField] + +class MultiPolygonField(GeometryField[_ST, _GT]): + _pyi_private_set_type: MultiPolygon | Combinable + _pyi_private_get_type: MultiPolygon + _pyi_lookup_exact_type: MultiPolygon + + geom_class: type[MultiPolygon] + form_class: type[forms.MultiPolygonField] + +class GeometryCollectionField(GeometryField[_ST, _GT]): + _pyi_private_set_type: GeometryCollection | Combinable + _pyi_private_get_type: GeometryCollection + _pyi_lookup_exact_type: GeometryCollection + + geom_class: type[GeometryCollection] + form_class: type[forms.GeometryCollectionField] + +class ExtentField(Field): + def get_internal_type(self) -> Any: ... + def select_format(self, compiler: Any, sql: Any, params: Any) -> Any: ... + +class RasterField(BaseSpatialField): + def db_type(self, connection: Any) -> Any: ... + def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def get_transform(self, name: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/functions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/functions.pyi new file mode 100644 index 000000000000..0af6c6913a33 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/functions.pyi @@ -0,0 +1,197 @@ +from typing import Any, ClassVar + +from django.contrib.gis.db.models.fields import GeometryField +from django.contrib.gis.db.models.sql.conversion import AreaField, DistanceField +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import BinaryField, BooleanField, FloatField, Func, IntegerField, TextField +from django.db.models import Transform as StandardTransform +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from django.utils.functional import cached_property + +NUMERIC_TYPES: Any + +class GeoFuncMixin: + geom_param_pos: Any + @property + def geo_field(self) -> Any: ... + +class GeoFunc(GeoFuncMixin, Func): ... + +class GeomOutputGeoFunc(GeoFunc): + @cached_property + def output_field(self) -> GeometryField: ... + +class SQLiteDecimalToFloatMixin: + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class OracleToleranceMixin: + tolerance: float + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Area(OracleToleranceMixin, GeoFunc): + arity: int + @cached_property + def output_field(self) -> AreaField: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Azimuth(GeoFunc): + output_field: ClassVar[FloatField] + arity: int + geom_param_pos: Any + +class AsGeoJSON(GeoFunc): + output_field: ClassVar[TextField] + def __init__( + self, expression: Any, bbox: bool = ..., crs: bool = ..., precision: int = ..., **extra: Any + ) -> None: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class AsGML(GeoFunc): + geom_param_pos: Any + output_field: ClassVar[TextField] + def __init__(self, expression: Any, version: int = ..., precision: int = ..., **extra: Any) -> None: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class AsKML(GeoFunc): + output_field: ClassVar[TextField] + def __init__(self, expression: Any, precision: int = ..., **extra: Any) -> None: ... + +class AsSVG(GeoFunc): + output_field: ClassVar[TextField] + def __init__(self, expression: Any, relative: bool = ..., precision: int = ..., **extra: Any) -> None: ... + +class AsWKB(GeoFunc): + output_field: ClassVar[BinaryField] + arity: int + +class AsWKT(GeoFunc): + output_field: ClassVar[TextField] + arity: int + +class BoundingCircle(OracleToleranceMixin, GeomOutputGeoFunc): + def __init__(self, expression: Any, num_seg: int = ..., **extra: Any) -> None: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Centroid(OracleToleranceMixin, GeomOutputGeoFunc): + arity: int + +class ClosestPoint(GeomOutputGeoFunc): + arity: int + geom_param_pos: tuple[int, int] + +class Difference(OracleToleranceMixin, GeomOutputGeoFunc): + arity: int + geom_param_pos: Any + +class DistanceResultMixin: + @cached_property + def output_field(self) -> DistanceField: ... + def source_is_geography(self) -> Any: ... + +class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc): + geom_param_pos: Any + spheroid: Any + def __init__(self, expr1: Any, expr2: Any, spheroid: Any | None = ..., **extra: Any) -> None: ... + def as_postgresql( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Envelope(GeomOutputGeoFunc): + arity: int + +class ForcePolygonCW(GeomOutputGeoFunc): + arity: int + +class FromWKB(GeoFunc): + output_field: ClassVar[GeometryField] + arity: int + +class FromWKT(GeoFunc): + output_field: ClassVar[GeometryField] + arity: int + +class GeoHash(GeoFunc): + output_field: ClassVar[TextField] + def __init__(self, expression: Any, precision: Any | None = ..., **extra: Any) -> None: ... + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class GeometryDistance(GeoFunc): + output_field: ClassVar[FloatField] + arity: int + function: str + arg_joiner: str + geom_param_pos: Any + +class Intersection(OracleToleranceMixin, GeomOutputGeoFunc): + arity: int + geom_param_pos: Any + +class IsEmpty(GeoFuncMixin, StandardTransform): + lookup_name: str + output_field: ClassVar[BooleanField] + +class IsValid(OracleToleranceMixin, GeoFuncMixin, StandardTransform): + lookup_name: str + output_field: ClassVar[BooleanField] + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Length(DistanceResultMixin, OracleToleranceMixin, GeoFunc): + spheroid: Any + def __init__(self, expr1: Any, spheroid: bool = ..., **extra: Any) -> None: ... + def as_postgresql( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class LineLocatePoint(GeoFunc): + output_field: ClassVar[FloatField] + arity: int + geom_param_pos: Any + +class MakeValid(GeomOutputGeoFunc): ... + +class MemSize(GeoFunc): + output_field: ClassVar[IntegerField] + arity: int + +class NumGeometries(GeoFunc): + output_field: ClassVar[IntegerField] + arity: int + +class NumPoints(GeoFunc): + output_field: ClassVar[IntegerField] + arity: int + +class Perimeter(DistanceResultMixin, OracleToleranceMixin, GeoFunc): + arity: int + def as_postgresql( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class PointOnSurface(OracleToleranceMixin, GeomOutputGeoFunc): + arity: int + +class Reverse(GeoFunc): + arity: int + +class Scale(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): + def __init__(self, expression: Any, x: Any, y: Any, z: float = ..., **extra: Any) -> None: ... + +class SnapToGrid(SQLiteDecimalToFloatMixin, GeomOutputGeoFunc): + def __init__(self, expression: Any, *args: Any, **extra: Any) -> None: ... + +class SymDifference(OracleToleranceMixin, GeomOutputGeoFunc): + arity: int + geom_param_pos: Any + +class Transform(GeomOutputGeoFunc): + def __init__(self, expression: Any, srid: Any, **extra: Any) -> None: ... + +class Translate(Scale): + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Union(OracleToleranceMixin, GeomOutputGeoFunc): + arity: int + geom_param_pos: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/lookups.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/lookups.pyi new file mode 100644 index 000000000000..6929e6e08d10 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/lookups.pyi @@ -0,0 +1,125 @@ +from typing import Any + +from django.db.models import Lookup, Transform + +class RasterBandTransform(Transform): ... + +class GISLookup(Lookup): + sql_template: Any + transform_func: Any + distance: bool + band_rhs: Any + band_lhs: Any + template_params: Any + def __init__(self, lhs: Any, rhs: Any) -> None: ... + def process_rhs_params(self) -> None: ... + def process_band_indices(self, only_lhs: bool = ...) -> None: ... + def get_db_prep_lookup(self, value: Any, connection: Any) -> Any: ... + rhs: Any + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... + def get_rhs_op(self, connection: Any, rhs: Any) -> Any: ... + +class OverlapsLeftLookup(GISLookup): + lookup_name: str + +class OverlapsRightLookup(GISLookup): + lookup_name: str + +class OverlapsBelowLookup(GISLookup): + lookup_name: str + +class OverlapsAboveLookup(GISLookup): + lookup_name: str + +class LeftLookup(GISLookup): + lookup_name: str + +class RightLookup(GISLookup): + lookup_name: str + +class StrictlyBelowLookup(GISLookup): + lookup_name: str + +class StrictlyAboveLookup(GISLookup): + lookup_name: str + +class SameAsLookup(GISLookup): + lookup_name: str + +class BBContainsLookup(GISLookup): + lookup_name: str + +class BBOverlapsLookup(GISLookup): + lookup_name: str + +class ContainedLookup(GISLookup): + lookup_name: str + +class ContainsLookup(GISLookup): + lookup_name: str + +class ContainsProperlyLookup(GISLookup): + lookup_name: str + +class CoveredByLookup(GISLookup): + lookup_name: str + +class CoversLookup(GISLookup): + lookup_name: str + +class CrossesLookup(GISLookup): + lookup_name: str + +class DisjointLookup(GISLookup): + lookup_name: str + +class EqualsLookup(GISLookup): + lookup_name: str + +class IntersectsLookup(GISLookup): + lookup_name: str + +class OverlapsLookup(GISLookup): + lookup_name: str + +class RelateLookup(GISLookup): + lookup_name: str + sql_template: str + pattern_regex: Any + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... + +class TouchesLookup(GISLookup): + lookup_name: str + +class WithinLookup(GISLookup): + lookup_name: str + +class DistanceLookupBase(GISLookup): + distance: bool + sql_template: str + def process_rhs_params(self) -> None: ... + def process_distance(self, compiler: Any, connection: Any) -> Any: ... + +class DWithinLookup(DistanceLookupBase): + lookup_name: str + sql_template: str + def process_distance(self, compiler: Any, connection: Any) -> Any: ... + def process_rhs(self, compiler: Any, connection: Any) -> Any: ... + +class DistanceLookupFromFunction(DistanceLookupBase): ... + +class DistanceGTLookup(DistanceLookupFromFunction): + lookup_name: str + op: str + +class DistanceGTELookup(DistanceLookupFromFunction): + lookup_name: str + op: str + +class DistanceLTLookup(DistanceLookupFromFunction): + lookup_name: str + op: str + +class DistanceLTELookup(DistanceLookupFromFunction): + lookup_name: str + op: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/proxy.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/proxy.pyi new file mode 100644 index 000000000000..50271f9bdb62 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/proxy.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.db.models.query_utils import DeferredAttribute + +class SpatialProxy(DeferredAttribute): + def __init__(self, klass: Any, field: Any, load_func: Any | None = ...) -> None: ... + def __get__(self, instance: Any, cls: Any | None = ...) -> Any: ... + def __set__(self, instance: Any, value: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/__init__.pyi new file mode 100644 index 000000000000..ab0a35c689a3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/__init__.pyi @@ -0,0 +1,2 @@ +from django.contrib.gis.db.models.sql.conversion import AreaField as AreaField +from django.contrib.gis.db.models.sql.conversion import DistanceField as DistanceField diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/conversion.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/conversion.pyi new file mode 100644 index 000000000000..94ac070477e3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/db/models/sql/conversion.pyi @@ -0,0 +1,19 @@ +from typing import Any + +from django.db import models + +class AreaField(models.FloatField): + geo_field: Any + def __init__(self, geo_field: Any) -> None: ... + def get_prep_value(self, value: Any) -> Any: ... + def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...) -> Any: ... + def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def get_internal_type(self) -> Any: ... + +class DistanceField(models.FloatField): + geo_field: Any + def __init__(self, geo_field: Any) -> None: ... + def get_prep_value(self, value: Any) -> Any: ... + def get_db_prep_value(self, value: Any, connection: Any, prepared: bool = ...) -> Any: ... + def from_db_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def get_internal_type(self) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/feeds.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/feeds.pyi new file mode 100644 index 000000000000..b5274bf7ff49 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/feeds.pyi @@ -0,0 +1,21 @@ +from collections.abc import Iterable, Sequence +from typing import Any + +from django.contrib.syndication.views import Feed as BaseFeed +from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed +from django.utils.xmlutils import SimplerXMLGenerator + +class GeoFeedMixin: + def georss_coords(self, coords: Iterable[Sequence[float]]) -> str: ... + def add_georss_point(self, handler: SimplerXMLGenerator, coords: Sequence[float], w3c_geo: bool = ...) -> None: ... + def add_georss_element(self, handler: SimplerXMLGenerator, item: dict[str, Any], w3c_geo: bool = ...) -> None: ... + +class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin): + def rss_attributes(self) -> dict[str, str]: ... + +class GeoAtom1Feed(Atom1Feed, GeoFeedMixin): ... + +class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin): + def rss_attributes(self) -> dict[str, str]: ... + +class Feed(BaseFeed): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/__init__.pyi new file mode 100644 index 000000000000..e12a01bd7fc4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/__init__.pyi @@ -0,0 +1,13 @@ +from django.forms import * + +from .fields import GeometryCollectionField as GeometryCollectionField +from .fields import GeometryField as GeometryField +from .fields import LineStringField as LineStringField +from .fields import MultiLineStringField as MultiLineStringField +from .fields import MultiPointField as MultiPointField +from .fields import MultiPolygonField as MultiPolygonField +from .fields import PointField as PointField +from .fields import PolygonField as PolygonField +from .widgets import BaseGeometryWidget as BaseGeometryWidget +from .widgets import OpenLayersWidget as OpenLayersWidget +from .widgets import OSMWidget as OSMWidget diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/fields.pyi new file mode 100644 index 000000000000..ac9c7f011d13 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/fields.pyi @@ -0,0 +1,33 @@ +from typing import Any + +from django import forms + +class GeometryField(forms.Field): + widget: Any + geom_type: str + srid: Any + def __init__(self, *, srid: Any | None = ..., geom_type: Any | None = ..., **kwargs: Any) -> None: ... + def to_python(self, value: Any) -> Any: ... + def clean(self, value: Any) -> Any: ... + def has_changed(self, initial: Any, data: Any) -> Any: ... + +class GeometryCollectionField(GeometryField): + geom_type: str + +class PointField(GeometryField): + geom_type: str + +class MultiPointField(GeometryField): + geom_type: str + +class LineStringField(GeometryField): + geom_type: str + +class MultiLineStringField(GeometryField): + geom_type: str + +class PolygonField(GeometryField): + geom_type: str + +class MultiPolygonField(GeometryField): + geom_type: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/widgets.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/widgets.pyi new file mode 100644 index 000000000000..6622ae10980c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/forms/widgets.pyi @@ -0,0 +1,38 @@ +from logging import Logger +from typing import Any + +from django.forms.widgets import Widget + +logger: Logger + +class BaseGeometryWidget(Widget): + geom_type: str + map_srid: int + map_width: int + map_height: int + display_raw: bool + supports_3d: bool + template_name: str + attrs: Any + def __init__(self, attrs: Any | None = ...) -> None: ... + def serialize(self, value: Any) -> Any: ... + def deserialize(self, value: Any) -> Any: ... + def get_context(self, name: Any, value: Any, attrs: Any) -> Any: ... + +class OpenLayersWidget(BaseGeometryWidget): + template_name: str + map_srid: int + + class Media: + css: Any + js: Any + + def serialize(self, value: Any) -> Any: ... + def deserialize(self, value: Any) -> Any: ... + +class OSMWidget(OpenLayersWidget): + template_name: str + default_lon: int + default_lat: int + default_zoom: int + def __init__(self, attrs: Any | None = ...) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/__init__.pyi new file mode 100644 index 000000000000..6c97a5d59055 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/__init__.pyi @@ -0,0 +1,15 @@ +from django.contrib.gis.gdal.datasource import DataSource as DataSource +from django.contrib.gis.gdal.driver import Driver as Driver +from django.contrib.gis.gdal.envelope import Envelope as Envelope +from django.contrib.gis.gdal.error import GDALException as GDALException +from django.contrib.gis.gdal.error import SRSException as SRSException +from django.contrib.gis.gdal.error import check_err as check_err +from django.contrib.gis.gdal.geometries import OGRGeometry as OGRGeometry +from django.contrib.gis.gdal.geomtype import OGRGeomType as OGRGeomType +from django.contrib.gis.gdal.libgdal import GDAL_VERSION as GDAL_VERSION +from django.contrib.gis.gdal.libgdal import gdal_full_version as gdal_full_version +from django.contrib.gis.gdal.libgdal import gdal_version as gdal_version +from django.contrib.gis.gdal.raster.source import GDALRaster as GDALRaster +from django.contrib.gis.gdal.srs import AxisOrder as AxisOrder +from django.contrib.gis.gdal.srs import CoordTransform as CoordTransform +from django.contrib.gis.gdal.srs import SpatialReference as SpatialReference diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/base.pyi new file mode 100644 index 000000000000..b4e300c75867 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/base.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.contrib.gis.ptr import CPointerBase + +class GDALBase(CPointerBase): + null_ptr_exception_class: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/datasource.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/datasource.pyi new file mode 100644 index 000000000000..aaaf621ed48a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/datasource.pyi @@ -0,0 +1,18 @@ +from typing import Any + +from django.contrib.gis.gdal.base import GDALBase +from django.contrib.gis.gdal.driver import Driver +from django.contrib.gis.gdal.layer import Layer + +class DataSource(GDALBase): + destructor: Any + encoding: str + ptr: Any + driver: Driver + def __init__(self, ds_input: Any, ds_driver: bool = ..., write: bool = ..., encoding: str = ...) -> None: ... + def __getitem__(self, index: str | int) -> Layer: ... + def __len__(self) -> int: ... + @property + def layer_count(self) -> int: ... + @property + def name(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/driver.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/driver.pyi new file mode 100644 index 000000000000..504a59902361 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/driver.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from django.contrib.gis.gdal.base import GDALBase + +class Driver(GDALBase): + ptr: Any + def __init__(self, dr_input: Any) -> None: ... + @classmethod + def ensure_registered(cls) -> None: ... + @classmethod + def driver_count(cls) -> int: ... + @property + def name(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/envelope.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/envelope.pyi new file mode 100644 index 000000000000..6bba207ab910 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/envelope.pyi @@ -0,0 +1,25 @@ +from ctypes import Structure +from typing import Any + +class OGREnvelope(Structure): ... + +class Envelope: + def __init__(self, *args: Any) -> None: ... + def __eq__(self, other: object) -> bool: ... + def expand_to_include(self, *args: Any) -> None: ... + @property + def min_x(self) -> float: ... + @property + def min_y(self) -> float: ... + @property + def max_x(self) -> float: ... + @property + def max_y(self) -> float: ... + @property + def ur(self) -> tuple[float, float]: ... + @property + def ll(self) -> tuple[float, float]: ... + @property + def tuple(self) -> tuple[float, float, float, float]: ... + @property + def wkt(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/error.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/error.pyi new file mode 100644 index 000000000000..99eca85bbc2e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/error.pyi @@ -0,0 +1,10 @@ +from typing import Any + +class GDALException(Exception): ... +class SRSException(Exception): ... + +OGRERR_DICT: Any +CPLERR_DICT: Any +ERR_NONE: int + +def check_err(code: Any, cpl: bool = ...) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/feature.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/feature.pyi new file mode 100644 index 000000000000..7fe283b008f5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/feature.pyi @@ -0,0 +1,30 @@ +from typing import Any + +from django.contrib.gis.gdal.base import GDALBase +from django.contrib.gis.gdal.field import Field +from django.contrib.gis.gdal.geometries import OGRGeometry +from django.contrib.gis.gdal.geomtype import OGRGeomType + +class Feature(GDALBase): + destructor: Any + ptr: Any + def __init__(self, feat: Any, layer: Any) -> None: ... + def __getitem__(self, index: str | int) -> Field: ... + def __len__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... + @property + def encoding(self) -> str: ... + @property + def fid(self) -> int: ... + @property + def layer_name(self) -> str: ... + @property + def num_fields(self) -> int: ... + @property + def fields(self) -> list[str]: ... + @property + def geom(self) -> OGRGeometry: ... + @property + def geom_type(self) -> OGRGeomType: ... + def get(self, field: str) -> Any: ... + def index(self, field_name: str) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/field.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/field.pyi new file mode 100644 index 000000000000..6d1a27a3b09f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/field.pyi @@ -0,0 +1,61 @@ +from typing import Any + +from django.contrib.gis.gdal.base import GDALBase + +class Field(GDALBase): + ptr: Any + def __init__(self, feat: Any, index: Any) -> None: ... + def as_double(self) -> float | None: ... + def as_int(self, is_64: bool = ...) -> int | None: ... + def as_string(self) -> str | None: ... + def as_datetime(self) -> tuple[int, int, int, int, int, int, int] | None: ... + @property + def is_set(self) -> bool: ... + @property + def name(self) -> str: ... + @property + def precision(self) -> int: ... + @property + def type(self) -> int: ... + @property + def type_name(self) -> bytes: ... + @property + def value(self) -> Any: ... + @property + def width(self) -> int: ... + +class OFTInteger(Field): + @property + def value(self) -> Any: ... + @property + def type(self) -> Any: ... + +class OFTReal(Field): + @property + def value(self) -> Any: ... + +class OFTString(Field): ... +class OFTWideString(Field): ... +class OFTBinary(Field): ... + +class OFTDate(Field): + @property + def value(self) -> Any: ... + +class OFTDateTime(Field): + @property + def value(self) -> Any: ... + +class OFTTime(Field): + @property + def value(self) -> Any: ... + +class OFTInteger64(OFTInteger): ... +class OFTIntegerList(Field): ... +class OFTRealList(Field): ... +class OFTStringList(Field): ... +class OFTWideStringList(Field): ... +class OFTInteger64List(Field): ... + +OGRFieldTypes: Any +ROGRFieldTypes: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/geometries.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/geometries.pyi new file mode 100644 index 000000000000..dc6d2a12f989 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/geometries.pyi @@ -0,0 +1,145 @@ +from typing import Any, AnyStr + +from django.contrib.gis.gdal import CoordTransform, SpatialReference +from django.contrib.gis.gdal.base import GDALBase +from django.contrib.gis.gdal.envelope import Envelope +from django.contrib.gis.gdal.geomtype import OGRGeomType +from django.contrib.gis.geos import GEOSGeometry + +class OGRGeometry(GDALBase): + destructor: Any + ptr: Any + srs: SpatialReference | None + def __init__(self, geom_input: Any, srs: SpatialReference | None = ...) -> None: ... + @classmethod + def from_bbox(cls, bbox: tuple[float, float, float, float]) -> OGRGeometry: ... + @staticmethod + def from_json(geom_input: AnyStr) -> OGRGeometry: ... + @classmethod + def from_gml(cls, gml_string: AnyStr) -> OGRGeometry: ... + def __or__(self, other: OGRGeometry) -> OGRGeometry: ... + def __and__(self, other: OGRGeometry) -> OGRGeometry: ... + def __sub__(self, other: OGRGeometry) -> OGRGeometry: ... + def __xor__(self, other: OGRGeometry) -> OGRGeometry: ... + def __eq__(self, other: object) -> bool: ... + @property + def dimension(self) -> int: ... + coord_dim: int + @property + def geom_count(self) -> int: ... + @property + def point_count(self) -> int: ... + @property + def num_points(self) -> int: ... + @property + def num_coords(self) -> int: ... + @property + def geom_type(self) -> OGRGeomType: ... + @property + def geom_name(self) -> str: ... + @property + def area(self) -> float: ... + @property + def envelope(self) -> Envelope: ... + @property + def empty(self) -> bool: ... + @property + def extent(self) -> tuple[float, float, float, float]: ... + srid: int | None + @property + def geos(self) -> GEOSGeometry: ... + @property + def gml(self) -> str: ... + @property + def hex(self) -> bytes: ... + @property + def json(self) -> str: ... + geojson: str + @property + def kml(self) -> str: ... + @property + def wkb_size(self) -> int: ... + @property + def wkb(self) -> memoryview: ... + @property + def wkt(self) -> str: ... + @property + def ewkt(self) -> str: ... + def clone(self) -> Any: ... + def close_rings(self) -> None: ... + def transform(self, coord_trans: CoordTransform | SpatialReference | str | int, clone: bool = ...) -> Any: ... + def intersects(self, other: OGRGeometry) -> bool: ... + def equals(self, other: OGRGeometry) -> bool: ... + def disjoint(self, other: OGRGeometry) -> bool: ... + def touches(self, other: OGRGeometry) -> bool: ... + def crosses(self, other: OGRGeometry) -> bool: ... + def within(self, other: OGRGeometry) -> bool: ... + def contains(self, other: OGRGeometry) -> bool: ... + def overlaps(self, other: OGRGeometry) -> bool: ... + @property + def boundary(self) -> OGRGeometry: ... + @property + def convex_hull(self) -> OGRGeometry: ... + def difference(self, other: OGRGeometry) -> OGRGeometry: ... + def intersection(self, other: OGRGeometry) -> OGRGeometry: ... + def sym_difference(self, other: OGRGeometry) -> OGRGeometry: ... + def union(self, other: OGRGeometry) -> OGRGeometry: ... + +class Point(OGRGeometry): + @property + def x(self) -> float: ... + @property + def y(self) -> float: ... + @property + def z(self) -> float | None: ... + @property + def coords(self) -> tuple[float, float] | tuple[float, float, float]: ... + @property + def tuple(self) -> tuple[float, float] | tuple[float, float, float]: ... + +class LineString(OGRGeometry): + def __getitem__(self, index: int) -> tuple[float, ...]: ... + def __len__(self) -> int: ... + @property + def tuple(self) -> tuple[tuple[float, ...]]: ... + coords: Any + @property + def x(self) -> list[float]: ... + @property + def y(self) -> list[float]: ... + @property + def z(self) -> list[float] | None: ... + +class LinearRing(LineString): ... + +class Polygon(OGRGeometry): + def __len__(self) -> int: ... + def __getitem__(self, index: int) -> OGRGeometry: ... + @property + def shell(self) -> OGRGeometry: ... + exterior_ring: OGRGeometry + @property + def coords(self) -> tuple[tuple[tuple[float, ...]]]: ... + @property + def tuple(self) -> tuple[tuple[tuple[float, ...]]]: ... + @property + def point_count(self) -> int: ... + @property + def centroid(self) -> Point: ... + +class GeometryCollection(OGRGeometry): + def __getitem__(self, index: int) -> OGRGeometry: ... + def __len__(self) -> int: ... + def add(self, geom: OGRGeometry | str) -> None: ... + @property + def point_count(self) -> int: ... + @property + def coords(self) -> tuple[Any, ...]: ... + @property + def tuple(self) -> tuple[Any, ...]: ... + +class MultiPoint(GeometryCollection): ... +class MultiLineString(GeometryCollection): ... +class MultiPolygon(GeometryCollection): ... + +GEO_CLASSES: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/geomtype.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/geomtype.pyi new file mode 100644 index 000000000000..d36533c92f1a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/geomtype.pyi @@ -0,0 +1,12 @@ +from typing import Any + +class OGRGeomType: + wkb25bit: int + num: int + def __init__(self, type_input: Any) -> None: ... + def __eq__(self, other: object) -> bool: ... + @property + def name(self) -> str: ... + @property + def django(self) -> str: ... + def to_multi(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/layer.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/layer.pyi new file mode 100644 index 000000000000..4020afed264d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/layer.pyi @@ -0,0 +1,48 @@ +from collections.abc import Iterator +from typing import Any, AnyStr, Literal, overload + +from django.contrib.gis.gdal.base import GDALBase +from django.contrib.gis.gdal.envelope import Envelope +from django.contrib.gis.gdal.feature import Feature +from django.contrib.gis.gdal.field import Field +from django.contrib.gis.gdal.geometries import OGRGeometry +from django.contrib.gis.gdal.geomtype import OGRGeomType +from django.contrib.gis.gdal.srs import SpatialReference +from django.contrib.gis.geos.geometry import GEOSGeometry + +class Layer(GDALBase): + ptr: Any + def __init__(self, layer_ptr: Any, ds: Any) -> None: ... + @overload + def __getitem__(self, index: int) -> Feature: ... + @overload + def __getitem__(self, index: slice) -> list[Feature]: ... + def __iter__(self) -> Iterator[Feature]: ... + def __len__(self) -> int: ... + @property + def extent(self) -> Envelope: ... + @property + def name(self) -> str: ... + @property + def num_feat(self) -> int: ... + @property + def num_fields(self) -> int: ... + @property + def geom_type(self) -> OGRGeomType: ... + @property + def srs(self) -> SpatialReference: ... + @property + def fields(self) -> list[str]: ... + @property + def field_types(self) -> list[type[Field]]: ... + @property + def field_widths(self) -> list[int]: ... + @property + def field_precisions(self) -> list[int]: ... + spatial_filter: OGRGeometry | None + def get_fields(self, field_name: str) -> list[Any]: ... + @overload + def get_geoms(self, geos: Literal[False] = False) -> list[OGRGeometry]: ... + @overload + def get_geoms(self, geos: Literal[True]) -> list[GEOSGeometry]: ... + def test_capability(self, capability: AnyStr) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/libgdal.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/libgdal.pyi new file mode 100644 index 000000000000..2b0cd0510107 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/libgdal.pyi @@ -0,0 +1,34 @@ +import sys +from _ctypes import _CData +from collections.abc import Callable, Sequence +from ctypes import CDLL, _FuncPointer, _NamedFuncPointer +from logging import Logger +from typing import Any + +logger: Logger +lib_path: str | None +lib_names: list[str] | None +lib_name: str +lgdal: CDLL +if sys.platform == "win32": + from ctypes import WinDLL + + lwingdal: WinDLL + +def std_call(func: str) -> _NamedFuncPointer: ... +def gdal_version() -> bytes: ... +def gdal_full_version() -> bytes: ... +def gdal_version_info() -> tuple[int, int, int]: ... + +GDAL_VERSION: tuple[int, int, int] +CPLErrorHandler: type[_FuncPointer] + +def function( + name: str, + # Taken from _ctypes.CFuncPtr + args: Sequence[type[_CData]], + restype: type[_CData] | Callable[[int], Any] | None, +) -> _NamedFuncPointer: ... + +err_handler: _FuncPointer +set_error_handler: _NamedFuncPointer diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/ds.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/ds.pyi new file mode 100644 index 000000000000..59aefc94c9a7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/ds.pyi @@ -0,0 +1,51 @@ +from typing import Any + +c_int_p: Any +register_all: Any +cleanup_all: Any +get_driver: Any +get_driver_by_name: Any +get_driver_count: Any +get_driver_name: Any +open_ds: Any +destroy_ds: Any +release_ds: Any +get_ds_name: Any +get_layer: Any +get_layer_by_name: Any +get_layer_count: Any +get_extent: Any +get_feature: Any +get_feature_count: Any +get_layer_defn: Any +get_layer_srs: Any +get_next_feature: Any +reset_reading: Any +test_capability: Any +get_spatial_filter: Any +set_spatial_filter: Any +set_spatial_filter_rect: Any +get_fd_geom_type: Any +get_fd_name: Any +get_feat_name: Any +get_field_count: Any +get_field_defn: Any +clone_feature: Any +destroy_feature: Any +feature_equal: Any +get_feat_geom_ref: Any +get_feat_field_count: Any +get_feat_field_defn: Any +get_fid: Any +get_field_as_datetime: Any +get_field_as_double: Any +get_field_as_integer: Any +get_field_as_integer64: Any +is_field_set: Any +get_field_as_string: Any +get_field_index: Any +get_field_name: Any +get_field_precision: Any +get_field_type: Any +get_field_type_name: Any +get_field_width: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi new file mode 100644 index 000000000000..2264790bcc58 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/errcheck.pyi @@ -0,0 +1,14 @@ +from typing import Any + +def arg_byref(args: Any, offset: int = ...) -> Any: ... +def ptr_byref(args: Any, offset: int = ...) -> Any: ... +def check_const_string(result: Any, func: Any, cargs: Any, offset: Any | None = ..., cpl: bool = ...) -> Any: ... +def check_string(result: Any, func: Any, cargs: Any, offset: int = ..., str_result: bool = ...) -> Any: ... +def check_envelope(result: Any, func: Any, cargs: Any, offset: int = ...) -> Any: ... +def check_geom(result: Any, func: Any, cargs: Any) -> Any: ... +def check_geom_offset(result: Any, func: Any, cargs: Any, offset: int = ...) -> Any: ... +def check_srs(result: Any, func: Any, cargs: Any) -> Any: ... +def check_arg_errcode(result: Any, func: Any, cargs: Any, cpl: bool = ...) -> Any: ... +def check_errcode(result: Any, func: Any, cargs: Any, cpl: bool = ...) -> None: ... +def check_pointer(result: Any, func: Any, cargs: Any) -> Any: ... +def check_str_arg(result: Any, func: Any, cargs: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/generation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/generation.pyi new file mode 100644 index 000000000000..55f9070afb24 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/generation.pyi @@ -0,0 +1,20 @@ +from ctypes import c_char_p +from typing import Any + +class gdal_char_p(c_char_p): ... + +def bool_output(func: Any, argtypes: Any, errcheck: Any | None = ...) -> Any: ... +def double_output(func: Any, argtypes: Any, errcheck: bool = ..., strarg: bool = ..., cpl: bool = ...) -> Any: ... +def geom_output(func: Any, argtypes: Any, offset: Any | None = ...) -> Any: ... +def int_output(func: Any, argtypes: Any, errcheck: Any | None = ...) -> Any: ... +def int64_output(func: Any, argtypes: Any) -> Any: ... +def srs_output(func: Any, argtypes: Any) -> Any: ... +def const_string_output( + func: Any, argtypes: Any, offset: Any | None = ..., decoding: Any | None = ..., cpl: bool = ... +) -> Any: ... +def string_output( + func: Any, argtypes: Any, offset: int = ..., str_result: bool = ..., decoding: Any | None = ... +) -> Any: ... +def void_output(func: Any, argtypes: Any, errcheck: bool = ..., cpl: bool = ...) -> Any: ... +def voidptr_output(func: Any, argtypes: Any, errcheck: bool = ...) -> Any: ... +def chararray_output(func: Any, argtypes: Any, errcheck: bool = ...) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/geom.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/geom.pyi new file mode 100644 index 000000000000..6a10b4c26111 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/geom.pyi @@ -0,0 +1,56 @@ +from typing import Any + +def env_func(f: Any, argtypes: Any) -> Any: ... +def pnt_func(f: Any) -> Any: ... +def topology_func(f: Any) -> Any: ... + +from_json: Any +to_json: Any +to_kml: Any +getx: Any +gety: Any +getz: Any +from_wkb: Any +from_wkt: Any +from_gml: Any +create_geom: Any +clone_geom: Any +get_geom_ref: Any +get_boundary: Any +geom_convex_hull: Any +geom_diff: Any +geom_intersection: Any +geom_sym_diff: Any +geom_union: Any +add_geom: Any +import_wkt: Any +destroy_geom: Any +to_wkb: Any +to_wkt: Any +to_gml: Any +get_wkbsize: Any +assign_srs: Any +get_geom_srs: Any +get_area: Any +get_centroid: Any +get_dims: Any +get_coord_dim: Any +set_coord_dim: Any +is_empty: Any +get_geom_count: Any +get_geom_name: Any +get_geom_type: Any +get_point_count: Any +get_point: Any +geom_close_rings: Any +ogr_contains: Any +ogr_crosses: Any +ogr_disjoint: Any +ogr_equals: Any +ogr_intersects: Any +ogr_overlaps: Any +ogr_touches: Any +ogr_within: Any +geom_transform: Any +geom_transform_to: Any +get_envelope: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/raster.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/raster.pyi new file mode 100644 index 000000000000..68651bc9c7ed --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/raster.pyi @@ -0,0 +1,48 @@ +from typing import Any + +register_all: Any +get_driver: Any +get_driver_by_name: Any +get_driver_count: Any +get_driver_description: Any +create_ds: Any +open_ds: Any +close_ds: Any +flush_ds: Any +copy_ds: Any +add_band_ds: Any +get_ds_description: Any +get_ds_driver: Any +get_ds_xsize: Any +get_ds_ysize: Any +get_ds_raster_count: Any +get_ds_raster_band: Any +get_ds_projection_ref: Any +set_ds_projection_ref: Any +get_ds_geotransform: Any +set_ds_geotransform: Any +get_ds_metadata: Any +set_ds_metadata: Any +get_ds_metadata_domain_list: Any +get_ds_metadata_item: Any +set_ds_metadata_item: Any +free_dsl: Any +get_ds_info: Any +band_io: Any +get_band_xsize: Any +get_band_ysize: Any +get_band_index: Any +get_band_description: Any +get_band_ds: Any +get_band_datatype: Any +get_band_color_interp: Any +get_band_nodata_value: Any +set_band_nodata_value: Any +delete_band_nodata_value: Any +get_band_statistics: Any +compute_band_statistics: Any +reproject_image: Any +auto_create_warped_vrt: Any +create_vsi_file_from_mem_buffer: Any +get_mem_buffer_from_vsi_file: Any +unlink_vsi_file: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/srs.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/srs.pyi new file mode 100644 index 000000000000..7fd3f24ba0c8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/prototypes/srs.pyi @@ -0,0 +1,36 @@ +from typing import Any + +def srs_double(f: Any) -> Any: ... +def units_func(f: Any) -> Any: ... + +clone_srs: Any +new_srs: Any +release_srs: Any +destroy_srs: Any +srs_validate: Any +set_axis_strategy: Any +semi_major: Any +semi_minor: Any +invflattening: Any +from_wkt: Any +from_proj: Any +from_epsg: Any +from_xml: Any +from_user_input: Any +morph_to_esri: Any +morph_from_esri: Any +identify_epsg: Any +linear_units: Any +angular_units: Any +to_wkt: Any +to_proj: Any +to_pretty_wkt: Any +to_xml: Any +get_attr_value: Any +get_auth_name: Any +get_auth_code: Any +isgeographic: Any +islocal: Any +isprojected: Any +new_ct: Any +destroy_ct: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/band.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/band.pyi new file mode 100644 index 000000000000..071b905a5361 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/band.pyi @@ -0,0 +1,50 @@ +from typing import Any, Literal, overload + +from django.contrib.gis.gdal.raster.base import GDALRasterBase + +class GDALBand(GDALRasterBase): + source: Any + def __init__(self, source: Any, index: Any) -> None: ... + @property + def description(self) -> str: ... + @property + def width(self) -> int: ... + @property + def height(self) -> int: ... + @property + def pixel_count(self) -> int: ... + def statistics( + self, refresh: bool = ..., approximate: bool = ... + ) -> tuple[float, float, float, float] | tuple[None, None, None, None]: ... + @property + def min(self) -> float | None: ... + @property + def max(self) -> float | None: ... + @property + def mean(self) -> float | None: ... + @property + def std(self) -> float | None: ... + @property + def nodata_value(self) -> float | None: ... + @nodata_value.setter + def nodata_value(self, value: float | None) -> None: ... + @overload + def datatype(self, as_string: Literal[False] = False) -> int: ... + @overload + def datatype(self, as_string: Literal[True]) -> str: ... + @overload + def color_interp(self, as_string: Literal[False] = False) -> int: ... + @overload + def color_interp(self, as_string: Literal[True]) -> str: ... + def data( + self, + data: Any | None = ..., + offset: Any | None = ..., + size: Any | None = ..., + shape: Any | None = ..., + as_memoryview: bool = ..., + ) -> Any: ... + +class BandList(list[GDALBand]): + source: Any + def __init__(self, source: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/base.pyi new file mode 100644 index 000000000000..3850e028fdd1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/base.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.contrib.gis.gdal.base import GDALBase + +class GDALRasterBase(GDALBase): + @property + def metadata(self) -> Any: ... + @metadata.setter + def metadata(self, value: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/const.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/const.pyi new file mode 100644 index 000000000000..e69b5dea81a6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/const.pyi @@ -0,0 +1,8 @@ +GDAL_PIXEL_TYPES: dict[int, str] +GDAL_INTEGER_TYPES: list[int] +GDAL_TO_CTYPES: type +GDAL_RESAMPLE_ALGORITHMS: dict[str, int] +GDAL_COLOR_TYPES: dict[int, str] +VSI_FILESYSTEM_BASE_PATH: str +VSI_TAKE_BUFFER_OWNERSHIP: bool +VSI_DELETE_BUFFER_ON_READ: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/source.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/source.pyi new file mode 100644 index 000000000000..b8df1381f893 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/raster/source.pyi @@ -0,0 +1,73 @@ +from collections.abc import Sequence +from ctypes import c_void_p +from pathlib import Path +from typing import Any + +from django.contrib.gis.gdal.driver import Driver +from django.contrib.gis.gdal.raster.band import BandList +from django.contrib.gis.gdal.raster.base import GDALRasterBase +from django.contrib.gis.gdal.srs import SpatialReference +from django.utils.functional import cached_property + +class TransformPoint(list[Sequence[float]]): + indices: dict[str, tuple[int, int]] + def __init__(self, raster: GDALRaster, prop: str) -> None: ... + @property + def x(self) -> float: ... + @x.setter + def x(self, value: float) -> None: ... + @property + def y(self) -> float: ... + @y.setter + def y(self, value: float) -> None: ... + +class GDALRaster(GDALRasterBase): + destructor: Any + def __init__(self, ds_input: str | Path | bytes | dict | c_void_p, write: bool = ...) -> None: ... + def __del__(self) -> None: ... + @property + def vsi_buffer(self) -> bytes | None: ... + @cached_property + def is_vsi_based(self) -> bool: ... + @property + def name(self) -> str: ... + @cached_property + def driver(self) -> Driver: ... + @property + def width(self) -> int: ... + @property + def height(self) -> int: ... + @property + def srs(self) -> SpatialReference | None: ... + @srs.setter + def srs(self, value: SpatialReference | int | str) -> None: ... + @property + def srid(self) -> int: ... + @srid.setter + def srid(self, value: int) -> None: ... + @property + def geotransform(self) -> list[float]: ... + @geotransform.setter + def geotransform(self, values: list[float]) -> None: ... + @property + def origin(self) -> TransformPoint: ... + @property + def scale(self) -> TransformPoint: ... + @property + def skew(self) -> TransformPoint: ... + @property + def extent(self) -> tuple[float, float, float, float]: ... + @property + def bands(self) -> BandList: ... + def warp(self, ds_input: Any, resampling: str = ..., max_error: float = ...) -> GDALRaster: ... + def clone(self, name: str | None = ...) -> GDALRaster: ... + def transform( + self, + srs: SpatialReference | int | str, + driver: Any | None = ..., + name: str | None = ..., + resampling: str = ..., + max_error: float = ..., + ) -> GDALRaster: ... + @property + def info(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/srs.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/srs.pyi new file mode 100644 index 000000000000..f43fab0dad85 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/gdal/srs.pyi @@ -0,0 +1,68 @@ +from enum import IntEnum +from typing import Any, AnyStr + +from django.contrib.gis.gdal.base import GDALBase +from typing_extensions import Self + +class AxisOrder(IntEnum): + TRADITIONAL: int + AUTHORITY: int + +class SpatialReference(GDALBase): + destructor: Any + axis_order: AxisOrder + ptr: Any + def __init__(self, srs_input: str | int = ..., srs_type: str = ..., axis_order: AxisOrder | None = ...) -> None: ... + def __getitem__(self, target: str | tuple[str, int]) -> str: ... + def attr_value(self, target: AnyStr, index: int = ...) -> str: ... + def auth_name(self, target: AnyStr) -> str: ... + def auth_code(self, target: AnyStr) -> str: ... + def clone(self) -> Self: ... + def from_esri(self) -> None: ... + def identify_epsg(self) -> None: ... + def to_esri(self) -> None: ... + def validate(self) -> None: ... + @property + def name(self) -> str | None: ... + @property + def srid(self) -> int | None: ... + @property + def linear_name(self) -> str: ... + @property + def linear_units(self) -> float: ... + @property + def angular_name(self) -> str: ... + @property + def angular_units(self) -> float: ... + @property + def units(self) -> tuple[float | None, str | None]: ... + @property + def ellipsoid(self) -> tuple[float, float, float]: ... + @property + def semi_major(self) -> float: ... + @property + def semi_minor(self) -> float: ... + @property + def inverse_flattening(self) -> float: ... + @property + def geographic(self) -> bool: ... + @property + def local(self) -> bool: ... + @property + def projected(self) -> bool: ... + def import_epsg(self, epsg: int) -> None: ... + def import_proj(self, proj: AnyStr) -> None: ... + def import_user_input(self, user_input: AnyStr) -> None: ... + def import_wkt(self, wkt: AnyStr) -> None: ... + def import_xml(self, xml: AnyStr) -> None: ... + @property + def wkt(self) -> str: ... + @property + def proj(self) -> str: ... + @property + def proj4(self) -> str: ... + +class CoordTransform(GDALBase): + destructor: Any + ptr: Any + def __init__(self, source: SpatialReference, target: SpatialReference) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/__init__.pyi new file mode 100644 index 000000000000..f524617cc4ee --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/__init__.pyi @@ -0,0 +1,4 @@ +from .base import GeoIP2 as GeoIP2 +from .base import GeoIP2Exception as GeoIP2Exception + +HAS_GEOIP2: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/base.pyi new file mode 100644 index 000000000000..8b4884238a74 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/base.pyi @@ -0,0 +1,33 @@ +from collections.abc import Sequence +from pathlib import Path +from typing import Any + +from django.contrib.gis.geos import Point + +GEOIP_SETTINGS: dict[str, Any] + +class GeoIP2Exception(Exception): ... + +class GeoIP2: + MODE_AUTO: int + MODE_MMAP_EXT: int + MODE_MMAP: int + MODE_FILE: int + MODE_MEMORY: int + cache_options: frozenset[int] + def __init__( + self, path: Path | str | None = ..., cache: int = ..., country: Any | None = ..., city: Any | None = ... + ) -> None: ... + def __del__(self) -> None: ... + def city(self, query: str) -> dict[str, Any]: ... + def country_code(self, query: str) -> str: ... + def country_name(self, query: str) -> str: ... + def country(self, query: str) -> dict[str, Any]: ... + def coords(self, query: str, ordering: Sequence[str] = ...) -> tuple[float, float] | tuple[None, None]: ... + def lon_lat(self, query: str) -> tuple[float, float] | tuple[None, None]: ... + def lat_lon(self, query: str) -> tuple[float, float] | tuple[None, None]: ... + def geos(self, query: str) -> Point: ... + @property + def info(self) -> str: ... + @classmethod + def open(cls, full_path: Path | str | None, cache: int) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/resources.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/resources.pyi new file mode 100644 index 000000000000..217bfc8b7030 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geoip2/resources.pyi @@ -0,0 +1,4 @@ +from typing import Any + +def City(response: Any) -> Any: ... +def Country(response: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geometry.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geometry.pyi new file mode 100644 index 000000000000..2bf08225cac3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geometry.pyi @@ -0,0 +1,5 @@ +from re import Pattern + +hex_regex: Pattern[str] +wkt_regex: Pattern[str] +json_regex: Pattern[str] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/__init__.pyi new file mode 100644 index 000000000000..c0d0e749f081 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/__init__.pyi @@ -0,0 +1,19 @@ +from ..geometry import hex_regex as hex_regex +from ..geometry import wkt_regex as wkt_regex +from .collections import GeometryCollection as GeometryCollection +from .collections import MultiLineString as MultiLineString +from .collections import MultiPoint as MultiPoint +from .collections import MultiPolygon as MultiPolygon +from .error import GEOSException as GEOSException +from .factory import fromfile as fromfile +from .factory import fromstr as fromstr +from .geometry import GEOSGeometry as GEOSGeometry +from .io import WKBReader as WKBReader +from .io import WKBWriter as WKBWriter +from .io import WKTReader as WKTReader +from .io import WKTWriter as WKTWriter +from .libgeos import geos_version as geos_version +from .linestring import LinearRing as LinearRing +from .linestring import LineString as LineString +from .point import Point as Point +from .polygon import Polygon as Polygon diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/base.pyi new file mode 100644 index 000000000000..d1b25990843c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/base.pyi @@ -0,0 +1,5 @@ +from django.contrib.gis.geos.error import GEOSException +from django.contrib.gis.ptr import CPointerBase + +class GEOSBase(CPointerBase): + null_ptr_exception_class: type[GEOSException] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/collections.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/collections.pyi new file mode 100644 index 000000000000..afa14c181359 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/collections.pyi @@ -0,0 +1,17 @@ +from collections.abc import Iterator +from typing import Any + +from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin + +class GeometryCollection(GEOSGeometry): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __iter__(self) -> Iterator[GEOSGeometry]: ... + def __len__(self) -> int: ... + @property + def coords(self) -> tuple[Any, ...]: ... + @property + def tuple(self) -> tuple[Any, ...]: ... + +class MultiPoint(GeometryCollection): ... +class MultiLineString(LinearGeometryMixin, GeometryCollection): ... +class MultiPolygon(GeometryCollection): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/coordseq.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/coordseq.pyi new file mode 100644 index 000000000000..bd58af312a32 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/coordseq.pyi @@ -0,0 +1,34 @@ +from collections.abc import Iterator +from typing import Any + +from django.contrib.gis.geos.base import GEOSBase +from typing_extensions import Self + +class GEOSCoordSeq(GEOSBase): + ptr_type: Any + def __init__(self, ptr: Any, z: bool = ...) -> None: ... + def __iter__(self) -> Iterator[tuple[float, ...]]: ... + def __len__(self) -> int: ... + def __getitem__(self, index: int) -> Any: ... + def __setitem__(self, index: int, value: Any) -> None: ... + def getOrdinate(self, dimension: int, index: int) -> float: ... + def setOrdinate(self, dimension: int, index: int, value: float) -> None: ... + def getX(self, index: int) -> float: ... + def setX(self, index: int, value: float) -> None: ... + def getY(self, index: int) -> float: ... + def setY(self, index: int, value: float) -> None: ... + def getZ(self, index: int) -> float: ... + def setZ(self, index: int, value: float) -> None: ... + @property + def size(self) -> int: ... + @property + def dims(self) -> int: ... + @property + def hasz(self) -> bool: ... + def clone(self) -> Self: ... + @property + def kml(self) -> str: ... + @property + def tuple(self) -> tuple[Any, ...]: ... + @property + def is_counterclockwise(self) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/error.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/error.pyi new file mode 100644 index 000000000000..f051ee57f272 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/error.pyi @@ -0,0 +1 @@ +class GEOSException(Exception): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/factory.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/factory.pyi new file mode 100644 index 000000000000..82315ffffdac --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/factory.pyi @@ -0,0 +1,10 @@ +from typing import Any, Protocol, type_check_only + +from django.contrib.gis.geos.geometry import GEOSGeometry + +@type_check_only +class _Reader(Protocol): + def read(self) -> str | bytes: ... + +def fromfile(file_h: str | _Reader) -> GEOSGeometry: ... +def fromstr(string: str, **kwargs: Any) -> GEOSGeometry: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/geometry.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/geometry.pyi new file mode 100644 index 000000000000..5ffceaf8f51c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/geometry.pyi @@ -0,0 +1,147 @@ +from typing import Any + +from django.contrib.gis.gdal import CoordTransform, SpatialReference +from django.contrib.gis.gdal.geometries import OGRGeometry +from django.contrib.gis.geos.base import GEOSBase +from django.contrib.gis.geos.coordseq import GEOSCoordSeq +from django.contrib.gis.geos.mutable_list import ListMixin +from django.contrib.gis.geos.point import Point +from django.contrib.gis.geos.prepared import PreparedGeometry +from django.utils.deconstruct import _Deconstructible +from typing_extensions import Self + +class GEOSGeometryBase(GEOSBase): + ptr_type: Any + destructor: Any + has_cs: bool + def __init__(self, ptr: Any, cls: Any) -> None: ... + def __copy__(self) -> Self: ... + def __deepcopy__(self, memodict: Any) -> Self: ... + @staticmethod + def from_ewkt(ewkt: str) -> GEOSGeometry: ... + @classmethod + def from_gml(cls, gml_string: str) -> GEOSGeometry: ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... + def __or__(self, other: GEOSGeometry) -> GEOSGeometry: ... + def __and__(self, other: GEOSGeometry) -> GEOSGeometry: ... + def __sub__(self, other: GEOSGeometry) -> GEOSGeometry: ... + def __xor__(self, other: GEOSGeometry) -> GEOSGeometry: ... + @property + def coord_seq(self) -> GEOSCoordSeq | None: ... + @property + def geom_type(self) -> str: ... + @property + def geom_typeid(self) -> int: ... + @property + def num_geom(self) -> int: ... + @property + def num_coords(self) -> int: ... + @property + def num_points(self) -> int: ... + @property + def dims(self) -> int: ... + def normalize(self) -> None: ... + @property + def empty(self) -> bool: ... + @property + def hasz(self) -> bool: ... + @property + def ring(self) -> bool: ... + @property + def simple(self) -> bool: ... + @property + def valid(self) -> bool: ... + @property + def valid_reason(self) -> str: ... + def contains(self, other: GEOSGeometry) -> bool: ... + def covers(self, other: GEOSGeometry) -> bool: ... + def crosses(self, other: GEOSGeometry) -> bool: ... + def disjoint(self, other: GEOSGeometry) -> bool: ... + def equals(self, other: GEOSGeometry) -> bool: ... + def equals_exact(self, other: GEOSGeometry, tolerance: float = ...) -> bool: ... + def equals_identical(self, other: GEOSGeometry) -> bool: ... + def intersects(self, other: GEOSGeometry) -> bool: ... + def overlaps(self, other: GEOSGeometry) -> bool: ... + def relate_pattern(self, other: GEOSGeometry, pattern: str) -> bool: ... + def touches(self, other: GEOSGeometry) -> bool: ... + def within(self, other: GEOSGeometry) -> bool: ... + @property + def srid(self) -> int | None: ... + @srid.setter + def srid(self, srid: int | None) -> None: ... + @property + def ewkt(self) -> str: ... + @property + def wkt(self) -> str: ... + @property + def hex(self) -> bytes: ... + @property + def hexewkb(self) -> bytes: ... + @property + def json(self) -> str: ... + geojson: str + @property + def wkb(self) -> memoryview: ... + @property + def ewkb(self) -> memoryview: ... + @property + def kml(self) -> str: ... + @property + def prepared(self) -> PreparedGeometry: ... + @property + def ogr(self) -> OGRGeometry: ... + @property + def srs(self) -> SpatialReference | None: ... + @property + def crs(self) -> SpatialReference | None: ... + ptr: Any + def transform(self, ct: CoordTransform | SpatialReference | str | int, clone: bool = ...) -> GEOSGeometry: ... + @property + def boundary(self) -> GEOSGeometry: ... + def buffer(self, width: float, quadsegs: int = ...) -> GEOSGeometry: ... + def buffer_with_style( + self, + width: float, + quadsegs: int = ..., + end_cap_style: int = ..., + join_style: int = ..., + mitre_limit: float = ..., + ) -> GEOSGeometry: ... + @property + def centroid(self) -> Point: ... + @property + def convex_hull(self) -> GEOSGeometry: ... + def difference(self, other: GEOSGeometry) -> GEOSGeometry: ... + @property + def envelope(self) -> GEOSGeometry: ... + def intersection(self, other: GEOSGeometry) -> GEOSGeometry: ... + @property + def point_on_surface(self) -> Point: ... + def relate(self, other: GEOSGeometry) -> str: ... + def simplify(self, tolerance: float = ..., preserve_topology: bool = ...) -> GEOSGeometry: ... + def sym_difference(self, other: GEOSGeometry) -> GEOSGeometry: ... + @property + def unary_union(self) -> GEOSGeometry: ... + def union(self, other: GEOSGeometry) -> GEOSGeometry: ... + @property + def area(self) -> float: ... + def distance(self, other: GEOSGeometry) -> float: ... + @property + def extent(self) -> tuple[float, float, float, float]: ... + @property + def length(self) -> float: ... + def clone(self) -> Self: ... + +class LinearGeometryMixin: + def interpolate(self, distance: float) -> Point: ... + def interpolate_normalized(self, distance: float) -> Point: ... + def project(self, point: Point) -> float: ... + def project_normalized(self, point: Point) -> float: ... + @property + def merged(self) -> GEOSGeometry: ... + @property + def closed(self) -> bool: ... + +class GEOSGeometry(_Deconstructible, GEOSGeometryBase, ListMixin): + def __init__(self, geo_input: Any, srid: int | None = ...) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/io.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/io.pyi new file mode 100644 index 000000000000..21528286e9ff --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/io.pyi @@ -0,0 +1,10 @@ +from django.contrib.gis.geos.geometry import GEOSGeometry +from django.contrib.gis.geos.prototypes.io import WKBWriter as WKBWriter +from django.contrib.gis.geos.prototypes.io import WKTWriter as WKTWriter +from django.contrib.gis.geos.prototypes.io import _WKBReader, _WKTReader + +class WKBReader(_WKBReader): + def read(self, wkb: bytes | str) -> GEOSGeometry: ... + +class WKTReader(_WKTReader): + def read(self, wkt: bytes | str) -> GEOSGeometry: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/libgeos.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/libgeos.pyi new file mode 100644 index 000000000000..406f52708d76 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/libgeos.pyi @@ -0,0 +1,41 @@ +from ctypes import Structure +from logging import Logger +from typing import Any + +logger: Logger + +def load_geos() -> Any: ... + +NOTICEFUNC: Any + +def notice_h(fmt: Any, lst: Any) -> None: ... + +ERRORFUNC: Any + +def error_h(fmt: Any, lst: Any) -> None: ... + +class GEOSGeom_t(Structure): ... +class GEOSPrepGeom_t(Structure): ... +class GEOSCoordSeq_t(Structure): ... +class GEOSContextHandle_t(Structure): ... + +GEOM_PTR: Any +PREPGEOM_PTR: Any +CS_PTR: Any +CONTEXT_PTR: Any +lgeos: Any + +class GEOSFuncFactory: + argtypes: Any + restype: Any + errcheck: Any + func_name: Any + def __init__( + self, func_name: Any, *, restype: Any | None = ..., errcheck: Any | None = ..., argtypes: Any | None = ... + ) -> None: ... + def __call__(self, *args: Any) -> Any: ... + @property + def func(self) -> Any: ... + +def geos_version() -> bytes: ... +def geos_version_tuple() -> tuple[int, ...]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/linestring.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/linestring.pyi new file mode 100644 index 000000000000..d7a6fc614603 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/linestring.pyi @@ -0,0 +1,26 @@ +from collections.abc import Iterator +from typing import Any + +from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin + +class LineString(LinearGeometryMixin, GEOSGeometry): + has_cs: bool + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __iter__(self) -> Iterator[tuple[float, ...]]: ... + def __len__(self) -> int: ... + @property + def coords(self) -> tuple[tuple[float, ...]]: ... + @property + def tuple(self) -> tuple[tuple[float, ...]]: ... + @property + def array(self) -> Any: ... + @property + def x(self) -> Any: ... + @property + def y(self) -> Any: ... + @property + def z(self) -> Any: ... + +class LinearRing(LineString): + @property + def is_counterclockwise(self) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/mutable_list.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/mutable_list.pyi new file mode 100644 index 000000000000..696d037141fa --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/mutable_list.pyi @@ -0,0 +1,26 @@ +from typing import Any + +from typing_extensions import Self + +class ListMixin: + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __getitem__(self, index: int | slice) -> Any: ... + def __delitem__(self, index: int | slice) -> None: ... + def __setitem__(self, index: int | slice, val: Any) -> None: ... + def __add__(self, other: Any) -> Self: ... + def __radd__(self, other: Any) -> Any: ... + def __iadd__(self, other: Any) -> Self: ... + def __mul__(self, n: int) -> Self: ... + def __rmul__(self, n: int) -> Self: ... + def __imul__(self, n: int) -> Self: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: Any) -> bool: ... + def count(self, val: Any) -> int: ... + def index(self, val: Any) -> int: ... + def append(self, val: Any) -> None: ... + def extend(self, vals: Any) -> None: ... + def insert(self, index: int, val: Any) -> None: ... + def pop(self, index: int = ...) -> Any: ... + def remove(self, val: Any) -> None: ... + def reverse(self) -> None: ... + def sort(self, key: Any | None = ..., reverse: bool = ...) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/point.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/point.pyi new file mode 100644 index 000000000000..791fe202fb49 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/point.pyi @@ -0,0 +1,28 @@ +from collections.abc import Iterator +from typing import Any + +from django.contrib.gis.geos.geometry import GEOSGeometry + +class Point(GEOSGeometry): + has_cs: bool + def __init__( + self, x: Any | None = ..., y: Any | None = ..., z: Any | None = ..., srid: Any | None = ... + ) -> None: ... + def __iter__(self) -> Iterator[float]: ... + def __len__(self) -> int: ... + @property + def x(self) -> float: ... + @x.setter + def x(self, value: float) -> None: ... + @property + def y(self) -> float: ... + @y.setter + def y(self, value: float) -> None: ... + @property + def z(self) -> float | None: ... + @z.setter + def z(self, value: float) -> None: ... + @property + def coords(self) -> tuple[float, ...]: ... + @coords.setter + def coords(self, tup: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/polygon.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/polygon.pyi new file mode 100644 index 000000000000..4d818e01507a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/polygon.pyi @@ -0,0 +1,20 @@ +from collections.abc import Iterator +from typing import Any + +from django.contrib.gis.geos.geometry import GEOSGeometry +from django.contrib.gis.geos.linestring import LinearRing + +class Polygon(GEOSGeometry): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __iter__(self) -> Iterator[LinearRing]: ... + def __len__(self) -> int: ... + @classmethod + def from_bbox(cls, bbox: tuple[float, float, float, float]) -> Polygon: ... + @property + def num_interior_rings(self) -> int: ... + exterior_ring: LinearRing + shell: LinearRing + @property + def coords(self) -> tuple[tuple[tuple[float, ...]]]: ... + @property + def tuple(self) -> tuple[tuple[tuple[float, ...]]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prepared.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prepared.pyi new file mode 100644 index 000000000000..f71ea3b97a63 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prepared.pyi @@ -0,0 +1,19 @@ +from typing import Any + +from .base import GEOSBase +from .geometry import GEOSGeometry + +class PreparedGeometry(GEOSBase): + ptr_type: Any + destructor: Any + ptr: Any + def __init__(self, geom: Any) -> None: ... + def contains(self, other: GEOSGeometry) -> bool: ... + def contains_properly(self, other: GEOSGeometry) -> bool: ... + def covers(self, other: GEOSGeometry) -> bool: ... + def intersects(self, other: GEOSGeometry) -> bool: ... + def crosses(self, other: GEOSGeometry) -> bool: ... + def disjoint(self, other: GEOSGeometry) -> bool: ... + def overlaps(self, other: GEOSGeometry) -> bool: ... + def touches(self, other: GEOSGeometry) -> bool: ... + def within(self, other: GEOSGeometry) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/__init__.pyi new file mode 100644 index 000000000000..eaae35db08f0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/__init__.pyi @@ -0,0 +1,51 @@ +from django.contrib.gis.geos.prototypes.coordseq import create_cs as create_cs +from django.contrib.gis.geos.prototypes.coordseq import cs_clone as cs_clone +from django.contrib.gis.geos.prototypes.coordseq import cs_getdims as cs_getdims +from django.contrib.gis.geos.prototypes.coordseq import cs_getordinate as cs_getordinate +from django.contrib.gis.geos.prototypes.coordseq import cs_getsize as cs_getsize +from django.contrib.gis.geos.prototypes.coordseq import cs_getx as cs_getx +from django.contrib.gis.geos.prototypes.coordseq import cs_gety as cs_gety +from django.contrib.gis.geos.prototypes.coordseq import cs_getz as cs_getz +from django.contrib.gis.geos.prototypes.coordseq import cs_is_ccw as cs_is_ccw +from django.contrib.gis.geos.prototypes.coordseq import cs_setordinate as cs_setordinate +from django.contrib.gis.geos.prototypes.coordseq import cs_setx as cs_setx +from django.contrib.gis.geos.prototypes.coordseq import cs_sety as cs_sety +from django.contrib.gis.geos.prototypes.coordseq import cs_setz as cs_setz +from django.contrib.gis.geos.prototypes.coordseq import get_cs as get_cs +from django.contrib.gis.geos.prototypes.geom import create_collection as create_collection +from django.contrib.gis.geos.prototypes.geom import create_empty_polygon as create_empty_polygon +from django.contrib.gis.geos.prototypes.geom import create_linearring as create_linearring +from django.contrib.gis.geos.prototypes.geom import create_linestring as create_linestring +from django.contrib.gis.geos.prototypes.geom import create_point as create_point +from django.contrib.gis.geos.prototypes.geom import create_polygon as create_polygon +from django.contrib.gis.geos.prototypes.geom import destroy_geom as destroy_geom +from django.contrib.gis.geos.prototypes.geom import geom_clone as geom_clone +from django.contrib.gis.geos.prototypes.geom import geos_get_srid as geos_get_srid +from django.contrib.gis.geos.prototypes.geom import geos_normalize as geos_normalize +from django.contrib.gis.geos.prototypes.geom import geos_set_srid as geos_set_srid +from django.contrib.gis.geos.prototypes.geom import geos_type as geos_type +from django.contrib.gis.geos.prototypes.geom import geos_typeid as geos_typeid +from django.contrib.gis.geos.prototypes.geom import get_dims as get_dims +from django.contrib.gis.geos.prototypes.geom import get_extring as get_extring +from django.contrib.gis.geos.prototypes.geom import get_geomn as get_geomn +from django.contrib.gis.geos.prototypes.geom import get_intring as get_intring +from django.contrib.gis.geos.prototypes.geom import get_nrings as get_nrings +from django.contrib.gis.geos.prototypes.geom import get_num_coords as get_num_coords +from django.contrib.gis.geos.prototypes.geom import get_num_geoms as get_num_geoms +from django.contrib.gis.geos.prototypes.predicates import geos_contains as geos_contains +from django.contrib.gis.geos.prototypes.predicates import geos_covers as geos_covers +from django.contrib.gis.geos.prototypes.predicates import geos_crosses as geos_crosses +from django.contrib.gis.geos.prototypes.predicates import geos_disjoint as geos_disjoint +from django.contrib.gis.geos.prototypes.predicates import geos_equals as geos_equals +from django.contrib.gis.geos.prototypes.predicates import geos_equalsexact as geos_equalsexact +from django.contrib.gis.geos.prototypes.predicates import geos_hasz as geos_hasz +from django.contrib.gis.geos.prototypes.predicates import geos_intersects as geos_intersects +from django.contrib.gis.geos.prototypes.predicates import geos_isclosed as geos_isclosed +from django.contrib.gis.geos.prototypes.predicates import geos_isempty as geos_isempty +from django.contrib.gis.geos.prototypes.predicates import geos_isring as geos_isring +from django.contrib.gis.geos.prototypes.predicates import geos_issimple as geos_issimple +from django.contrib.gis.geos.prototypes.predicates import geos_isvalid as geos_isvalid +from django.contrib.gis.geos.prototypes.predicates import geos_overlaps as geos_overlaps +from django.contrib.gis.geos.prototypes.predicates import geos_relatepattern as geos_relatepattern +from django.contrib.gis.geos.prototypes.predicates import geos_touches as geos_touches +from django.contrib.gis.geos.prototypes.predicates import geos_within as geos_within diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi new file mode 100644 index 000000000000..b0505f4cbbea --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/coordseq.pyi @@ -0,0 +1,35 @@ +from typing import Any + +from django.contrib.gis.geos.libgeos import GEOSFuncFactory + +def check_cs_op(result: Any, func: Any, cargs: Any) -> Any: ... +def check_cs_get(result: Any, func: Any, cargs: Any) -> Any: ... + +class CsInt(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + +class CsOperation(GEOSFuncFactory): + restype: Any + def __init__(self, *args: Any, ordinate: bool = ..., get: bool = ..., **kwargs: Any) -> None: ... + +class CsOutput(GEOSFuncFactory): + restype: Any + @staticmethod + def errcheck(result: Any, func: Any, cargs: Any) -> Any: ... + +cs_clone: Any +create_cs: Any +get_cs: Any +cs_getordinate: Any +cs_setordinate: Any +cs_getx: Any +cs_gety: Any +cs_getz: Any +cs_setx: Any +cs_sety: Any +cs_setz: Any +cs_getsize: Any +cs_getdims: Any +cs_is_ccw: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi new file mode 100644 index 000000000000..fb59af59be76 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/errcheck.pyi @@ -0,0 +1,11 @@ +from typing import Any + +free: Any + +def last_arg_byref(args: Any) -> Any: ... +def check_dbl(result: Any, func: Any, cargs: Any) -> Any: ... +def check_geom(result: Any, func: Any, cargs: Any) -> Any: ... +def check_minus_one(result: Any, func: Any, cargs: Any) -> Any: ... +def check_predicate(result: Any, func: Any, cargs: Any) -> Any: ... +def check_sized_string(result: Any, func: Any, cargs: Any) -> Any: ... +def check_string(result: Any, func: Any, cargs: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/geom.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/geom.pyi new file mode 100644 index 000000000000..72f2466fc5e1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/geom.pyi @@ -0,0 +1,43 @@ +from ctypes import c_char_p +from typing import Any + +from django.contrib.gis.geos.libgeos import GEOSFuncFactory + +c_uchar_p: Any + +class geos_char_p(c_char_p): ... + +class GeomOutput(GEOSFuncFactory): + restype: Any + errcheck: Any + +class IntFromGeom(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + +class StringFromGeom(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + +geos_normalize: Any +geos_type: Any +geos_typeid: Any +get_dims: Any +get_num_coords: Any +get_num_geoms: Any +create_point: Any +create_linestring: Any +create_linearring: Any +create_polygon: Any +create_empty_polygon: Any +create_collection: Any +get_extring: Any +get_intring: Any +get_nrings: Any +get_geomn: Any +geom_clone: Any +destroy_geom: Any +geos_get_srid: Any +geos_set_srid: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/io.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/io.pyi new file mode 100644 index 000000000000..20b3c836df35 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/io.pyi @@ -0,0 +1,126 @@ +import threading +from ctypes import Structure +from typing import Any + +from django.contrib.gis.geos.base import GEOSBase +from django.contrib.gis.geos.libgeos import GEOSFuncFactory + +class WKTReader_st(Structure): ... +class WKTWriter_st(Structure): ... +class WKBReader_st(Structure): ... +class WKBWriter_st(Structure): ... + +WKT_READ_PTR: Any +WKT_WRITE_PTR: Any +WKB_READ_PTR: Any +WKB_WRITE_PTR: Any +wkt_reader_create: Any +wkt_reader_destroy: Any +wkt_reader_read: Any +wkt_writer_create: Any +wkt_writer_destroy: Any +wkt_writer_write: Any +wkt_writer_get_outdim: Any +wkt_writer_set_outdim: Any +wkt_writer_set_trim: Any +wkt_writer_set_precision: Any +wkb_reader_create: Any +wkb_reader_destroy: Any + +class WKBReadFunc(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + +wkb_reader_read: Any +wkb_reader_read_hex: Any +wkb_writer_create: Any +wkb_writer_destroy: Any + +class WKBWriteFunc(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + +wkb_writer_write: Any +wkb_writer_write_hex: Any + +class WKBWriterGet(GEOSFuncFactory): + argtypes: Any + restype: Any + +class WKBWriterSet(GEOSFuncFactory): + argtypes: Any + +wkb_writer_get_byteorder: Any +wkb_writer_set_byteorder: Any +wkb_writer_get_outdim: Any +wkb_writer_set_outdim: Any +wkb_writer_get_include_srid: Any +wkb_writer_set_include_srid: Any + +class IOBase(GEOSBase): + ptr: Any + def __init__(self) -> None: ... + +class _WKTReader(IOBase): + ptr_type: Any + destructor: Any + def read(self, wkt: Any) -> Any: ... + +class _WKBReader(IOBase): + ptr_type: Any + destructor: Any + def read(self, wkb: Any) -> Any: ... + +def default_trim_value() -> bool: ... + +class WKTWriter(IOBase): + ptr_type: Any + destructor: Any + def __init__(self, dim: int = ..., trim: bool = ..., precision: Any | None = ...) -> None: ... + def write(self, geom: Any) -> Any: ... + @property + def outdim(self) -> Any: ... + @outdim.setter + def outdim(self, new_dim: Any) -> None: ... + @property + def trim(self) -> Any: ... + @trim.setter + def trim(self, flag: Any) -> None: ... + @property + def precision(self) -> Any: ... + @precision.setter + def precision(self, precision: Any) -> None: ... + +class WKBWriter(IOBase): + ptr_type: Any + destructor: Any + geos_version: Any + def __init__(self, dim: int = ...) -> None: ... + def write(self, geom: Any) -> Any: ... + def write_hex(self, geom: Any) -> Any: ... + byteorder: Any + @property + def outdim(self) -> Any: ... + @outdim.setter + def outdim(self, new_dim: Any) -> None: ... + @property + def srid(self) -> Any: ... + @srid.setter + def srid(self, include: Any) -> None: ... + +class ThreadLocalIO(threading.local): + wkt_r: Any + wkt_w: Any + wkb_r: Any + wkb_w: Any + ewkb_w: Any + +thread_context: Any + +def wkt_r() -> Any: ... +def wkt_w(dim: int = ..., trim: bool = ..., precision: Any | None = ...) -> Any: ... +def wkb_r() -> Any: ... +def wkb_w(dim: int = ...) -> Any: ... +def ewkb_w(dim: int = ...) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/misc.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/misc.pyi new file mode 100644 index 000000000000..30c97c461044 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/misc.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from django.contrib.gis.geos.libgeos import GEOSFuncFactory + +class DblFromGeom(GEOSFuncFactory): + restype: Any + errcheck: Any + +geos_area: Any +geos_distance: Any +geos_length: Any +geos_isvalidreason: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/predicates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/predicates.pyi new file mode 100644 index 000000000000..e0aad50c3da8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/predicates.pyi @@ -0,0 +1,30 @@ +from typing import Any + +from django.contrib.gis.geos.libgeos import GEOSFuncFactory + +class UnaryPredicate(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + +class BinaryPredicate(UnaryPredicate): + argtypes: Any + +geos_hasz: UnaryPredicate +geos_isclosed: UnaryPredicate +geos_isempty: UnaryPredicate +geos_isring: UnaryPredicate +geos_issimple: UnaryPredicate +geos_isvalid: UnaryPredicate +geos_contains: BinaryPredicate +geos_covers: BinaryPredicate +geos_crosses: BinaryPredicate +geos_disjoint: BinaryPredicate +geos_equals: BinaryPredicate +geos_equalsexact: BinaryPredicate +geos_equalsidentical: BinaryPredicate +geos_intersects: BinaryPredicate +geos_overlaps: BinaryPredicate +geos_relatepattern: BinaryPredicate +geos_touches: BinaryPredicate +geos_within: BinaryPredicate diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/prepared.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/prepared.pyi new file mode 100644 index 000000000000..47656fb2f2b6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/prepared.pyi @@ -0,0 +1,21 @@ +from typing import Any + +from django.contrib.gis.geos.libgeos import GEOSFuncFactory + +geos_prepare: Any +prepared_destroy: Any + +class PreparedPredicate(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + +prepared_contains: Any +prepared_contains_properly: Any +prepared_covers: Any +prepared_crosses: Any +prepared_disjoint: Any +prepared_intersects: Any +prepared_overlaps: Any +prepared_touches: Any +prepared_within: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi new file mode 100644 index 000000000000..4774195c955c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/threadsafe.pyi @@ -0,0 +1,24 @@ +import threading +from typing import Any + +from django.contrib.gis.geos.base import GEOSBase + +class GEOSContextHandle(GEOSBase): + ptr_type: Any + destructor: Any + ptr: Any + def __init__(self) -> None: ... + +class GEOSContext(threading.local): + handle: Any + +thread_context: Any + +class GEOSFunc: + cfunc: Any + thread_context: Any + def __init__(self, func_name: Any) -> None: ... + def __call__(self, *args: Any) -> Any: ... + argtypes: Any + restype: Any + errcheck: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/topology.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/topology.pyi new file mode 100644 index 000000000000..94ffcd939730 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/geos/prototypes/topology.pyi @@ -0,0 +1,29 @@ +from typing import Any + +from django.contrib.gis.geos.libgeos import GEOSFuncFactory + +class Topology(GEOSFuncFactory): + argtypes: Any + restype: Any + errcheck: Any + +geos_boundary: Any +geos_buffer: Any +geos_bufferwithstyle: Any +geos_centroid: Any +geos_convexhull: Any +geos_difference: Any +geos_envelope: Any +geos_intersection: Any +geos_linemerge: Any +geos_pointonsurface: Any +geos_preservesimplify: Any +geos_simplify: Any +geos_symdifference: Any +geos_union: Any +geos_unary_union: Any +geos_relate: Any +geos_project: Any +geos_interpolate: Any +geos_project_normalized: Any +geos_interpolate_normalized: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/measure.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/measure.pyi new file mode 100644 index 000000000000..3cdd78577fb9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/measure.pyi @@ -0,0 +1,40 @@ +from decimal import Decimal +from typing import Any + +from typing_extensions import Self, TypeAlias + +_NUMERIC_TYPES: TypeAlias = int | float | Decimal + +class MeasureBase: + STANDARD_UNIT: str | None + UNITS: dict[str, float] + ALIAS: dict[str, str] + LALIAS: dict[str, str] + def __init__(self, default_unit: str | None = None, **kwargs: Any) -> None: ... + standard: Any + def __getattr__(self, name: str) -> float: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: Self) -> bool: ... + def __add__(self, other: Self) -> Self: ... + def __iadd__(self, other: Self) -> Self: ... + def __sub__(self, other: Self) -> Self: ... + def __isub__(self, other: Self) -> Self: ... + def __mul__(self, other: _NUMERIC_TYPES) -> Any: ... + def __imul__(self, other: _NUMERIC_TYPES) -> Self: ... + def __rmul__(self, other: Any) -> Self: ... + def __truediv__(self, other: _NUMERIC_TYPES) -> Self: ... + def __itruediv__(self, other: _NUMERIC_TYPES) -> Self: ... + def __bool__(self) -> bool: ... + def default_units(self, kwargs: dict[str, Any]) -> tuple[float, str]: ... + @classmethod + def unit_attname(cls, unit_str: str) -> str: ... + +class Distance(MeasureBase): + STANDARD_UNIT: str + +class Area(MeasureBase): + STANDARD_UNIT: str + +D: TypeAlias = Distance + +A: TypeAlias = Area diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/ptr.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/ptr.pyi new file mode 100644 index 000000000000..93d740b423d0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/ptr.pyi @@ -0,0 +1,11 @@ +from typing import Any + +class CPointerBase: + ptr_type: Any + destructor: Any + null_ptr_exception_class: Any + @property + def ptr(self) -> Any: ... + @ptr.setter + def ptr(self, ptr: Any) -> None: ... + def __del__(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/serializers/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/serializers/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/serializers/geojson.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/serializers/geojson.pyi new file mode 100644 index 000000000000..757bc606da78 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/serializers/geojson.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from django.core.serializers.json import Serializer as JSONSerializer + +class Serializer(JSONSerializer): + def start_serialization(self) -> None: ... + def end_serialization(self) -> None: ... + geometry_field: Any + def start_object(self, obj: Any) -> None: ... + def get_dump_object(self, obj: Any) -> Any: ... + def handle_field(self, obj: Any, field: Any) -> None: ... + +class Deserializer: + def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/shortcuts.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/shortcuts.pyi new file mode 100644 index 000000000000..cb2f0443ba85 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/shortcuts.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.http.response import HttpResponse + +def compress_kml(kml: str) -> bytes: ... +def render_to_kml(*args: Any, **kwargs: Any) -> HttpResponse: ... +def render_to_kmz(*args: Any, **kwargs: Any) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/__init__.pyi new file mode 100644 index 000000000000..3d41fca13f9b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/__init__.pyi @@ -0,0 +1,2 @@ +from django.contrib.gis.sitemaps.kml import KMLSitemap as KMLSitemap +from django.contrib.gis.sitemaps.kml import KMZSitemap as KMZSitemap diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/kml.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/kml.pyi new file mode 100644 index 000000000000..679e7900cebd --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/kml.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from django.contrib.sitemaps import Sitemap + +class KMLSitemap(Sitemap): + geo_format: str + locations: Any + def __init__(self, locations: Any | None = ...) -> None: ... + def items(self) -> Any: ... + def location(self, obj: Any) -> Any: ... + +class KMZSitemap(KMLSitemap): + geo_format: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/views.pyi new file mode 100644 index 000000000000..efc64d88f18f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/sitemaps/views.pyi @@ -0,0 +1,13 @@ +from django.http import HttpRequest, HttpResponse + +def kml( + request: HttpRequest, + label: str, + model: str, + field_name: str | None = ..., + compress: bool = ..., + using: str = ..., +) -> HttpResponse: ... +def kmz( + request: HttpRequest, label: str, model: str, field_name: str | None = ..., using: str = ... +) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/__init__.pyi new file mode 100644 index 000000000000..833d3c7e1746 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/__init__.pyi @@ -0,0 +1,6 @@ +from django.contrib.gis.utils.layermapping import LayerMapError as LayerMapError +from django.contrib.gis.utils.layermapping import LayerMapping as LayerMapping +from django.contrib.gis.utils.ogrinfo import ogrinfo as ogrinfo +from django.contrib.gis.utils.ogrinspect import mapping as mapping +from django.contrib.gis.utils.ogrinspect import ogrinspect as ogrinspect +from django.contrib.gis.utils.srs import add_srs_entry as add_srs_entry diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/layermapping.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/layermapping.pyi new file mode 100644 index 000000000000..bf13f43d07dc --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/layermapping.pyi @@ -0,0 +1,74 @@ +from collections.abc import Mapping +from pathlib import Path +from typing import Any, Protocol, type_check_only + +from django.contrib.gis.gdal import DataSource, OGRGeomType +from django.contrib.gis.gdal.field import Field as OGRField +from django.contrib.gis.gdal.layer import Layer +from django.db.backends.base.operations import BaseDatabaseOperations +from django.db.models import Field, Model + +class LayerMapError(Exception): ... +class InvalidString(LayerMapError): ... +class InvalidDecimal(LayerMapError): ... +class InvalidInteger(LayerMapError): ... +class MissingForeignKey(LayerMapError): ... + +@type_check_only +class _Writer(Protocol): + def write(self, s: str, /) -> Any: ... + +class LayerMapping: + MULTI_TYPES: dict[int, OGRGeomType] + FIELD_TYPES: dict[Field, OGRField | tuple[OGRField, ...]] + ds: DataSource + layer: Layer + using: str + spatial_backend: BaseDatabaseOperations + mapping: Mapping[str, str] + model: type[Model] + geo_field: Any + source_srs: Any + transform: Any + encoding: str | None + unique: list[str] | tuple[str, ...] | str | None + transaction_mode: Any + transaction_decorator: Any + def __init__( + self, + model: type[Model], + data: str | Path | DataSource, + mapping: Mapping[str, str], + layer: int = ..., + source_srs: Any | None = ..., + encoding: str = ..., + transaction_mode: str = ..., + transform: bool = ..., + unique: list[str] | tuple[str, ...] | str | None = ..., + using: str | None = ..., + ) -> None: ... + def check_fid_range(self, fid_range: Any) -> Any: ... + geom_field: str + fields: dict[str, Field] + coord_dim: int + def check_layer(self) -> Any: ... + def check_srs(self, source_srs: Any) -> Any: ... + def check_unique(self, unique: Any) -> None: ... + def feature_kwargs(self, feat: Any) -> Any: ... + def unique_kwargs(self, kwargs: Any) -> Any: ... + def verify_ogr_field(self, ogr_field: Any, model_field: Any) -> Any: ... + def verify_fk(self, feat: Any, rel_model: Any, rel_mapping: Any) -> Any: ... + def verify_geom(self, geom: Any, model_field: Any) -> Any: ... + def coord_transform(self) -> Any: ... + def geometry_field(self) -> Any: ... + def make_multi(self, geom_type: Any, model_field: Any) -> Any: ... + def save( + self, + verbose: bool = ..., + fid_range: bool = ..., + step: bool = ..., + progress: bool = ..., + silent: bool = ..., + stream: _Writer = ..., + strict: bool = ..., + ) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/ogrinfo.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/ogrinfo.pyi new file mode 100644 index 000000000000..3028569afd95 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/ogrinfo.pyi @@ -0,0 +1,3 @@ +from django.contrib.gis.gdal import DataSource + +def ogrinfo(data_source: str | DataSource, num_features: int = ...) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/ogrinspect.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/ogrinspect.pyi new file mode 100644 index 000000000000..cc6874c5da9e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/ogrinspect.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.contrib.gis.gdal import DataSource + +def mapping( + data_source: str | DataSource, geom_name: str = ..., layer_key: int | str = ..., multi_geom: bool = ... +) -> dict[str, str]: ... +def ogrinspect(data_source: str | DataSource, model_name: str, *args: Any, **kwargs: Any) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/srs.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/srs.pyi new file mode 100644 index 000000000000..bf6472f78cb7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/utils/srs.pyi @@ -0,0 +1,9 @@ +from typing import Any + +def add_srs_entry( + srs: Any, + auth_name: str = ..., + auth_srid: Any | None = ..., + ref_sys_name: Any | None = ..., + database: Any | None = ..., +) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/views.pyi new file mode 100644 index 000000000000..fe9efc44127b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/gis/views.pyi @@ -0,0 +1,4 @@ +from django.contrib.gis.feeds import Feed +from django.http import HttpRequest, HttpResponse + +def feed(request: HttpRequest, url: str, feed_dict: dict[str, type[Feed]] | None = ...) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/apps.pyi new file mode 100644 index 000000000000..9bc3a53be52c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/apps.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.apps import AppConfig + +class HumanizeConfig(AppConfig): + name: str + verbose_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/templatetags/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/templatetags/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/templatetags/humanize.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/templatetags/humanize.pyi new file mode 100644 index 000000000000..46804d54f37c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/humanize/templatetags/humanize.pyi @@ -0,0 +1,24 @@ +from collections.abc import Callable +from datetime import date, datetime +from typing import Any, SupportsInt + +from django import template + +register: template.Library + +def ordinal(value: str | SupportsInt | None) -> str | None: ... +def intcomma(value: str | SupportsInt | None, use_l10n: bool = True) -> str: ... + +intword_converters: tuple[tuple[int, Callable]] + +def intword(value: str | SupportsInt | None) -> int | str | None: ... +def apnumber(value: str | SupportsInt | None) -> int | str | None: ... +def naturalday(value: date | str | None, arg: str | None = None) -> str | None: ... +def naturaltime(value: datetime) -> str: ... + +class NaturalTimeFormatter: + time_strings: dict[str, str] + past_substrings: dict[str, str] + future_substrings: dict[str, str] + @classmethod + def string_for(cls: type[NaturalTimeFormatter], value: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/__init__.pyi new file mode 100644 index 000000000000..19149436c410 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/__init__.pyi @@ -0,0 +1,17 @@ +from .api import MessageFailure as MessageFailure +from .api import add_message as add_message +from .api import debug as debug +from .api import error as error +from .api import get_level as get_level +from .api import get_messages as get_messages +from .api import info as info +from .api import set_level as set_level +from .api import success as success +from .api import warning as warning +from .constants import DEBUG as DEBUG +from .constants import DEFAULT_LEVELS as DEFAULT_LEVELS +from .constants import DEFAULT_TAGS as DEFAULT_TAGS +from .constants import ERROR as ERROR +from .constants import INFO as INFO +from .constants import SUCCESS as SUCCESS +from .constants import WARNING as WARNING diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/api.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/api.pyi new file mode 100644 index 000000000000..f71febff244c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/api.pyi @@ -0,0 +1,48 @@ +from typing import Any + +from django.contrib.messages.storage.base import BaseStorage +from django.http.request import HttpRequest +from django.utils.functional import _StrOrPromise + +class MessageFailure(Exception): ... + +def add_message( + request: HttpRequest | None, + level: int, + message: _StrOrPromise, + extra_tags: str = "", + fail_silently: bool | str = False, +) -> None: ... +def get_messages(request: HttpRequest) -> list[Any] | BaseStorage: ... +def get_level(request: HttpRequest) -> int: ... +def set_level(request: HttpRequest, level: int) -> bool: ... +def debug( + request: HttpRequest, + message: _StrOrPromise, + extra_tags: str = "", + fail_silently: bool | str = False, +) -> None: ... +def info( + request: HttpRequest, + message: _StrOrPromise, + extra_tags: str = "", + fail_silently: bool | str = False, +) -> None: ... +def success( + request: HttpRequest, + message: _StrOrPromise, + extra_tags: str = "", + fail_silently: bool | str = False, +) -> None: ... +def warning( + request: HttpRequest, + message: _StrOrPromise, + extra_tags: str = "", + fail_silently: bool | str = False, +) -> None: ... +def error( + request: HttpRequest, + message: _StrOrPromise, + extra_tags: str = "", + fail_silently: bool | str = False, +) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/apps.pyi new file mode 100644 index 000000000000..934a185b8175 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/apps.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.apps import AppConfig + +def update_level_tags(setting: str, **kwargs: Any) -> None: ... + +class MessagesConfig(AppConfig): + name: str + verbose_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/constants.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/constants.pyi new file mode 100644 index 000000000000..2904b34bd2d7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/constants.pyi @@ -0,0 +1,9 @@ +DEBUG: int +INFO: int +SUCCESS: int +WARNING: int +ERROR: int + +DEFAULT_TAGS: dict[int, str] + +DEFAULT_LEVELS: dict[str, int] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/context_processors.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/context_processors.pyi new file mode 100644 index 000000000000..7fb1a97da790 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/context_processors.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.contrib.messages.storage.base import BaseStorage +from django.http.request import HttpRequest + +def messages(request: HttpRequest) -> dict[str, dict[str, int] | list[Any] | BaseStorage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/middleware.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/middleware.pyi new file mode 100644 index 000000000000..427f8d0a7ca9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/middleware.pyi @@ -0,0 +1,7 @@ +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.utils.deprecation import MiddlewareMixin + +class MessageMiddleware(MiddlewareMixin): + def process_request(self, request: HttpRequest) -> None: ... + def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/__init__.pyi new file mode 100644 index 000000000000..3616d6f7004c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/__init__.pyi @@ -0,0 +1,4 @@ +from django.contrib.messages.storage.base import BaseStorage +from django.http.request import HttpRequest + +def default_storage(request: HttpRequest) -> BaseStorage: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/base.pyi new file mode 100644 index 000000000000..17b2e83c49d4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/base.pyi @@ -0,0 +1,29 @@ +from collections.abc import Iterator +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase + +LEVEL_TAGS: Any + +class Message: + level: int + message: str + extra_tags: str + def __init__(self, level: int, message: str, extra_tags: str | None = None) -> None: ... + @property + def tags(self) -> str: ... + @property + def level_tag(self) -> str: ... + +class BaseStorage: + request: HttpRequest + used: bool + added_new: bool + def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[Message]: ... + def __contains__(self, item: Any) -> bool: ... + def update(self, response: HttpResponseBase) -> list[Message] | None: ... + def add(self, level: int, message: str, extra_tags: str | None = "") -> None: ... + level: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/cookie.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/cookie.pyi new file mode 100644 index 000000000000..b6e6ae592150 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/cookie.pyi @@ -0,0 +1,33 @@ +import json +from typing import Any, Callable, Sequence + +from django.contrib.messages.storage.base import BaseStorage + +class MessageEncoder(json.JSONEncoder): + allow_nan: bool + check_circular: bool + ensure_ascii: bool + skipkeys: bool + sort_keys: bool + message_key: str + +class MessageDecoder(json.JSONDecoder): + def process_messages(self, obj: Any) -> Any: ... + +class MessagePartSerializer: + def dumps(self, obj: Any) -> Sequence[str]: ... + +class MessagePartGatherSerializer: + def dumps(self, obj: Any) -> bytes: ... + +class MessageSerializer: + def loads(self, data: bytes | bytearray) -> Any: ... + +class CookieStorage(BaseStorage): + cookie_name: str + max_cookie_size: int + not_finished: str + not_finished_json: str + +def bisect_keep_left(a: list[int], fn: Callable[[list[int]], bool]) -> int: ... +def bisect_keep_right(a: list[int], fn: Callable[[list[int]], bool]) -> int: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/fallback.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/fallback.pyi new file mode 100644 index 000000000000..cfea1f37eb5b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/fallback.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.contrib.messages.storage.base import BaseStorage + +class FallbackStorage(BaseStorage): + storage_classes: Any + storages: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/session.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/session.pyi new file mode 100644 index 000000000000..e8880f958290 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/storage/session.pyi @@ -0,0 +1,11 @@ +from collections.abc import Sequence +from typing import Any + +from django.contrib.messages.storage.base import BaseStorage +from django.http.request import HttpRequest + +class SessionStorage(BaseStorage): + session_key: str + def __init__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... + def serialize_messages(self, messages: Sequence[Any]) -> str: ... + def deserialize_messages(self, data: list[Any] | str | None) -> list[Any] | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/test.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/test.pyi new file mode 100644 index 000000000000..152c4a8f2fd7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/test.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.contrib.messages.storage.base import BaseStorage +from django.http.response import HttpResponse + +class MessagesTestMixin: + def assertMessages( + self, response: HttpResponse, expected_messages: list[Any] | BaseStorage, *, ordered: bool = True + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/utils.pyi new file mode 100644 index 000000000000..13affff7c541 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/utils.pyi @@ -0,0 +1 @@ +def get_level_tags() -> dict[int, str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/views.pyi new file mode 100644 index 000000000000..e746f9ec7252 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/messages/views.pyi @@ -0,0 +1,12 @@ +from typing import Generic, TypeVar + +from django.forms.forms import BaseForm +from django.http.response import HttpResponse +from django.utils.functional import _StrOrPromise + +_F = TypeVar("_F", bound=BaseForm) + +class SuccessMessageMixin(Generic[_F]): + success_message: _StrOrPromise + def form_valid(self, form: _F) -> HttpResponse: ... + def get_success_message(self, cleaned_data: dict[str, str]) -> _StrOrPromise: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/__init__.pyi new file mode 100644 index 000000000000..217067c5ec3b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/__init__.pyi @@ -0,0 +1,20 @@ +from .general import ArrayAgg as ArrayAgg +from .general import BitAnd as BitAnd +from .general import BitOr as BitOr +from .general import BitXor as BitXor +from .general import BoolAnd as BoolAnd +from .general import BoolOr as BoolOr +from .general import JSONBAgg as JSONBAgg +from .general import StringAgg as StringAgg +from .statistics import Corr as Corr +from .statistics import CovarPop as CovarPop +from .statistics import RegrAvgX as RegrAvgX +from .statistics import RegrAvgY as RegrAvgY +from .statistics import RegrCount as RegrCount +from .statistics import RegrIntercept as RegrIntercept +from .statistics import RegrR2 as RegrR2 +from .statistics import RegrSlope as RegrSlope +from .statistics import RegrSXX as RegrSXX +from .statistics import RegrSXY as RegrSXY +from .statistics import RegrSYY as RegrSYY +from .statistics import StatAggregate as StatAggregate diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/general.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/general.pyi new file mode 100644 index 000000000000..ee0841727190 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/general.pyi @@ -0,0 +1,61 @@ +from typing import Any, ClassVar + +from django.contrib.postgres.fields import ArrayField +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Aggregate, BooleanField, JSONField, TextField +from django.db.models.expressions import BaseExpression, Combinable +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from typing_extensions import Self + +from .mixins import OrderableAggMixin + +class ArrayAgg(OrderableAggMixin, Aggregate): + @property + def output_field(self) -> ArrayField: ... + def resolve_expression( + self, + query: Any = ..., + allow_joins: bool = ..., + reuse: set[str] | None = ..., + summarize: bool = ..., + for_save: bool = ..., + ) -> Self: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] + +class BitAnd(Aggregate): ... +class BitOr(Aggregate): ... +class BitXor(Aggregate): ... + +class BoolAnd(Aggregate): + output_field: ClassVar[BooleanField] + +class BoolOr(Aggregate): + output_field: ClassVar[BooleanField] + +class JSONBAgg(OrderableAggMixin, Aggregate): + output_field: ClassVar[JSONField] + def __init__( + self, *expressions: BaseExpression | Combinable | str, default: Any | None = ..., **extra: Any + ) -> None: ... + def resolve_expression( + self, + query: Any = ..., + allow_joins: bool = ..., + reuse: set[str] | None = ..., + summarize: bool = ..., + for_save: bool = ..., + ) -> Self: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] + +class StringAgg(OrderableAggMixin, Aggregate): + output_field: ClassVar[TextField] + def __init__(self, expression: BaseExpression | Combinable | str, delimiter: Any, **extra: Any) -> None: ... + def resolve_expression( + self, + query: Any = ..., + allow_joins: bool = ..., + reuse: set[str] | None = ..., + summarize: bool = ..., + for_save: bool = ..., + ) -> Self: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/mixins.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/mixins.pyi new file mode 100644 index 000000000000..260612d5413f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/mixins.pyi @@ -0,0 +1,17 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.expressions import BaseExpression, Combinable, Expression, OrderByList +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from typing_extensions import Self + +class OrderableAggMixin: + order_by: OrderByList + def __init__( + self, *expressions: BaseExpression | Combinable | str, ordering: Sequence[str] = ..., **extra: Any + ) -> None: ... + def resolve_expression(self, *args: Any, **kwargs: Any) -> Self: ... + def get_source_expressions(self) -> list[Expression]: ... + def set_source_expressions(self, exprs: Sequence[Combinable]) -> None: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/statistics.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/statistics.pyi new file mode 100644 index 000000000000..d5a449d1bedb --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/aggregates/statistics.pyi @@ -0,0 +1,29 @@ +from typing import Any, ClassVar + +from django.db.models import Aggregate, FloatField, IntegerField + +class StatAggregate(Aggregate): + output_field: ClassVar[FloatField] + def __init__( + self, y: Any, x: Any, output_field: Any | None = ..., filter: Any | None = ..., default: Any | None = ... + ) -> None: ... + +class Corr(StatAggregate): ... + +class CovarPop(StatAggregate): + def __init__( + self, y: Any, x: Any, sample: bool = ..., filter: Any | None = ..., default: Any | None = ... + ) -> None: ... + +class RegrAvgX(StatAggregate): ... +class RegrAvgY(StatAggregate): ... + +class RegrCount(StatAggregate): + output_field: ClassVar[IntegerField] # type: ignore[assignment] + +class RegrIntercept(StatAggregate): ... +class RegrR2(StatAggregate): ... +class RegrSlope(StatAggregate): ... +class RegrSXX(StatAggregate): ... +class RegrSXY(StatAggregate): ... +class RegrSYY(StatAggregate): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/apps.pyi new file mode 100644 index 000000000000..9c5f83cb065f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/apps.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from django.apps import AppConfig + +RANGE_TYPES: Any + +def uninstall_if_needed(setting: Any, value: Any, enter: Any, **kwargs: Any) -> None: ... + +class PostgresConfig(AppConfig): + name: str + verbose_name: Any + def ready(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/constraints.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/constraints.pyi new file mode 100644 index 000000000000..6e0d7dd245f1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/constraints.pyi @@ -0,0 +1,34 @@ +from collections.abc import Iterable, Sequence + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.models import Deferrable +from django.db.models.base import Model +from django.db.models.constraints import BaseConstraint +from django.db.models.expressions import Combinable +from django.db.models.indexes import IndexExpression +from django.db.models.query_utils import Q +from django.utils.functional import _StrOrPromise + +class ExclusionConstraintExpression(IndexExpression): ... + +class ExclusionConstraint(BaseConstraint): + template: str + expressions: Sequence[tuple[str | Combinable, str]] + index_type: str + condition: Q | None + def __init__( + self, + *, + name: str, + expressions: Sequence[tuple[str | Combinable, str]], + index_type: str | None = None, + condition: Q | None = None, + deferrable: Deferrable | None = None, + include: list[str] | tuple[str, ...] | None = None, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, + ) -> None: ... + def check_supported(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... + def validate( + self, model: type[Model], instance: Model, exclude: Iterable[str] | None = None, using: str = "default" + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/expressions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/expressions.pyi new file mode 100644 index 000000000000..f7e76d9a9f0a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/expressions.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from django.contrib.postgres.fields import ArrayField +from django.db.models import Subquery +from django.db.models.query import QuerySet +from django.db.models.sql.query import Query +from django.utils.functional import cached_property + +class ArraySubquery(Subquery): + template: str + + def __init__(self, queryset: Query | QuerySet[Any], **kwargs: Any) -> None: ... + @cached_property + def output_field(self) -> ArrayField: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/__init__.pyi new file mode 100644 index 000000000000..5e5cefb672b8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/__init__.pyi @@ -0,0 +1,15 @@ +from .array import ArrayField as ArrayField +from .citext import CICharField as CICharField +from .citext import CIEmailField as CIEmailField +from .citext import CIText as CIText +from .citext import CITextField as CITextField +from .hstore import HStoreField as HStoreField +from .jsonb import JSONField as JSONField +from .ranges import BigIntegerRangeField as BigIntegerRangeField +from .ranges import DateRangeField as DateRangeField +from .ranges import DateTimeRangeField as DateTimeRangeField +from .ranges import DecimalRangeField as DecimalRangeField +from .ranges import IntegerRangeField as IntegerRangeField +from .ranges import RangeBoundary as RangeBoundary +from .ranges import RangeField as RangeField +from .ranges import RangeOperators as RangeOperators diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/array.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/array.pyi new file mode 100644 index 000000000000..8b2094ab3466 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/array.pyi @@ -0,0 +1,63 @@ +from collections.abc import Iterable, Sequence +from typing import Any, TypeVar + +from _typeshed import Unused +from django.core.validators import _ValidatorCallable +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Field +from django.db.models.expressions import Combinable, Expression +from django.db.models.fields import NOT_PROVIDED, _ErrorMessagesDict, _ErrorMessagesMapping +from django.db.models.fields.mixins import CheckFieldDefaultMixin +from django.db.models.lookups import Transform +from django.utils.choices import _Choices +from django.utils.functional import _StrOrPromise + +# __set__ value type +_ST = TypeVar("_ST") +# __get__ return type +_GT = TypeVar("_GT") + +class ArrayField(CheckFieldDefaultMixin, Field[_ST, _GT]): + _pyi_private_set_type: Sequence[Any] | Combinable + _pyi_private_get_type: list[Any] + + empty_strings_allowed: bool + default_error_messages: _ErrorMessagesDict + base_field: Field + size: int | None + default_validators: Sequence[_ValidatorCallable] + from_db_value: Any + def __init__( + self, + base_field: Field, + size: int | None = None, + *, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + @property + def description(self) -> str: ... # type: ignore[override] + def cast_db_type(self, connection: BaseDatabaseWrapper) -> str: ... + def get_placeholder(self, value: Unused, compiler: Unused, connection: BaseDatabaseWrapper) -> str: ... + def get_transform(self, name: str) -> type[Transform] | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/citext.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/citext.pyi new file mode 100644 index 000000000000..3f18bbeaac42 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/citext.pyi @@ -0,0 +1,10 @@ +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.fields import CharField, EmailField, TextField + +class CIText: + def get_internal_type(self) -> str: ... + def db_type(self, connection: BaseDatabaseWrapper) -> str: ... + +class CICharField(CIText, CharField): ... +class CIEmailField(CIText, EmailField): ... +class CITextField(CIText, TextField): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/hstore.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/hstore.pyi new file mode 100644 index 000000000000..d0d2cac398d9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/hstore.pyi @@ -0,0 +1,26 @@ +from typing import Any, ClassVar + +from django.contrib.postgres.fields.array import ArrayField +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Field, TextField, Transform +from django.db.models.fields.mixins import CheckFieldDefaultMixin +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType + +class HStoreField(CheckFieldDefaultMixin, Field): + def get_transform(self, name: str) -> Any: ... + +class KeyTransform(Transform): + output_field: ClassVar[TextField] + + def __init__(self, key_name: str, *args: Any, **kwargs: Any) -> None: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] + +class KeyTransformFactory: + def __init__(self, key_name: str) -> None: ... + def __call__(self, *args: Any, **kwargs: Any) -> KeyTransform: ... + +class KeysTransform(Transform): + output_field: ClassVar[ArrayField] + +class ValuesTransform(Transform): + output_field: ClassVar[ArrayField] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/jsonb.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/jsonb.pyi new file mode 100644 index 000000000000..ef0ecf9d52e3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/jsonb.pyi @@ -0,0 +1,3 @@ +from django.db.models import JSONField as BuiltinJSONField + +class JSONField(BuiltinJSONField): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/ranges.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/ranges.pyi new file mode 100644 index 000000000000..4ada445cf825 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/ranges.pyi @@ -0,0 +1,91 @@ +from typing import Any, ClassVar, Literal, TypeVar + +from _typeshed import Unused +from django.contrib.postgres import forms +from django.db import models +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.lookups import PostgresOperatorLookup +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange, Range # type: ignore [import-untyped] + +class RangeBoundary(models.Expression): + lower: str + upper: str + def __init__(self, inclusive_lower: bool = ..., inclusive_upper: bool = ...) -> None: ... + +class RangeOperators: + EQUAL: Literal["="] + NOT_EQUAL: Literal["<>"] + CONTAINS: Literal["@>"] + CONTAINED_BY: Literal["<@"] + OVERLAPS: Literal["&&"] + FULLY_LT: Literal["<<"] + FULLY_GT: Literal[">>"] + NOT_LT: Literal["&>"] + NOT_GT: Literal["&<"] + ADJACENT_TO: Literal["-|-"] + +_RangeT = TypeVar("_RangeT", bound=Range[Any]) + +class RangeField(models.Field[Any, _RangeT]): + empty_strings_allowed: bool + base_field: type[models.Field] + range_type: type[_RangeT] + def get_prep_value(self, value: Any) -> Any | None: ... + def get_placeholder(self, value: Unused, compiler: Unused, connection: BaseDatabaseWrapper) -> str: ... + def to_python(self, value: Any) -> Any: ... + +class IntegerRangeField(RangeField[NumericRange]): + base_field: type[models.IntegerField] + form_field: type[forms.IntegerRangeField] + +class BigIntegerRangeField(RangeField[NumericRange]): + base_field: type[models.BigIntegerField] + form_field: type[forms.IntegerRangeField] + +class DecimalRangeField(RangeField[NumericRange]): + base_field: type[models.DecimalField] + form_field: type[forms.DecimalRangeField] + +class DateTimeRangeField(RangeField[DateTimeTZRange]): + base_field: type[models.DecimalField] + form_field: type[forms.DecimalRangeField] + +class DateRangeField(RangeField[DateRange]): + base_field: type[models.DateField] + form_field: type[forms.DateRangeField] + +class DateTimeRangeContains(PostgresOperatorLookup): ... + +class RangeContainedBy(PostgresOperatorLookup): + type_mapping: dict[str, str] + def process_lhs(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] + +class FullyLessThan(PostgresOperatorLookup): ... +class FullGreaterThan(PostgresOperatorLookup): ... +class NotLessThan(PostgresOperatorLookup): ... +class NotGreaterThan(PostgresOperatorLookup): ... +class AdjacentToLookup(PostgresOperatorLookup): ... + +class RangeStartsWith(models.Transform): + @property + def output_field(self) -> models.Field: ... + +class RangeEndsWith(models.Transform): + @property + def output_field(self) -> models.Field: ... + +class IsEmpty(models.Transform): + output_field: ClassVar[models.BooleanField] + +class LowerInclusive(models.Transform): + output_field: ClassVar[models.BooleanField] + +class LowerInfinite(models.Transform): + output_field: ClassVar[models.BooleanField] + +class UpperInclusive(models.Transform): + output_field: ClassVar[models.BooleanField] + +class UpperInfinite(models.Transform): + output_field: ClassVar[models.BooleanField] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/utils.pyi new file mode 100644 index 000000000000..e9aa3e135dde --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/fields/utils.pyi @@ -0,0 +1,4 @@ +from typing import Any + +class AttributeSetter: + def __init__(self, name: Any, value: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/__init__.pyi new file mode 100644 index 000000000000..e567b0ccbafe --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/__init__.pyi @@ -0,0 +1,11 @@ +from .array import SimpleArrayField as SimpleArrayField +from .array import SplitArrayField as SplitArrayField +from .array import SplitArrayWidget as SplitArrayWidget +from .hstore import HStoreField as HStoreField +from .ranges import BaseRangeField as BaseRangeField +from .ranges import DateRangeField as DateRangeField +from .ranges import DateTimeRangeField as DateTimeRangeField +from .ranges import DecimalRangeField as DecimalRangeField +from .ranges import HiddenRangeWidget as HiddenRangeWidget +from .ranges import IntegerRangeField as IntegerRangeField +from .ranges import RangeWidget as RangeWidget diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/array.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/array.pyi new file mode 100644 index 000000000000..65adef5450c6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/array.pyi @@ -0,0 +1,58 @@ +from collections.abc import Sequence +from typing import Any + +from django import forms +from django.db.models.fields import _ErrorMessagesDict +from django.forms.fields import _ClassLevelWidgetT +from django.forms.utils import _DataT, _FilesT +from django.forms.widgets import _OptAttrs + +from ..utils import prefix_validation_error as prefix_validation_error + +class SimpleArrayField(forms.CharField): + default_error_messages: _ErrorMessagesDict + base_field: forms.Field + delimiter: str + min_length: int | None + max_length: int | None + def __init__( + self, + base_field: forms.Field, + *, + delimiter: str = ",", + max_length: int | None = None, + min_length: int | None = None, + **kwargs: Any, + ) -> None: ... + def clean(self, value: Any) -> Sequence[Any]: ... + def prepare_value(self, value: Any) -> Any: ... + def to_python(self, value: Any) -> Sequence[Any]: ... # type: ignore[override] + def validate(self, value: Sequence[Any]) -> None: ... + def run_validators(self, value: Sequence[Any]) -> None: ... + def has_changed(self, initial: Any, data: Any) -> bool: ... + +class SplitArrayWidget(forms.Widget): + template_name: str + widget: _ClassLevelWidgetT + size: int + def __init__(self, widget: forms.Widget | type[forms.Widget], size: int, **kwargs: Any) -> None: ... + @property + def is_hidden(self) -> bool: ... + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... + def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... + def id_for_label(self, id_: str) -> str: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None = None) -> dict[str, Any]: ... + @property + def needs_multipart_form(self) -> bool: ... # type: ignore[override] + +class SplitArrayField(forms.Field): + default_error_messages: _ErrorMessagesDict + base_field: forms.Field + size: int + remove_trailing_nulls: bool + def __init__( + self, base_field: forms.Field, size: int, *, remove_trailing_nulls: bool = False, **kwargs: Any + ) -> None: ... + def to_python(self, value: Any) -> Sequence[Any]: ... + def clean(self, value: Any) -> Sequence[Any]: ... + def has_changed(self, initial: Any, data: Any) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/hstore.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/hstore.pyi new file mode 100644 index 000000000000..d672d3b85603 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/hstore.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from django import forms +from django.db.models.fields import _ErrorMessagesDict +from django.forms.fields import _ClassLevelWidgetT + +class HStoreField(forms.CharField): + widget: _ClassLevelWidgetT + default_error_messages: _ErrorMessagesDict + def prepare_value(self, value: Any) -> Any: ... + def to_python(self, value: Any) -> dict[str, str | None]: ... # type: ignore[override] + def has_changed(self, initial: Any, data: Any) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/ranges.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/ranges.pyi new file mode 100644 index 000000000000..0a2b2c8e6da7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/forms/ranges.pyi @@ -0,0 +1,42 @@ +from typing import Any + +from django import forms +from django.db.models.fields import _ErrorMessagesDict +from django.forms.widgets import MultiWidget, _OptAttrs +from psycopg2.extras import Range # type: ignore [import-untyped] + +class RangeWidget(MultiWidget): + def __init__(self, base_widget: forms.Widget | type[forms.Widget], attrs: _OptAttrs | None = None) -> None: ... + def decompress(self, value: Any) -> tuple[Any | None, Any | None]: ... + +class HiddenRangeWidget(RangeWidget): + def __init__(self, attrs: _OptAttrs | None = None) -> None: ... + +class BaseRangeField(forms.MultiValueField): + default_error_messages: _ErrorMessagesDict + base_field: type[forms.Field] + range_type: type[Range] + hidden_widget: type[forms.Widget] + def __init__(self, **kwargs: Any) -> None: ... + def prepare_value(self, value: Any) -> Any: ... + def compress(self, values: tuple[Any | None, Any | None]) -> Range | None: ... + +class IntegerRangeField(BaseRangeField): + default_error_messages: _ErrorMessagesDict + base_field: type[forms.Field] + range_type: type[Range] + +class DecimalRangeField(BaseRangeField): + default_error_messages: _ErrorMessagesDict + base_field: type[forms.Field] + range_type: type[Range] + +class DateTimeRangeField(BaseRangeField): + default_error_messages: _ErrorMessagesDict + base_field: type[forms.Field] + range_type: type[Range] + +class DateRangeField(BaseRangeField): + default_error_messages: _ErrorMessagesDict + base_field: type[forms.Field] + range_type: type[Range] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/functions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/functions.pyi new file mode 100644 index 000000000000..2d957735d7a5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/functions.pyi @@ -0,0 +1,9 @@ +from typing import ClassVar + +from django.db.models import DateTimeField, Func, UUIDField + +class RandomUUID(Func): + output_field: ClassVar[UUIDField] + +class TransactionNow(Func): + output_field: ClassVar[DateTimeField] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/indexes.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/indexes.pyi new file mode 100644 index 000000000000..00bd9511472e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/indexes.pyi @@ -0,0 +1,121 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.backends.ddl_references import Statement +from django.db.models import Func, Index, Model +from django.db.models.expressions import BaseExpression, Combinable +from django.db.models.query_utils import Q +from django.utils.datastructures import _ListOrTuple +from django.utils.functional import cached_property + +class PostgresIndex(Index): + @cached_property + def max_name_length(self) -> int: ... # type: ignore[override] + def create_sql( + self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, using: str = "", **kwargs: Any + ) -> Statement: ... + def check_supported(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... + def get_with_params(self) -> Sequence[str]: ... + +class BloomIndex(PostgresIndex): + def __init__( + self, + *expressions: BaseExpression | Combinable | str, + length: int | None = None, + columns: _ListOrTuple[int] = (), + fields: Sequence[str] = ..., + name: str | None = ..., + db_tablespace: str | None = ..., + opclasses: Sequence[str] = ..., + condition: Q | None = ..., + include: Sequence[str] | None = ..., + ) -> None: ... + +class BrinIndex(PostgresIndex): + def __init__( + self, + *expressions: BaseExpression | Combinable | str, + autosummarize: bool | None = None, + pages_per_range: int | None = None, + fields: Sequence[str] = ..., + name: str | None = ..., + db_tablespace: str | None = ..., + opclasses: Sequence[str] = ..., + condition: Q | None = ..., + include: Sequence[str] | None = ..., + ) -> None: ... + +class BTreeIndex(PostgresIndex): + def __init__( + self, + *expressions: BaseExpression | Combinable | str, + fillfactor: int | None = None, + fields: Sequence[str] = ..., + name: str | None = ..., + db_tablespace: str | None = ..., + opclasses: Sequence[str] = ..., + condition: Q | None = ..., + include: Sequence[str] | None = ..., + ) -> None: ... + +class GinIndex(PostgresIndex): + def __init__( + self, + *expressions: BaseExpression | Combinable | str, + fastupdate: bool | None = None, + gin_pending_list_limit: int | None = None, + fields: Sequence[str] = ..., + name: str | None = ..., + db_tablespace: str | None = ..., + opclasses: Sequence[str] = ..., + condition: Q | None = ..., + include: Sequence[str] | None = ..., + ) -> None: ... + +class GistIndex(PostgresIndex): + def __init__( + self, + *expressions: BaseExpression | Combinable | str, + buffering: bool | None = None, + fillfactor: int | None = None, + fields: Sequence[str] = ..., + name: str | None = ..., + db_tablespace: str | None = ..., + opclasses: Sequence[str] = ..., + condition: Q | None = ..., + include: Sequence[str] | None = ..., + ) -> None: ... + +class HashIndex(PostgresIndex): + def __init__( + self, + *expressions: BaseExpression | Combinable | str, + fillfactor: int | None = None, + fields: Sequence[str] = ..., + name: str | None = ..., + db_tablespace: str | None = ..., + opclasses: Sequence[str] = ..., + condition: Q | None = ..., + include: Sequence[str] | None = ..., + ) -> None: ... + +class SpGistIndex(PostgresIndex): + def __init__( + self, + *expressions: BaseExpression | Combinable | str, + fillfactor: int | None = None, + fields: Sequence[str] = ..., + name: str | None = ..., + db_tablespace: str | None = ..., + opclasses: Sequence[str] = ..., + condition: Q | None = ..., + include: Sequence[str] | None = ..., + ) -> None: ... + +class OpClass(Func): + def __init__( + self, + expression: BaseExpression | Combinable | str, + name: str, + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/lookups.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/lookups.pyi new file mode 100644 index 000000000000..5aa6da193d08 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/lookups.pyi @@ -0,0 +1,21 @@ +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Transform +from django.db.models.lookups import PostgresOperatorLookup +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType + +from .search import SearchVectorExact + +class DataContains(PostgresOperatorLookup): ... +class ContainedBy(PostgresOperatorLookup): ... +class Overlap(PostgresOperatorLookup): ... +class HasKey(PostgresOperatorLookup): ... +class HasKeys(PostgresOperatorLookup): ... +class HasAnyKeys(HasKeys): ... +class Unaccent(Transform): ... + +class SearchLookup(SearchVectorExact): + def process_lhs(self, qn: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] + +class TrigramSimilar(PostgresOperatorLookup): ... +class TrigramWordSimilar(PostgresOperatorLookup): ... +class TrigramStrictWordSimilar(PostgresOperatorLookup): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/operations.pyi new file mode 100644 index 000000000000..8b86cd576fd5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/operations.pyi @@ -0,0 +1,62 @@ +from typing import Literal + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.migrations import AddConstraint, AddIndex, RemoveIndex +from django.db.migrations.operations.base import Operation + +class CreateExtension(Operation): + reversible: bool + name: str + def __init__(self, name: str) -> None: ... + def extension_exists(self, schema_editor: BaseDatabaseSchemaEditor, extension: str) -> bool: ... + +class BloomExtension(CreateExtension): + def __init__(self) -> None: ... + +class BtreeGinExtension(CreateExtension): + def __init__(self) -> None: ... + +class BtreeGistExtension(CreateExtension): + def __init__(self) -> None: ... + +class CITextExtension(CreateExtension): + def __init__(self) -> None: ... + +class CryptoExtension(CreateExtension): + def __init__(self) -> None: ... + +class HStoreExtension(CreateExtension): + def __init__(self) -> None: ... + +class TrigramExtension(CreateExtension): + def __init__(self) -> None: ... + +class UnaccentExtension(CreateExtension): + def __init__(self) -> None: ... + +class NotInTransactionMixin: + def _ensure_not_in_transaction(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... + +class AddIndexConcurrently(NotInTransactionMixin, AddIndex): + atomic: Literal[False] + +class RemoveIndexConcurrently(NotInTransactionMixin, RemoveIndex): + atomic: Literal[False] + +class CollationOperation(Operation): + name: str + locale: str + provider: str + deterministic: bool + def __init__(self, name: str, locale: str, *, provider: str = "libc", deterministic: bool = True) -> None: ... + def create_collation(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... + def remove_collation(self, schema_editor: BaseDatabaseSchemaEditor) -> None: ... + +class CreateCollation(CollationOperation): ... +class RemoveCollation(CollationOperation): ... +class AddConstraintNotValid(AddConstraint): ... + +class ValidateConstraint(Operation): + model_name: str + name: str + def __init__(self, model_name: str, name: str) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/search.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/search.pyi new file mode 100644 index 000000000000..92335c2030f7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/search.pyi @@ -0,0 +1,144 @@ +from typing import Any, ClassVar + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Expression, Field, FloatField, TextField +from django.db.models.expressions import Combinable, CombinedExpression, Func +from django.db.models.lookups import Lookup +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from typing_extensions import Self, TypeAlias + +_Expression: TypeAlias = str | Combinable | SearchQueryCombinable + +class SearchVectorExact(Lookup): + def process_rhs(self, qn: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + def as_sql(self, qn: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + +class SearchVectorField(Field): ... +class SearchQueryField(Field): ... + +class SearchConfig(Expression): + config: _Expression | None + def __init__(self, config: _Expression) -> None: ... + @classmethod + def from_parameter(cls, config: _Expression | None) -> SearchConfig: ... + +class SearchVectorCombinable: + ADD: str + +class SearchVector(SearchVectorCombinable, Func): + config: _Expression | None + function: str + arg_joiner: str + output_field: ClassVar[SearchVectorField] + def __init__( + self, *expressions: _Expression, config: _Expression | None = None, weight: Any | None = None + ) -> None: ... + def as_sql( # type: ignore[override] + self, + compiler: SQLCompiler, + connection: BaseDatabaseWrapper, + function: str | None = None, + template: str | None = None, + ) -> _AsSqlType: ... + +class CombinedSearchVector(SearchVectorCombinable, CombinedExpression): + def __init__( + self, + lhs: Combinable, + connector: str, + rhs: Combinable, + config: _Expression | None, + output_field: Field | None = None, + ) -> None: ... + +class SearchQueryCombinable: + BITAND: str + BITOR: str + def __or__(self, other: SearchQueryCombinable) -> Self: ... + def __ror__(self, other: SearchQueryCombinable) -> Self: ... + def __and__(self, other: SearchQueryCombinable) -> Self: ... + def __rand__(self, other: SearchQueryCombinable) -> Self: ... + +class SearchQuery(SearchQueryCombinable, Func): # type: ignore[misc] + output_field: ClassVar[SearchQueryField] + SEARCH_TYPES: dict[str, str] + def __init__( + self, + value: _Expression, + output_field: Field | None = None, + *, + config: _Expression | None = None, + invert: bool = False, + search_type: str = "plain", + ) -> None: ... + def as_sql( # type: ignore[override] + self, + compiler: SQLCompiler, + connection: BaseDatabaseWrapper, + function: str | None = None, + template: str | None = None, + ) -> _AsSqlType: ... + def __invert__(self) -> Self: ... # type: ignore[override] + +class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression): # type: ignore[misc] + def __init__( + self, + lhs: Combinable, + connector: str, + rhs: Combinable, + config: _Expression | None, + output_field: Field | None = None, + ) -> None: ... + +class SearchRank(Func): + output_field: ClassVar[FloatField] + def __init__( + self, + vector: SearchVector | _Expression, + query: SearchQuery | _Expression, + weights: Any | None = None, + normalization: Any | None = None, + cover_density: bool = False, + ) -> None: ... + +class SearchHeadline(Func): + function: str + template: str + output_field: ClassVar[TextField] + def __init__( + self, + expression: _Expression, + query: _Expression, + *, + config: _Expression | None = None, + start_sel: Any | None = None, + stop_sel: Any | None = None, + max_words: int | None = None, + min_words: int | None = None, + short_word: str | None = None, + highlight_all: bool | None = None, + max_fragments: int | None = None, + fragment_delimiter: str | None = None, + ) -> None: ... + def as_sql( # type: ignore[override] + self, + compiler: SQLCompiler, + connection: BaseDatabaseWrapper, + function: str | None = None, + template: str | None = None, + ) -> _AsSqlType: ... + +class TrigramBase(Func): + output_field: ClassVar[FloatField] + def __init__(self, expression: _Expression, string: str, **extra: Any) -> None: ... + +class TrigramWordBase(Func): + output_field: ClassVar[FloatField] + def __init__(self, string: str, expression: _Expression, **extra: Any) -> None: ... + +class TrigramSimilarity(TrigramBase): ... +class TrigramDistance(TrigramBase): ... +class TrigramWordDistance(TrigramWordBase): ... +class TrigramStrictWordDistance(TrigramWordBase): ... +class TrigramWordSimilarity(TrigramWordBase): ... +class TrigramStrictWordSimilarity(TrigramWordBase): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/serializers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/serializers.pyi new file mode 100644 index 000000000000..3aca9ff2d3d7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/serializers.pyi @@ -0,0 +1,4 @@ +from django.db.migrations.serializer import BaseSerializer + +class RangeSerializer(BaseSerializer): + def serialize(self) -> tuple[str, set[str]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/signals.pyi new file mode 100644 index 000000000000..19d3c44bf8db --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/signals.pyi @@ -0,0 +1,6 @@ +from typing import Any + +def get_type_oids(connection_alias: str, type_name: str) -> tuple[tuple[Any, ...], tuple[Any, ...]]: ... +def get_hstore_oids(connection_alias: str) -> tuple[tuple[Any, ...], tuple[Any, ...]]: ... +def get_citext_oids(connection_alias: str) -> tuple[tuple[Any, ...], tuple[Any, ...]]: ... +def register_type_handlers(connection: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/utils.pyi new file mode 100644 index 000000000000..0919dd6795e6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/utils.pyi @@ -0,0 +1,5 @@ +from typing import Any + +from django.core.exceptions import ValidationError + +def prefix_validation_error(error: Any, prefix: Any, code: Any, params: Any) -> ValidationError: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/validators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/validators.pyi new file mode 100644 index 000000000000..c9963baa9f29 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/postgres/validators.pyi @@ -0,0 +1,19 @@ +from collections.abc import Iterable, Mapping +from typing import Any + +from django.core.validators import MaxLengthValidator, MaxValueValidator, MinLengthValidator, MinValueValidator +from django.utils.deconstruct import _Deconstructible + +class ArrayMaxLengthValidator(MaxLengthValidator): ... +class ArrayMinLengthValidator(MinLengthValidator): ... + +class KeysValidator(_Deconstructible): + messages: dict[str, str] + strict: bool + def __init__( + self, keys: Iterable[str], strict: bool = False, messages: Mapping[str, str] | None = None + ) -> None: ... + def __call__(self, value: Any) -> None: ... + +class RangeMaxValueValidator(MaxValueValidator): ... +class RangeMinValueValidator(MinValueValidator): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/admin.pyi new file mode 100644 index 000000000000..295fb8786fb5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/admin.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.contrib import admin + +class RedirectAdmin(admin.ModelAdmin): + list_display: Any + list_filter: Any + search_fields: Any + radio_fields: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/apps.pyi new file mode 100644 index 000000000000..5cf32c2a596f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/apps.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.apps import AppConfig + +class RedirectsConfig(AppConfig): + name: str + verbose_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/middleware.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/middleware.pyi new file mode 100644 index 000000000000..69d99de02d29 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/middleware.pyi @@ -0,0 +1,10 @@ +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.utils.deprecation import MiddlewareMixin + +class RedirectFallbackMiddleware(MiddlewareMixin): + response_gone_class: Any + response_redirect_class: Any + def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/migrations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/migrations/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/models.pyi new file mode 100644 index 000000000000..444960881d91 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/redirects/models.pyi @@ -0,0 +1,6 @@ +from django.db import models + +class Redirect(models.Model): + site: models.ForeignKey + old_path: models.CharField + new_path: models.CharField diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/apps.pyi new file mode 100644 index 000000000000..918abc0f8501 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/apps.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.apps import AppConfig + +class SessionsConfig(AppConfig): + name: str + verbose_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/base.pyi new file mode 100644 index 000000000000..e72ec11473e2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/base.pyi @@ -0,0 +1,89 @@ +from _collections_abc import dict_items, dict_keys, dict_values +from collections.abc import Iterable +from datetime import datetime, timedelta +from typing import Any, overload + +from _typeshed import SupportsKeysAndGetItem + +VALID_KEY_CHARS: Any + +class CreateError(Exception): ... +class UpdateError(Exception): ... + +class SessionBase(dict[str, Any]): + TEST_COOKIE_NAME: str + TEST_COOKIE_VALUE: str + accessed: bool + modified: bool + serializer: Any + def __init__(self, session_key: str | None = None) -> None: ... + async def aset(self, key: str, value: Any) -> None: ... + @property + def key_salt(self) -> str: ... + @overload + async def aget(self, key: str) -> Any | None: ... + @overload + async def aget(self, key: str, default: Any) -> Any: ... + @overload + async def apop(self, key: str) -> Any: ... + @overload + async def apop(self, key: str, default: Any) -> Any: ... + async def asetdefault(self, key: str, value: Any) -> Any: ... + def set_test_cookie(self) -> None: ... + async def aset_test_cookie(self) -> None: ... + def test_cookie_worked(self) -> bool: ... + async def atest_cookie_worked(self) -> bool: ... + def delete_test_cookie(self) -> None: ... + async def adelete_test_cookie(self) -> None: ... + def encode(self, session_dict: dict[str, Any]) -> str: ... + def decode(self, session_data: bytes | str) -> dict[str, Any]: ... + @overload # type: ignore[override] + def update(self, dict_: SupportsKeysAndGetItem[str, Any]) -> None: ... + @overload + def update(self, dict_: Iterable[tuple[str, Any]]) -> None: ... + @overload + async def aupdate(self, dict_: SupportsKeysAndGetItem[str, Any]) -> None: ... + @overload + async def aupdate(self, dict_: Iterable[tuple[str, Any]]) -> None: ... + def has_key(self, key: Any) -> bool: ... + async def ahas_key(self, key: Any) -> bool: ... + async def akeys(self) -> dict_keys[str, Any]: ... + async def avalues(self) -> dict_values[str, Any]: ... + async def aitems(self) -> dict_items[str, Any]: ... + def clear(self) -> None: ... + def is_empty(self) -> bool: ... + def _get_session_key(self) -> str | None: ... + def _set_session_key(self, value: str | None) -> None: ... + @property + def session_key(self) -> str | None: ... + @property + def _session_key(self) -> str | None: ... + @_session_key.setter + def _session_key(self, value: str | None) -> None: ... + def get_session_cookie_age(self) -> int: ... + def get_expiry_age(self, **kwargs: Any) -> int: ... + async def aget_expiry_age(self, **kwargs: Any) -> int: ... + def get_expiry_date(self, **kwargs: Any) -> datetime: ... + async def aget_expiry_date(self, **kwargs: Any) -> datetime: ... + def set_expiry(self, value: datetime | timedelta | int | None) -> None: ... + async def aset_expiry(self, value: datetime | timedelta | int | None) -> None: ... + def get_expire_at_browser_close(self) -> bool: ... + async def aget_expire_at_browser_close(self) -> bool: ... + def flush(self) -> None: ... + async def aflush(self) -> None: ... + def cycle_key(self) -> None: ... + async def acycle_key(self) -> None: ... + def exists(self, session_key: str) -> bool: ... + async def aexists(self, session_key: str) -> bool: ... + def create(self) -> None: ... + async def acreate(self) -> None: ... + def save(self, must_create: bool = False) -> None: ... + async def asave(self, must_create: bool = False) -> None: ... + def delete(self, session_key: str | None = None) -> None: ... + async def adelete(self, session_key: str | None = None) -> None: ... + def load(self) -> dict[str, Any]: ... + async def aload(self) -> dict[str, Any]: ... + @classmethod + def clear_expired(cls) -> None: ... + @classmethod + async def aclear_expired(cls) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/cache.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/cache.pyi new file mode 100644 index 000000000000..c628c4673cba --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/cache.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from django.contrib.sessions.backends.base import SessionBase + +KEY_PREFIX: str + +class SessionStore(SessionBase): + cache_key_prefix: Any + def __init__(self, session_key: str | None = None) -> None: ... + @property + def cache_key(self) -> str: ... + async def acache_key(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/cached_db.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/cached_db.pyi new file mode 100644 index 000000000000..86d1429227e4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/cached_db.pyi @@ -0,0 +1,15 @@ +from logging import Logger +from typing import Any + +from django.contrib.sessions.backends.db import SessionStore as DBStore + +KEY_PREFIX: str + +logger: Logger + +class SessionStore(DBStore): + cache_key_prefix: Any + def __init__(self, session_key: str | None = None) -> None: ... + @property + def cache_key(self) -> str: ... + async def acache_key(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/db.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/db.pyi new file mode 100644 index 000000000000..d550ec0e7084 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/db.pyi @@ -0,0 +1,14 @@ +from typing import Any + +from django.contrib.sessions.backends.base import SessionBase +from django.contrib.sessions.base_session import AbstractBaseSession +from django.utils.functional import cached_property + +class SessionStore(SessionBase): + def __init__(self, session_key: str | None = None) -> None: ... + @classmethod + def get_model_class(cls) -> type[AbstractBaseSession]: ... + @cached_property + def model(self) -> type[AbstractBaseSession]: ... + def create_model_instance(self, data: dict[str, Any]) -> AbstractBaseSession: ... + async def acreate_model_instance(self, data: dict[str, Any]) -> AbstractBaseSession: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/file.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/file.pyi new file mode 100644 index 000000000000..dad5410266f7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/file.pyi @@ -0,0 +1,6 @@ +from django.contrib.sessions.backends.base import SessionBase + +class SessionStore(SessionBase): + storage_path: str + file_prefix: str + def __init__(self, session_key: str | None = None) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/signed_cookies.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/signed_cookies.pyi new file mode 100644 index 000000000000..fa8c99e4cb00 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/backends/signed_cookies.pyi @@ -0,0 +1,4 @@ +from django.contrib.sessions.backends.base import SessionBase + +class SessionStore(SessionBase): + async def aexists(self, session_key: str | None = None) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/base_session.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/base_session.pyi new file mode 100644 index 000000000000..4da1bdb2631b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/base_session.pyi @@ -0,0 +1,22 @@ +from datetime import datetime +from typing import Any, ClassVar, TypeVar + +from django.contrib.sessions.backends.base import SessionBase +from django.db import models +from typing_extensions import Self + +_T = TypeVar("_T", bound=AbstractBaseSession) + +class BaseSessionManager(models.Manager[_T]): + def encode(self, session_dict: dict[str, Any]) -> str: ... + def save(self, session_key: str, session_dict: dict[str, Any], expire_date: datetime) -> _T: ... + +class AbstractBaseSession(models.Model): + session_key = models.CharField(primary_key=True) + session_data = models.TextField() + expire_date = models.DateTimeField() + objects: ClassVar[BaseSessionManager[Self]] + + @classmethod + def get_session_store_class(cls) -> type[SessionBase] | None: ... + def get_decoded(self) -> dict[str, Any]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/exceptions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/exceptions.pyi new file mode 100644 index 000000000000..194592ea90bf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/exceptions.pyi @@ -0,0 +1,5 @@ +from django.core.exceptions import BadRequest, SuspiciousOperation + +class InvalidSessionKey(SuspiciousOperation): ... +class SuspiciousSession(SuspiciousOperation): ... +class SessionInterrupted(BadRequest): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/commands/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/commands/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/commands/clearsessions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/commands/clearsessions.pyi new file mode 100644 index 000000000000..6aed04c535e7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/management/commands/clearsessions.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + def handle(self, **options: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/middleware.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/middleware.pyi new file mode 100644 index 000000000000..b6e0eaaac514 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/middleware.pyi @@ -0,0 +1,9 @@ +from django.contrib.sessions.backends.base import SessionBase +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.utils.deprecation import MiddlewareMixin + +class SessionMiddleware(MiddlewareMixin): + SessionStore: type[SessionBase] + def process_request(self, request: HttpRequest) -> None: ... + def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/migrations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/migrations/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/models.pyi new file mode 100644 index 000000000000..492c9c34deb1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/models.pyi @@ -0,0 +1,8 @@ +from typing import TypeVar + +from django.contrib.sessions.base_session import AbstractBaseSession, BaseSessionManager + +_T = TypeVar("_T", bound=Session) + +class SessionManager(BaseSessionManager[_T]): ... +class Session(AbstractBaseSession): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/serializers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/serializers.pyi new file mode 100644 index 000000000000..4ce8f4307d10 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sessions/serializers.pyi @@ -0,0 +1,4 @@ +from django.core.signing import JSONSerializer as BaseJSONSerializer +from typing_extensions import TypeAlias + +JSONSerializer: TypeAlias = BaseJSONSerializer diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/__init__.pyi new file mode 100644 index 000000000000..782341fbdf1c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/__init__.pyi @@ -0,0 +1,49 @@ +from collections.abc import Iterable, Mapping, Sequence +from datetime import datetime +from typing import Any, Generic, TypeVar + +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 + +_ItemT = TypeVar("_ItemT") + +class Sitemap(Generic[_ItemT]): + limit: int + protocol: str | None + i18n: bool + languages: Sequence[str] | None + alternates: bool + x_default: bool + def items(self) -> Iterable[_ItemT]: ... + def location(self, item: _ItemT) -> str: ... + @property + def paginator(self) -> Paginator: ... + def get_languages_for_item(self, item: _ItemT) -> list[str]: ... + def get_protocol(self, protocol: str | None = None) -> str: ... + def get_domain(self, site: Site | RequestSite | None = None) -> str: ... + def get_urls( + self, page: int | str = 1, site: Site | RequestSite | None = None, protocol: str | None = None + ) -> list[dict[str, Any]]: ... + def get_latest_lastmod(self) -> datetime | None: ... + +_ModelT = TypeVar("_ModelT", bound=Model) + +class GenericSitemap(Sitemap[_ModelT]): + priority: float | None + changefreq: str | None + queryset: QuerySet[_ModelT] + date_field: str | None + protocol: str | None + def __init__( + self, + info_dict: Mapping[str, datetime | QuerySet[_ModelT] | str], + priority: float | None = None, + changefreq: str | None = None, + protocol: str | None = None, + ) -> None: ... + def items(self) -> QuerySet[_ModelT]: ... + def lastmod(self, item: _ModelT) -> datetime | None: ... + def get_latest_lastmod(self) -> datetime | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/apps.pyi new file mode 100644 index 000000000000..04dee814dc0f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/apps.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.apps import AppConfig + +class SiteMapsConfig(AppConfig): + name: str + verbose_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/views.pyi new file mode 100644 index 000000000000..a2f3e92eedeb --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sitemaps/views.pyi @@ -0,0 +1,24 @@ +from collections.abc import Callable +from typing import TypeVar + +from django.contrib.sitemaps import Sitemap +from django.http.request import HttpRequest +from django.template.response import TemplateResponse + +_C = TypeVar("_C", bound=Callable) + +def x_robots_tag(func: _C) -> _C: ... +def index( + request: HttpRequest, + sitemaps: dict[str, type[Sitemap] | Sitemap], + template_name: str = ..., + content_type: str = ..., + sitemap_url_name: str = ..., +) -> TemplateResponse: ... +def sitemap( + request: HttpRequest, + sitemaps: dict[str, type[Sitemap] | Sitemap], + section: str | None = ..., + template_name: str = ..., + content_type: str = ..., +) -> TemplateResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/admin.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/admin.pyi new file mode 100644 index 000000000000..5891cce4fe1c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/admin.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.contrib import admin + +class SiteAdmin(admin.ModelAdmin): + list_display: Any + search_fields: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/apps.pyi new file mode 100644 index 000000000000..75db9afdaaca --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/apps.pyi @@ -0,0 +1,3 @@ +from django.apps import AppConfig + +class SitesConfig(AppConfig): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/checks.pyi new file mode 100644 index 000000000000..5116be8f3b4e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/checks.pyi @@ -0,0 +1,7 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Error + +def check_site_id(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/management.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/management.pyi new file mode 100644 index 000000000000..20c545f5b97e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/management.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from django.apps.config import AppConfig +from django.apps.registry import Apps + +def create_default_site( + app_config: AppConfig, + verbosity: int = 2, + interactive: bool = True, + using: str = "default", + apps: Apps = ..., + **kwargs: Any, +) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/managers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/managers.pyi new file mode 100644 index 000000000000..b9872d2120a3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/managers.pyi @@ -0,0 +1,8 @@ +from typing import TypeVar + +from django.db import models + +_T = TypeVar("_T", bound=models.Model) + +class CurrentSiteManager(models.Manager[_T]): + def __init__(self, field_name: str | None = None) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/middleware.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/middleware.pyi new file mode 100644 index 000000000000..018bd5f77396 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/middleware.pyi @@ -0,0 +1,5 @@ +from django.http.request import HttpRequest +from django.utils.deprecation import MiddlewareMixin + +class CurrentSiteMiddleware(MiddlewareMixin): + def process_request(self, request: HttpRequest) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/migrations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/migrations/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/models.pyi new file mode 100644 index 000000000000..e4181d66f5f4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/models.pyi @@ -0,0 +1,20 @@ +from typing import Any, ClassVar + +from django.db import models +from django.http.request import HttpRequest + +SITE_CACHE: Any + +class SiteManager(models.Manager[Site]): + def get_current(self, request: HttpRequest | None = ...) -> Site: ... + def clear_cache(self) -> None: ... + def get_by_natural_key(self, domain: str) -> Site: ... + +class Site(models.Model): + objects: ClassVar[SiteManager] + + domain = models.CharField(max_length=100) + name = models.CharField(max_length=50) + def natural_key(self) -> tuple[str]: ... + +def clear_site_cache(sender: type[Site], **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/requests.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/requests.pyi new file mode 100644 index 000000000000..90dbace5a420 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/requests.pyi @@ -0,0 +1,11 @@ +from typing import NoReturn + +from django.db.models.base import ModelBase +from django.http.request import HttpRequest + +class RequestSite: + name: str + domain: str + def __init__(self, request: HttpRequest) -> None: ... + def save(self, force_insert: bool | tuple[ModelBase, ...] = False, force_update: bool = False) -> NoReturn: ... + def delete(self) -> NoReturn: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/shortcuts.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/shortcuts.pyi new file mode 100644 index 000000000000..44f8d02054b8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/sites/shortcuts.pyi @@ -0,0 +1,5 @@ +from django.contrib.sites.models import Site +from django.contrib.sites.requests import RequestSite +from django.http.request import HttpRequest + +def get_current_site(request: HttpRequest | None) -> Site | RequestSite: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/apps.pyi new file mode 100644 index 000000000000..69fc831fe0da --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/apps.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.apps import AppConfig + +class StaticFilesConfig(AppConfig): + ignore_patterns: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/checks.pyi new file mode 100644 index 000000000000..da7008158b89 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/checks.pyi @@ -0,0 +1,10 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import CheckMessage, Error + +E005: Error + +def check_finders(app_configs: Sequence[AppConfig] | None = None, **kwargs: Any) -> list[CheckMessage]: ... +def check_storages(app_configs: Sequence[AppConfig] | None = None, **kwargs: Any) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/finders.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/finders.pyi new file mode 100644 index 000000000000..24bbbcefa3e5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/finders.pyi @@ -0,0 +1,59 @@ +from collections.abc import Iterable, Iterator, Sequence +from typing import Any, Literal, overload + +from django.core.checks.messages import CheckMessage +from django.core.files.storage import FileSystemStorage, Storage + +searched_locations: Any + +class BaseFinder: + def check(self, **kwargs: Any) -> list[CheckMessage]: ... + @overload + def find(self, path: str, all: Literal[False] = False) -> str | None: ... + @overload + def find(self, path: str, all: Literal[True]) -> list[str]: ... + def list(self, ignore_patterns: Iterable[str] | None) -> Iterable[Any]: ... + +class FileSystemFinder(BaseFinder): + locations: list[tuple[str, str]] + storages: dict[str, Any] + def __init__(self, app_names: Sequence[str] | None = None, *args: Any, **kwargs: Any) -> None: ... + def find_location(self, root: str, path: str, prefix: str | None = None) -> str | None: ... + @overload + def find(self, path: str, all: Literal[False] = False) -> str | None: ... + @overload + def find(self, path: str, all: Literal[True]) -> list[str]: ... + def list(self, ignore_patterns: Iterable[str] | None) -> Iterable[Any]: ... + +class AppDirectoriesFinder(BaseFinder): + storage_class: type[FileSystemStorage] + source_dir: str + apps: list[str] + storages: dict[str, FileSystemStorage] + def __init__(self, app_names: Iterable[str] | None = None, *args: Any, **kwargs: Any) -> None: ... + def find_in_app(self, app: str, path: str) -> str | None: ... + @overload + def find(self, path: str, all: Literal[False] = False) -> str | None: ... + @overload + def find(self, path: str, all: Literal[True]) -> list[str]: ... + def list(self, ignore_patterns: Iterable[str] | None) -> Iterable[Any]: ... + +class BaseStorageFinder(BaseFinder): + storage: Storage + def __init__(self, storage: Storage | None = None, *args: Any, **kwargs: Any) -> None: ... + @overload + def find(self, path: str, all: Literal[False] = False) -> str | None: ... + @overload + def find(self, path: str, all: Literal[True]) -> list[str]: ... + def list(self, ignore_patterns: Iterable[str] | None) -> Iterable[Any]: ... + +class DefaultStorageFinder(BaseStorageFinder): + storage: Storage + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + +@overload +def find(path: str, all: Literal[False] = False) -> str | None: ... +@overload +def find(path: str, all: Literal[True]) -> list[str]: ... +def get_finders() -> Iterator[BaseFinder]: ... +def get_finder(import_path: str) -> BaseFinder: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/handlers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/handlers.pyi new file mode 100644 index 000000000000..423631f12da1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/handlers.pyi @@ -0,0 +1,48 @@ +import sys +from collections.abc import Awaitable, Callable, Mapping +from typing import Any +from urllib.parse import ParseResult + +from django.core.handlers.asgi import ASGIHandler +from django.core.handlers.base import BaseHandler +from django.core.handlers.wsgi import WSGIHandler +from django.http import HttpRequest +from django.http.response import FileResponse, HttpResponseBase + +if sys.version_info >= (3, 11): + from wsgiref.types import StartResponse, WSGIEnvironment +else: + from _typeshed.wsgi import StartResponse, WSGIEnvironment + +class StaticFilesHandlerMixin: + handles_files: bool + application: BaseHandler + base_url: ParseResult + def load_middleware(self) -> None: ... + def get_base_url(self) -> str: ... + def _should_handle(self, path: str) -> bool: ... + def file_path(self, url: str) -> str: ... + def serve(self, request: HttpRequest) -> FileResponse: ... + def get_response(self, request: HttpRequest) -> HttpResponseBase: ... + async def get_response_async(self, request: HttpRequest) -> HttpResponseBase: ... + +class StaticFilesHandler(StaticFilesHandlerMixin, WSGIHandler): # type: ignore[misc] + application: WSGIHandler + base_url: ParseResult + def __init__(self, application: WSGIHandler) -> None: ... + def __call__( + self, + environ: WSGIEnvironment, + start_response: StartResponse, + ) -> HttpResponseBase: ... + +class ASGIStaticFilesHandler(StaticFilesHandlerMixin, ASGIHandler): # type: ignore[misc] + application: ASGIHandler + base_url: ParseResult + def __init__(self, application: ASGIHandler) -> None: ... + async def __call__( + self, + scope: dict[str, Any], + receive: Callable[[], Awaitable[Mapping[str, Any]]], + send: Callable[[Mapping[str, Any]], Awaitable[None]], + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi new file mode 100644 index 000000000000..ecd423481213 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/collectstatic.pyi @@ -0,0 +1,31 @@ +from typing import Any + +from django.core.files.storage import Storage +from django.core.management.base import BaseCommand +from django.utils.functional import cached_property + +class Command(BaseCommand): + copied_files: Any + symlinked_files: Any + unmodified_files: Any + post_processed_files: Any + storage: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + @cached_property + def local(self) -> bool: ... + interactive: Any + verbosity: Any + symlink: Any + clear: Any + dry_run: Any + ignore_patterns: Any + post_process: Any + def set_options(self, **options: Any) -> None: ... + def collect(self) -> dict[str, list[str]]: ... + def handle(self, **options: Any) -> str | None: ... + def log(self, msg: str, level: int = 2) -> None: ... + def is_local_storage(self) -> bool: ... + def clear_dir(self, path: str) -> None: ... + def delete_file(self, path: str, prefixed_path: str, source_storage: Storage) -> bool: ... + def link_file(self, path: str, prefixed_path: str, source_storage: Storage) -> None: ... + def copy_file(self, path: str, prefixed_path: str, source_storage: Storage) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/findstatic.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/findstatic.pyi new file mode 100644 index 000000000000..19df69eaa8d3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/findstatic.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.core.management.base import LabelCommand + +class Command(LabelCommand): + def handle_label(self, path: str, **options: Any) -> str | None: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/runserver.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/runserver.pyi new file mode 100644 index 000000000000..6be2de8c5fd9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/management/commands/runserver.pyi @@ -0,0 +1,3 @@ +from django.core.management.commands.runserver import Command as RunserverCommand + +class Command(RunserverCommand): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/storage.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/storage.pyi new file mode 100644 index 000000000000..41ff5691615b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/storage.pyi @@ -0,0 +1,56 @@ +from collections.abc import Callable, Iterator +from re import Match +from typing import Any + +from django.core.files.base import File +from django.core.files.storage import FileSystemStorage, Storage +from django.utils._os import _PathCompatible +from django.utils.functional import LazyObject +from typing_extensions import TypeAlias + +_PostProcessT: TypeAlias = Iterator[tuple[str, str, bool] | tuple[str, None, RuntimeError]] + +class StaticFilesStorage(FileSystemStorage): + def __init__( + self, location: _PathCompatible | None = None, base_url: str | None = None, *args: Any, **kwargs: Any + ) -> None: ... + def path(self, name: _PathCompatible) -> str: ... + +class HashedFilesMixin: + default_template: str + max_post_process_passes: int + support_js_module_import_aggregation: bool + patterns: Any + hashed_files: Any + keep_intermediate_files: bool + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def file_hash(self, name: str, content: File | None = None) -> str | None: ... + def hashed_name(self, name: str, content: File | None = None, filename: str | None = None) -> str: ... + def url(self, name: str, force: bool = False) -> str: ... + def url_converter( + self, name: str, hashed_files: dict[str, Any], template: str | None = None + ) -> Callable[[Match], str]: ... + def post_process(self, paths: dict[str, Any], dry_run: bool = False, **options: Any) -> _PostProcessT: ... + def clean_name(self, name: str) -> str: ... + def hash_key(self, name: str) -> str: ... + def stored_name(self, name: str) -> str: ... + +class ManifestFilesMixin(HashedFilesMixin): + manifest_version: str + manifest_name: str + manifest_strict: bool + keep_intermediate_files: bool + manifest_storage: Storage | None + hashed_files: dict[str, str] + manifest_hash: str + def __init__(self, *args: Any, manifest_storage: Storage | None = None, **kwargs: Any) -> None: ... + def read_manifest(self) -> str: ... + def load_manifest(self) -> dict[str, Any]: ... + def save_manifest(self) -> None: ... + def post_process(self, *args: Any, **kwargs: Any) -> _PostProcessT: ... + def stored_name(self, name: str) -> str: ... + +class ManifestStaticFilesStorage(ManifestFilesMixin, StaticFilesStorage): ... # type: ignore[misc] +class ConfiguredStorage(LazyObject): ... + +staticfiles_storage: Storage diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/testing.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/testing.pyi new file mode 100644 index 000000000000..a404820004d5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/testing.pyi @@ -0,0 +1,3 @@ +from django.test import LiveServerTestCase + +class StaticLiveServerTestCase(LiveServerTestCase): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/urls.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/urls.pyi new file mode 100644 index 000000000000..b6825710ed36 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/urls.pyi @@ -0,0 +1,5 @@ +from django.urls import URLPattern, _AnyURL + +urlpatterns: list[_AnyURL] + +def staticfiles_urlpatterns(prefix: str | None = ...) -> list[URLPattern]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/utils.pyi new file mode 100644 index 000000000000..e076d0ab3a2b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/utils.pyi @@ -0,0 +1,7 @@ +from collections.abc import Iterable, Iterator + +from django.core.files.storage import Storage + +def matches_patterns(path: str, patterns: Iterable[str]) -> bool: ... +def get_files(storage: Storage, ignore_patterns: Iterable[str] | None = None, location: str = "") -> Iterator[str]: ... +def check_settings(base_url: str | None = None) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/views.pyi new file mode 100644 index 000000000000..0f5fbb02a827 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/staticfiles/views.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import FileResponse + +def serve(request: HttpRequest, path: str, insecure: bool = ..., **kwargs: Any) -> FileResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/apps.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/apps.pyi new file mode 100644 index 000000000000..61acf8648106 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/apps.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.apps import AppConfig + +class SyndicationConfig(AppConfig): + name: str + verbose_name: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/views.pyi b/python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/views.pyi new file mode 100644 index 000000000000..f1b03b3b5dfa --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/contrib/syndication/views.pyi @@ -0,0 +1,56 @@ +from typing import Any, Generic, TypeVar + +from django.core.exceptions import ObjectDoesNotExist +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.utils.feedgenerator import Enclosure, SyndicationFeed + +def add_domain(domain: str, url: str, secure: bool = ...) -> str: ... + +class FeedDoesNotExist(ObjectDoesNotExist): ... + +_Item = TypeVar("_Item") +_Object = TypeVar("_Object") + +class Feed(Generic[_Item, _Object]): + feed_type: type[SyndicationFeed] + title_template: str | None + description_template: str | None + language: str | None + + # Dynamic attributes: + title: Any + link: Any + feed_url: Any + feed_guid: Any + description: Any + author_name: Any + author_email: Any + author_link: Any + categories: Any + feed_copyright: Any + ttl: Any + items: Any + item_guid: Any + item_guid_is_permalink: Any + item_author_name: Any + item_author_email: Any + item_author_link: Any + item_enclosure_url: Any + item_enclosure_length: Any + item_enclosure_mime_type: Any + item_pubdate: Any + item_updateddate: Any + item_categories: Any + item_copyright: Any + item_comments: Any + def __call__(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def get_object(self, request: HttpRequest, *args: Any, **kwargs: Any) -> _Object | None: ... + def feed_extra_kwargs(self, obj: _Object) -> dict[Any, Any]: ... + def item_extra_kwargs(self, item: _Item) -> dict[Any, Any]: ... + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + def get_feed(self, obj: _Object, request: HttpRequest) -> SyndicationFeed: ... + def item_title(self, item: _Item) -> str: ... + def item_description(self, item: _Item) -> str: ... + def item_link(self, item: _Item) -> str: ... + def item_enclosures(self, item: _Item) -> list[Enclosure]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/asgi.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/asgi.pyi new file mode 100644 index 000000000000..9641fa837ce4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/asgi.pyi @@ -0,0 +1,3 @@ +from django.core.handlers.asgi import ASGIHandler + +def get_asgi_application() -> ASGIHandler: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/__init__.pyi new file mode 100644 index 000000000000..3c236e325f46 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/__init__.pyi @@ -0,0 +1,22 @@ +from typing import Any + +from django.utils.connection import BaseConnectionHandler + +from .backends.base import BaseCache as BaseCache +from .backends.base import CacheKeyWarning as CacheKeyWarning +from .backends.base import InvalidCacheBackendError as InvalidCacheBackendError +from .backends.base import InvalidCacheKey as InvalidCacheKey + +DEFAULT_CACHE_ALIAS: str + +class CacheHandler(BaseConnectionHandler[BaseCache]): + settings_name: str + exception_class: type[Exception] + def create_connection(self, alias: str) -> BaseCache: ... + def all(self, initialized_only: bool = False) -> list[BaseCache]: ... + +def close_caches(**kwargs: Any) -> None: ... + +caches: CacheHandler +# Actually ConnectionProxy, but quacks exactly like BaseCache, it's not worth distinguishing the two. +cache: BaseCache diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/base.pyi new file mode 100644 index 000000000000..c87be3333bc2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/base.pyi @@ -0,0 +1,72 @@ +from collections.abc import Callable, Iterable, Iterator +from re import Pattern +from typing import Any + +from django.core.exceptions import ImproperlyConfigured + +class InvalidCacheBackendError(ImproperlyConfigured): ... +class CacheKeyWarning(RuntimeWarning): ... +class InvalidCacheKey(ValueError): ... + +DEFAULT_TIMEOUT: Any +MEMCACHE_MAX_KEY_LENGTH: int + +def default_key_func(key: Any, key_prefix: str, version: Any) -> str: ... +def get_key_func(key_func: Callable | str | None) -> Callable: ... + +class BaseCache: + _missing_key: object + default_timeout: float | None + _max_entries: int + _cull_frequency: int + key_prefix: str + version: int + key_func: Callable + def __init__(self, params: dict[str, Any]) -> None: ... + def get_backend_timeout(self, timeout: float | None = ...) -> float | None: ... + def make_key(self, key: Any, version: int | None = None) -> str: ... + def validate_key(self, key: Any) -> None: ... + def make_and_validate_key(self, key: Any, version: int | None = None) -> str: ... + def add(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> bool: ... + async def aadd(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> bool: ... + def get(self, key: Any, default: Any | None = None, version: int | None = None) -> Any: ... + async def aget(self, key: Any, default: Any | None = None, version: int | None = None) -> Any: ... + def set(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> None: ... + async def aset(self, key: Any, value: Any, timeout: float | None = ..., version: int | None = None) -> None: ... + def touch(self, key: Any, timeout: float | None = ..., version: int | None = None) -> bool: ... + async def atouch(self, key: Any, timeout: float | None = ..., version: int | None = None) -> bool: ... + def delete(self, key: Any, version: int | None = None) -> bool: ... + async def adelete(self, key: Any, version: int | None = None) -> bool: ... + def get_many(self, keys: Iterable[Any], version: int | None = None) -> dict[Any, Any]: ... + async def aget_many(self, keys: Iterable[Any], version: int | None = None) -> dict[Any, Any]: ... + def get_or_set( + self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = None + ) -> Any | None: ... + async def aget_or_set( + self, key: Any, default: Any | None, timeout: float | None = ..., version: int | None = None + ) -> Any | None: ... + def has_key(self, key: Any, version: int | None = None) -> bool: ... + async def ahas_key(self, key: Any, version: int | None = None) -> bool: ... + def incr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + async def aincr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + def decr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + async def adecr(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + def __contains__(self, key: Any) -> bool: ... + def set_many(self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = None) -> list[Any]: ... + async def aset_many( + self, data: dict[Any, Any], timeout: float | None = ..., version: int | None = None + ) -> list[Any]: ... + def delete_many(self, keys: Iterable[Any], version: int | None = None) -> None: ... + async def adelete_many(self, keys: Iterable[Any], version: int | None = None) -> None: ... + def clear(self) -> None: ... + async def aclear(self) -> None: ... + def incr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + async def aincr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + def decr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + async def adecr_version(self, key: Any, delta: int = 1, version: int | None = None) -> int: ... + def close(self, **kwargs: Any) -> None: ... + async def aclose(self, **kwargs: Any) -> None: ... + +memcached_error_chars_re: Pattern[str] + +def memcache_key_warnings(key: str) -> Iterator[str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/db.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/db.pyi new file mode 100644 index 000000000000..80c67aa15acb --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/db.pyi @@ -0,0 +1,24 @@ +from typing import Any, ClassVar + +from django.core.cache.backends.base import BaseCache +from django.utils.functional import _StrOrPromise + +class Options: + db_table: str + app_label: str + model_name: str + verbose_name: _StrOrPromise + verbose_name_plural: _StrOrPromise + object_name: str + abstract: bool + managed: bool + proxy: bool + swapped: bool + def __init__(self, table: str) -> None: ... + +class BaseDatabaseCache(BaseCache): + cache_model_class: Any + def __init__(self, table: str, params: dict[str, Any]) -> None: ... + +class DatabaseCache(BaseDatabaseCache): + pickle_protocol: ClassVar[int] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/dummy.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/dummy.pyi new file mode 100644 index 000000000000..8984faadc05e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/dummy.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.core.cache.backends.base import BaseCache + +class DummyCache(BaseCache): + def __init__(self, host: str, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/filebased.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/filebased.pyi new file mode 100644 index 000000000000..956a47703449 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/filebased.pyi @@ -0,0 +1,8 @@ +from typing import Any, ClassVar + +from django.core.cache.backends.base import BaseCache + +class FileBasedCache(BaseCache): + cache_suffix: ClassVar[str] + pickle_protocol: ClassVar[int] + def __init__(self, dir: str, params: dict[str, Any]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/locmem.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/locmem.pyi new file mode 100644 index 000000000000..c2634b0040da --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/locmem.pyi @@ -0,0 +1,8 @@ +from typing import Any, ClassVar + +from django.core.cache.backends.base import BaseCache + +class LocMemCache(BaseCache): + pickle_protocol: ClassVar[int] + + def __init__(self, name: str, params: dict[str, Any]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/memcached.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/memcached.pyi new file mode 100644 index 000000000000..e748b8fc44d3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/memcached.pyi @@ -0,0 +1,24 @@ +from collections.abc import Sequence +from types import ModuleType +from typing import Any + +from django.core.cache.backends.base import BaseCache + +class BaseMemcachedCache(BaseCache): + def __init__( + self, + server: str | Sequence[str], + params: dict[str, Any], + library: ModuleType, + value_not_found_exception: type[BaseException], + ) -> None: ... + @property + def client_servers(self) -> Sequence[str]: ... + +class PyLibMCCache(BaseMemcachedCache): + def __init__(self, server: str | Sequence[str], params: dict[str, Any]) -> None: ... + @property + def client_servers(self) -> list[str]: ... + +class PyMemcacheCache(BaseMemcachedCache): + def __init__(self, server: str | Sequence[str], params: dict[str, Any]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/redis.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/redis.pyi new file mode 100644 index 000000000000..ede8e14f9a8b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/backends/redis.pyi @@ -0,0 +1,55 @@ +from collections.abc import Mapping +from datetime import timedelta +from typing import Any, Callable, Iterable, Protocol, SupportsInt, overload, type_check_only + +from _typeshed import ReadableBuffer +from django.core.cache.backends.base import BaseCache +from redis._parsers import BaseParser +from redis.client import Redis +from redis.connection import ConnectionPool +from typing_extensions import TypeAlias + +@type_check_only +class _RedisCacheClientSerializer(Protocol): + def dumps(self, obj: Any) -> bytes: ... + @overload + def loads(self, data: SupportsInt) -> int: ... + @overload + def loads(self, data: ReadableBuffer) -> Any: ... + +class RedisSerializer: + def __init__(self, protocol: int | None = None) -> None: ... + def dumps(self, obj: Any) -> bytes: ... + @overload + def loads(self, data: SupportsInt) -> int: ... + @overload + def loads(self, data: ReadableBuffer) -> Any: ... + +# Taken from https://github.com/redis/redis-py/blob/6b8978/redis/typing.py +_Key: TypeAlias = str | bytes | memoryview +_Expiry: TypeAlias = int | timedelta + +class RedisCacheClient: + def __init__( + self, + servers: list[str], + serializer: str | Callable[[], _RedisCacheClientSerializer] | _RedisCacheClientSerializer | None = None, + pool_class: str | type[ConnectionPool] | None = None, + parser_class: str | type[BaseParser] | None = None, + **options: Any, + ) -> None: ... + def get_client(self, key: _Key | None = None, *, write: bool = False) -> Redis: ... + def add(self, key: _Key, value: Any, timeout: _Expiry | None) -> bool: ... + def get(self, key: _Key, default: Any) -> Any: ... + def set(self, key: _Key, value: Any, timeout: _Expiry | None) -> None: ... + def touch(self, key: _Key, timeout: _Expiry) -> bool: ... + def delete(self, key: _Key) -> bool: ... + def get_many(self, keys: Iterable[_Key]) -> dict[_Key, Any]: ... + def has_key(self, key: _Key) -> bool: ... + def incr(self, key: _Key, delta: int) -> Any: ... + def set_many(self, data: Mapping[_Key, Any], timeout: _Expiry) -> None: ... + def delete_many(self, keys: Iterable[_Key]) -> None: ... + def clear(self) -> bool: ... + +class RedisCache(BaseCache): + def __init__(self, server: str | list[str], params: dict[str, Any]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/cache/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/utils.pyi new file mode 100644 index 000000000000..3be305227108 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/cache/utils.pyi @@ -0,0 +1,6 @@ +from collections.abc import Iterable +from typing import Any + +TEMPLATE_FRAGMENT_KEY_TEMPLATE: str + +def make_template_fragment_key(fragment_name: str, vary_on: Iterable[Any] | None = None) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/__init__.pyi new file mode 100644 index 000000000000..69626e9dd9bd --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/__init__.pyi @@ -0,0 +1,16 @@ +from . import model_checks as model_checks +from .messages import CRITICAL as CRITICAL +from .messages import DEBUG as DEBUG +from .messages import ERROR as ERROR +from .messages import INFO as INFO +from .messages import WARNING as WARNING +from .messages import CheckMessage as CheckMessage +from .messages import Critical as Critical +from .messages import Debug as Debug +from .messages import Error as Error +from .messages import Info as Info +from .messages import Warning as Warning +from .registry import Tags as Tags +from .registry import register as register +from .registry import run_checks as run_checks +from .registry import tag_exists as tag_exists diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/async_checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/async_checks.pyi new file mode 100644 index 000000000000..a4877a4efb9c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/async_checks.pyi @@ -0,0 +1,9 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Error + +E001: Error + +def check_async_unsafe(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/caches.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/caches.pyi new file mode 100644 index 000000000000..01ec34faae52 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/caches.pyi @@ -0,0 +1,11 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Error, Warning + +E001: Error + +def check_default_cache_is_configured(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... +def check_cache_location_not_exposed(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_file_based_cache_is_absolute(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/django_4_0.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/django_4_0.pyi new file mode 100644 index 000000000000..bb1d355bd283 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/compatibility/django_4_0.pyi @@ -0,0 +1,7 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Error + +def check_csrf_trusted_origins(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> list[Error]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/database.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/database.pyi new file mode 100644 index 000000000000..da958d70a998 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/database.pyi @@ -0,0 +1,6 @@ +from collections.abc import Iterable, Sequence +from typing import Any + +from django.core.checks import CheckMessage + +def check_database_backends(databases: Iterable[str] | None = None, **kwargs: Any) -> Sequence[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/files.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/files.pyi new file mode 100644 index 000000000000..2a14298d8e12 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/files.pyi @@ -0,0 +1,7 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Error + +def check_setting_file_upload_temp_dir(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/messages.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/messages.pyi new file mode 100644 index 000000000000..ff7e2614a77a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/messages.pyi @@ -0,0 +1,34 @@ +from typing import Any + +DEBUG: int +INFO: int +WARNING: int +ERROR: int +CRITICAL: int + +class CheckMessage: + level: int + msg: str + hint: str | None + obj: Any + id: str | None + def __init__( + self, level: int, msg: str, hint: str | None = None, obj: Any | None = None, id: str | None = None + ) -> None: ... + def is_serious(self, level: int = 40) -> bool: ... + def is_silenced(self) -> bool: ... + +class Debug(CheckMessage): + def __init__(self, msg: str, hint: str | None = ..., obj: Any = ..., id: str | None = ...) -> None: ... + +class Info(CheckMessage): + def __init__(self, msg: str, hint: str | None = ..., obj: Any = ..., id: str | None = ...) -> None: ... + +class Warning(CheckMessage): + def __init__(self, msg: str, hint: str | None = ..., obj: Any = ..., id: str | None = ...) -> None: ... + +class Error(CheckMessage): + def __init__(self, msg: str, hint: str | None = ..., obj: Any = ..., id: str | None = ...) -> None: ... + +class Critical(CheckMessage): + def __init__(self, msg: str, hint: str | None = ..., obj: Any = ..., id: str | None = ...) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/model_checks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/model_checks.pyi new file mode 100644 index 000000000000..23f2b674eba4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/model_checks.pyi @@ -0,0 +1,8 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import CheckMessage + +def check_all_models(app_configs: Sequence[AppConfig] | None = None, **kwargs: Any) -> Sequence[CheckMessage]: ... +def check_lazy_references(app_configs: Sequence[AppConfig] | None = None, **kwargs: Any) -> Sequence[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/registry.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/registry.pyi new file mode 100644 index 000000000000..f4987f041b79 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/registry.pyi @@ -0,0 +1,64 @@ +from collections.abc import Callable, Iterable, Sequence +from typing import Any, Protocol, TypeVar, overload, type_check_only + +from django.apps.config import AppConfig +from django.core.checks.messages import CheckMessage + +class Tags: + admin: str + async_support: str + caches: str + compatibility: str + database: str + files: str + models: str + security: str + signals: str + sites: str + staticfiles: str + templates: str + translation: str + urls: str + +@type_check_only +class _CheckCallable(Protocol): + def __call__( + self, + *, + app_configs: Sequence[AppConfig] | None, + databases: Sequence[str] | None, + **kwargs: Any, + ) -> Iterable[CheckMessage]: ... + +_C = TypeVar("_C", bound=_CheckCallable) + +@type_check_only +class _ProcessedCheckCallable(Protocol[_C]): + tags: Sequence[str] + __call__: _C + +class CheckRegistry: + registered_checks: set[_ProcessedCheckCallable] + deployment_checks: set[_ProcessedCheckCallable] + def __init__(self) -> None: ... + @overload + def register(self, check: _C, *tags: str, **kwargs: Any) -> _ProcessedCheckCallable[_C]: ... + @overload + def register( + self, check: str | None = None, *tags: str, **kwargs: Any + ) -> Callable[[_C], _ProcessedCheckCallable[_C]]: ... + def run_checks( + self, + app_configs: Sequence[AppConfig] | None = None, + tags: Sequence[str] | None = None, + include_deployment_checks: bool = False, + databases: Sequence[str] | None = None, + ) -> list[CheckMessage]: ... + def tag_exists(self, tag: str, include_deployment_checks: bool = False) -> bool: ... + def tags_available(self, deployment_checks: bool = False) -> set[str]: ... + def get_checks(self, include_deployment_checks: bool = False) -> list[_ProcessedCheckCallable]: ... + +registry: CheckRegistry = ... +register = registry.register +run_checks = registry.run_checks +tag_exists = registry.tag_exists diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/base.pyi new file mode 100644 index 000000000000..f93590ac3022 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/base.pyi @@ -0,0 +1,42 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Error, Warning + +CROSS_ORIGIN_OPENER_POLICY_VALUES: set[str] +REFERRER_POLICY_VALUES: set[str] +SECRET_KEY_INSECURE_PREFIX: str +SECRET_KEY_MIN_LENGTH: int +SECRET_KEY_MIN_UNIQUE_CHARACTERS: int +SECRET_KEY_WARNING_MSG: str +W001: Warning +W002: Warning +W004: Warning +W005: Warning +W006: Warning +W008: Warning +W009: Warning +W018: Warning +W019: Warning +W020: Warning +W021: Warning +W022: Warning +E023: Error +E024: Error +W025: Warning + +def check_security_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_xframe_options_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_sts(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_sts_include_subdomains(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_sts_preload(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_content_type_nosniff(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_ssl_redirect(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_secret_key(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_secret_key_fallbacks(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_debug(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_xframe_deny(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_allowed_hosts(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_referrer_policy(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning | Error]: ... +def check_cross_origin_opener_policy(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/csrf.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/csrf.pyi new file mode 100644 index 000000000000..7d9130200656 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/csrf.pyi @@ -0,0 +1,12 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Error, Warning + +W003: Warning +W016: Warning + +def check_csrf_middleware(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_csrf_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_csrf_failure_view(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/sessions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/sessions.pyi new file mode 100644 index 000000000000..c8cbaefce514 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/security/sessions.pyi @@ -0,0 +1,20 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Warning + +def add_session_cookie_message(message: str) -> str: ... + +W010: Warning +W011: Warning +W012: Warning + +def add_httponly_message(message: str) -> str: ... + +W013: Warning +W014: Warning +W015: Warning + +def check_session_cookie_secure(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def check_session_cookie_httponly(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/templates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/templates.pyi new file mode 100644 index 000000000000..163a550f7bc3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/templates.pyi @@ -0,0 +1,15 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import Error, Warning + +E001: Error +E002: Error +W003: Warning + +def check_setting_app_dirs_loaders(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... +def check_string_if_invalid_is_string(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... +def check_for_template_tags_with_the_same_name( + app_configs: Sequence[AppConfig] | None, **kwargs: Any +) -> Sequence[Warning]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/translation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/translation.pyi new file mode 100644 index 000000000000..07ee32180940 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/translation.pyi @@ -0,0 +1,16 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig + +from . import Error + +E001: Error +E002: Error +E003: Error +E004: Error + +def check_setting_language_code(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... +def check_setting_languages(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... +def check_setting_languages_bidi(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... +def check_language_settings_consistent(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/checks/urls.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/urls.pyi new file mode 100644 index 000000000000..5c4c6a1d54bf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/checks/urls.pyi @@ -0,0 +1,13 @@ +from collections.abc import Sequence +from typing import Any + +from django.apps.config import AppConfig +from django.core.checks.messages import CheckMessage, Error, Warning +from django.urls import _AnyURL + +def check_url_config(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[CheckMessage]: ... +def check_resolver(resolver: _AnyURL) -> Sequence[CheckMessage]: ... +def check_url_namespaces_unique(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Warning]: ... +def get_warning_for_invalid_pattern(pattern: Any) -> Sequence[Error]: ... +def check_url_settings(app_configs: Sequence[AppConfig] | None, **kwargs: Any) -> Sequence[Error]: ... +def E006(name: str) -> Error: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/exceptions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/exceptions.pyi new file mode 100644 index 000000000000..1a335aa5ef23 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/exceptions.pyi @@ -0,0 +1,53 @@ +from collections.abc import Iterator +from typing import Any, Literal + +from django.utils.functional import _StrOrPromise + +class FieldDoesNotExist(Exception): ... +class AppRegistryNotReady(Exception): ... + +class ObjectDoesNotExist(Exception): + silent_variable_failure: bool + +class MultipleObjectsReturned(Exception): ... +class SuspiciousOperation(Exception): ... +class SuspiciousMultipartForm(SuspiciousOperation): ... +class SuspiciousFileOperation(SuspiciousOperation): ... +class DisallowedHost(SuspiciousOperation): ... +class DisallowedRedirect(SuspiciousOperation): ... +class TooManyFieldsSent(SuspiciousOperation): ... +class TooManyFilesSent(SuspiciousOperation): ... +class RequestDataTooBig(SuspiciousOperation): ... +class RequestAborted(Exception): ... +class BadRequest(Exception): ... +class PermissionDenied(Exception): ... +class ViewDoesNotExist(Exception): ... +class MiddlewareNotUsed(Exception): ... +class ImproperlyConfigured(Exception): ... +class FieldError(Exception): ... + +NON_FIELD_ERRORS: Literal["__all__"] + +class ValidationError(Exception): + error_dict: dict[str, list[ValidationError]] + error_list: list[ValidationError] + message: _StrOrPromise + code: str | None + params: dict[str, Any] | None + def __init__( + self, + # Accepts arbitrarily nested data structure, mypy doesn't allow describing it accurately. + message: _StrOrPromise | ValidationError | dict[str, Any] | list[Any], + code: str | None = None, + params: dict[str, Any] | None = None, + ) -> None: ... + @property + def message_dict(self) -> dict[str, list[str]]: ... + @property + def messages(self) -> list[str]: ... + def update_error_dict(self, error_dict: dict[str, list[ValidationError]]) -> dict[str, list[ValidationError]]: ... + def __iter__(self) -> Iterator[tuple[str, list[str]] | str]: ... + +class EmptyResultSet(Exception): ... +class FullResultSet(Exception): ... +class SynchronousOnlyOperation(Exception): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/__init__.pyi new file mode 100644 index 000000000000..af01506f97a2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/__init__.pyi @@ -0,0 +1,3 @@ +from django.core.files.base import File as File + +__all__ = ["File"] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/base.pyi new file mode 100644 index 000000000000..6ccf006e3dc8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/base.pyi @@ -0,0 +1,53 @@ +from collections.abc import Iterator +from types import TracebackType +from typing import IO, AnyStr, Callable, type_check_only + +from django.core.files.utils import FileProxyMixin +from django.utils.functional import cached_property +from typing_extensions import Self + +class File(FileProxyMixin[AnyStr], IO[AnyStr]): + DEFAULT_CHUNK_SIZE: int + file: IO[AnyStr] | None + name: str | None + mode: str + def __init__(self, file: IO[AnyStr] | None, name: str | None = None) -> None: ... + def __bool__(self) -> bool: ... + def __len__(self) -> int: ... + @cached_property + def size(self) -> int: ... + def chunks(self, chunk_size: int | None = None) -> Iterator[AnyStr]: ... + def multiple_chunks(self, chunk_size: int | None = None) -> bool | None: ... + def __iter__(self) -> Iterator[AnyStr]: ... + def __enter__(self) -> Self: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + def open( + self, + mode: str | None = None, + buffering: int = -1, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + closefd: bool = True, + opener: Callable[[str, int], int] | None = None, + ) -> Self: ... + def close(self) -> None: ... + @type_check_only + def __next__(self) -> AnyStr: ... + +class ContentFile(File[AnyStr]): + file: IO[AnyStr] + def __init__(self, content: AnyStr, name: str | None = None) -> None: ... + def __bool__(self) -> bool: ... + def open(self, mode: str | None = None) -> Self: ... # type: ignore[override] + def close(self) -> None: ... + def write(self, data: AnyStr) -> int: ... + +def endswith_cr(line: bytes | str) -> bool: ... +def endswith_lf(line: bytes | str) -> bool: ... +def equals_lf(line: bytes | str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/images.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/images.pyi new file mode 100644 index 000000000000..70fe9ace32cf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/images.pyi @@ -0,0 +1,14 @@ +from typing import IO + +from django.core.files import File +from django.utils._os import _PathCompatible + +class ImageFile(File[bytes]): + @property + def width(self) -> int: ... + @property + def height(self) -> int: ... + +def get_image_dimensions( + file_or_path: _PathCompatible | IO[bytes], close: bool = False +) -> tuple[int | None, int | None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/locks.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/locks.pyi new file mode 100644 index 000000000000..cc44d811f152 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/locks.pyi @@ -0,0 +1,15 @@ +from ctypes import Structure, Union +from typing import Any + +LOCK_SH: int +LOCK_NB: int +LOCK_EX: int +ULONG_PTR: Any +PVOID: Any + +class _OFFSET(Structure): ... +class _OFFSET_UNION(Union): ... +class OVERLAPPED(Structure): ... + +def lock(f: Any, flags: int) -> bool: ... +def unlock(f: Any) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/move.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/move.pyi new file mode 100644 index 000000000000..7c216a79b745 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/move.pyi @@ -0,0 +1,3 @@ +def file_move_safe( + old_file_name: str, new_file_name: str, chunk_size: int = 65536, allow_overwrite: bool = False +) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/__init__.pyi new file mode 100644 index 000000000000..e4b8e072794c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/__init__.pyi @@ -0,0 +1,28 @@ +from django.utils.functional import LazyObject + +from .base import Storage +from .filesystem import FileSystemStorage +from .handler import InvalidStorageError, StorageHandler +from .memory import InMemoryStorage + +__all__ = ( + "FileSystemStorage", + "InMemoryStorage", + "Storage", + "DefaultStorage", + "default_storage", + "get_storage_class", + "InvalidStorageError", + "StorageHandler", + "storages", +) + +GET_STORAGE_CLASS_DEPRECATED_MSG: str + +def get_storage_class(import_path: str | None = None) -> type[Storage]: ... + +class DefaultStorage(LazyObject): ... + +storages: StorageHandler +# default_storage is actually an instance of DefaultStorage, but it proxies through to a Storage +default_storage: Storage diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/base.pyi new file mode 100644 index 000000000000..25ca45156c29 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/base.pyi @@ -0,0 +1,22 @@ +from datetime import datetime +from typing import IO, Any + +from django.core.files.base import File +from django.utils._os import _PathCompatible + +class Storage: + def open(self, name: str, mode: str = "rb") -> File: ... + def save(self, name: str | None, content: IO[Any], max_length: int | None = None) -> str: ... + def get_valid_name(self, name: str) -> str: ... + def get_alternative_name(self, file_root: str, file_ext: str) -> str: ... + def get_available_name(self, name: str, max_length: int | None = None) -> str: ... + def generate_filename(self, filename: _PathCompatible) -> str: ... + def path(self, name: str) -> str: ... + def delete(self, name: str) -> None: ... + def exists(self, name: str) -> bool: ... + def listdir(self, path: str) -> tuple[list[str], list[str]]: ... + def size(self, name: str) -> int: ... + def url(self, name: str | None) -> str: ... + def get_accessed_time(self, name: str) -> datetime: ... + def get_created_time(self, name: str) -> datetime: ... + def get_modified_time(self, name: str) -> datetime: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/filesystem.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/filesystem.pyi new file mode 100644 index 000000000000..31448c7bf99a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/filesystem.pyi @@ -0,0 +1,27 @@ +from django.utils._os import _PathCompatible +from django.utils.deconstruct import _Deconstructible +from django.utils.functional import cached_property + +from .base import Storage +from .mixins import StorageSettingsMixin + +class FileSystemStorage(_Deconstructible, Storage, StorageSettingsMixin): + OS_OPEN_FLAGS: int + + def __init__( + self, + location: _PathCompatible | None = None, + base_url: str | None = None, + file_permissions_mode: int | None = None, + directory_permissions_mode: int | None = None, + ) -> None: ... + @cached_property + def base_location(self) -> _PathCompatible: ... + @cached_property + def location(self) -> _PathCompatible: ... + @cached_property + def base_url(self) -> str: ... + @cached_property + def file_permissions_mode(self) -> int | None: ... + @cached_property + def directory_permissions_mode(self) -> int | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/handler.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/handler.pyi new file mode 100644 index 000000000000..02ca26273e4c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/handler.pyi @@ -0,0 +1,15 @@ +from typing import Any + +from django.core.exceptions import ImproperlyConfigured +from django.utils.functional import cached_property + +from .base import Storage + +class InvalidStorageError(ImproperlyConfigured): ... + +class StorageHandler: + def __init__(self, backends: dict[str, Storage] | None = None) -> None: ... + @cached_property + def backends(self) -> dict[str, Storage]: ... + def __getitem__(self, alias: str) -> Storage: ... + def create_storage(self, params: dict[str, Any]) -> Storage: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/memory.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/memory.pyi new file mode 100644 index 000000000000..64a318ef6bb9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/memory.pyi @@ -0,0 +1,25 @@ +from django.utils._os import _PathCompatible +from django.utils.deconstruct import _Deconstructible +from django.utils.functional import cached_property + +from .base import Storage +from .mixins import StorageSettingsMixin + +class InMemoryStorage(_Deconstructible, Storage, StorageSettingsMixin): + def __init__( + self, + location: _PathCompatible | None = None, + base_url: str | None = None, + file_permissions_mode: int | None = None, + directory_permissions_mode: int | None = None, + ) -> None: ... + @cached_property + def base_location(self) -> _PathCompatible: ... + @cached_property + def location(self) -> _PathCompatible: ... + @cached_property + def base_url(self) -> str: ... + @cached_property + def file_permissions_mode(self) -> int | None: ... + @cached_property + def directory_permissions_mode(self) -> int | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/mixins.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/mixins.pyi new file mode 100644 index 000000000000..917574a87934 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/storage/mixins.pyi @@ -0,0 +1,9 @@ +from typing import Any, Literal + +class StorageSettingsMixin: + def _clear_cached_properties( + self, + setting: Literal["MEDIA_ROOT", "MEDIA_URL", "FILE_UPLOAD_PERMISSIONS", "FILE_UPLOAD_DIRECTORY_PERMISSIONS"], + **kwargs: Any, + ) -> None: ... + def _value_or_setting(self, value: Any, setting: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/temp.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/temp.pyi new file mode 100644 index 000000000000..9439e13abc33 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/temp.pyi @@ -0,0 +1,5 @@ +import tempfile + +NamedTemporaryFile = tempfile.NamedTemporaryFile + +gettempdir = tempfile.gettempdir diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadedfile.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadedfile.pyi new file mode 100644 index 000000000000..4dcb71e99080 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadedfile.pyi @@ -0,0 +1,50 @@ +from typing import IO + +from django.core.files.base import File +from typing_extensions import Self + +class UploadedFile(File): + content_type: str | None + charset: str | None + content_type_extra: dict[str, str] | None + size: int | None # type: ignore[assignment] + name: str | None + def __init__( + self, + file: IO | None = None, + name: str | None = None, + content_type: str | None = None, + size: int | None = None, + charset: str | None = None, + content_type_extra: dict[str, str] | None = None, + ) -> None: ... + +class TemporaryUploadedFile(UploadedFile): + def __init__( + self, + name: str, + content_type: str | None, + size: int | None, + charset: str | None, + content_type_extra: dict[str, str] | None = None, + ) -> None: ... + def temporary_file_path(self) -> str: ... + +class InMemoryUploadedFile(UploadedFile): + field_name: str | None + def __init__( + self, + file: IO, + field_name: str | None, + name: str | None, + content_type: str | None, + size: int | None, + charset: str | None, + content_type_extra: dict[str, str] | None = None, + ) -> None: ... + def open(self, mode: str | None = None) -> Self: ... # type: ignore[override] + +class SimpleUploadedFile(InMemoryUploadedFile): + def __init__(self, name: str, content: bytes | None, content_type: str = "text/plain") -> None: ... + @classmethod + def from_dict(cls, file_dict: dict[str, str | bytes]) -> Self: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadhandler.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadhandler.pyi new file mode 100644 index 000000000000..5dccbecf9afe --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/uploadhandler.pyi @@ -0,0 +1,88 @@ +# Stubs for django.core.files.uploadhandler (Python 3.5) + +from typing import IO, Any + +from django.core.files.uploadedfile import TemporaryUploadedFile, UploadedFile +from django.http.request import HttpRequest, QueryDict +from django.utils.datastructures import MultiValueDict + +class UploadFileException(Exception): ... + +class StopUpload(UploadFileException): + connection_reset: bool + def __init__(self, connection_reset: bool = False) -> None: ... + +class SkipFile(UploadFileException): ... +class StopFutureHandlers(UploadFileException): ... + +class FileUploadHandler: + chunk_size: int + file_name: str | None + content_type: str | None + content_length: int | None + charset: str | None + content_type_extra: dict[str, str] | None + request: HttpRequest | None + field_name: str + def __init__(self, request: HttpRequest | None = None) -> None: ... + def handle_raw_input( + self, + input_data: IO[bytes], + META: dict[str, str], + content_length: int, + boundary: str, + encoding: str | None = None, + ) -> tuple[QueryDict, MultiValueDict[str, UploadedFile]] | None: ... + def new_file( + self, + field_name: str, + file_name: str, + content_type: str, + content_length: int | None, + charset: str | None = None, + content_type_extra: dict[str, str] | None = None, + ) -> None: ... + def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ... + def file_complete(self, file_size: int) -> UploadedFile | None: ... + def upload_complete(self) -> None: ... + def upload_interrupted(self) -> None: ... + +class TemporaryFileUploadHandler(FileUploadHandler): + file: TemporaryUploadedFile + def new_file( + self, + field_name: str, + file_name: str, + content_type: str, + content_length: int | None, + charset: str | None = ..., + content_type_extra: dict[str, str] | None = ..., + ) -> None: ... + def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ... + def file_complete(self, file_size: int) -> UploadedFile | None: ... + def upload_interrupted(self) -> None: ... + +class MemoryFileUploadHandler(FileUploadHandler): + activated: bool + file: IO[bytes] + def handle_raw_input( + self, + input_data: IO[bytes], + META: dict[str, str], + content_length: int, + boundary: str, + encoding: str | None = None, + ) -> tuple[QueryDict, MultiValueDict[str, UploadedFile]] | None: ... + def new_file( + self, + field_name: str, + file_name: str, + content_type: str, + content_length: int | None, + charset: str | None = ..., + content_type_extra: dict[str, str] | None = ..., + ) -> None: ... + def receive_data_chunk(self, raw_data: bytes, start: int) -> bytes | None: ... + def file_complete(self, file_size: int) -> UploadedFile | None: ... + +def load_handler(path: str, *args: Any, **kwargs: Any) -> FileUploadHandler: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/files/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/files/utils.pyi new file mode 100644 index 000000000000..68fd9c7695ca --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/files/utils.pyi @@ -0,0 +1,29 @@ +from collections.abc import Iterator +from typing import IO, Any, AnyStr, Generic + +from django.utils._os import _PathCompatible + +def validate_file_name(name: _PathCompatible, allow_relative_path: bool = False) -> _PathCompatible: ... + +class FileProxyMixin(Generic[AnyStr]): + file: IO[AnyStr] | None + encoding: Any + fileno: Any + flush: Any + isatty: Any + newlines: Any + read: Any + readinto: Any + readline: Any + readlines: Any + seek: Any + tell: Any + truncate: Any + write: Any + writelines: Any + @property + def closed(self) -> bool: ... + def readable(self) -> bool: ... + def writable(self) -> bool: ... + def seekable(self) -> bool: ... + def __iter__(self) -> Iterator[AnyStr]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/asgi.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/asgi.pyi new file mode 100644 index 000000000000..f260cc714ec8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/asgi.pyi @@ -0,0 +1,64 @@ +from collections.abc import Awaitable, Callable, Iterator, Mapping, Sequence +from logging import Logger +from typing import IO, Any, TypeVar + +from django.core.handlers import base +from django.http.request import HttpRequest, _ImmutableQueryDict +from django.http.response import HttpResponseBase +from django.urls.resolvers import ResolverMatch, URLResolver +from django.utils.datastructures import MultiValueDict +from django.utils.functional import cached_property +from typing_extensions import TypeAlias + +_ReceiveCallback: TypeAlias = Callable[[], Awaitable[Mapping[str, Any]]] + +_SendCallback: TypeAlias = Callable[[Mapping[str, Any]], Awaitable[None]] + +logger: Logger + +def get_script_prefix(scope: Mapping[str, Any]) -> str: ... + +class ASGIRequest(HttpRequest): + body_receive_timeout: int + scope: Mapping[str, Any] + resolver_match: ResolverMatch | None + script_name: str | None + path_info: str + path: str + method: str + META: dict[str, Any] + def __init__(self, scope: Mapping[str, Any], body_file: IO[bytes]) -> None: ... + @cached_property + def GET(self) -> _ImmutableQueryDict: ... # type: ignore[override] + POST: _ImmutableQueryDict + FILES: MultiValueDict + @cached_property + def COOKIES(self) -> dict[str, str]: ... # type: ignore[override] + +_T = TypeVar("_T") + +class ASGIHandler(base.BaseHandler): + request_class: type[ASGIRequest] + chunk_size: int + def __init__(self) -> None: ... + async def __call__( + self, + scope: dict[str, Any], + receive: _ReceiveCallback, + send: _SendCallback, + ) -> None: ... + async def handle( + self, scope: dict[str, Any], receive: _ReceiveCallback, send: _SendCallback + ) -> HttpResponseBase | None: ... + async def listen_for_disconnect(self, receive: _ReceiveCallback) -> None: ... + async def run_get_response(self, request: HttpRequest) -> HttpResponseBase: ... + async def read_body(self, receive: _ReceiveCallback) -> IO[bytes]: ... + def create_request( + self, scope: Mapping[str, Any], body_file: IO[bytes] + ) -> tuple[ASGIRequest, None] | tuple[None, HttpResponseBase]: ... + def handle_uncaught_exception( + self, request: HttpRequest, resolver: URLResolver, exc_info: Any + ) -> HttpResponseBase: ... + async def send_response(self, response: HttpResponseBase, send: _SendCallback) -> None: ... + @classmethod + def chunk_bytes(cls, data: Sequence[_T]) -> Iterator[tuple[Sequence[_T], bool]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/base.pyi new file mode 100644 index 000000000000..ee36a3cc1e52 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/base.pyi @@ -0,0 +1,29 @@ +from collections.abc import Awaitable, Callable +from logging import Logger +from typing import Any + +import _typeshed +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseBase +from django.urls.resolvers import ResolverMatch + +logger: Logger + +class BaseHandler: + def load_middleware(self, is_async: bool = ...) -> None: ... + def adapt_method_mode( + self, + is_async: bool, + method: Callable[[HttpRequest], HttpResponseBase | Awaitable[HttpResponseBase]], + method_is_async: bool | None = ..., + debug: bool = ..., + name: str | None = ..., + ) -> Callable[[HttpRequest], HttpResponseBase | Awaitable[HttpResponseBase]]: ... + def get_response(self, request: HttpRequest) -> HttpResponseBase: ... + async def get_response_async(self, request: HttpRequest) -> HttpResponseBase: ... + def resolve_request(self, request: HttpRequest) -> ResolverMatch: ... + def check_response(self, response: HttpResponseBase, callback: Any, name: str | None = ...) -> None: ... + def make_view_atomic(self, view: Callable[..., HttpResponseBase]) -> Callable[..., HttpResponseBase]: ... + def process_exception_by_middleware(self, exception: Exception, request: HttpRequest) -> HttpResponse: ... + +def reset_urlconf(sender: _typeshed.Unused, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/exception.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/exception.pyi new file mode 100644 index 000000000000..7edff206a1a0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/exception.pyi @@ -0,0 +1,15 @@ +from collections.abc import Awaitable, Callable +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseBase +from django.urls.resolvers import URLResolver + +def convert_exception_to_response( + get_response: Callable[[HttpRequest], HttpResponseBase | Awaitable[HttpResponseBase]] +) -> Callable[[HttpRequest], HttpResponseBase | Awaitable[HttpResponseBase]]: ... +def response_for_exception(request: HttpRequest, exc: Exception) -> HttpResponse: ... +def get_exception_response( + request: HttpRequest, resolver: URLResolver, status_code: int, exception: Exception +) -> HttpResponse: ... +def handle_uncaught_exception(request: HttpRequest, resolver: URLResolver, exc_info: Any) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/wsgi.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/wsgi.pyi new file mode 100644 index 000000000000..435df07924f0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/handlers/wsgi.pyi @@ -0,0 +1,36 @@ +import sys +from io import BytesIO, IOBase +from typing import Any + +from django.core.handlers import base +from django.http import HttpRequest +from django.http.response import HttpResponseBase + +if sys.version_info >= (3, 11): + from wsgiref.types import StartResponse, WSGIEnvironment +else: + from _typeshed.wsgi import StartResponse, WSGIEnvironment + +class LimitedStream(IOBase): + limit: int + def __init__(self, stream: BytesIO, limit: int) -> None: ... + def read(self, size: int | None = ...) -> bytes: ... + def readline(self, size: int | None = ...) -> bytes: ... + +class WSGIRequest(HttpRequest): + environ: WSGIEnvironment + def __init__(self, environ: WSGIEnvironment) -> None: ... + +class WSGIHandler(base.BaseHandler): + request_class: type[WSGIRequest] + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def __call__( + self, + environ: WSGIEnvironment, + start_response: StartResponse, + ) -> HttpResponseBase: ... + +def get_path_info(environ: WSGIEnvironment) -> str: ... +def get_script_name(environ: WSGIEnvironment) -> str: ... +def get_bytes_from_wsgi(environ: WSGIEnvironment, key: str, default: str) -> bytes: ... +def get_str_from_wsgi(environ: WSGIEnvironment, key: str, default: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/__init__.pyi new file mode 100644 index 000000000000..63de22ae6eef --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/__init__.pyi @@ -0,0 +1,50 @@ +from collections.abc import Iterable, Sequence +from typing import Any + +from django.utils.functional import _StrOrPromise + +from .message import DEFAULT_ATTACHMENT_MIME_TYPE as DEFAULT_ATTACHMENT_MIME_TYPE +from .message import BadHeaderError as BadHeaderError +from .message import EmailMessage as EmailMessage +from .message import EmailMultiAlternatives as EmailMultiAlternatives +from .message import SafeMIMEMultipart as SafeMIMEMultipart +from .message import SafeMIMEText as SafeMIMEText +from .message import forbid_multi_line_headers as forbid_multi_line_headers +from .utils import DNS_NAME as DNS_NAME +from .utils import CachedDnsName as CachedDnsName + +def get_connection(backend: str | None = None, fail_silently: bool = False, **kwds: Any) -> Any: ... +def send_mail( + subject: _StrOrPromise, + message: _StrOrPromise, + from_email: str | None, + recipient_list: Sequence[str], + fail_silently: bool = False, + auth_user: str | None = None, + auth_password: str | None = None, + connection: Any | None = None, + html_message: str | None = None, +) -> int: ... +def send_mass_mail( + datatuple: Iterable[tuple[str, str, str | None, list[str]]], + fail_silently: bool = False, + auth_user: str | None = None, + auth_password: str | None = None, + connection: Any | None = None, +) -> int: ... +def mail_admins( + subject: _StrOrPromise, + message: _StrOrPromise, + fail_silently: bool = False, + connection: Any | None = None, + html_message: str | None = None, +) -> None: ... +def mail_managers( + subject: _StrOrPromise, + message: _StrOrPromise, + fail_silently: bool = False, + connection: Any | None = None, + html_message: str | None = None, +) -> None: ... + +outbox: list[EmailMessage] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/base.pyi new file mode 100644 index 000000000000..a282c451587a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/base.pyi @@ -0,0 +1,20 @@ +from collections.abc import Sequence +from types import TracebackType +from typing import Any + +from django.core.mail.message import EmailMessage +from typing_extensions import Self + +class BaseEmailBackend: + fail_silently: bool + def __init__(self, fail_silently: bool = False, **kwargs: Any) -> None: ... + def open(self) -> bool | None: ... + def close(self) -> None: ... + def __enter__(self) -> Self: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + def send_messages(self, email_messages: Sequence[EmailMessage]) -> int: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/console.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/console.pyi new file mode 100644 index 000000000000..4e6ccf8f6589 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/console.pyi @@ -0,0 +1,10 @@ +import threading +from typing import TextIO + +from django.core.mail.backends.base import BaseEmailBackend +from django.core.mail.message import EmailMessage + +class EmailBackend(BaseEmailBackend): + stream: TextIO + _lock: threading.RLock + def write_message(self, message: EmailMessage) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/dummy.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/dummy.pyi new file mode 100644 index 000000000000..80ba2615a170 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/dummy.pyi @@ -0,0 +1,3 @@ +from django.core.mail.backends.base import BaseEmailBackend + +class EmailBackend(BaseEmailBackend): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/filebased.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/filebased.pyi new file mode 100644 index 000000000000..a79023136ba2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/filebased.pyi @@ -0,0 +1,3 @@ +from django.core.mail.backends.console import EmailBackend as ConsoleEmailBackend + +class EmailBackend(ConsoleEmailBackend): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/locmem.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/locmem.pyi new file mode 100644 index 000000000000..80ba2615a170 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/locmem.pyi @@ -0,0 +1,3 @@ +from django.core.mail.backends.base import BaseEmailBackend + +class EmailBackend(BaseEmailBackend): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/smtp.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/smtp.pyi new file mode 100644 index 000000000000..6f753653a124 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/backends/smtp.pyi @@ -0,0 +1,18 @@ +import smtplib +import threading + +from _typeshed import StrOrBytesPath +from django.core.mail.backends.base import BaseEmailBackend + +class EmailBackend(BaseEmailBackend): + host: str + port: int + username: str + password: str + use_tls: bool + use_ssl: bool + timeout: int | None + ssl_keyfile: StrOrBytesPath | None + ssl_certfile: StrOrBytesPath | None + connection: smtplib.SMTP_SSL | smtplib.SMTP | None + _lock: threading.RLock diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/message.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/message.pyi new file mode 100644 index 000000000000..581b4a1aa3b3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/message.pyi @@ -0,0 +1,111 @@ +from collections.abc import Sequence +from email.message import Message +from email.mime.base import MIMEBase +from email.mime.message import MIMEMessage +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from typing import Any, overload + +from django.utils.functional import _StrOrPromise +from typing_extensions import TypeAlias + +utf8_charset: Any +utf8_charset_qp: Any +DEFAULT_ATTACHMENT_MIME_TYPE: str +RFC5322_EMAIL_LINE_LENGTH_LIMIT: int + +class BadHeaderError(ValueError): ... + +ADDRESS_HEADERS: set[str] + +def forbid_multi_line_headers(name: str, val: str, encoding: str) -> tuple[str, str]: ... +def sanitize_address(addr: tuple[str, str] | str, encoding: str) -> str: ... + +class MIMEMixin: + def as_string(self, unixfrom: bool = False, linesep: str = "\n") -> str: ... + def as_bytes(self, unixfrom: bool = False, linesep: str = "\n") -> bytes: ... + +class SafeMIMEMessage(MIMEMixin, MIMEMessage): ... # type: ignore[misc] + +class SafeMIMEText(MIMEMixin, MIMEText): # type: ignore[misc] + encoding: str + def __init__(self, _text: str, _subtype: str = "plain", _charset: str | None = None) -> None: ... + +class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): # type: ignore[misc] + encoding: str + def __init__( + self, + _subtype: str = "mixed", + boundary: Any | None = None, + _subparts: Any | None = None, + encoding: str | None = None, + **_params: Any, + ) -> None: ... + +_AttachmentContent: TypeAlias = bytes | EmailMessage | Message | SafeMIMEText | str +_AttachmentTuple: TypeAlias = ( + tuple[str, _AttachmentContent] | tuple[str | None, _AttachmentContent, str] | tuple[str, _AttachmentContent, None] +) + +class EmailMessage: + content_subtype: str + mixed_subtype: str + encoding: Any + to: list[str] + cc: list[Any] + bcc: list[Any] + reply_to: list[Any] + from_email: str + subject: _StrOrPromise + body: _StrOrPromise + attachments: list[Any] + extra_headers: dict[Any, Any] + connection: Any + def __init__( + self, + subject: _StrOrPromise = "", + body: _StrOrPromise | None = "", + from_email: str | None = None, + to: Sequence[str] | None = None, + bcc: Sequence[str] | None = None, + connection: Any | None = None, + attachments: Sequence[MIMEBase | _AttachmentTuple] | None = None, + headers: dict[str, str] | None = None, + cc: Sequence[str] | None = None, + reply_to: Sequence[str] | None = None, + ) -> None: ... + def get_connection(self, fail_silently: bool = False) -> Any: ... + # TODO: when typeshed gets more types for email.Message, move it to MIMEMessage, now it has too many false-positives + def message(self) -> Any: ... + def recipients(self) -> list[str]: ... + def send(self, fail_silently: bool = False) -> int: ... + @overload + def attach(self, filename: MIMEBase | None = None, content: None = None, mimetype: None = None) -> None: ... + @overload + def attach( + self, filename: None = None, content: _AttachmentContent | None = None, mimetype: str | None = None + ) -> None: ... + @overload + def attach( + self, filename: str | None = None, content: _AttachmentContent | None = None, mimetype: str | None = None + ) -> None: ... + def attach_file(self, path: str, mimetype: str | None = None) -> None: ... + +class EmailMultiAlternatives(EmailMessage): + alternative_subtype: str + alternatives: list[tuple[_AttachmentContent, str]] + def __init__( + self, + subject: _StrOrPromise = "", + body: _StrOrPromise | None = "", + from_email: str | None = None, + to: Sequence[str] | None = None, + bcc: Sequence[str] | None = None, + connection: Any | None = None, + attachments: Sequence[MIMEBase | _AttachmentTuple] | None = None, + headers: dict[str, str] | None = None, + alternatives: list[tuple[_AttachmentContent, str]] | None = None, + cc: Sequence[str] | None = None, + reply_to: Sequence[str] | None = None, + ) -> None: ... + def attach_alternative(self, content: _AttachmentContent, mimetype: str) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/mail/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/utils.pyi new file mode 100644 index 000000000000..68b3a64fb09b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/mail/utils.pyi @@ -0,0 +1,6 @@ +from typing import Any + +class CachedDnsName: + def get_fqdn(self) -> str: ... + +DNS_NAME: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/__init__.pyi new file mode 100644 index 000000000000..297019b6c8c9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/__init__.pyi @@ -0,0 +1,23 @@ +from typing import Any + +from .base import BaseCommand as BaseCommand +from .base import CommandError as CommandError +from .base import CommandParser as CommandParser +from .base import handle_default_options as handle_default_options + +def find_commands(management_dir: str) -> list[str]: ... +def load_command_class(app_name: str, name: str) -> BaseCommand: ... +def get_commands() -> dict[str, str]: ... +def call_command(command_name: BaseCommand | str, *args: Any, **options: Any) -> str: ... + +class ManagementUtility: + argv: list[str] + prog_name: str + settings_exception: Exception | None + def __init__(self, argv: list[str] | None = None) -> None: ... + def main_help_text(self, commands_only: bool = False) -> str: ... + def fetch_command(self, subcommand: str) -> BaseCommand: ... + def autocomplete(self) -> None: ... + def execute(self) -> None: ... + +def execute_from_command_line(argv: list[str] | None = None) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/base.pyi new file mode 100644 index 000000000000..c65d0dbb0ca0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/base.pyi @@ -0,0 +1,96 @@ +from argparse import ArgumentParser, HelpFormatter, Namespace +from collections.abc import Callable, Iterable, Sequence +from io import TextIOBase +from typing import Any, Literal, TextIO + +from django.apps.config import AppConfig +from django.core.management.color import Style +from django.utils.datastructures import _ListOrTuple + +ALL_CHECKS: Literal["__all__"] + +class CommandError(Exception): + returncode: int + def __init__(self, *args: Any, returncode: int = 1, **kwargs: Any) -> None: ... + +class SystemCheckError(CommandError): ... + +class CommandParser(ArgumentParser): + missing_args_message: str | None + called_from_command_line: bool | None + def __init__( + self, *, missing_args_message: str | None = None, called_from_command_line: bool | None = None, **kwargs: Any + ) -> None: ... + def error(self, message: str) -> Any: ... + +def handle_default_options(options: Namespace) -> None: ... +def no_translations(handle_func: Callable) -> Callable: ... + +class DjangoHelpFormatter(HelpFormatter): + show_last: set[str] + def add_usage(self, usage: str | None, actions: Iterable[Any], *args: Any, **kwargs: Any) -> Any: ... + def add_arguments(self, actions: Any) -> Any: ... + +class OutputWrapper(TextIOBase): + @property + def style_func(self) -> Callable[[str], str]: ... + @style_func.setter + def style_func(self, style_func: Callable[[str], str] | None) -> None: ... + ending: str + def __init__(self, out: TextIO, ending: str = "\n") -> None: ... + def __getattr__(self, name: str) -> Callable: ... + def flush(self) -> None: ... + def isatty(self) -> bool: ... + def write( # type: ignore[override] + self, msg: str = "", style_func: Callable[[str], str] | None = None, ending: str | None = None + ) -> None: ... + +class BaseCommand: + help: str + output_transaction: bool + requires_migrations_checks: bool + requires_system_checks: _ListOrTuple[str] | Literal["__all__"] + base_stealth_options: tuple[str, ...] + stealth_options: tuple[str, ...] + suppressed_base_arguments: set[str] + stdout: OutputWrapper + stderr: OutputWrapper + style: Style + def __init__( + self, + stdout: TextIO | None = None, + stderr: TextIO | None = None, + no_color: bool = False, + force_color: bool = False, + ) -> None: ... + def get_version(self) -> str: ... + def create_parser(self, prog_name: str, subcommand: str, **kwargs: Any) -> CommandParser: ... + def add_arguments(self, parser: CommandParser) -> None: ... + def add_base_argument(self, parser: CommandParser, *args: Any, **kwargs: Any) -> None: ... + def print_help(self, prog_name: str, subcommand: str) -> None: ... + def run_from_argv(self, argv: list[str]) -> None: ... + def execute(self, *args: Any, **options: Any) -> str | None: ... + def check( + self, + app_configs: Sequence[AppConfig] | None = None, + tags: Sequence[str] | None = None, + display_num_errors: bool = False, + include_deployment_checks: bool = False, + fail_level: int = 40, + databases: Sequence[str] | None = None, + ) -> None: ... + def check_migrations(self) -> None: ... + def handle(self, *args: Any, **options: Any) -> str | None: ... + +class AppCommand(BaseCommand): + missing_args_message: str + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, *app_labels: str, **options: Any) -> str | None: ... + def handle_app_config(self, app_config: Any, **options: Any) -> str | None: ... + +class LabelCommand(BaseCommand): + label: str + missing_args_message: Any + def add_arguments(self, parser: CommandParser) -> None: ... + def handle(self, *labels: str, **options: Any) -> str | None: ... + def handle_label(self, label: str, **options: Any) -> str | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/color.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/color.pyi new file mode 100644 index 000000000000..9fd033c4264b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/color.pyi @@ -0,0 +1,28 @@ +HAS_COLORAMA: bool + +def supports_color() -> bool: ... + +class Style: + # set by make_style. Method names are keys in django.utils.termcolors.PALETTES + def ERROR(self, text: str) -> str: ... + def SUCCESS(self, text: str) -> str: ... + def WARNING(self, text: str) -> str: ... + def NOTICE(self, text: str) -> str: ... + def SQL_FIELD(self, text: str) -> str: ... + def SQL_COLTYPE(self, text: str) -> str: ... + def SQL_KEYWORD(self, text: str) -> str: ... + def SQL_TABLE(self, text: str) -> str: ... + def HTTP_INFO(self, text: str) -> str: ... + def HTTP_SUCCESS(self, text: str) -> str: ... + def HTTP_REDIRECT(self, text: str) -> str: ... + def HTTP_NOT_MODIFIED(self, text: str) -> str: ... + def HTTP_BAD_REQUEST(self, text: str) -> str: ... + def HTTP_NOT_FOUND(self, text: str) -> str: ... + def HTTP_SERVER_ERROR(self, text: str) -> str: ... + def MIGRATE_HEADING(self, text: str) -> str: ... + def MIGRATE_LABEL(self, text: str) -> str: ... + def ERROR_OUTPUT(self, text: str) -> str: ... + +def make_style(config_string: str = "") -> Style: ... +def no_style() -> Style: ... +def color_style(force_color: bool = False) -> Style: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/check.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/check.pyi new file mode 100644 index 000000000000..0ebc3a9c202d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/check.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + def handle(self, *app_labels: list[str], **options: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/compilemessages.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/compilemessages.pyi new file mode 100644 index 000000000000..f4454cf134be --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/compilemessages.pyi @@ -0,0 +1,16 @@ +from pathlib import Path +from typing import Any + +from django.core.management.base import BaseCommand +from django.utils._os import _PathCompatible + +def has_bom(fn: Path) -> bool: ... +def is_writable(path: _PathCompatible) -> bool: ... + +class Command(BaseCommand): + program: str + program_options: list[str] + verbosity: int + has_errors: bool + def handle(self, **options: Any) -> None: ... + def compile_messages(self, locations: list[tuple[_PathCompatible, _PathCompatible]]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/createcachetable.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/createcachetable.pyi new file mode 100644 index 000000000000..20184201d6d4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/createcachetable.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + verbosity: int + def handle(self, *tablenames: list[str], **options: Any) -> None: ... + def create_table(self, database: str, tablename: str, dry_run: bool) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/dbshell.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/dbshell.pyi new file mode 100644 index 000000000000..6aed04c535e7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/dbshell.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + def handle(self, **options: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/diffsettings.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/diffsettings.pyi new file mode 100644 index 000000000000..390cf51089b6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/diffsettings.pyi @@ -0,0 +1,15 @@ +from collections.abc import Callable +from typing import Any + +from django.core.management.base import BaseCommand + +def module_to_dict(module: Any, omittable: Callable[[str], bool] = ...) -> dict[str, str]: ... + +class Command(BaseCommand): + def handle(self, **options: Any) -> str: ... + def output_hash( + self, user_settings: dict[str, str], default_settings: dict[str, str], **options: Any + ) -> list[str]: ... + def output_unified( + self, user_settings: dict[str, str], default_settings: dict[str, str], **options: Any + ) -> list[str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/dumpdata.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/dumpdata.pyi new file mode 100644 index 000000000000..32004ef1c930 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/dumpdata.pyi @@ -0,0 +1,7 @@ +from django.core.management.base import BaseCommand + +has_bz2: bool +has_lzma: bool + +class ProxyModelWarning(Warning): ... +class Command(BaseCommand): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/flush.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/flush.pyi new file mode 100644 index 000000000000..512fe1a304ec --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/flush.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.core.management.base import BaseCommand +from django.core.management.color import Style + +class Command(BaseCommand): + style: Style + + def handle(self, **options: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/inspectdb.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/inspectdb.pyi new file mode 100644 index 000000000000..ccdf42d9956e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/inspectdb.pyi @@ -0,0 +1,27 @@ +from collections.abc import Iterable +from typing import Any + +from django.core.management.base import BaseCommand +from django.db.backends.base.base import BaseDatabaseWrapper + +class Command(BaseCommand): + db_module: str + + def handle(self, **options: Any) -> None: ... + def handle_inspection(self, options: dict[str, Any]) -> Iterable[str]: ... + def normalize_col_name( + self, col_name: str, used_column_names: list[str], is_relation: bool + ) -> tuple[str, dict[str, str], list[str]]: ... + def normalize_table_name(self, table_name: str) -> str: ... + def get_field_type( + self, connection: BaseDatabaseWrapper, table_name: str, row: Any + ) -> tuple[str, dict[str, Any], list[str]]: ... + def get_meta( + self, + table_name: str, + constraints: Any, + column_to_field_name: Any, + is_view: bool, + is_partition: bool, + comment: str | None, + ) -> list[str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/loaddata.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/loaddata.pyi new file mode 100644 index 000000000000..53a668d1b9b6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/loaddata.pyi @@ -0,0 +1,60 @@ +import zipfile +from collections.abc import Sequence +from io import BufferedReader +from typing import Callable, Literal + +from django.apps.config import AppConfig +from django.core.management.base import BaseCommand +from django.core.serializers.base import DeserializedObject +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.base import Model +from django.utils.functional import cached_property +from typing_extensions import TypeAlias + +has_bz2: bool +has_lzma: bool + +READ_STDIN: str +_ReadBinaryMode: TypeAlias = Literal["r", "rb"] + +class Command(BaseCommand): + missing_args_message: str + ignore: bool + using: str + app_label: str + verbosity: int + excluded_models: set[type[Model]] + excluded_apps: set[AppConfig] + format: str + fixture_count: int + loaded_object_count: int + fixture_object_count: int + models: set[type[Model]] + serialization_formats: list[str] + objs_with_deferred_fields: list[DeserializedObject] + @cached_property + def compression_formats(self) -> dict[str | None, tuple[Callable[[str, _ReadBinaryMode], BufferedReader]]]: ... + def reset_sequences(self, connection: BaseDatabaseWrapper, models: set[type[Model]]) -> None: ... + def loaddata(self, fixture_labels: Sequence[str]) -> None: ... + def save_obj(self, obj: DeserializedObject) -> bool: ... + def load_label(self, fixture_label: str) -> None: ... + def get_fixture_name_and_dirs(self, fixture_name: str) -> tuple[str, list[str]]: ... + def get_targets(self, fixture_name: str, ser_fmt: str | None, cmp_fmt: str | None) -> set[str]: ... + def find_fixture_files_in_dir( + self, fixture_dir: str, fixture_name: str, targets: set[str] + ) -> list[tuple[str, str, str]]: ... + def find_fixtures(self, fixture_label: str) -> list[tuple[str, str | None, str | None]]: ... + @cached_property + def fixture_dirs(self) -> list[str]: ... + def parse_name(self, fixture_name: str) -> tuple[str, str | None, str | None]: ... + +class SingleZipReader(zipfile.ZipFile): + # Incompatible override + # zipfile.ZipFile.read( + # self, + # name: typing.Union[typing.Text, zipfile.ZipInfo], + # pwd: Optional[bytes] = ..., + # ) -> bytes: ... + def read(self) -> bytes: ... # type: ignore[override] + +def humanize(dirname: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/makemessages.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/makemessages.pyi new file mode 100644 index 000000000000..1bb1515316b1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/makemessages.pyi @@ -0,0 +1,70 @@ +from re import Match, Pattern +from typing import Any + +from django.core.management.base import BaseCommand +from django.utils.functional import cached_property + +plural_forms_re: Pattern[str] +STATUS_OK: int +NO_LOCALE_DIR: Any + +def check_programs(*programs: str) -> None: ... +def is_valid_locale(locale: str) -> Match[str] | None: ... + +class TranslatableFile: + dirpath: str + file_name: str + locale_dir: str + def __init__(self, dirpath: str, file_name: str, locale_dir: str | None) -> None: ... + +class BuildFile: + """ + Represent the state of a translatable file during the build process. + """ + + command: BaseCommand + domain: str + translatable: TranslatableFile + def __init__(self, command: BaseCommand, domain: str, translatable: TranslatableFile) -> None: ... + @cached_property + def is_templatized(self) -> bool: ... + @cached_property + def path(self) -> str: ... + @cached_property + def work_path(self) -> str: ... + def preprocess(self) -> None: ... + def postprocess_messages(self, msgs: str) -> str: ... + def cleanup(self) -> None: ... + +def normalize_eols(raw_contents: str) -> str: ... +def write_pot_file(potfile: str, msgs: str) -> None: ... + +class Command(BaseCommand): + translatable_file_class: type[TranslatableFile] + build_file_class: type[BuildFile] + msgmerge_options: list[str] + msguniq_options: list[str] + msgattrib_options: list[str] + xgettext_options: list[str] + + domain: str + verbosity: int + symlinks: bool + ignore_patterns: list[str] + no_obsolete: bool + keep_pot: bool + extensions: set[str] + invoked_for_django: bool + locale_paths: list[str] + default_locale_path: str | None + @cached_property + def gettext_version(self) -> tuple[int, int] | tuple[int, int, int]: ... + @cached_property + def settings_available(self) -> bool: ... + def build_potfiles(self) -> list[str]: ... + def remove_potfiles(self) -> None: ... + def find_files(self, root: str) -> list[TranslatableFile]: ... + def process_files(self, file_list: list[TranslatableFile]) -> None: ... + def process_locale_dir(self, locale_dir: str, files: list[TranslatableFile]) -> None: ... + def write_po_file(self, potfile: str, locale: str) -> None: ... + def copy_plural_forms(self, msgs: str, locale: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/makemigrations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/makemigrations.pyi new file mode 100644 index 000000000000..fc6a8432ce16 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/makemigrations.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from django.core.management.base import BaseCommand, OutputWrapper +from django.db.migrations.loader import MigrationLoader + +class Command(BaseCommand): + verbosity: int + interactive: bool + dry_run: bool + merge: bool + empty: bool + migration_name: str + include_header: bool + scriptable: bool + update: bool + @property + def log_output(self) -> OutputWrapper: ... + def log(self, msg: str) -> None: ... + def write_to_last_migration_files(self, changes: dict[str, Any]) -> None: ... + def write_migration_files( + self, changes: dict[str, Any], update_previous_migration_paths: dict[str, str] | None = None + ) -> None: ... + @staticmethod + def get_relative_path(path: str) -> str: ... + def handle_merge(self, loader: MigrationLoader, conflicts: dict[str, Any]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/migrate.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/migrate.pyi new file mode 100644 index 000000000000..7b82595af11a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/migrate.pyi @@ -0,0 +1,15 @@ +from collections.abc import Container +from typing import Any + +from django.core.management.base import BaseCommand +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.migrations.operations.base import Operation + +class Command(BaseCommand): + verbosity: int + interactive: bool + start: float + def migration_progress_callback(self, action: str, migration: Any | None = None, fake: bool = False) -> None: ... + def sync_apps(self, connection: BaseDatabaseWrapper, app_labels: Container[str]) -> None: ... + @staticmethod + def describe_operation(operation: Operation, backwards: bool) -> tuple[str, bool]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/optimizemigration.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/optimizemigration.pyi new file mode 100644 index 000000000000..8d75fb4d613f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/optimizemigration.pyi @@ -0,0 +1,3 @@ +from django.core.management.base import BaseCommand + +class Command(BaseCommand): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/runserver.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/runserver.pyi new file mode 100644 index 000000000000..28d03ec23432 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/runserver.pyi @@ -0,0 +1,19 @@ +from re import Pattern +from typing import Any + +from django.core.handlers.wsgi import WSGIHandler +from django.core.management.base import BaseCommand +from django.core.servers.basehttp import WSGIServer + +naiveip_re: Pattern[str] + +class Command(BaseCommand): + default_addr: str + default_addr_ipv6: str + default_port: str + protocol: str + server_cls: type[WSGIServer] + def run(self, **options: Any) -> None: ... + def get_handler(self, *args: Any, **options: Any) -> WSGIHandler: ... + def inner_run(self, *args: Any, **options: Any) -> None: ... + def on_bind(self, server_port: int) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sendtestemail.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sendtestemail.pyi new file mode 100644 index 000000000000..c27c67d72997 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sendtestemail.pyi @@ -0,0 +1,4 @@ +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + missing_args_message: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/shell.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/shell.pyi new file mode 100644 index 000000000000..a522f2ab6fd2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/shell.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from django.core.management import BaseCommand + +class Command(BaseCommand): + shells: list[str] + + def handle(self, **options: Any) -> None: ... + def ipython(self, options: Any) -> None: ... + def bpython(self, options: Any) -> None: ... + def python(self, options: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/showmigrations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/showmigrations.pyi new file mode 100644 index 000000000000..7162edd514a4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/showmigrations.pyi @@ -0,0 +1,7 @@ +from django.core.management.base import BaseCommand +from django.db.backends.base.base import BaseDatabaseWrapper + +class Command(BaseCommand): + verbosity: int + def show_list(self, connection: BaseDatabaseWrapper, app_names: list[str] | None = None) -> None: ... + def show_plan(self, connection: BaseDatabaseWrapper, app_names: list[str] | None = None) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlflush.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlflush.pyi new file mode 100644 index 000000000000..0fe988d86fb6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlflush.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + output_transaction: bool + + def handle(self, **options: Any) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlmigrate.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlmigrate.pyi new file mode 100644 index 000000000000..8608316d03e2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlmigrate.pyi @@ -0,0 +1,7 @@ +from typing import Any + +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + output_transaction: bool + def execute(self, *args: Any, **options: Any) -> str | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlsequencereset.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlsequencereset.pyi new file mode 100644 index 000000000000..713a16bef167 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/sqlsequencereset.pyi @@ -0,0 +1,3 @@ +from django.core.management.base import AppCommand + +class Command(AppCommand): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/squashmigrations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/squashmigrations.pyi new file mode 100644 index 000000000000..1c827decac64 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/squashmigrations.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from django.core.management.base import BaseCommand +from django.db.migrations.loader import MigrationLoader +from django.db.migrations.migration import Migration + +class Command(BaseCommand): + verbosity: int + interactive: bool + + def handle(self, **options: Any) -> None: ... + def find_migration(self, loader: MigrationLoader, app_label: str, name: str) -> Migration: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/startapp.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/startapp.pyi new file mode 100644 index 000000000000..1b9f0bc54bd2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/startapp.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.core.management.templates import TemplateCommand + +class Command(TemplateCommand): + missing_args_message: str + + def handle(self, **options: Any) -> None: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/startproject.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/startproject.pyi new file mode 100644 index 000000000000..1b9f0bc54bd2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/startproject.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.core.management.templates import TemplateCommand + +class Command(TemplateCommand): + missing_args_message: str + + def handle(self, **options: Any) -> None: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/test.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/test.pyi new file mode 100644 index 000000000000..aeb21e6604d2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/test.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + test_runner: Any + def run_from_argv(self, argv: Any) -> None: ... + def add_arguments(self, parser: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/testserver.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/testserver.pyi new file mode 100644 index 000000000000..8d75fb4d613f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/commands/testserver.pyi @@ -0,0 +1,3 @@ +from django.core.management.base import BaseCommand + +class Command(BaseCommand): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/sql.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/sql.pyi new file mode 100644 index 000000000000..a14f83a9fac1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/sql.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from django.core.management.color import Style +from django.db.backends.base.base import BaseDatabaseWrapper + +def sql_flush( + style: Style, + connection: BaseDatabaseWrapper, + reset_sequences: bool = True, + allow_cascade: bool = False, +) -> list[str]: ... +def emit_pre_migrate_signal(verbosity: int, interactive: bool, db: str, **kwargs: Any) -> None: ... +def emit_post_migrate_signal(verbosity: int, interactive: bool, db: str, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/templates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/templates.pyi new file mode 100644 index 000000000000..97d04ef0796c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/templates.pyi @@ -0,0 +1,23 @@ +from argparse import ArgumentParser +from collections.abc import Sequence +from typing import Any + +from django.core.management.base import BaseCommand + +class TemplateCommand(BaseCommand): + url_schemes: Sequence[str] + rewrite_template_suffixes: Sequence[tuple[str, str]] + app_or_project: str + a_or_an: str + paths_to_remove: Sequence[Any] + verbosity: Any + def add_arguments(self, parser: ArgumentParser) -> None: ... + def handle(self, app_or_project: str, name: str, target: str | None = ..., **options: Any) -> None: ... + def handle_template(self, template: str | None, subdir: str | None) -> str: ... + def validate_name(self, name: str, name_or_dir: str = ...) -> None: ... + def download(self, url: str) -> str: ... + def splitext(self, the_path: str) -> tuple[str, str]: ... + def extract(self, filename: str) -> str: ... + def is_url(self, template: str) -> bool: ... + def apply_umask(self, old_path: str, new_path: str) -> None: ... + def make_writeable(self, filename: str) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/management/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/management/utils.pyi new file mode 100644 index 000000000000..578c58c6539f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/management/utils.pyi @@ -0,0 +1,21 @@ +from collections.abc import Iterable, Sequence +from typing import Any + +from _typeshed import StrOrBytesPath, StrPath +from django.apps.config import AppConfig +from django.db.models.base import Model + +def popen_wrapper(args: list[str], stdout_encoding: str = "utf-8") -> tuple[str, str, int]: ... +def handle_extensions(extensions: Iterable[str]) -> set[str]: ... +def find_command( + cmd: str, + path: str | Iterable[str] | None = None, + pathext: str | Iterable[str] | None = None, +) -> str | None: ... +def get_random_secret_key() -> str: ... +def parse_apps_and_model_labels(labels: Iterable[str]) -> tuple[set[type[Model]], set[AppConfig]]: ... +def get_command_line_option(argv: Sequence[Any], option: Any) -> Any | None: ... +def normalize_path_patterns(patterns: Iterable[str]) -> list[str]: ... +def is_ignored_path(path: StrPath, ignore_patterns: Iterable[str]) -> bool: ... +def find_formatters() -> dict[str, str | None]: ... +def run_formatters(written_files: Sequence[StrOrBytesPath], black_path: str = ...) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/paginator.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/paginator.pyi new file mode 100644 index 000000000000..be57dad7264f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/paginator.pyi @@ -0,0 +1,72 @@ +from collections.abc import Iterable, Iterator, Sequence, Sized +from typing import ClassVar, Generic, Protocol, TypeVar, overload, type_check_only + +from django.db.models.fields import _ErrorMessagesDict +from django.utils.functional import _StrPromise, cached_property + +class UnorderedObjectListWarning(RuntimeWarning): ... +class InvalidPage(Exception): ... +class PageNotAnInteger(InvalidPage): ... +class EmptyPage(InvalidPage): ... + +_T = TypeVar("_T") + +@type_check_only +class _SupportsPagination(Protocol[_T], Sized, Iterable): + @overload + def __getitem__(self, index: int, /) -> _T: ... + @overload + def __getitem__(self, index: slice, /) -> _SupportsPagination[_T]: ... + +class Paginator(Generic[_T]): + ELLIPSIS: ClassVar[_StrPromise] + default_error_messages: ClassVar[_ErrorMessagesDict] + error_messages: _ErrorMessagesDict + object_list: _SupportsPagination[_T] + per_page: int + orphans: int + allow_empty_first_page: bool + def __init__( + self, + object_list: _SupportsPagination[_T], + per_page: int | str, + orphans: int = 0, + allow_empty_first_page: bool = True, + error_messages: _ErrorMessagesDict | None = None, + ) -> None: ... + def __iter__(self) -> Iterator[Page[_T]]: ... + def validate_number(self, number: int | float | str) -> int: ... + def get_page(self, number: int | float | str | None) -> Page[_T]: ... + def page(self, number: int | str) -> Page[_T]: ... + @cached_property + def count(self) -> int: ... + @cached_property + def num_pages(self) -> int: ... + @property + def page_range(self) -> range: ... + def get_elided_page_range( + self, number: int | float | str = 1, *, on_each_side: int = 3, on_ends: int = 2 + ) -> Iterator[str | int]: ... + +class Page(Sequence[_T]): + object_list: _SupportsPagination[_T] + number: int + paginator: Paginator[_T] + def __init__( + self, + object_list: _SupportsPagination[_T], + number: int, + paginator: Paginator[_T], + ) -> None: ... + @overload + def __getitem__(self, index: int) -> _T: ... + @overload + def __getitem__(self, index: slice) -> Sequence[_T]: ... # Avoid override error + def __len__(self) -> int: ... + def has_next(self) -> bool: ... + def has_previous(self) -> bool: ... + def has_other_pages(self) -> bool: ... + def next_page_number(self) -> int: ... + def previous_page_number(self) -> int: ... + def start_index(self) -> int: ... + def end_index(self) -> int: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/__init__.pyi new file mode 100644 index 000000000000..f8db005c4837 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/__init__.pyi @@ -0,0 +1,25 @@ +from collections.abc import Callable, Iterable, Iterator +from typing import Any + +from django.db.models.base import Model + +from .base import DeserializedObject, Deserializer, Serializer +from .base import SerializerDoesNotExist as SerializerDoesNotExist + +BUILTIN_SERIALIZERS: dict[str, str] + +class BadSerializer: + internal_use_only: bool + exception: BaseException + def __init__(self, exception: BaseException) -> None: ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... + +def register_serializer(format: str, serializer_module: str, serializers: dict[str, Any] | None = None) -> None: ... +def unregister_serializer(format: str) -> None: ... +def get_serializer(format: str) -> type[Serializer] | BadSerializer: ... +def get_serializer_formats() -> list[str]: ... +def get_public_serializer_formats() -> list[str]: ... +def get_deserializer(format: str) -> Callable | type[Deserializer]: ... +def serialize(format: str, queryset: Iterable[Model], **options: Any) -> Any: ... +def deserialize(format: str, stream_or_string: Any, **options: Any) -> Iterator[DeserializedObject]: ... +def sort_dependencies(app_list: Iterable[Any], allow_cycles: bool = False) -> list[type[Model]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/base.pyi new file mode 100644 index 000000000000..ecc3e167bc1b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/base.pyi @@ -0,0 +1,89 @@ +from collections.abc import Collection, Iterable, Sequence +from typing import IO, Any + +from django.db.models.base import Model +from django.db.models.fields import Field +from django.db.models.fields.related import ForeignKey, ManyToManyField + +DEFER_FIELD: object + +class SerializerDoesNotExist(KeyError): ... +class SerializationError(Exception): ... + +class DeserializationError(Exception): + @classmethod + def WithData( + cls, original_exc: Exception, model: str, fk: int | str, field_value: Sequence[str] | str | None + ) -> DeserializationError: ... + +class M2MDeserializationError(Exception): + original_exc: Exception + pk: Any + def __init__(self, original_exc: Exception, pk: Any) -> None: ... + +class ProgressBar: + progress_width: int + output: IO[str] | None + total_count: int + prev_done: int + def __init__(self, output: IO[str] | None, total_count: int) -> None: ... + def update(self, count: int) -> None: ... + +class Serializer: + internal_use_only: bool + progress_class: type[ProgressBar] + stream_class: type[IO[str]] + options: dict[str, Any] + stream: IO[str] + selected_fields: Collection[str] | None + use_natural_foreign_keys: bool + use_natural_primary_keys: bool + first: bool + def serialize( + self, + queryset: Iterable[Model], + *, + stream: IO[str] | None = None, + fields: Collection[str] | None = None, + use_natural_foreign_keys: bool = False, + use_natural_primary_keys: bool = False, + progress_output: IO[str] | None = None, + object_count: int = 0, + **options: Any, + ) -> Any: ... + def start_serialization(self) -> None: ... + def end_serialization(self) -> None: ... + def start_object(self, obj: Any) -> None: ... + def end_object(self, obj: Any) -> None: ... + def handle_field(self, obj: Any, field: Any) -> None: ... + def handle_fk_field(self, obj: Any, field: Any) -> None: ... + def handle_m2m_field(self, obj: Any, field: Any) -> None: ... + def getvalue(self) -> bytes | str | None: ... + +class Deserializer: + options: dict[str, Any] + stream: IO[str] | IO[bytes] + def __init__(self, stream_or_string: bytes | str | IO[bytes] | IO[str], **options: Any) -> None: ... + def __iter__(self) -> Deserializer: ... + def __next__(self) -> Any: ... + +class DeserializedObject: + object: Model + m2m_data: dict[str, Sequence[Any]] | None + deferred_fields: dict[Field, Any] + def __init__( + self, + obj: Model, + m2m_data: dict[str, Sequence[Any]] | None = None, + deferred_fields: dict[Field, Any] | None = None, + ) -> None: ... + def save(self, save_m2m: bool = True, using: str | None = None, **kwargs: Any) -> None: ... + def save_deferred_fields(self, using: str | None = None) -> None: ... + +def build_instance(Model: type[Model], data: dict[str, Any], db: str) -> Model: ... +def deserialize_m2m_values( + field: ManyToManyField, field_value: Iterable[Any], using: str | None, handle_forward_references: bool +) -> Sequence[Any] | object: ... +def deserialize_fk_value( + field: ForeignKey, field_value: Any, using: str | None, handle_forward_references: bool +) -> Any | object: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/json.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/json.pyi new file mode 100644 index 000000000000..f50593482cac --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/json.pyi @@ -0,0 +1,21 @@ +import json +from collections.abc import Iterator +from typing import IO, Any + +from django.core.serializers.base import DeserializedObject +from django.core.serializers.python import Serializer as PythonSerializer + +class Serializer(PythonSerializer): + json_kwargs: dict[str, Any] + +def Deserializer( + stream_or_string: IO[bytes] | IO[str] | bytes | str, **options: Any +) -> Iterator[DeserializedObject]: ... + +class DjangoJSONEncoder(json.JSONEncoder): + allow_nan: bool + check_circular: bool + ensure_ascii: bool + indent: int + skipkeys: bool + sort_keys: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/jsonl.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/jsonl.pyi new file mode 100644 index 000000000000..9c7aa5536be6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/jsonl.pyi @@ -0,0 +1,12 @@ +from collections.abc import Iterator +from typing import IO, Any + +from django.core.serializers.base import DeserializedObject +from django.core.serializers.python import Serializer as PythonSerializer + +class Serializer(PythonSerializer): + json_kwargs: dict[str, Any] + +def Deserializer( + stream_or_string: IO[bytes] | IO[str] | bytes | str, **options: Any +) -> Iterator[DeserializedObject]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/python.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/python.pyi new file mode 100644 index 000000000000..c7a106cd6890 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/python.pyi @@ -0,0 +1,14 @@ +from collections.abc import Iterator +from typing import Any + +from django.core.serializers import base +from django.core.serializers.base import DeserializedObject +from django.db.models.base import Model + +class Serializer(base.Serializer): + objects: list[Any] + def get_dump_object(self, obj: Model) -> dict[str, Any]: ... + +def Deserializer( + object_list: list[dict[str, Any]], *, using: str = "default", ignorenonexistent: bool = False, **options: Any +) -> Iterator[DeserializedObject]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/pyyaml.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/pyyaml.pyi new file mode 100644 index 000000000000..d6a439850040 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/pyyaml.pyi @@ -0,0 +1,22 @@ +from collections.abc import Iterator +from typing import IO, Any + +from django.core.serializers.base import DeserializedObject +from django.core.serializers.python import Serializer as PythonSerializer +from django.db.models.fields import Field +from yaml import CSafeDumper as SafeDumper +from yaml import MappingNode, ScalarNode + +class DjangoSafeDumper(SafeDumper): + def represent_decimal(self, data: Any) -> ScalarNode: ... + def represent_ordered_dict(self, data: Any) -> MappingNode: ... + +class Serializer(PythonSerializer): + internal_use_only: bool + def handle_field(self, obj: Any, field: Field) -> None: ... + def end_serialization(self) -> None: ... + def getvalue(self) -> Any: ... + +def Deserializer( + stream_or_string: bytes | str | IO[bytes] | IO[str], **options: Any +) -> Iterator[DeserializedObject]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/xml_serializer.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/xml_serializer.pyi new file mode 100644 index 000000000000..c1b6e048faf9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/serializers/xml_serializer.pyi @@ -0,0 +1,66 @@ +from typing import IO, Any +from xml.sax.expatreader import ExpatParser as _ExpatParser # type: ignore[import-not-found] + +from django.core.serializers import base + +class Serializer(base.Serializer): + def indent(self, level: int) -> None: ... + xml: Any + def start_serialization(self) -> None: ... + def end_serialization(self) -> None: ... + def start_object(self, obj: Any) -> None: ... + def end_object(self, obj: Any) -> None: ... + def handle_field(self, obj: Any, field: Any) -> None: ... + def handle_fk_field(self, obj: Any, field: Any) -> None: ... + def handle_m2m_field(self, obj: Any, field: Any) -> None: ... + +class Deserializer(base.Deserializer): + handle_forward_references: bool + event_stream: Any + db: str + ignore: bool + def __init__( + self, + stream_or_string: bytes | str | IO[bytes] | IO[str], + *, + using: str = ..., + ignorenonexistent: bool = ..., + **options: Any, + ) -> None: ... + def __next__(self) -> base.DeserializedObject: ... + +def getInnerText(node: Any) -> str: ... + +class DefusedExpatParser(_ExpatParser): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def start_doctype_decl(self, name: Any, sysid: Any, pubid: Any, has_internal_subset: Any) -> None: ... + def entity_decl( + self, name: Any, is_parameter_entity: Any, value: Any, base: Any, sysid: Any, pubid: Any, notation_name: Any + ) -> None: ... + def unparsed_entity_decl(self, name: Any, base: Any, sysid: Any, pubid: Any, notation_name: Any) -> None: ... + def external_entity_ref_handler(self, context: Any, base: Any, sysid: Any, pubid: Any) -> None: ... + def reset(self) -> None: ... + +class DefusedXmlException(ValueError): ... + +class DTDForbidden(DefusedXmlException): + name: Any + sysid: Any + pubid: Any + def __init__(self, name: Any, sysid: Any, pubid: Any) -> None: ... + +class EntitiesForbidden(DefusedXmlException): + name: Any + value: Any + base: Any + sysid: Any + pubid: Any + notation_name: Any + def __init__(self, name: Any, value: Any, base: Any, sysid: Any, pubid: Any, notation_name: Any) -> None: ... + +class ExternalReferenceForbidden(DefusedXmlException): + context: Any + base: Any + sysid: Any + pubid: Any + def __init__(self, context: Any, base: Any, sysid: Any, pubid: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/servers/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/servers/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/servers/basehttp.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/servers/basehttp.pyi new file mode 100644 index 000000000000..0e1120fb952a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/servers/basehttp.pyi @@ -0,0 +1,46 @@ +import socketserver +from io import BytesIO +from typing import Any, Callable +from wsgiref import simple_server + +from django.core.handlers.wsgi import WSGIHandler, WSGIRequest + +def get_internal_wsgi_application() -> WSGIHandler: ... +def is_broken_pipe_error() -> bool: ... + +class WSGIServer(simple_server.WSGIServer): + request_queue_size: int + address_family: Any + allow_reuse_address: Any + def __init__(self, *args: Any, ipv6: bool = ..., allow_reuse_address: bool = ..., **kwargs: Any) -> None: ... + def handle_error(self, request: Any, client_address: Any) -> None: ... + +class ThreadedWSGIServer(socketserver.ThreadingMixIn, WSGIServer): ... + +class ServerHandler(simple_server.ServerHandler): + def handle_error(self) -> None: ... + +class WSGIRequestHandler(simple_server.WSGIRequestHandler): + close_connection: bool + connection: WSGIRequest + request: WSGIRequest + rfile: BytesIO + wfile: BytesIO + protocol_version: str + def address_string(self) -> str: ... + def log_message(self, format: str, *args: Any) -> None: ... + def get_environ(self) -> dict[str, str]: ... + raw_requestline: bytes + requestline: str + request_version: str + def handle(self) -> None: ... + +def run( + addr: str | bytes | bytearray, + port: int, + wsgi_handler: WSGIHandler, + ipv6: bool = ..., + threading: bool = ..., + on_bind: Callable[[str], None] | None = ..., + server_cls: type[WSGIServer] = ..., +) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/signals.pyi new file mode 100644 index 000000000000..ff59bd05a13e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/signals.pyi @@ -0,0 +1,6 @@ +from django.dispatch import Signal + +request_started: Signal +request_finished: Signal +got_request_exception: Signal +setting_changed: Signal diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/signing.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/signing.pyi new file mode 100644 index 000000000000..2b5fa75fa158 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/signing.pyi @@ -0,0 +1,88 @@ +from datetime import timedelta +from typing import Any, Protocol, overload, type_check_only + +from typing_extensions import deprecated + +BASE62_ALPHABET: str + +class BadSignature(Exception): ... +class SignatureExpired(BadSignature): ... + +def b62_encode(s: int) -> str: ... +def b62_decode(s: str) -> int: ... +def b64_encode(s: bytes) -> bytes: ... +def b64_decode(s: bytes) -> bytes: ... +def base64_hmac(salt: bytes | str, value: bytes | str, key: bytes | str, algorithm: str = "sha1") -> str: ... +def get_cookie_signer(salt: str = "django.core.signing.get_cookie_signer") -> TimestampSigner: ... +@type_check_only +class Serializer(Protocol): + def dumps(self, obj: Any) -> bytes: ... + def loads(self, data: bytes) -> Any: ... + +class JSONSerializer: + def dumps(self, obj: Any) -> bytes: ... + def loads(self, data: bytes) -> Any: ... + +def dumps( + obj: Any, + key: bytes | str | None = None, + salt: bytes | str = "django.core.signing", + serializer: type[Serializer] = ..., + compress: bool = False, +) -> str: ... +def loads( + s: str, + key: bytes | str | None = None, + salt: bytes | str = "django.core.signing", + serializer: type[Serializer] = ..., + max_age: int | timedelta | None = None, + fallback_keys: list[str | bytes] | None = None, +) -> Any: ... + +class Signer: + key: bytes | str + fallback_keys: list[bytes | str] + sep: str + salt: bytes | str + algorithm: str + @overload + def __init__( + self, + *, + key: bytes | str | None = None, + sep: str = ":", + salt: bytes | str | None = None, + algorithm: str | None = None, + fallback_keys: list[bytes | str] | None = None, + ) -> None: ... + @overload + @deprecated("Passing positional arguments to Signer is deprecated and will be removed in Django 5.1") + def __init__( + self, + *args: Any, + key: bytes | str | None = None, + sep: str = ":", + salt: bytes | str | None = None, + algorithm: str | None = None, + fallback_keys: list[bytes | str] | None = None, + ) -> None: ... + def signature(self, value: bytes | str, key: bytes | str | None = None) -> str: ... + def sign(self, value: str) -> str: ... + def unsign(self, signed_value: str) -> str: ... + def sign_object( + self, + obj: Any, + serializer: type[Serializer] = ..., + compress: bool = False, + ) -> str: ... + def unsign_object( + self, + signed_obj: str, + serializer: type[Serializer] = ..., + **kwargs: Any, + ) -> Any: ... + +class TimestampSigner(Signer): + def timestamp(self) -> str: ... + def sign(self, value: str) -> str: ... + def unsign(self, value: str, max_age: int | timedelta | None = None) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/validators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/validators.pyi new file mode 100644 index 000000000000..cbe29a1b0859 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/validators.pyi @@ -0,0 +1,140 @@ +from collections.abc import Callable, Collection, Sequence, Sized +from decimal import Decimal +from re import Pattern, RegexFlag +from typing import Any + +from django.core.files.base import File +from django.utils.deconstruct import _Deconstructible +from django.utils.functional import _StrOrPromise +from typing_extensions import TypeAlias + +EMPTY_VALUES: Any + +_Regex: TypeAlias = str | Pattern[str] + +_ValidatorCallable: TypeAlias = Callable[[Any], None] # noqa: PYI047 + +class RegexValidator(_Deconstructible): + regex: _Regex # Pattern[str] on instance, but may be str on class definition + message: _StrOrPromise + code: str + inverse_match: bool + flags: int + def __init__( + self, + regex: _Regex | None = None, + message: _StrOrPromise | None = None, + code: str | None = None, + inverse_match: bool | None = None, + flags: RegexFlag | None = None, + ) -> None: ... + def __call__(self, value: Any) -> None: ... + +class URLValidator(RegexValidator): + ul: str + ipv4_re: str + ipv6_re: str + hostname_re: str + domain_re: str + tld_re: str + host_re: str + schemes: Sequence[str] + unsafe_chars: frozenset[str] + max_length: int + def __init__(self, schemes: Sequence[str] | None = None, **kwargs: Any) -> None: ... + def __call__(self, value: Any) -> None: ... + +integer_validator: RegexValidator + +def validate_integer(value: float | str | None) -> None: ... + +class EmailValidator(_Deconstructible): + message: _StrOrPromise + code: str + user_regex: Pattern[str] + domain_regex: Pattern[str] + literal_regex: Pattern[str] + domain_allowlist: Sequence[str] + def __init__( + self, + message: _StrOrPromise | None = None, + code: str | None = None, + allowlist: Sequence[str] | None = None, + ) -> None: ... + def __call__(self, value: str | None) -> None: ... + def validate_domain_part(self, domain_part: str) -> bool: ... + def __eq__(self, other: object) -> bool: ... + +validate_email: EmailValidator +slug_re: Pattern[str] +validate_slug: RegexValidator +slug_unicode_re: Pattern[str] +validate_unicode_slug: RegexValidator + +def validate_ipv4_address(value: str) -> None: ... +def validate_ipv6_address(value: str) -> None: ... +def validate_ipv46_address(value: str) -> None: ... + +_IPValidator: TypeAlias = tuple[list[Callable[[Any], None]], str] +ip_address_validator_map: dict[str, _IPValidator] + +def ip_address_validators(protocol: str, unpack_ipv4: bool) -> _IPValidator: ... +def int_list_validator( + sep: str = ",", message: _StrOrPromise | None = None, code: str = "invalid", allow_negative: bool = False +) -> RegexValidator: ... + +validate_comma_separated_integer_list: RegexValidator + +class BaseValidator(_Deconstructible): + message: _StrOrPromise + code: str + limit_value: Any + def __init__(self, limit_value: Any | Callable[[], Any], message: _StrOrPromise | None = None) -> None: ... + def __call__(self, value: Any) -> None: ... + def compare(self, a: Any, b: Any) -> bool: ... + def clean(self, x: Any) -> Any: ... + def __eq__(self, other: object) -> bool: ... + +class MaxValueValidator(BaseValidator): ... +class MinValueValidator(BaseValidator): ... + +class StepValueValidator(BaseValidator): + offset: int | None + def __init__( + self, limit_value: Any | Callable[[], Any], message: _StrOrPromise | None = None, offset: int | None = None + ) -> None: ... + +class MinLengthValidator(BaseValidator): + def clean(self, x: Sized) -> int: ... + +class MaxLengthValidator(BaseValidator): + def clean(self, x: Sized) -> int: ... + +class DecimalValidator(_Deconstructible): + messages: dict[str, str] + max_digits: int | None + decimal_places: int | None + def __init__(self, max_digits: int | None, decimal_places: int | None) -> None: ... + def __call__(self, value: Decimal) -> None: ... + def __eq__(self, other: object) -> bool: ... + +class FileExtensionValidator(_Deconstructible): + message: _StrOrPromise + code: str + allowed_extensions: Collection[str] | None + def __init__( + self, + allowed_extensions: Collection[str] | None = None, + message: _StrOrPromise | None = None, + code: str | None = None, + ) -> None: ... + def __call__(self, value: File) -> None: ... + +def get_available_image_extensions() -> Sequence[str]: ... +def validate_image_file_extension(value: File) -> None: ... + +class ProhibitNullCharactersValidator(_Deconstructible): + message: _StrOrPromise + code: str + def __init__(self, message: _StrOrPromise | None = None, code: str | None = None) -> None: ... + def __call__(self, value: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/core/wsgi.pyi b/python/helpers/bundled_stubs/Django/django-stubs/core/wsgi.pyi new file mode 100644 index 000000000000..ac5938a54749 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/core/wsgi.pyi @@ -0,0 +1,3 @@ +from django.core.handlers.wsgi import WSGIHandler + +def get_wsgi_application() -> WSGIHandler: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/__init__.pyi new file mode 100644 index 000000000000..2c50094e641b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/__init__.pyi @@ -0,0 +1,23 @@ +from typing import Any + +from .backends.base.base import BaseDatabaseWrapper +from .utils import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS # Not exported in __all__ +from .utils import DJANGO_VERSION_PICKLE_KEY as DJANGO_VERSION_PICKLE_KEY +from .utils import ConnectionHandler, ConnectionRouter +from .utils import DatabaseError as DatabaseError +from .utils import DataError as DataError +from .utils import Error as Error +from .utils import IntegrityError as IntegrityError +from .utils import InterfaceError as InterfaceError +from .utils import InternalError as InternalError +from .utils import NotSupportedError as NotSupportedError +from .utils import OperationalError as OperationalError +from .utils import ProgrammingError as ProgrammingError + +connections: ConnectionHandler +router: ConnectionRouter +# Actually ConnectionProxy, but quacks exactly like BaseDatabaseWrapper, it's not worth distinguishing the two. +connection: BaseDatabaseWrapper + +def close_old_connections(**kwargs: Any) -> None: ... +def reset_queries(**kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/base.pyi new file mode 100644 index 000000000000..0626d1949f03 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/base.pyi @@ -0,0 +1,130 @@ +from collections.abc import Callable, Generator, Iterator, MutableMapping +from contextlib import contextmanager +from datetime import tzinfo +from logging import Logger +from typing import Any + +from django.db.backends.base.client import BaseDatabaseClient +from django.db.backends.base.creation import BaseDatabaseCreation +from django.db.backends.base.features import BaseDatabaseFeatures +from django.db.backends.base.introspection import BaseDatabaseIntrospection +from django.db.backends.base.operations import BaseDatabaseOperations +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.backends.base.validation import BaseDatabaseValidation +from django.db.backends.utils import CursorDebugWrapper, CursorWrapper +from django.db.transaction import Atomic +from django.utils.functional import cached_property +from typing_extensions import Self, TypeAlias + +NO_DB_ALIAS: str +RAN_DB_VERSION_CHECK: set[str] + +logger: Logger + +_ExecuteWrapper: TypeAlias = Callable[ + [Callable[[str, Any, bool, dict[str, Any]], Any], str, Any, bool, dict[str, Any]], Any +] + +class BaseDatabaseWrapper: + data_types: dict[str, str] + data_types_suffix: dict[str, str] + data_type_check_constraints: dict[str, str] + vendor: str + display_name: str + SchemaEditorClass: type[BaseDatabaseSchemaEditor] + client_class: type[BaseDatabaseClient] + creation_class: type[BaseDatabaseCreation] + features_class: type[BaseDatabaseFeatures] + introspection_class: type[BaseDatabaseIntrospection] + ops_class: type[BaseDatabaseOperations] + validation_class: type[BaseDatabaseValidation] + queries_limit: int + connection: Any + settings_dict: dict[str, Any] + alias: str + queries_log: Any + force_debug_cursor: bool + autocommit: bool + in_atomic_block: bool + savepoint_state: int + savepoint_ids: list[str] + commit_on_exit: bool + needs_rollback: bool + close_at: float | None + closed_in_transaction: bool + errors_occurred: bool + run_on_commit: list[tuple[set[str], Callable[[], None]]] + run_commit_hooks_on_set_autocommit_on: bool + execute_wrappers: list[_ExecuteWrapper] + client: BaseDatabaseClient + creation: BaseDatabaseCreation + features: BaseDatabaseFeatures + introspection: BaseDatabaseIntrospection + ops: BaseDatabaseOperations + validation: BaseDatabaseValidation + operators: MutableMapping[str, str] + atomic_blocks: list[Atomic] + def __init__(self, settings_dict: dict[str, Any], alias: str = "default") -> None: ... + def ensure_timezone(self) -> bool: ... + @cached_property + def timezone(self) -> tzinfo | None: ... + @cached_property + def timezone_name(self) -> str: ... + @property + def queries_logged(self) -> bool: ... + @property + def queries(self) -> list[dict[str, str]]: ... + def get_database_version(self) -> tuple[int, ...]: ... + def check_database_version_supported(self) -> None: ... + def get_connection_params(self) -> dict[str, Any]: ... + def get_new_connection(self, conn_params: Any) -> Any: ... + def init_connection_state(self) -> None: ... + def create_cursor(self, name: Any | None = None) -> Any: ... + def connect(self) -> None: ... + def check_settings(self) -> None: ... + def ensure_connection(self) -> None: ... + def cursor(self) -> CursorWrapper: ... + def commit(self) -> None: ... + def rollback(self) -> None: ... + def close(self) -> None: ... + def savepoint(self) -> str | None: ... + def savepoint_rollback(self, sid: str) -> None: ... + def savepoint_commit(self, sid: str) -> None: ... + def clean_savepoints(self) -> None: ... + def get_autocommit(self) -> bool: ... + def set_autocommit( + self, autocommit: bool, force_begin_transaction_with_broken_autocommit: bool = False + ) -> None: ... + def get_rollback(self) -> bool: ... + def set_rollback(self, rollback: bool) -> None: ... + def validate_no_atomic_block(self) -> None: ... + def validate_no_broken_transaction(self) -> None: ... + @contextmanager + def constraint_checks_disabled(self) -> Iterator[None]: ... + def disable_constraint_checking(self) -> bool: ... + def enable_constraint_checking(self) -> None: ... + def check_constraints(self, table_names: Any | None = None) -> None: ... + def is_usable(self) -> bool: ... + def close_if_health_check_failed(self) -> None: ... + def close_if_unusable_or_obsolete(self) -> None: ... + @property + def allow_thread_sharing(self) -> bool: ... + def inc_thread_sharing(self) -> None: ... + def dec_thread_sharing(self) -> None: ... + def validate_thread_sharing(self) -> None: ... + def prepare_database(self) -> None: ... + @property + def wrap_database_errors(self) -> Any: ... + def chunked_cursor(self) -> CursorWrapper: ... + def make_debug_cursor(self, cursor: CursorWrapper) -> CursorDebugWrapper: ... + def make_cursor(self, cursor: CursorWrapper) -> CursorWrapper: ... + @contextmanager + def temporary_connection(self) -> Generator[CursorWrapper, None, None]: ... + @contextmanager + def _nodb_cursor(self) -> Generator[CursorWrapper, None, None]: ... + def schema_editor(self, *args: Any, **kwargs: Any) -> BaseDatabaseSchemaEditor: ... + def on_commit(self, func: Callable[[], object], robust: bool = False) -> None: ... + def run_and_clear_commit_hooks(self) -> None: ... + @contextmanager + def execute_wrapper(self, wrapper: _ExecuteWrapper) -> Generator[None, None, None]: ... + def copy(self, alias: str | None = None) -> Self: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/client.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/client.pyi new file mode 100644 index 000000000000..01178c58c0b0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/client.pyi @@ -0,0 +1,16 @@ +from collections.abc import Iterable, Sequence +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper + +class BaseDatabaseClient: + executable_name: str | None + connection: BaseDatabaseWrapper + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + @classmethod + def settings_to_cmd_args_env( + cls, + settings_dict: dict[str, Any], + parameters: Iterable[str], + ) -> tuple[Sequence[str], dict[str, str] | None]: ... + def runshell(self, parameters: Iterable[str]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/creation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/creation.pyi new file mode 100644 index 000000000000..3203de77f015 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/creation.pyi @@ -0,0 +1,31 @@ +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper + +TEST_DATABASE_PREFIX: str + +class BaseDatabaseCreation: + connection: BaseDatabaseWrapper + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + def log(self, msg: str) -> None: ... + def create_test_db( + self, verbosity: int = 1, autoclobber: bool = False, serialize: bool = True, keepdb: bool = False + ) -> str: ... + def set_as_test_mirror(self, primary_settings_dict: dict[str, dict[str, None] | int | str | None]) -> None: ... + def serialize_db_to_string(self) -> str: ... + def deserialize_db_from_string(self, data: str) -> None: ... + def clone_test_db( + self, suffix: Any, verbosity: int = 1, autoclobber: bool = False, keepdb: bool = False + ) -> None: ... + def get_test_db_clone_settings(self, suffix: str) -> dict[str, Any]: ... + def destroy_test_db( + self, + old_database_name: str | None = None, + verbosity: int = 1, + keepdb: bool = False, + suffix: str | None = None, + ) -> None: ... + def mark_expected_failures_and_skips(self) -> None: ... + def sql_table_creation_suffix(self) -> str: ... + def test_db_signature(self) -> tuple[str, str, str, str]: ... + def setup_worker_connection(self, _worker_id: int) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/features.pyi new file mode 100644 index 000000000000..f8916b0e1c61 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/features.pyi @@ -0,0 +1,153 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.base import Model +from django.db.utils import DatabaseError, DataError +from django.utils.functional import cached_property + +class BaseDatabaseFeatures: + minimum_database_version: tuple[int, ...] | None + gis_enabled: bool + allows_group_by_lob: bool + allows_group_by_selected_pks: bool + allows_group_by_select_index: bool + empty_fetchmany_value: Sequence[Any] + update_can_self_select: bool + delete_can_self_reference_subquery: bool + interprets_empty_strings_as_nulls: bool + supports_nullable_unique_constraints: bool + supports_partially_nullable_unique_constraints: bool + supports_deferrable_unique_constraints: bool + can_use_chunked_reads: bool + can_return_columns_from_insert: bool + can_return_rows_from_bulk_insert: bool + has_bulk_insert: bool + uses_savepoints: bool + can_release_savepoints: bool + related_fields_match_type: bool + allow_sliced_subqueries_with_in: bool + has_select_for_update: bool + has_select_for_update_nowait: bool + has_select_for_update_skip_locked: bool + has_select_for_update_of: bool + has_select_for_no_key_update: bool + select_for_update_of_column: bool + test_db_allows_multiple_connections: bool + supports_unspecified_pk: bool + supports_forward_references: bool + truncates_names: bool + has_real_datatype: bool + supports_subqueries_in_group_by: bool + ignores_unnecessary_order_by_in_subqueries: bool + has_native_uuid_field: bool + has_native_duration_field: bool + supports_temporal_subtraction: bool + supports_regex_backreferencing: bool + supports_date_lookup_using_string: bool + supports_timezones: bool + has_zoneinfo_database: bool + requires_explicit_null_ordering_when_grouping: bool + nulls_order_largest: bool + supports_order_by_nulls_modifier: bool + order_by_nulls_first: bool + max_query_params: int | None + allows_auto_pk_0: bool + can_defer_constraint_checks: bool + supports_tablespaces: bool + supports_sequence_reset: bool + can_introspect_default: bool + can_introspect_foreign_keys: bool + introspected_field_types: dict[str, str] + supports_index_column_ordering: bool + can_introspect_materialized_views: bool + can_distinct_on_fields: bool + atomic_transactions: bool + can_rollback_ddl: bool + schema_editor_uses_clientside_param_binding: bool + supports_combined_alters: bool + supports_foreign_keys: bool + can_create_inline_fk: bool + can_rename_index: bool + indexes_foreign_keys: bool + supports_column_check_constraints: bool + supports_table_check_constraints: bool + can_introspect_check_constraints: bool + supports_paramstyle_pyformat: bool + requires_literal_defaults: bool + supports_expression_defaults: bool + supports_default_keyword_in_insert: bool + supports_default_keyword_in_bulk_insert: bool + connection_persists_old_columns: bool + closed_cursor_error_class: type[DatabaseError] + has_case_insensitive_like: bool + bare_select_suffix: str + implied_column_null: bool + supports_select_for_update_with_limit: bool + greatest_least_ignores_nulls: bool + can_clone_databases: bool + ignores_table_name_case: bool + for_update_after_from: bool + supports_select_union: bool + supports_select_intersection: bool + supports_select_difference: bool + supports_slicing_ordering_in_compound: bool + supports_parentheses_in_compound: bool + supports_nulls_distinct_unique_constraints: bool + requires_compound_order_by_subquery: bool + supports_aggregate_filter_clause: bool + supports_index_on_text_field: bool + supports_over_clause: bool + supports_frame_range_fixed_distance: bool + only_supports_unbounded_with_preceding_and_following: bool + supports_cast_with_precision: bool + time_cast_precision: int + create_test_procedure_without_params_sql: str | None + create_test_procedure_with_int_param_sql: str | None + create_test_table_with_composite_primary_key: str | None + supports_callproc_kwargs: bool + supported_explain_formats: set[str] + supports_default_in_lead_lag: bool + supports_ignore_conflicts: bool + supports_update_conflicts: bool + supports_update_conflicts_with_target: bool + requires_casted_case_in_updates: bool + supports_partial_indexes: bool + supports_functions_in_partial_indexes: bool + supports_covering_indexes: bool + supports_expression_indexes: bool + collate_as_index_expression: bool + allows_multiple_constraints_on_same_fields: bool + supports_comparing_boolean_expr: bool + supports_json_field: bool + can_introspect_json_field: bool + supports_primitives_in_json_field: bool + has_native_json_field: bool + has_json_operators: bool + supports_json_field_contains: bool + json_key_contains_list_matching_requires_list: bool + has_json_object_function: bool + supports_collation_on_charfield: bool + supports_collation_on_textfield: bool + supports_non_deterministic_collations: bool + supports_comments: bool + supports_comments_inline: bool + supports_stored_generated_columns: bool + supports_virtual_generated_columns: bool + supports_logical_xor: bool + prohibits_null_characters_in_text_exception: tuple[ValueError | DataError] | None + supports_unlimited_charfield: bool + test_collations: dict[str, str | None] + test_now_utc_template: str | None + insert_test_table_with_defaults: str | None + django_test_expected_failures: set[str] + django_test_skips: dict[str, set[str]] + connection: BaseDatabaseWrapper + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + @cached_property + def supports_explaining_query_execution(self) -> bool: ... + @cached_property + def supports_transactions(self) -> bool: ... + @cached_property + def supports_boolean_expr_in_select_clause(self) -> bool: ... + def allows_group_by_selected_pks_on_model(self, model: type[Model]) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/introspection.pyi new file mode 100644 index 000000000000..a7040840b0c8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/introspection.pyi @@ -0,0 +1,33 @@ +from collections import namedtuple +from collections.abc import Iterable +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.utils import CursorWrapper +from django.db.models.base import Model + +TableInfo = namedtuple("TableInfo", ["name", "type"]) + +FieldInfo = namedtuple( + "FieldInfo", + ["name", "type_code", "display_size", "internal_size", "precision", "scale", "null_ok", "default", "collation"], +) + +class BaseDatabaseIntrospection: + data_types_reverse: Any + connection: BaseDatabaseWrapper + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + def get_field_type(self, data_type: str, description: FieldInfo) -> str: ... + def identifier_converter(self, name: str) -> str: ... + def table_names(self, cursor: CursorWrapper | None = None, include_views: bool = False) -> list[str]: ... + def get_table_list(self, cursor: CursorWrapper | None) -> Any: ... + def get_table_description(self, cursor: CursorWrapper | None, table_name: str) -> Any: ... + def get_migratable_models(self) -> Iterable[type[Model]]: ... + def django_table_names(self, only_existing: bool = False, include_views: bool = True) -> list[str]: ... + def installed_models(self, tables: list[str]) -> set[type[Model]]: ... + def sequence_list(self) -> list[dict[str, str]]: ... + def get_sequences(self, cursor: CursorWrapper | None, table_name: str, table_fields: Any = ()) -> Any: ... + def get_relations(self, cursor: CursorWrapper | None, table_name: str) -> dict[str, tuple[str, str]]: ... + def get_primary_key_column(self, cursor: CursorWrapper | None, table_name: str) -> str | None: ... + def get_primary_key_columns(self, cursor: CursorWrapper | None, table_name: str) -> list[str] | None: ... + def get_constraints(self, cursor: CursorWrapper | None, table_name: str) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/operations.pyi new file mode 100644 index 000000000000..c071866450c8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/operations.pyi @@ -0,0 +1,118 @@ +import json +from collections.abc import Iterable, Sequence +from datetime import date, time, timedelta +from datetime import datetime as real_datetime +from decimal import Decimal +from typing import Any + +from django.core.management.color import Style +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.utils import CursorWrapper +from django.db.models.base import Model +from django.db.models.constants import OnConflict +from django.db.models.expressions import Case, Col, Expression +from django.db.models.fields import Field +from django.db.models.sql.compiler import SQLCompiler + +class BaseDatabaseOperations: + compiler_module: str + integer_field_ranges: dict[str, tuple[int, int]] + set_operators: dict[str, str] + cast_data_types: dict[Any, Any] + cast_char_field_without_max_length: Any + PRECEDING: str + FOLLOWING: str + UNBOUNDED_PRECEDING: str + UNBOUNDED_FOLLOWING: str + CURRENT_ROW: str + explain_prefix: str | None + connection: BaseDatabaseWrapper + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + def autoinc_sql(self, table: str, column: str) -> str | None: ... + def bulk_batch_size(self, fields: Any, objs: Any) -> int: ... + def cache_key_culling_sql(self) -> str: ... + def unification_cast_sql(self, output_field: Field) -> str: ... + def date_extract_sql(self, lookup_type: str, sql: Any, params: Any) -> tuple[str, Any]: ... + # def date_interval_sql(self, timedelta: None) -> Any: ... + def date_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = None) -> tuple[str, Any]: ... + def datetime_cast_date_sql(self, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... + def datetime_cast_time_sql(self, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... + def datetime_extract_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... + def datetime_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> str: ... + def time_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = None) -> str: ... + def time_extract_sql(self, lookup_type: str, sql: str, params: Any) -> str: ... + def deferrable_sql(self) -> str: ... + def distinct_sql(self, fields: list[str], params: list[Any] | None) -> tuple[list[str], list[str]]: ... + def fetch_returned_insert_columns(self, cursor: Any, returning_params: Any) -> Any: ... + def field_cast_sql(self, db_type: str | None, internal_type: str) -> str: ... + def force_no_ordering(self) -> list[Any]: ... + def for_update_sql( + self, nowait: bool = False, skip_locked: bool = False, of: Any = (), no_key: bool = False + ) -> str: ... + def limit_offset_sql(self, low_mark: int, high_mark: int | None) -> str: ... + def last_executed_query(self, cursor: Any, sql: Any, params: Any) -> str: ... + def last_insert_id(self, cursor: CursorWrapper, table_name: str, pk_name: str) -> int: ... + def lookup_cast(self, lookup_type: str, internal_type: str | None = None) -> str: ... + def max_in_list_size(self) -> int | None: ... + def max_name_length(self) -> int | None: ... + def no_limit_value(self) -> str | None: ... + def pk_default_value(self) -> str: ... + def prepare_sql_script(self, sql: Any) -> list[str]: ... + def process_clob(self, value: str) -> str: ... + def return_insert_columns(self, fields: Any) -> Any: ... + def compiler(self, compiler_name: str) -> type[SQLCompiler]: ... + def quote_name(self, name: str) -> str: ... + def regex_lookup(self, lookup_type: str) -> str: ... + def savepoint_create_sql(self, sid: str) -> str: ... + def savepoint_commit_sql(self, sid: str) -> str: ... + def savepoint_rollback_sql(self, sid: str) -> str: ... + def set_time_zone_sql(self) -> str: ... + def sql_flush( + self, style: Any, tables: Sequence[str], *, reset_sequences: bool = False, allow_cascade: bool = False + ) -> list[str]: ... + def execute_sql_flush(self, sql_list: Iterable[str]) -> None: ... + def sequence_reset_by_name_sql(self, style: Style | None, sequences: list[Any]) -> list[Any]: ... + def sequence_reset_sql(self, style: Style, model_list: Sequence[type[Model]]) -> list[Any]: ... + def start_transaction_sql(self) -> str: ... + def end_transaction_sql(self, success: bool = True) -> str: ... + def tablespace_sql(self, tablespace: str | None, inline: bool = False) -> str: ... + def prep_for_like_query(self, x: str) -> str: ... + prep_for_iexact_query: Any + def validate_autopk_value(self, value: int) -> int: ... + def adapt_unknown_value(self, value: Any) -> Any: ... + def adapt_datefield_value(self, value: date | None) -> str | None: ... + def adapt_datetimefield_value(self, value: real_datetime | None) -> str | None: ... + def adapt_timefield_value(self, value: real_datetime | time | None) -> str | None: ... + def adapt_decimalfield_value( + self, value: Decimal | None, max_digits: int | None = None, decimal_places: int | None = None + ) -> str | None: ... + def adapt_ipaddressfield_value(self, value: str | None) -> str | None: ... + def adapt_json_value(self, value: Any, encoder: type[json.JSONEncoder] | None) -> str: ... + def adapt_integerfield_value(self, value: Any, internal_type: Any) -> Any: ... + def year_lookup_bounds_for_date_field(self, value: int, iso_year: bool = False) -> list[str]: ... + def year_lookup_bounds_for_datetime_field(self, value: int, iso_year: bool = False) -> list[str]: ... + def get_db_converters(self, expression: Expression) -> list[Any]: ... + def convert_durationfield_value( + self, value: float | None, expression: Expression, connection: BaseDatabaseWrapper + ) -> timedelta | None: ... + def check_expression_support(self, expression: Any) -> None: ... + def conditional_expression_supported_in_where_clause(self, expression: Any) -> bool: ... + def combine_expression(self, connector: str, sub_expressions: list[str]) -> str: ... + def combine_duration_expression(self, connector: Any, sub_expressions: Any) -> str: ... + def binary_placeholder_sql(self, value: Case | None) -> str: ... + def modify_insert_params(self, placeholder: str, params: Any) -> Any: ... + def integer_field_range(self, internal_type: Any) -> tuple[int, int]: ... + def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> tuple[str, tuple[Any, ...]]: ... + def window_frame_start(self, start: Any) -> str: ... + def window_frame_end(self, end: Any) -> str: ... + def window_frame_rows_start_end(self, start: int | None = None, end: int | None = None) -> tuple[str, str]: ... + def window_frame_range_start_end(self, start: int | None = None, end: int | None = None) -> tuple[str, str]: ... + def explain_query_prefix(self, format: str | None = None, **options: Any) -> str: ... + def insert_statement(self, on_conflict: OnConflict | None = None) -> str: ... + def on_conflict_suffix_sql( + self, fields: Any, on_conflict: Any, update_fields: Any, unique_fields: Any + ) -> str | Any: ... + def format_for_duration_arithmetic(self, sql: str) -> str: ... + def prepare_join_on_clause( + self, lhs_table: str, lhs_field: Field, rhs_table: str, rhs_field: Field + ) -> tuple[Col, Col]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/schema.pyi new file mode 100644 index 000000000000..118920f3b73f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/schema.pyi @@ -0,0 +1,110 @@ +from collections.abc import Sequence +from contextlib import AbstractContextManager +from logging import Logger +from types import TracebackType +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.ddl_references import Statement +from django.db.models.base import Model +from django.db.models.constraints import BaseConstraint +from django.db.models.fields import Field +from django.db.models.indexes import Index +from django.db.models.sql.compiler import _AsSqlType +from typing_extensions import Self + +logger: Logger + +class BaseDatabaseSchemaEditor(AbstractContextManager[Any]): + sql_create_table: str + sql_rename_table: str + sql_retablespace_table: str + sql_delete_table: str + sql_create_column: str + sql_alter_column: str + sql_alter_column_type: str + sql_alter_column_null: str + sql_alter_column_not_null: str + sql_alter_column_default: str + sql_alter_column_no_default: str + sql_alter_column_no_default_null: str + sql_delete_column: str + sql_rename_column: str + sql_update_with_default: str + sql_unique_constraint: str + sql_check_constraint: str + sql_delete_constraint: str + sql_constraint: str + sql_create_check: str + sql_delete_check: str + sql_create_unique: str + sql_delete_unique: str + + sql_create_fk: str + sql_create_inline_fk: str | None + sql_create_column_inline_fk: str | None + sql_delete_fk: str + + sql_create_index: str + sql_create_unique_index: str + sql_rename_index: str + sql_delete_index: str + sql_create_pk: str + sql_delete_pk: str + sql_delete_procedure: str + sql_alter_table_comment: str + sql_alter_column_comment: str + connection: BaseDatabaseWrapper + collect_sql: bool + collected_sql: Any + atomic_migration: Any + def __init__(self, connection: BaseDatabaseWrapper, collect_sql: bool = False, atomic: bool = True) -> None: ... + deferred_sql: Any + atomic: Any + def __enter__(self) -> Self: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + def execute(self, sql: Statement | str, params: Sequence[Any] | None = ()) -> None: ... + def quote_name(self, name: str) -> str: ... + def table_sql(self, model: type[Model]) -> tuple[str, list[Any]]: ... + def column_sql( + self, model: type[Model], field: Field, include_default: bool = False + ) -> tuple[None, None] | tuple[str, list[Any]]: ... + def skip_default(self, field: Field) -> bool: ... + def skip_default_on_alter(self, field: Field) -> bool: ... + def prepare_default(self, value: Any) -> Any: ... + def db_default_sql(self, field: Field) -> _AsSqlType: ... + def effective_default(self, field: Field) -> int | str: ... + def quote_value(self, value: Any) -> str: ... + def create_model(self, model: type[Model]) -> None: ... + def delete_model(self, model: type[Model]) -> None: ... + def add_index(self, model: type[Model], index: Index) -> None: ... + def remove_index(self, model: type[Model], index: Index) -> None: ... + def rename_index(self, model: type[Model], old_index: Index, new_index: Index) -> None: ... + def add_constraint(self, model: type[Model], constraint: BaseConstraint) -> None: ... + def remove_constraint(self, model: type[Model], constraint: BaseConstraint) -> None: ... + def alter_unique_together( + self, + model: type[Model], + old_unique_together: Sequence[Sequence[str]], + new_unique_together: Sequence[Sequence[str]], + ) -> None: ... + def alter_index_together( + self, + model: type[Model], + old_index_together: Sequence[Sequence[str]], + new_index_together: Sequence[Sequence[str]], + ) -> None: ... + def alter_db_table(self, model: type[Model], old_db_table: str, new_db_table: str) -> None: ... + def alter_db_table_comment( + self, model: type[Model], old_db_table_comment: str, new_db_table_comment: str + ) -> None: ... + def alter_db_tablespace(self, model: type[Model], old_db_tablespace: str, new_db_tablespace: str) -> None: ... + def add_field(self, model: type[Model], field: Field) -> None: ... + def remove_field(self, model: type[Model], field: Field) -> None: ... + def alter_field(self, model: type[Model], old_field: Field, new_field: Field, strict: bool = False) -> None: ... + def remove_procedure(self, procedure_name: Any, param_types: Any = ()) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/validation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/validation.pyi new file mode 100644 index 000000000000..6d1c8acb3a5a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/base/validation.pyi @@ -0,0 +1,10 @@ +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.fields import Field + +class BaseDatabaseValidation: + connection: BaseDatabaseWrapper + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + def check(self, **kwargs: Any) -> list[Any]: ... + def check_field(self, field: Field, **kwargs: Any) -> list[Any]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/ddl_references.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/ddl_references.pyi new file mode 100644 index 000000000000..d122b2151170 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/ddl_references.pyi @@ -0,0 +1,85 @@ +from collections.abc import Sequence +from typing import Any, Protocol, type_check_only + +@type_check_only +class _QuoteCallable(Protocol): + """Get rid of `cannot assign to method`""" + + def __call__(self, column: str, /) -> str: ... + +class Reference: + def references_table(self, table: Any) -> bool: ... + def references_column(self, table: Any, column: Any) -> bool: ... + def rename_table_references(self, old_table: Any, new_table: Any) -> None: ... + def rename_column_references(self, table: Any, old_column: Any, new_column: Any) -> None: ... + +class Table(Reference): + table: str + quote_name: _QuoteCallable + def __init__(self, table: str, quote_name: _QuoteCallable) -> None: ... + def references_table(self, table: str) -> bool: ... + def rename_table_references(self, old_table: str, new_table: str) -> None: ... + +class TableColumns(Table): + table: str + columns: list[str] + 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: ... + +class Columns(TableColumns): + columns: list[str] + table: str + quote_name: _QuoteCallable + col_suffixes: Sequence[str] + def __init__( + self, table: str, columns: list[str], quote_name: _QuoteCallable, col_suffixes: Sequence[str] = () + ) -> None: ... + +@type_check_only +class _NameCallable(Protocol): + """Get rid of `cannot assign to method`""" + + def __call__(self, table: str, columns: list[str], suffix: str, /) -> str: ... + +class IndexName(TableColumns): + columns: list[str] + table: str + suffix: str + create_index_name: _NameCallable + def __init__(self, table: str, columns: list[str], suffix: str, create_index_name: _NameCallable) -> None: ... + +class IndexColumns(Columns): + opclasses: Any + def __init__( + self, table: Any, columns: Any, quote_name: Any, col_suffixes: Any = (), opclasses: Any = () + ) -> None: ... + +class ForeignKeyName(TableColumns): + columns: list[str] + table: str + to_reference: TableColumns + suffix_template: str + create_fk_name: _NameCallable + def __init__( + self, + from_table: str, + from_columns: list[str], + to_table: str, + to_columns: list[str], + suffix_template: str, + create_fk_name: _NameCallable, + ) -> None: ... + def references_table(self, table: str) -> bool: ... + def references_column(self, table: str, column: str) -> bool: ... + def rename_table_references(self, old_table: str, new_table: str) -> None: ... + def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ... + +class Statement(Reference): + template: str + parts: dict[str, Table] + def __init__(self, template: str, **parts: Any) -> None: ... + def references_table(self, table: str) -> bool: ... + def references_column(self, table: str, column: str) -> bool: ... + def rename_table_references(self, old_table: str, new_table: str) -> None: ... + def rename_column_references(self, table: str, old_column: str, new_column: str) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/base.pyi new file mode 100644 index 000000000000..d8c767573e30 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/base.pyi @@ -0,0 +1,29 @@ +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.base.client import BaseDatabaseClient +from django.db.backends.base.creation import BaseDatabaseCreation +from django.db.backends.base.introspection import BaseDatabaseIntrospection +from django.db.backends.base.operations import BaseDatabaseOperations + +def complain(*args: Any, **kwargs: Any) -> Any: ... +def ignore(*args: Any, **kwargs: Any) -> None: ... + +class DatabaseOperations(BaseDatabaseOperations): + quote_name: Any + +class DatabaseClient(BaseDatabaseClient): ... + +class DatabaseCreation(BaseDatabaseCreation): + create_test_db: Any + destroy_test_db: Any + +class DatabaseIntrospection(BaseDatabaseIntrospection): + get_table_list: Any + get_table_description: Any + get_relations: Any + get_indexes: Any + +class DatabaseWrapper(BaseDatabaseWrapper): + operators: Any + ensure_connection: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/features.pyi new file mode 100644 index 000000000000..669b40f6fe74 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/dummy/features.pyi @@ -0,0 +1,5 @@ +from django.db.backends.base.features import BaseDatabaseFeatures + +class DummyDatabaseFeatures(BaseDatabaseFeatures): + supports_transactions: bool + uses_savepoints: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/base.pyi new file mode 100644 index 000000000000..b51618314347 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/base.pyi @@ -0,0 +1,72 @@ +from collections.abc import Container, Iterator +from typing import Any, Literal + +from django.db.backends.base.base import BaseDatabaseWrapper + +from .client import DatabaseClient +from .creation import DatabaseCreation +from .features import DatabaseFeatures +from .introspection import DatabaseIntrospection +from .operations import DatabaseOperations +from .validation import DatabaseValidation + +version: Any +django_conversions: Any +server_version_re: Any + +class CursorWrapper: + codes_for_integrityerror: Any + cursor: Any + def __init__(self, cursor: Any) -> None: ... + def execute(self, query: Any, args: Any | None = ...) -> Any: ... + def executemany(self, query: Any, args: Any) -> Any: ... + def __getattr__(self, attr: Any) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + +class DatabaseWrapper(BaseDatabaseWrapper): + client: DatabaseClient + creation: DatabaseCreation + features: DatabaseFeatures + introspection: DatabaseIntrospection + validation: DatabaseValidation + ops: DatabaseOperations + + client_class: type[DatabaseClient] + creation_class: type[DatabaseCreation] + features_class: type[DatabaseFeatures] + introspection_class: type[DatabaseIntrospection] + ops_class: type[DatabaseOperations] + validation_class: type[DatabaseValidation] + + vendor: str + data_types: Any + operators: Any + pattern_esc: str + pattern_ops: Any + isolation_levels: Any + Database: Any + SchemaEditorClass: Any + isolation_level: Any + def get_connection_params(self) -> dict[str, Any]: ... + def get_new_connection(self, conn_params: Any) -> Any: ... + def init_connection_state(self) -> None: ... + def create_cursor(self, name: Any | None = ...) -> CursorWrapper: ... + def disable_constraint_checking(self) -> Literal[True]: ... + needs_rollback: Any + def enable_constraint_checking(self) -> None: ... + def check_constraints(self, table_names: Any | None = ...) -> None: ... + def is_usable(self) -> bool: ... + @property + def display_name(self) -> str: ... # type: ignore[override] + @property + def data_type_check_constraints(self) -> dict[str, str]: ... # type: ignore[override] + @property + def mysql_server_data(self) -> dict[str, Any]: ... + @property + def mysql_server_info(self) -> str: ... + @property + def mysql_version(self) -> tuple[int, ...]: ... + @property + def mysql_is_mariadb(self) -> bool: ... + @property + def sql_mode(self) -> Container[str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/client.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/client.pyi new file mode 100644 index 000000000000..f3fa6ff300d0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/client.pyi @@ -0,0 +1,15 @@ +from collections.abc import Iterable +from typing import Any + +from django.db.backends.base.client import BaseDatabaseClient +from django.db.backends.mysql.base import DatabaseWrapper + +class DatabaseClient(BaseDatabaseClient): + connection: DatabaseWrapper + executable_name: str + @classmethod + def settings_to_cmd_args_env( + cls, + settings_dict: dict[str, Any], + parameters: Iterable[str], + ) -> tuple[list[str], dict[str, str] | None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/compiler.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/compiler.pyi new file mode 100644 index 000000000000..299d04faca7c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/compiler.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from django.db.models.sql import compiler +from django.db.models.sql.compiler import _AsSqlType + +class SQLCompiler(compiler.SQLCompiler): + def as_subquery_condition(self, alias: Any, columns: Any, compiler: Any) -> _AsSqlType: ... + +class SQLInsertCompiler(compiler.SQLInsertCompiler, SQLCompiler): ... + +class SQLDeleteCompiler(compiler.SQLDeleteCompiler, SQLCompiler): + # https://github.com/django/django/blob/242499f2dc2bf24a9a5c855690a2e13d3303581a/django/db/backends/mysql/compiler.py#L26 + def as_sql(self) -> _AsSqlType: ... # type: ignore[override] + +class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler): ... +class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/creation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/creation.pyi new file mode 100644 index 000000000000..548c0e116ede --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/creation.pyi @@ -0,0 +1,6 @@ +from django.db.backends.base.creation import BaseDatabaseCreation +from django.db.backends.mysql.base import DatabaseWrapper + +class DatabaseCreation(BaseDatabaseCreation): + connection: DatabaseWrapper + def sql_table_creation_suffix(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/features.pyi new file mode 100644 index 000000000000..1302e0b96c04 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/features.pyi @@ -0,0 +1,88 @@ +from typing import Any + +from django.db.backends.base.features import BaseDatabaseFeatures +from django.db.backends.mysql.base import DatabaseWrapper +from django.utils.functional import cached_property + +class DatabaseFeatures(BaseDatabaseFeatures): + connection: DatabaseWrapper + empty_fetchmany_value: Any + allows_group_by_pk: bool + related_fields_match_type: bool + allow_sliced_subqueries_with_in: bool + has_select_for_update: bool + supports_forward_references: bool + supports_regex_backreferencing: bool + supports_date_lookup_using_string: bool + can_introspect_autofield: bool + can_introspect_binary_field: bool + can_introspect_duration_field: bool + can_introspect_small_integer_field: bool + can_introspect_positive_integer_field: bool + introspected_boolean_field_type: str + supports_timezones: bool + requires_explicit_null_ordering_when_grouping: bool + can_release_savepoints: bool + atomic_transactions: bool + can_clone_databases: bool + supports_temporal_subtraction: bool + supports_select_intersection: bool + supports_select_difference: bool + supports_slicing_ordering_in_compound: bool + supports_index_on_text_field: bool + has_case_insensitive_like: bool + create_test_procedure_without_params_sql: str + create_test_procedure_with_int_param_sql: str + db_functions_convert_bytes_to_str: bool + supports_partial_indexes: bool + supports_order_by_nulls_modifier: bool + order_by_nulls_first: bool + + # fake properties (until `property` is generic) + supports_frame_range_fixed_distance: bool + supports_table_check_constraints: bool + can_return_rows_from_bulk_insert: bool + @cached_property + def allows_auto_pk_0(self) -> bool: ... # type: ignore[override] + @cached_property + def update_can_self_select(self) -> bool: ... # type: ignore[override] + @cached_property + def can_introspect_foreign_keys(self) -> bool: ... # type: ignore[override] + @cached_property + def introspected_field_types(self) -> dict[str, str]: ... # type: ignore[override] + @cached_property + def can_return_columns_from_insert(self) -> bool: ... # type: ignore[override] + @cached_property + def has_zoneinfo_database(self) -> bool: ... # type: ignore[override] + @cached_property + def is_sql_auto_is_null_enabled(self) -> bool: ... + @cached_property + def supports_over_clause(self) -> bool: ... # type: ignore[override] + @cached_property + def supports_column_check_constraints(self) -> bool: ... # type: ignore[override] + @cached_property + def can_introspect_check_constraints(self) -> bool: ... # type: ignore[override] + @cached_property + def has_select_for_update_skip_locked(self) -> bool: ... # type: ignore[override] + @cached_property + def has_select_for_update_nowait(self) -> bool: ... # type: ignore[override] + @cached_property + def has_select_for_update_of(self) -> bool: ... # type: ignore[override] + @cached_property + def supports_explain_analyze(self) -> bool: ... + @cached_property + def supported_explain_formats(self) -> set[str]: ... # type: ignore[override] + @cached_property + def supports_transactions(self) -> bool: ... + @cached_property + def ignores_table_name_case(self) -> bool: ... # type: ignore[override] + @cached_property + def supports_default_in_lead_lag(self) -> bool: ... # type: ignore[override] + @property + def supports_json_field(self) -> bool: ... # type: ignore[override] + @cached_property + def can_introspect_json_field(self) -> bool: ... # type: ignore[override] + @cached_property + def supports_index_column_ordering(self) -> bool: ... # type: ignore[override] + @cached_property + def supports_expression_indexes(self) -> bool: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/introspection.pyi new file mode 100644 index 000000000000..ec51fd27bd0c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/introspection.pyi @@ -0,0 +1,25 @@ +from collections import namedtuple +from typing import Any + +from django.db.backends.base.introspection import BaseDatabaseIntrospection +from django.db.backends.mysql.base import DatabaseWrapper + +FieldInfo: Any +InfoLine = namedtuple( + "InfoLine", + [ + "col_name", + "data_type", + "max_len", + "num_prec", + "num_scale", + "extra", + "column_default", + "collation", + "is_unsigned", + ], +) + +class DatabaseIntrospection(BaseDatabaseIntrospection): + connection: DatabaseWrapper + data_types_reverse: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/operations.pyi new file mode 100644 index 000000000000..195af2b69108 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/operations.pyi @@ -0,0 +1,44 @@ +from typing import Any + +from django.db.backends.base.operations import BaseDatabaseOperations +from django.db.backends.mysql.base import DatabaseWrapper +from django.db.models.constants import OnConflict + +class DatabaseOperations(BaseDatabaseOperations): + connection: DatabaseWrapper + compiler_module: str + integer_field_ranges: dict[str, tuple[int, int]] + cast_data_types: dict[str, str] + cast_char_field_without_max_length: str + explain_prefix: str + def date_extract_sql(self, lookup_type: str, sql: str, params: Any) -> tuple[str, Any]: ... + def date_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = None) -> Any: ... + def datetime_cast_date_sql(self, sql: str, params: Any, tzname: str | None) -> Any: ... + def datetime_cast_time_sql(self, sql: str, params: Any, tzname: str | None) -> Any: ... + def datetime_extract_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> Any: ... + def datetime_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> Any: ... + def time_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = None) -> Any: ... + def fetch_returned_insert_rows(self, cursor: Any) -> Any: ... + def format_for_duration_arithmetic(self, sql: Any) -> Any: ... + def force_no_ordering(self) -> Any: ... + def last_executed_query(self, cursor: Any, sql: Any, params: Any) -> Any: ... + def no_limit_value(self) -> Any: ... + def quote_name(self, name: str) -> Any: ... + def return_insert_columns(self, fields: Any) -> Any: ... + def sequence_reset_by_name_sql(self, style: Any, sequences: Any) -> Any: ... + def validate_autopk_value(self, value: Any) -> Any: ... + def adapt_datetimefield_value(self, value: Any) -> Any: ... + def adapt_timefield_value(self, value: Any) -> Any: ... + def max_name_length(self) -> Any: ... + def bulk_insert_sql(self, fields: Any, placeholder_rows: Any) -> Any: ... + def combine_expression(self, connector: Any, sub_expressions: Any) -> Any: ... + def get_db_converters(self, expression: Any) -> Any: ... + def convert_booleanfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_datetimefield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def binary_placeholder_sql(self, value: Any) -> Any: ... + def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> Any: ... + def explain_query_prefix(self, format: Any | None = None, **options: Any) -> Any: ... + def regex_lookup(self, lookup_type: str) -> Any: ... + def insert_statement(self, on_conflict: OnConflict | None = None) -> str: ... + def lookup_cast(self, lookup_type: str, internal_type: Any | None = None) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/schema.pyi new file mode 100644 index 000000000000..4a274a1daaa2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/schema.pyi @@ -0,0 +1,28 @@ +from typing import Any + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.backends.mysql.base import DatabaseWrapper +from django.db.models.base import Model +from django.db.models.fields import Field + +class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): + connection: DatabaseWrapper + sql_rename_table: str + sql_alter_column_null: str + sql_alter_column_not_null: str + sql_alter_column_type: str + sql_delete_column: str + sql_delete_unique: str + sql_create_column_inline_fk: str + sql_delete_fk: str + sql_delete_index: str + sql_create_pk: str + sql_delete_pk: str + sql_create_index: str + @property + def sql_delete_check(self) -> str: ... # type: ignore[override] + @property + def sql_rename_column(self) -> str: ... # type: ignore[override] + def quote_value(self, value: Any) -> str: ... + def skip_default(self, field: Field) -> bool: ... + def add_field(self, model: type[Model], field: Field) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/validation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/validation.pyi new file mode 100644 index 000000000000..40b3ce525cb8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/mysql/validation.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.db.backends.base.validation import BaseDatabaseValidation +from django.db.backends.mysql.base import DatabaseWrapper + +class DatabaseValidation(BaseDatabaseValidation): + connection: DatabaseWrapper + def check(self, **kwargs: Any) -> Any: ... + def check_field_type(self, field: Any, field_type: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/base.pyi new file mode 100644 index 000000000000..0d80f93c5f36 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/base.pyi @@ -0,0 +1,77 @@ +from collections.abc import Generator, Iterator +from contextlib import contextmanager +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper + +from .client import DatabaseClient +from .creation import DatabaseCreation +from .features import DatabaseFeatures +from .introspection import DatabaseIntrospection +from .operations import DatabaseOperations +from .validation import DatabaseValidation + +@contextmanager +def wrap_oracle_errors() -> Generator[None, None, None]: ... + +class _UninitializedOperatorsDescriptor: + def __get__(self, instance: Any, cls: Any | None = None) -> Any: ... + +class DatabaseWrapper(BaseDatabaseWrapper): + client: DatabaseClient + creation: DatabaseCreation + features: DatabaseFeatures + introspection: DatabaseIntrospection + validation: DatabaseValidation + ops: DatabaseOperations + + client_class: type[DatabaseClient] + creation_class: type[DatabaseCreation] + features_class: type[DatabaseFeatures] + introspection_class: type[DatabaseIntrospection] + ops_class: type[DatabaseOperations] + validation_class: type[DatabaseValidation] + + vendor: str + display_name: str + data_types: Any + data_type_check_constraints: Any + operators: Any + pattern_esc: str + Database: Any + SchemaEditorClass: Any + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def get_connection_params(self) -> Any: ... + def get_new_connection(self, conn_params: Any) -> Any: ... + pattern_ops: Any + def init_connection_state(self) -> None: ... + def create_cursor(self, name: Any | None = None) -> Any: ... + def check_constraints(self, table_names: Any | None = None) -> None: ... + def is_usable(self) -> Any: ... + @property + def oracle_version(self) -> Any: ... + +class OracleParam: + force_bytes: Any + input_size: Any + def __init__(self, param: Any, cursor: Any, strings_only: bool = False) -> None: ... + +class VariableWrapper: + var: Any + def __init__(self, var: Any) -> None: ... + def bind_parameter(self, cursor: Any) -> Any: ... + def __getattr__(self, key: Any) -> Any: ... + def __setattr__(self, key: Any, value: Any) -> None: ... + +class FormatStylePlaceholderCursor: + charset: str + cursor: Any + database: BaseDatabaseWrapper + def __init__(self, connection: Any, database: BaseDatabaseWrapper) -> None: ... + def execute(self, query: Any, params: Any | None = None) -> Any: ... + def executemany(self, query: Any, params: Any | None = None) -> Any: ... + def close(self) -> None: ... + def var(self, *args: Any) -> Any: ... + def arrayvar(self, *args: Any) -> Any: ... + def __getattr__(self, attr: Any) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/client.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/client.pyi new file mode 100644 index 000000000000..a8e42a9e9fc2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/client.pyi @@ -0,0 +1,16 @@ +from collections.abc import Iterable +from typing import Any + +from django.db.backends.base.client import BaseDatabaseClient +from django.db.backends.oracle.base import DatabaseWrapper + +class DatabaseClient(BaseDatabaseClient): + connection: DatabaseWrapper + executable_name: str + wrapper_name: str + @staticmethod + def connect_string(settings_dict: dict[str, Any]) -> str: ... + @classmethod + def settings_to_cmd_args_env( + cls, settings_dict: dict[str, Any], parameters: Iterable[str] + ) -> tuple[list[str], None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/creation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/creation.pyi new file mode 100644 index 000000000000..2289024efdcd --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/creation.pyi @@ -0,0 +1,11 @@ +from typing import Any + +from django.db.backends.base.creation import BaseDatabaseCreation +from django.db.backends.oracle.base import DatabaseWrapper + +TEST_DATABASE_PREFIX: str + +class DatabaseCreation(BaseDatabaseCreation): + connection: DatabaseWrapper + def set_as_test_mirror(self, primary_settings_dict: Any) -> None: ... + def test_db_signature(self) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/features.pyi new file mode 100644 index 000000000000..b8ec21cd1ec1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/features.pyi @@ -0,0 +1,50 @@ +from typing import Any + +from django.db.backends.base.features import BaseDatabaseFeatures +from django.db.backends.oracle.base import DatabaseWrapper + +class DatabaseFeatures(BaseDatabaseFeatures): + connection: DatabaseWrapper + interprets_empty_strings_as_nulls: bool + has_select_for_update: bool + has_select_for_update_nowait: bool + has_select_for_update_skip_locked: bool + has_select_for_update_of: bool + select_for_update_of_column: bool + can_return_columns_from_insert: bool + can_introspect_autofield: bool + supports_subqueries_in_group_by: bool + supports_transactions: bool + supports_timezones: bool + has_native_duration_field: bool + can_defer_constraint_checks: bool + supports_partially_nullable_unique_constraints: bool + supports_deferrable_unique_constraints: bool + truncates_names: bool + supports_tablespaces: bool + supports_sequence_reset: bool + can_introspect_materialized_views: bool + can_introspect_time_field: bool + atomic_transactions: bool + supports_combined_alters: bool + nulls_order_largest: bool + requires_literal_defaults: bool + closed_cursor_error_class: Any + bare_select_suffix: str + supports_select_for_update_with_limit: bool + supports_temporal_subtraction: bool + ignores_table_name_case: bool + supports_index_on_text_field: bool + has_case_insensitive_like: bool + create_test_procedure_without_params_sql: str + create_test_procedure_with_int_param_sql: str + supports_callproc_kwargs: bool + supports_over_clause: bool + supports_frame_range_fixed_distance: bool + supports_ignore_conflicts: bool + max_query_params: Any + supports_partial_indexes: bool + supports_slicing_ordering_in_compound: bool + allows_multiple_constraints_on_same_fields: bool + supports_primitives_in_json_field: bool + supports_json_field_contains: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/functions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/functions.pyi new file mode 100644 index 000000000000..d642ccaec701 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/functions.pyi @@ -0,0 +1,13 @@ +from typing import Any + +from django.db.models import Func + +class IntervalToSeconds(Func): + function: str + template: str + def __init__(self, expression: Any, *, output_field: Any | None = None, **extra: Any) -> None: ... + +class SecondsToInterval(Func): + function: str + template: str + def __init__(self, expression: Any, *, output_field: Any | None = None, **extra: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/introspection.pyi new file mode 100644 index 000000000000..2386381720af --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/introspection.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from django.db.backends.base.introspection import BaseDatabaseIntrospection +from django.db.backends.oracle.base import DatabaseWrapper + +FieldInfo: Any + +class DatabaseIntrospection(BaseDatabaseIntrospection): + connection: DatabaseWrapper + cache_bust_counter: int + @property + def data_types_reverse(self) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/operations.pyi new file mode 100644 index 000000000000..8047fecd5dc8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/operations.pyi @@ -0,0 +1,59 @@ +from typing import Any + +from django.db.backends.base.operations import BaseDatabaseOperations +from django.db.backends.oracle.base import DatabaseWrapper + +class DatabaseOperations(BaseDatabaseOperations): + connection: DatabaseWrapper + integer_field_ranges: Any + set_operators: Any + cast_char_field_without_max_length: str + cast_data_types: Any + def cache_key_culling_sql(self) -> str: ... + def date_extract_sql(self, lookup_type: str, sql: str, params: Any) -> tuple[str, Any]: ... + def date_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = ...) -> tuple[str, Any]: ... + def datetime_cast_date_sql(self, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... + def datetime_cast_time_sql(self, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... + def datetime_extract_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> tuple[str, Any]: ... + def datetime_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None) -> str: ... + def time_trunc_sql(self, lookup_type: str, sql: str, params: Any, tzname: str | None = ...) -> str: ... + def get_db_converters(self, expression: Any) -> list[Any]: ... + def convert_textfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_binaryfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_booleanfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_datetimefield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_datefield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_timefield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + @staticmethod + def convert_empty_string(value: Any, expression: Any, connection: Any) -> Any: ... + @staticmethod + def convert_empty_bytes(value: Any, expression: Any, connection: Any) -> Any: ... + def deferrable_sql(self) -> str: ... + def fetch_returned_insert_columns(self, cursor: Any, returning_params: Any) -> Any: ... + def field_cast_sql(self, db_type: Any, internal_type: Any) -> str: ... + def no_limit_value(self) -> str | None: ... + def limit_offset_sql(self, low_mark: Any, high_mark: Any) -> str: ... + def last_executed_query(self, cursor: Any, sql: Any, params: Any) -> str: ... + def last_insert_id(self, cursor: Any, table_name: Any, pk_name: Any) -> Any: ... + def lookup_cast(self, lookup_type: str, internal_type: Any | None = ...) -> str: ... + def max_in_list_size(self) -> int: ... + def max_name_length(self) -> int: ... + def pk_default_value(self) -> str: ... + def prep_for_iexact_query(self, x: Any) -> str: ... + def process_clob(self, value: Any) -> Any: ... + def quote_name(self, name: str) -> str: ... + def regex_lookup(self, lookup_type: str) -> str: ... + def return_insert_columns(self, fields: Any) -> Any: ... + def sequence_reset_by_name_sql(self, style: Any, sequences: Any) -> list[str]: ... + def sequence_reset_sql(self, style: Any, model_list: Any) -> list[str]: ... + def start_transaction_sql(self) -> str: ... + def tablespace_sql(self, tablespace: Any, inline: bool = ...) -> str: ... + def adapt_datefield_value(self, value: Any) -> Any: ... + def adapt_datetimefield_value(self, value: Any) -> Any: ... + def adapt_timefield_value(self, value: Any) -> Any: ... + def combine_expression(self, connector: Any, sub_expressions: Any) -> Any: ... + def bulk_insert_sql(self, fields: Any, placeholder_rows: Any) -> str: ... + def subtract_temporals(self, internal_type: Any, lhs: Any, rhs: Any) -> Any: ... + def bulk_batch_size(self, fields: Any, objs: Any) -> int: ... + def conditional_expression_supported_in_where_clause(self, expression: Any) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/schema.pyi new file mode 100644 index 000000000000..be1b90295301 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/schema.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.backends.oracle.base import DatabaseWrapper +from django.db.models.base import Model +from django.db.models.fields import Field + +class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): + connection: DatabaseWrapper + sql_create_column: str + sql_alter_column_type: str + sql_alter_column_null: str + sql_alter_column_not_null: str + sql_alter_column_default: str + sql_alter_column_no_default: str + sql_delete_column: str + sql_create_column_inline_fk: str + sql_delete_table: str + sql_create_index: str + def quote_value(self, value: Any) -> str: ... + def remove_field(self, model: type[Model], field: Field) -> None: ... + def delete_model(self, model: type[Model]) -> None: ... + def alter_field(self, model: type[Model], old_field: Field, new_field: Field, strict: bool = False) -> None: ... + def normalize_name(self, name: Any) -> str: ... + def prepare_default(self, value: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/utils.pyi new file mode 100644 index 000000000000..8aaf0edcd1eb --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/utils.pyi @@ -0,0 +1,24 @@ +import datetime +from typing import Any + +class InsertVar: + types: Any + db_type: Any + bound_param: Any + def __init__(self, field: Any) -> None: ... + def bind_parameter(self, cursor: Any) -> Any: ... + def get_value(self) -> Any: ... + +class Oracle_datetime(datetime.datetime): + input_size: Any + @classmethod + def from_datetime(cls, dt: Any) -> Any: ... + +class BulkInsertMapper: + BLOB: str + CLOB: str + DATE: str + INTERVAL: str + NUMBER: str + TIMESTAMP: str + types: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/validation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/validation.pyi new file mode 100644 index 000000000000..aef1ac2e6106 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/oracle/validation.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from django.db.backends.base.validation import BaseDatabaseValidation +from django.db.backends.oracle.base import DatabaseWrapper + +class DatabaseValidation(BaseDatabaseValidation): + connection: DatabaseWrapper + def check_field_type(self, field: Any, field_type: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/base.pyi new file mode 100644 index 000000000000..68e5d7e492a8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/base.pyi @@ -0,0 +1,43 @@ +from io import IOBase +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.utils import CursorDebugWrapper as BaseCursorDebugWrapper +from django.db.backends.utils import _ExecuteQuery +from django.utils.functional import cached_property + +from .client import DatabaseClient +from .creation import DatabaseCreation +from .features import DatabaseFeatures +from .introspection import DatabaseIntrospection +from .operations import DatabaseOperations + +def psycopg2_version() -> tuple[int, ...]: ... + +PSYCOPG2_VERSION: tuple[int, ...] + +class DatabaseWrapper(BaseDatabaseWrapper): + client: DatabaseClient + creation: DatabaseCreation + features: DatabaseFeatures + introspection: DatabaseIntrospection + ops: DatabaseOperations + + client_class: type[DatabaseClient] + creation_class: type[DatabaseCreation] + features_class: type[DatabaseFeatures] + introspection_class: type[DatabaseIntrospection] + ops_class: type[DatabaseOperations] + + operators: dict[str, str] + pattern_esc: str + pattern_ops: dict[str, str] + + # PostgreSQL backend-specific attributes. + _named_cursor_idx: int + @cached_property + def pg_version(self) -> int: ... + +class CursorDebugWrapper(BaseCursorDebugWrapper): + def copy_expert(self, sql: _ExecuteQuery, file: IOBase, *args: Any) -> Any: ... + def copy_to(self, file: IOBase, table: str, *args: Any, **kwargs: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/client.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/client.pyi new file mode 100644 index 000000000000..ba70d1bb4fb7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/client.pyi @@ -0,0 +1,14 @@ +from collections.abc import Iterable +from typing import Any + +from django.db.backends.base.client import BaseDatabaseClient +from django.db.backends.postgresql.base import DatabaseWrapper + +class DatabaseClient(BaseDatabaseClient): + connection: DatabaseWrapper + executable_name: str + @classmethod + def settings_to_cmd_args_env( + cls, settings_dict: dict[str, Any], parameters: Iterable[str] + ) -> tuple[list[str], dict[str, str] | None]: ... + def runshell(self, parameters: Iterable[str]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/creation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/creation.pyi new file mode 100644 index 000000000000..abb06160a863 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/creation.pyi @@ -0,0 +1,5 @@ +from django.db.backends.base.creation import BaseDatabaseCreation +from django.db.backends.postgresql.base import DatabaseWrapper + +class DatabaseCreation(BaseDatabaseCreation): + connection: DatabaseWrapper diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/features.pyi new file mode 100644 index 000000000000..36b507074eb0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/features.pyi @@ -0,0 +1,61 @@ +from typing import Any + +from django.db.backends.base.features import BaseDatabaseFeatures +from django.db.backends.postgresql.base import DatabaseWrapper +from django.utils.functional import cached_property + +class DatabaseFeatures(BaseDatabaseFeatures): + connection: DatabaseWrapper + allows_group_by_selected_pks: bool + can_return_columns_from_insert: bool + can_return_rows_from_bulk_insert: bool + has_real_datatype: bool + has_native_uuid_field: bool + has_native_duration_field: bool + has_native_json_field: bool + can_defer_constraint_checks: bool + has_select_for_update: bool + has_select_for_update_nowait: bool + has_select_for_update_of: bool + has_select_for_update_skip_locked: bool + has_select_for_no_key_update: bool + can_release_savepoints: bool + supports_tablespaces: bool + supports_transactions: bool + can_introspect_materialized_views: bool + can_distinct_on_fields: bool + can_rollback_ddl: bool + supports_combined_alters: bool + nulls_order_largest: bool + closed_cursor_error_class: Any + has_case_insensitive_like: bool + greatest_least_ignores_nulls: bool + can_clone_databases: bool + supports_temporal_subtraction: bool + supports_slicing_ordering_in_compound: bool + create_test_procedure_without_params_sql: str + create_test_procedure_with_int_param_sql: str + requires_casted_case_in_updates: bool + supports_over_clause: bool + only_supports_unbounded_with_preceding_and_following: bool + supports_aggregate_filter_clause: bool + supported_explain_formats: Any + validates_explain_options: bool + supports_deferrable_unique_constraints: bool + has_json_operators: bool + json_key_contains_list_matching_requires_list: bool + @property + def is_postgresql_10(self) -> bool: ... + @property + def is_postgresql_11(self) -> bool: ... + @property + def is_postgresql_12(self) -> bool: ... + @cached_property + def is_postgresql_13(self) -> bool: ... + has_brin_autosummarize: bool + has_websearch_to_tsquery: bool + supports_table_partitions: bool + supports_covering_indexes: bool + supports_covering_gist_indexes: bool + supports_non_deterministic_collations: bool + supports_alternate_collation_providers: bool diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/introspection.pyi new file mode 100644 index 000000000000..80c5fdb17916 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/introspection.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.db.backends.base.introspection import BaseDatabaseIntrospection +from django.db.backends.postgresql.base import DatabaseWrapper + +class DatabaseIntrospection(BaseDatabaseIntrospection): + connection: DatabaseWrapper + data_types_reverse: Any + ignored_tables: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/operations.pyi new file mode 100644 index 000000000000..354e6fc7ffd4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/operations.pyi @@ -0,0 +1,13 @@ +from collections.abc import Iterable +from typing import Any + +from django.db.backends.base.operations import BaseDatabaseOperations +from django.db.backends.postgresql.base import DatabaseWrapper + +class DatabaseOperations(BaseDatabaseOperations): + connection: DatabaseWrapper + explain_options: frozenset[str] + + def bulk_insert_sql(self, fields: Any, placeholder_rows: Iterable[str]) -> str: ... + def compose_sql(self, sql: Any, params: Any) -> Any: ... + def fetch_returned_insert_rows(self, cursor: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/schema.pyi new file mode 100644 index 000000000000..5aa7e3d2617f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/postgresql/schema.pyi @@ -0,0 +1,23 @@ +from typing import Any + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.backends.postgresql.base import DatabaseWrapper +from django.db.models.base import Model +from django.db.models.indexes import Index + +class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): + connection: DatabaseWrapper + sql_create_sequence: str + sql_delete_sequence: str + sql_set_sequence_max: str + sql_set_sequence_owner: str + sql_create_index: str + sql_create_index_concurrently: str + sql_delete_index: str + sql_delete_index_concurrently: str + sql_create_column_inline_fk: str + sql_delete_fk: str + sql_delete_procedure: str + def quote_value(self, value: Any) -> str: ... + def add_index(self, model: type[Model], index: Index, concurrently: bool = False) -> None: ... + def remove_index(self, model: type[Model], index: Index, concurrently: bool = False) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/signals.pyi new file mode 100644 index 000000000000..79c4207c313a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/signals.pyi @@ -0,0 +1,3 @@ +from django.dispatch import Signal + +connection_created: Signal diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/base.pyi new file mode 100644 index 000000000000..b2714365885a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/base.pyi @@ -0,0 +1,36 @@ +from collections.abc import Callable +from sqlite3 import dbapi2 as Database +from typing import Any, TypeVar + +from django.db.backends.base.base import BaseDatabaseWrapper + +from .client import DatabaseClient +from .creation import DatabaseCreation +from .features import DatabaseFeatures +from .introspection import DatabaseIntrospection +from .operations import DatabaseOperations + +_R = TypeVar("_R") + +def decoder(conv_func: Callable[[str], _R]) -> Callable[[bytes], _R]: ... + +class DatabaseWrapper(BaseDatabaseWrapper): + client: DatabaseClient + creation: DatabaseCreation + features: DatabaseFeatures + introspection: DatabaseIntrospection + ops: DatabaseOperations + + client_class: type[DatabaseClient] + creation_class: type[DatabaseCreation] + features_class: type[DatabaseFeatures] + introspection_class: type[DatabaseIntrospection] + ops_class: type[DatabaseOperations] + + def is_in_memory_db(self) -> bool: ... + +FORMAT_QMARK_REGEX: Any + +class SQLiteCursorWrapper(Database.Cursor): ... + +def check_sqlite_version() -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/client.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/client.pyi new file mode 100644 index 000000000000..42eb8d80105f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/client.pyi @@ -0,0 +1,13 @@ +from collections.abc import Iterable +from typing import Any + +from django.db.backends.base.client import BaseDatabaseClient +from django.db.backends.sqlite3.base import DatabaseWrapper + +class DatabaseClient(BaseDatabaseClient): + connection: DatabaseWrapper + executable_name: str + @classmethod + def settings_to_cmd_args_env( + cls, settings_dict: dict[str, Any], parameters: Iterable[str] + ) -> tuple[list[str], None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/creation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/creation.pyi new file mode 100644 index 000000000000..a5767a685480 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/creation.pyi @@ -0,0 +1,10 @@ +from os import PathLike + +from django.db.backends.base.creation import BaseDatabaseCreation +from django.db.backends.sqlite3.base import DatabaseWrapper + +class DatabaseCreation(BaseDatabaseCreation): + connection: DatabaseWrapper + + @staticmethod + def is_in_memory_db(database_name: str | PathLike[str]) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/features.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/features.pyi new file mode 100644 index 000000000000..b4d9c91b88f7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/features.pyi @@ -0,0 +1,5 @@ +from django.db.backends.base.features import BaseDatabaseFeatures +from django.db.backends.sqlite3.base import DatabaseWrapper + +class DatabaseFeatures(BaseDatabaseFeatures): + connection: DatabaseWrapper diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/introspection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/introspection.pyi new file mode 100644 index 000000000000..4a3434b66f01 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/introspection.pyi @@ -0,0 +1,15 @@ +from typing import Any + +from django.db.backends.base.introspection import BaseDatabaseIntrospection +from django.db.backends.sqlite3.base import DatabaseWrapper + +field_size_re: Any + +def get_field_size(name: str) -> int | None: ... + +class FlexibleFieldLookupDict: + base_data_types_reverse: Any + def __getitem__(self, key: str) -> Any: ... + +class DatabaseIntrospection(BaseDatabaseIntrospection): + connection: DatabaseWrapper diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/operations.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/operations.pyi new file mode 100644 index 000000000000..2da2f31a0b6a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/operations.pyi @@ -0,0 +1,19 @@ +from collections.abc import Callable, Iterable +from typing import Any +from uuid import UUID + +from django.db.backends.base.operations import BaseDatabaseOperations + +class DatabaseOperations(BaseDatabaseOperations): + jsonfield_datatype_values: frozenset[str] + def bulk_insert_sql(self, fields: Any, placeholder_rows: Iterable[str]) -> str: ... + def convert_booleanfield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_datefield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_datetimefield_value(self, value: Any, expression: Any, connection: Any) -> Any | None: ... + def convert_timefield_value(self, value: Any, expression: Any, connection: Any) -> Any: ... + def convert_uuidfield_value(self, value: Any, expression: Any, connection: Any) -> UUID | None: ... + def fetch_returned_insert_rows(self, cursor: Any) -> Any: ... + def get_decimalfield_converter( + self, + expression: Any, + ) -> Callable: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/schema.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/schema.pyi new file mode 100644 index 000000000000..1b96b579b55c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/sqlite3/schema.pyi @@ -0,0 +1,5 @@ +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.backends.sqlite3.base import DatabaseWrapper + +class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): + connection: DatabaseWrapper diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/backends/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/utils.pyi new file mode 100644 index 000000000000..912a49ae70d0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/backends/utils.pyi @@ -0,0 +1,89 @@ +import datetime +from collections.abc import Generator, Iterator, Mapping, Sequence +from contextlib import contextmanager +from decimal import Decimal +from logging import Logger +from types import TracebackType +from typing import Any, Literal, Protocol, overload, type_check_only +from uuid import UUID + +from typing_extensions import Self, TypeAlias + +logger: Logger + +# Protocol matching psycopg2.sql.Composable, to avoid depending psycopg2 +@type_check_only +class _Composable(Protocol): + def as_string(self, context: Any) -> str: ... + def __add__(self, other: Self) -> _Composable: ... + def __mul__(self, n: int) -> _Composable: ... + +_ExecuteQuery: TypeAlias = str | _Composable + +# Python types that can be adapted to SQL. +_SQLType: TypeAlias = ( + None + | bool + | int + | float + | Decimal + | str + | bytes + | datetime.date + | datetime.datetime + | UUID + | tuple[Any, ...] + | list[Any] +) +_ExecuteParameters: TypeAlias = Sequence[_SQLType] | Mapping[str, _SQLType] | None + +class CursorWrapper: + cursor: Any + db: Any + def __init__(self, cursor: Any, db: Any) -> None: ... + WRAP_ERROR_ATTRS: Any + APPS_NOT_READY_WARNING_MSG: str + + def __getattr__(self, attr: str) -> Any: ... + def __iter__(self) -> Iterator[tuple[Any, ...]]: ... + def __enter__(self) -> Self: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + def callproc( + self, procname: str, params: Sequence[Any] | None = None, kparams: dict[str, int] | None = None + ) -> Any: ... + def execute(self, sql: _ExecuteQuery, params: _ExecuteParameters | None = None) -> Any: ... + def executemany(self, sql: _ExecuteQuery, param_list: Sequence[_ExecuteParameters]) -> Any: ... + +class CursorDebugWrapper(CursorWrapper): + cursor: Any + db: Any + @contextmanager + def debug_sql( + self, + sql: str | None = None, + params: _ExecuteParameters | Sequence[_ExecuteParameters] | None = None, + use_last_executed_query: bool = False, + many: bool = False, + ) -> Generator[None, None, None]: ... + +@overload +def typecast_date(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap] +@overload +def typecast_date(s: str) -> datetime.date: ... +@overload +def typecast_time(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap] +@overload +def typecast_time(s: str) -> datetime.time: ... +@overload +def typecast_timestamp(s: None | Literal[""]) -> None: ... # type: ignore[overload-overlap] +@overload +def typecast_timestamp(s: str) -> datetime.datetime: ... +def split_identifier(identifier: str) -> tuple[str, str]: ... +def truncate_name(identifier: str, length: int | None = None, hash_len: int = 4) -> str: ... +def format_number(value: Decimal | None, max_digits: int | None, decimal_places: int | None) -> str | None: ... +def strip_quotes(table_name: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/__init__.pyi new file mode 100644 index 000000000000..4a8e9a23e33e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/__init__.pyi @@ -0,0 +1,7 @@ +# Stubs for django.db.migrations (Python 3.6) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from .migration import Migration as Migration +from .migration import swappable_dependency as swappable_dependency +from .operations import * diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/autodetector.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/autodetector.pyi new file mode 100644 index 000000000000..8448276a0db5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/autodetector.pyi @@ -0,0 +1,71 @@ +from collections.abc import Callable, Iterable +from typing import Any + +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.questioner import MigrationQuestioner +from django.db.migrations.state import ProjectState +from django.db.models.fields import Field + +class MigrationAutodetector: + from_state: ProjectState + to_state: ProjectState + questioner: MigrationQuestioner + existing_apps: set[Any] + def __init__( + self, from_state: ProjectState, to_state: ProjectState, questioner: MigrationQuestioner | None = None + ) -> None: ... + def changes( + self, + graph: MigrationGraph, + trim_to_apps: set[str] | None = None, + convert_apps: set[str] | None = None, + migration_name: str | None = None, + ) -> dict[str, list[Migration]]: ... + def deep_deconstruct(self, obj: Any) -> Any: ... + def only_relation_agnostic_fields( + self, fields: dict[str, Field] + ) -> list[tuple[str, list[Any], dict[str, Callable | int | str]]]: ... + def check_dependency(self, operation: Operation, dependency: tuple[str, str, str | None, bool | str]) -> bool: ... + def add_operation( + self, + app_label: str, + operation: Operation, + dependencies: Iterable[tuple[str, str, str | None, bool | str]] | None = None, + beginning: bool = False, + ) -> None: ... + def swappable_first_key(self, item: tuple[str, str]) -> tuple[str, str]: ... + renamed_models: Any + renamed_models_rel: Any + def generate_renamed_models(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 create_renamed_fields(self) -> None: ... + renamed_fields: Any + def generate_renamed_fields(self) -> None: ... + def generate_added_fields(self) -> None: ... + def generate_removed_fields(self) -> None: ... + def generate_altered_fields(self) -> None: ... + def create_altered_indexes(self) -> None: ... + def generate_renamed_indexes(self) -> None: ... + def create_altered_constraints(self) -> None: ... + def generate_added_constraints(self) -> None: ... + def generate_removed_constraints(self) -> None: ... + def generate_added_indexes(self) -> None: ... + def generate_removed_indexes(self) -> None: ... + def generate_removed_altered_unique_together(self) -> None: ... + def generate_altered_unique_together(self) -> None: ... + def generate_altered_index_together(self) -> None: ... + def generate_altered_db_table(self) -> None: ... + def generate_altered_db_table_comment(self) -> None: ... + def generate_altered_options(self) -> None: ... + def generate_altered_order_with_respect_to(self) -> None: ... + def generate_altered_managers(self) -> None: ... + def arrange_for_graph( + self, changes: dict[str, list[Migration]], graph: MigrationGraph, migration_name: str | None = None + ) -> dict[str, list[Migration]]: ... + @classmethod + def parse_number(cls, name: str) -> int: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/exceptions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/exceptions.pyi new file mode 100644 index 000000000000..5715c449a08a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/exceptions.pyi @@ -0,0 +1,18 @@ +from django.db.migrations.migration import Migration +from django.db.utils import DatabaseError + +class AmbiguityError(Exception): ... +class BadMigrationError(Exception): ... +class CircularDependencyError(Exception): ... +class InconsistentMigrationHistory(Exception): ... +class InvalidBasesError(ValueError): ... +class IrreversibleError(RuntimeError): ... + +class NodeNotFoundError(LookupError): + message: str + origin: Migration | None + node: tuple[str, str] + def __init__(self, message: str, node: tuple[str, str], origin: Migration | None = None) -> None: ... + +class MigrationSchemaMissing(DatabaseError): ... +class InvalidMigrationPlan(ValueError): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/executor.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/executor.pyi new file mode 100644 index 000000000000..21a72570c76f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/executor.pyi @@ -0,0 +1,44 @@ +from collections.abc import Sequence +from typing import Protocol, type_check_only + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.migrations.migration import Migration + +from .loader import MigrationLoader +from .recorder import MigrationRecorder +from .state import ProjectState + +@type_check_only +class _ProgressCallbackT(Protocol): + def __call__(self, action: str, migration: Migration | None = ..., fake: bool | None = ..., /) -> None: ... + +class MigrationExecutor: + connection: BaseDatabaseWrapper + loader: MigrationLoader + recorder: MigrationRecorder + progress_callback: _ProgressCallbackT | None + def __init__( + self, + connection: BaseDatabaseWrapper | None, + progress_callback: _ProgressCallbackT | None = None, + ) -> None: ... + def migration_plan( + self, targets: Sequence[tuple[str, str | None]] | set[tuple[str, str]], clean_start: bool = False + ) -> list[tuple[Migration, bool]]: ... + def migrate( + self, + targets: Sequence[tuple[str, str | None]] | None, + plan: Sequence[tuple[Migration, bool]] | None = None, + state: ProjectState | None = None, + fake: bool = False, + fake_initial: bool = False, + ) -> ProjectState: ... + def apply_migration( + self, state: ProjectState, migration: Migration, fake: bool = False, fake_initial: bool = False + ) -> ProjectState: ... + def record_migration(self, migration: Migration) -> None: ... + def unapply_migration(self, state: ProjectState, migration: Migration, fake: bool = False) -> ProjectState: ... + def check_replacements(self) -> None: ... + def detect_soft_applied( + self, project_state: ProjectState | None, migration: Migration + ) -> tuple[bool, ProjectState]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/graph.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/graph.pyi new file mode 100644 index 000000000000..a219fa61e537 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/graph.pyi @@ -0,0 +1,56 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.migrations.migration import Migration +from django.db.migrations.state import ProjectState + +RECURSION_DEPTH_WARNING: str + +class Node: + key: tuple[str, str] + children: set[Any] + parents: set[Any] + def __init__(self, key: tuple[str, str]) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: tuple[str, str] | Node) -> bool: ... + def __getitem__(self, item: int) -> str: ... + def __hash__(self) -> int: ... + def add_child(self, child: Node) -> None: ... + def add_parent(self, parent: Node) -> None: ... + +class DummyNode(Node): + origin: Any + error_message: Any + def __init__(self, key: tuple[str, str], origin: Migration | str, error_message: str) -> None: ... + def raise_error(self) -> None: ... + +class MigrationGraph: + node_map: dict[tuple[str, str], Node] + nodes: dict[tuple[str, str], Migration | None] + cached: bool + def __init__(self) -> None: ... + def add_node(self, key: tuple[str, str], migration: Migration | None) -> None: ... + def add_dummy_node(self, key: tuple[str, str], origin: Migration | str, error_message: str) -> None: ... + def add_dependency( + self, + migration: Migration | str | None, + child: tuple[str, str], + parent: tuple[str, str], + skip_validation: bool = False, + ) -> None: ... + 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 validate_consistency(self) -> None: ... + def forwards_plan(self, target: tuple[str, str]) -> list[tuple[str, str]]: ... + def backwards_plan(self, target: tuple[str, str]) -> list[tuple[str, str]]: ... + def iterative_dfs(self, start: Any, forwards: bool = True) -> list[tuple[str, str]]: ... + def root_nodes(self, app: str | None = None) -> list[tuple[str, str]]: ... + def leaf_nodes(self, app: str | None = None) -> list[tuple[str, str]]: ... + def ensure_not_cyclic(self) -> None: ... + def make_state( + self, + nodes: None | tuple[str, str] | Sequence[tuple[str, str]] = None, + at_end: bool = True, + real_apps: list[str] | None = None, + ) -> ProjectState: ... + def __contains__(self, node: tuple[str, str]) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/loader.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/loader.pyi new file mode 100644 index 000000000000..fbc6cfa0b5d4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/loader.pyi @@ -0,0 +1,44 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.migrations.migration import Migration +from django.db.migrations.state import ProjectState + +from .exceptions import AmbiguityError as AmbiguityError +from .exceptions import BadMigrationError as BadMigrationError +from .exceptions import InconsistentMigrationHistory as InconsistentMigrationHistory +from .exceptions import NodeNotFoundError as NodeNotFoundError + +MIGRATIONS_MODULE_NAME: str + +class MigrationLoader: + connection: BaseDatabaseWrapper | None + disk_migrations: dict[tuple[str, str], Migration] + applied_migrations: dict[tuple[str, str], Migration] + ignore_no_migrations: bool + def __init__( + self, + connection: BaseDatabaseWrapper | None, + load: bool = True, + ignore_no_migrations: bool = False, + replace_migrations: bool = True, + ) -> None: ... + @classmethod + def migrations_module(cls, app_label: str) -> tuple[str | None, bool]: ... + unmigrated_apps: set[str] + migrated_apps: set[str] + def load_disk(self) -> None: ... + 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 check_key(self, key: tuple[str, str], current_app: str) -> tuple[str, str] | None: ... + def add_internal_dependencies(self, key: tuple[str, str], migration: Migration) -> None: ... + def add_external_dependencies(self, key: tuple[str, str], migration: Migration) -> None: ... + graph: Any + replacements: Any + def build_graph(self) -> None: ... + def check_consistent_history(self, connection: BaseDatabaseWrapper) -> None: ... + def detect_conflicts(self) -> dict[str, list[str]]: ... + def project_state( + self, nodes: tuple[str, str] | Sequence[tuple[str, str]] | None = None, at_end: bool = True + ) -> ProjectState: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/migration.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/migration.pyi new file mode 100644 index 000000000000..83fa7906c0ec --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/migration.pyi @@ -0,0 +1,30 @@ +from collections.abc import Sequence + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.migrations.operations.base import Operation +from django.db.migrations.state import ProjectState +from typing_extensions import Self + +class Migration: + operations: Sequence[Operation] + dependencies: Sequence[tuple[str, str]] + run_before: Sequence[tuple[str, str]] + replaces: Sequence[tuple[str, str]] + initial: bool | None + atomic: bool + name: str + app_label: str + def __init__(self, name: str, app_label: str) -> None: ... + def mutate_state(self, project_state: ProjectState, preserve: bool = True) -> ProjectState: ... + def apply( + self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = False + ) -> ProjectState: ... + def unapply( + self, project_state: ProjectState, schema_editor: BaseDatabaseSchemaEditor, collect_sql: bool = False + ) -> ProjectState: ... + +class SwappableTuple(tuple[str, str]): + setting: str + def __new__(cls, value: tuple[str, str], setting: str) -> Self: ... + +def swappable_dependency(value: str) -> SwappableTuple: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/__init__.pyi new file mode 100644 index 000000000000..bb50e22ecf7c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/__init__.pyi @@ -0,0 +1,22 @@ +from .fields import AddField as AddField +from .fields import AlterField as AlterField +from .fields import RemoveField as RemoveField +from .fields import RenameField as RenameField +from .models import AddConstraint as AddConstraint +from .models import AddIndex as AddIndex +from .models import AlterIndexTogether as AlterIndexTogether +from .models import AlterModelManagers as AlterModelManagers +from .models import AlterModelOptions as AlterModelOptions +from .models import AlterModelTable as AlterModelTable +from .models import AlterModelTableComment as AlterModelTableComment +from .models import AlterOrderWithRespectTo as AlterOrderWithRespectTo +from .models import AlterUniqueTogether as AlterUniqueTogether +from .models import CreateModel as CreateModel +from .models import DeleteModel as DeleteModel +from .models import RemoveConstraint as RemoveConstraint +from .models import RemoveIndex as RemoveIndex +from .models import RenameIndex as RenameIndex +from .models import RenameModel as RenameModel +from .special import RunPython as RunPython +from .special import RunSQL as RunSQL +from .special import SeparateDatabaseAndState as SeparateDatabaseAndState diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/base.pyi new file mode 100644 index 000000000000..010b9beb4d2a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/base.pyi @@ -0,0 +1,32 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.migrations.state import ProjectState +from django.db.models import Model +from typing_extensions import Self + +class Operation: + reversible: bool + reduces_to_sql: bool + atomic: bool + elidable: bool + serialization_expand_args: list[str] + _constructor_args: tuple[Sequence[Any], dict[str, Any]] + def __new__(cls, *args: Any, **kwargs: Any) -> Self: ... + def deconstruct(self) -> tuple[str, Sequence[Any], dict[str, Any]]: ... + def state_forwards(self, app_label: str, state: ProjectState) -> None: ... + def database_forwards( + self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState + ) -> None: ... + def database_backwards( + self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState + ) -> None: ... + def describe(self) -> str: ... + def references_model(self, name: str, app_label: str) -> bool: ... + def references_field(self, model_name: str, name: str, app_label: str) -> bool: ... + def allow_migrate_model(self, connection_alias: BaseDatabaseWrapper | str, model: type[Model]) -> bool: ... + def reduce(self, operation: Operation, app_label: str) -> bool | list[Operation]: ... + @property + def migration_name_fragment(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/fields.pyi new file mode 100644 index 000000000000..3b1a09d6364d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/fields.pyi @@ -0,0 +1,36 @@ +from django.db.models.fields import Field +from django.utils.functional import cached_property + +from .base import Operation + +class FieldOperation(Operation): + model_name: str + name: str + def __init__(self, model_name: str, name: str, field: Field | None = None) -> None: ... + @cached_property + def name_lower(self) -> str: ... + @cached_property + def model_name_lower(self) -> str: ... + def is_same_model_operation(self, operation: FieldOperation) -> bool: ... + def is_same_field_operation(self, operation: FieldOperation) -> bool: ... + +class AddField(FieldOperation): + field: Field + preserve_default: bool + def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = True) -> None: ... + +class RemoveField(FieldOperation): ... + +class AlterField(FieldOperation): + field: Field + preserve_default: bool + def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = True) -> None: ... + +class RenameField(FieldOperation): + old_name: str + new_name: str + def __init__(self, model_name: str, old_name: str, new_name: str) -> None: ... + @cached_property + def old_name_lower(self) -> str: ... + @cached_property + def new_name_lower(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/models.pyi new file mode 100644 index 000000000000..794a1479e794 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/models.pyi @@ -0,0 +1,147 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.migrations.operations.base import Operation +from django.db.models.base import Model +from django.db.models.constraints import BaseConstraint +from django.db.models.fields import Field +from django.db.models.indexes import Index +from django.db.models.manager import Manager +from django.db.models.options import _OptionTogetherT +from django.utils.functional import cached_property + +class ModelOperation(Operation): + name: str + def __init__(self, name: str) -> None: ... + @cached_property + def name_lower(self) -> str: ... + def can_reduce_through(self, operation: Operation, app_label: str) -> bool: ... + +class CreateModel(ModelOperation): + fields: list[tuple[str, Field]] + options: dict[str, Any] + bases: Sequence[type[Model] | str] | None + managers: Sequence[tuple[str, Manager]] | None + def __init__( + self, + name: str, + fields: list[tuple[str, Field]], + options: dict[str, Any] | None = None, + bases: Sequence[type[Any] | str] | None = None, + managers: Sequence[tuple[str, Manager]] | None = None, + ) -> None: ... + +class DeleteModel(ModelOperation): ... + +class RenameModel(ModelOperation): + old_name: str + new_name: str + def __init__(self, old_name: str, new_name: str) -> None: ... + @cached_property + def old_name_lower(self) -> str: ... + @cached_property + def new_name_lower(self) -> str: ... + +class ModelOptionOperation(ModelOperation): ... + +class AlterModelTable(ModelOptionOperation): + table: str | None + def __init__(self, name: str, table: str | None) -> None: ... + +class AlterModelTableComment(ModelOptionOperation): + table_comment: str + def __init__(self, name: str, table_comment: str) -> None: ... + def state_forwards(self, app_label: str, state: Any) -> None: ... + def database_forwards( + self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: Any, to_state: Any + ) -> None: ... + def database_backwards( + self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: Any, to_state: Any + ) -> None: ... + def describe(self) -> str: ... + @property + def migration_name_fragment(self) -> str: ... + +class AlterTogetherOptionOperation(ModelOptionOperation): + option_name: str + def __init__( + self, + name: str, + option_value: _OptionTogetherT | None, + ) -> None: ... + @cached_property + def option_value(self) -> set[tuple[str, ...]] | None: ... + def state_forwards(self, app_label: str, state: Any) -> None: ... + def database_forwards( + self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: Any, to_state: Any + ) -> None: ... + def database_backwards( + self, app_label: str, schema_editor: BaseDatabaseSchemaEditor, from_state: Any, to_state: Any + ) -> None: ... + def references_field(self, model_name: str, name: str, app_label: str) -> bool: ... + def describe(self) -> str: ... + @property + def migration_name_fragment(self) -> str: ... + +class AlterUniqueTogether(AlterTogetherOptionOperation): + option_name: str + unique_together: set[tuple[str, ...]] | None + def __init__(self, name: str, unique_together: _OptionTogetherT | None) -> None: ... + +class AlterIndexTogether(AlterTogetherOptionOperation): + option_name: str + index_together: set[tuple[str, ...]] | None + def __init__(self, name: str, index_together: _OptionTogetherT | None) -> None: ... + +class AlterOrderWithRespectTo(ModelOptionOperation): + option_name: str + order_with_respect_to: str + def __init__(self, name: str, order_with_respect_to: str) -> None: ... + +class AlterModelOptions(ModelOptionOperation): + ALTER_OPTION_KEYS: list[str] + options: dict[str, Any] + def __init__(self, name: str, options: dict[str, Any]) -> None: ... + +class AlterModelManagers(ModelOptionOperation): + managers: Sequence[tuple[str, Manager]] + def __init__(self, name: str, managers: Sequence[tuple[str, Manager]]) -> None: ... + +class IndexOperation(Operation): + option_name: str + @cached_property + def model_name_lower(self) -> str: ... + +class AddIndex(IndexOperation): + model_name: str + index: Index + def __init__(self, model_name: str, index: Index) -> None: ... + +class RemoveIndex(IndexOperation): + model_name: str + name: str + def __init__(self, model_name: str, name: str) -> None: ... + +class RenameIndex(IndexOperation): + model_name: str + new_name: str + old_name: str | None + old_fields: Sequence[str] | None + def __init__( + self, + model_name: str, + new_name: str, + old_name: str | None = None, + old_fields: Sequence[str] | None = None, + ) -> None: ... + @cached_property + def old_name_lower(self) -> str: ... + @cached_property + def new_name_lower(self) -> str: ... + +class AddConstraint(IndexOperation): + def __init__(self, model_name: str, constraint: BaseConstraint) -> None: ... + +class RemoveConstraint(IndexOperation): + def __init__(self, model_name: str, name: str) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/special.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/special.pyi new file mode 100644 index 000000000000..71f81aee127c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/special.pyi @@ -0,0 +1,59 @@ +from collections.abc import Mapping, Sequence +from typing import Any, Literal, Protocol, type_check_only + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.migrations.state import StateApps +from django.utils.datastructures import _ListOrTuple +from typing_extensions import TypeAlias + +from .base import Operation + +_SqlOperations: TypeAlias = str | _ListOrTuple[str | tuple[str, dict[str, Any] | _ListOrTuple[Any] | None]] + +class SeparateDatabaseAndState(Operation): + database_operations: Sequence[Operation] + state_operations: Sequence[Operation] + + def __init__( + self, + database_operations: Sequence[Operation] | None = None, + state_operations: Sequence[Operation] | None = None, + ) -> None: ... + +class RunSQL(Operation): + noop: Literal[""] + sql: _SqlOperations + reverse_sql: _SqlOperations | None + state_operations: Sequence[Operation] + hints: Mapping[str, Any] + def __init__( + self, + sql: _SqlOperations, + reverse_sql: _SqlOperations | None = None, + state_operations: Sequence[Operation] | None = None, + hints: Mapping[str, Any] | None = None, + elidable: bool = False, + ) -> None: ... + @property + def reversible(self) -> bool: ... # type: ignore[override] + +@type_check_only +class _CodeCallable(Protocol): + def __call__(self, state_apps: StateApps, schema_editor: BaseDatabaseSchemaEditor, /) -> None: ... + +class RunPython(Operation): + code: _CodeCallable + reverse_code: _CodeCallable | None + hints: Mapping[str, Any] + def __init__( + self, + code: _CodeCallable, + reverse_code: _CodeCallable | None = None, + atomic: bool | None = None, + hints: Mapping[str, Any] | None = None, + elidable: bool = False, + ) -> None: ... + @staticmethod + def noop(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: ... + @property + def reversible(self) -> bool: ... # type: ignore[override] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/utils.pyi new file mode 100644 index 000000000000..246745ca7a2c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/operations/utils.pyi @@ -0,0 +1,26 @@ +from collections import namedtuple +from collections.abc import Iterator +from typing import Literal + +from django.db.migrations.state import ModelState, ProjectState +from django.db.models import Field, Model + +def resolve_relation( + model: str | type[Model], app_label: str | None = ..., model_name: str | None = ... +) -> tuple[str, str]: ... + +FieldReference = namedtuple("FieldReference", ["to", "through"]) + +def field_references( + model_tuple: tuple[str, str], + field: Field, + reference_model_tuple: tuple[str, str], + reference_field_name: str | None = ..., + reference_field: Field | None = ..., +) -> Literal[False] | FieldReference: ... +def get_references( + state: ProjectState, + model_tuple: tuple[str, str], + field_tuple: tuple[()] | tuple[str, Field] = ..., +) -> Iterator[tuple[ModelState, str, Field, FieldReference]]: ... +def field_is_referenced(state: ProjectState, model_tuple: tuple[str, str], field_tuple: tuple[str, Field]) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/optimizer.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/optimizer.pyi new file mode 100644 index 000000000000..b8022f171195 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/optimizer.pyi @@ -0,0 +1,5 @@ +from django.db.migrations.operations.base import Operation + +class MigrationOptimizer: + def optimize(self, operations: list[Operation], app_label: str | None) -> list[Operation]: ... + def optimize_inner(self, operations: list[Operation], app_label: str | None) -> list[Operation]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/questioner.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/questioner.pyi new file mode 100644 index 000000000000..60b6bac6b5ce --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/questioner.pyi @@ -0,0 +1,25 @@ +from typing import Any + +from django.db.migrations.state import ModelState +from django.db.models.fields import Field + +class MigrationQuestioner: + defaults: dict[str, Any] + specified_apps: set[str] + dry_run: bool | None + def __init__( + self, + defaults: dict[str, bool] | None = None, + specified_apps: set[str] | None = None, + dry_run: bool | None = None, + ) -> None: ... + def ask_initial(self, app_label: str) -> bool: ... + def ask_not_null_addition(self, field_name: str, model_name: str) -> Any: ... + def ask_not_null_alteration(self, field_name: Any, model_name: Any) -> Any: ... + def ask_rename(self, model_name: str, old_name: str, new_name: str, field_instance: Field) -> bool: ... + def ask_rename_model(self, old_model_state: ModelState, new_model_state: ModelState) -> bool: ... + def ask_merge(self, app_label: str) -> bool: ... + def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> Any: ... + +class InteractiveMigrationQuestioner(MigrationQuestioner): ... +class NonInteractiveMigrationQuestioner(MigrationQuestioner): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/recorder.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/recorder.pyi new file mode 100644 index 000000000000..8db4583723be --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/recorder.pyi @@ -0,0 +1,25 @@ +from typing import Any, ClassVar + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.base import Model +from django.db.models.manager import Manager +from django.db.models.query import QuerySet +from typing_extensions import Self + +class MigrationRecorder: + class Migration(Model): + app: Any + name: Any + applied: Any + objects: ClassVar[Manager[Self]] + + connection: BaseDatabaseWrapper + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + @property + def migration_qs(self) -> QuerySet: ... + def has_table(self) -> bool: ... + def ensure_schema(self) -> None: ... + def applied_migrations(self) -> dict[tuple[str, str], Migration]: ... + def record_applied(self, app: str, name: str) -> None: ... + def record_unapplied(self, app: str, name: str) -> None: ... + def flush(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/serializer.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/serializer.pyi new file mode 100644 index 000000000000..c05bec752171 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/serializer.pyi @@ -0,0 +1,50 @@ +from collections.abc import Callable +from typing import Any + +FUNCTION_TYPES: tuple[type, ...] + +class BaseSerializer: + value: Any + def __init__(self, value: Any) -> None: ... + def serialize(self) -> tuple[str, set[str]]: ... + +class BaseSequenceSerializer(BaseSerializer): ... +class BaseUnorderedSequenceSerializer(BaseSequenceSerializer): ... +class BaseSimpleSerializer(BaseSerializer): ... +class DateTimeSerializer(BaseSerializer): ... +class DatetimeDatetimeSerializer(BaseSerializer): ... +class DecimalSerializer(BaseSerializer): ... + +class DeconstructableSerializer(BaseSerializer): + @staticmethod + def serialize_deconstructed( + path: str, args: list[Any], kwargs: dict[str, Callable | int | str] + ) -> tuple[str, set[str]]: ... + +class DictionarySerializer(BaseSerializer): ... +class EnumSerializer(BaseSerializer): ... +class FloatSerializer(BaseSimpleSerializer): ... +class FrozensetSerializer(BaseUnorderedSequenceSerializer): ... +class FunctionTypeSerializer(BaseSerializer): ... +class FunctoolsPartialSerializer(BaseSerializer): ... +class IterableSerializer(BaseSerializer): ... +class ModelFieldSerializer(DeconstructableSerializer): ... +class ModelManagerSerializer(DeconstructableSerializer): ... +class OperationSerializer(BaseSerializer): ... +class PathLikeSerializer(BaseSerializer): ... +class PathSerializer(BaseSerializer): ... +class RegexSerializer(BaseSerializer): ... +class SequenceSerializer(BaseSequenceSerializer): ... +class SetSerializer(BaseUnorderedSequenceSerializer): ... +class SettingsReferenceSerializer(BaseSerializer): ... +class TupleSerializer(BaseSequenceSerializer): ... +class TypeSerializer(BaseSerializer): ... +class UUIDSerializer(BaseSerializer): ... + +def serializer_factory(value: Any) -> BaseSerializer: ... + +class Serializer: + @classmethod + def register(cls, type_: type, serializer: type[BaseSerializer]) -> None: ... + @classmethod + def unregister(cls, type_: type) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/state.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/state.pyi new file mode 100644 index 000000000000..9828f1196b0a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/state.pyi @@ -0,0 +1,100 @@ +from collections.abc import Iterable, Iterator, Sequence +from contextlib import contextmanager +from typing import Any + +from django.apps import AppConfig +from django.apps.registry import Apps +from django.db.models.base import Model +from django.db.models.fields import Field +from django.db.models.manager import Manager +from django.utils.functional import cached_property + +class AppConfigStub(AppConfig): + def __init__(self, label: str) -> None: ... + +class ModelState: + name: str + app_label: str + fields: dict[str, Field] + options: dict[str, Any] + bases: Sequence[type[Model] | str] + managers: list[tuple[str, Manager]] + def __init__( + self, + app_label: str, + name: str, + fields: list[tuple[str, Field]] | dict[str, Field], + options: dict[str, Any] | None = None, + bases: Sequence[type[Model] | str] | None = None, + managers: list[tuple[str, Manager]] | None = None, + ) -> None: ... + def clone(self) -> ModelState: ... + def construct_managers(self) -> Iterator[tuple[str, Manager]]: ... + @classmethod + def from_model(cls, model: type[Model], exclude_rels: bool = False) -> ModelState: ... + def get_field(self, field_name: str) -> Field: ... + @cached_property + def name_lower(self) -> str: ... + def render(self, apps: Apps) -> Any: ... + def get_index_by_name(self, name: str) -> Any: ... + def get_constraint_by_name(self, name: str) -> Any: ... + def __eq__(self, other: object) -> bool: ... + +def get_related_models_tuples(model: type[Model]) -> set[tuple[str, str]]: ... +def get_related_models_recursive(model: type[Model]) -> set[tuple[str, str]]: ... + +class ProjectState: + is_delayed: bool + models: dict[Any, Any] + real_apps: set[str] + def __init__( + self, models: dict[tuple[str, str], ModelState] | None = None, real_apps: set[str] | None = None + ) -> None: ... + @property + def relations(self) -> Any: ... + def add_model(self, model_state: ModelState) -> None: ... + @cached_property + def apps(self) -> StateApps: ... + def clear_delayed_apps_cache(self) -> None: ... + def clone(self) -> ProjectState: ... + @classmethod + def from_apps(cls, apps: Apps) -> ProjectState: ... + def reload_model(self, app_label: str, model_name: str, delay: bool = False) -> None: ... + def reload_models(self, models: list[Any], delay: bool = True) -> None: ... + def remove_model(self, app_label: str, model_name: str) -> None: ... + def rename_model(self, app_label: str, old_name: str, new_name: str) -> None: ... + def alter_model_options( + self, app_label: str, model_name: str, options: dict[str, Any], option_keys: Iterable[str] | None = None + ) -> None: ... + def remove_model_options(self, app_label: str, model_name: str, option_name: str, value_to_remove: Any) -> None: ... + def alter_model_managers(self, app_label: str, model_name: str, managers: list[tuple[str, Manager]]) -> None: ... + def add_index(self, app_label: str, model_name: str, index: Any) -> None: ... + def remove_index(self, app_label: str, model_name: str, index_name: str) -> None: ... + def rename_index(self, app_label: str, model_name: str, old_index_name: str, new_index_name: str) -> None: ... + def add_constraint(self, app_label: str, model_name: str, constraint: Any) -> None: ... + def remove_constraint(self, app_label: str, model_name: str, constraint_name: str) -> None: ... + def add_field(self, app_label: str, model_name: str, name: str, field: Field, preserve_default: Any) -> None: ... + def remove_field(self, app_label: str, model_name: str, name: str) -> None: ... + def alter_field(self, app_label: str, model_name: str, name: str, field: Field, preserve_default: Any) -> None: ... + def rename_field(self, app_label: str, model_name: str, old_name: str, new_name: str) -> None: ... + def update_model_field_relation( + self, model: type[Model], model_key: tuple[str, str], field_name: str, field: Field, concretes: Any + ) -> None: ... + def resolve_model_field_relations( + self, model_key: tuple[str, str], field_name: str, field: Field, concretes: Any | None = None + ) -> None: ... + def resolve_model_relations(self, model_key: tuple[str, str], concretes: Any | None = None) -> None: ... + def resolve_fields_and_relations(self) -> None: ... + def get_concrete_model_key(self, model: type[Model]) -> Any: ... + +class StateApps(Apps): + real_models: list[ModelState] + def __init__( + self, real_apps: list[str], models: dict[tuple[str, str], ModelState], ignore_swappable: bool = False + ) -> None: ... + @contextmanager + def bulk_update(self) -> Iterator[None]: ... + def clone(self) -> StateApps: ... + def render_multiple(self, model_states: list[ModelState]) -> None: ... + def register_model(self, app_label: str, model: type[Model]) -> None: ... + def unregister_model(self, app_label: str, model_name: str) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/utils.pyi new file mode 100644 index 000000000000..9cd93bfbc509 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/utils.pyi @@ -0,0 +1,10 @@ +from typing import Any + +COMPILED_REGEX_TYPE: Any + +class RegexObject: + pattern: str + flags: int + def __init__(self, obj: Any) -> None: ... + +def get_migration_name_timestamp() -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/writer.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/writer.pyi new file mode 100644 index 000000000000..ed22d54451b3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/migrations/writer.pyi @@ -0,0 +1,37 @@ +from typing import Any + +from django.db.migrations.migration import Migration +from django.db.migrations.operations.base import Operation +from django.db.migrations.serializer import BaseSerializer + +class OperationWriter: + operation: Operation + buff: list[Any] + indentation: int + def __init__(self, operation: Operation, indentation: int = 2) -> None: ... + def serialize(self) -> tuple[str, set[str]]: ... + def indent(self) -> None: ... + def unindent(self) -> None: ... + def feed(self, line: str) -> None: ... + def render(self) -> str: ... + +class MigrationWriter: + migration: Migration + needs_manual_porting: bool + def __init__(self, migration: Migration, include_header: bool = True) -> 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) -> tuple[str, set[str]]: ... + @classmethod + def register_serializer(cls, type_: type, serializer: type[BaseSerializer]) -> None: ... + @classmethod + def unregister_serializer(cls, type_: type) -> None: ... + +MIGRATION_HEADER_TEMPLATE: str +MIGRATION_TEMPLATE: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/__init__.pyi new file mode 100644 index 000000000000..7b547ad50bb5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/__init__.pyi @@ -0,0 +1,96 @@ +from . import lookups as lookups +from . import signals as signals +from .aggregates import Aggregate as Aggregate +from .aggregates import Avg as Avg +from .aggregates import Count as Count +from .aggregates import Max as Max +from .aggregates import Min as Min +from .aggregates import StdDev as StdDev +from .aggregates import Sum as Sum +from .aggregates import Variance as Variance +from .base import Model as Model +from .constraints import BaseConstraint as BaseConstraint +from .constraints import CheckConstraint as CheckConstraint +from .constraints import Deferrable as Deferrable +from .constraints import UniqueConstraint as UniqueConstraint +from .deletion import CASCADE as CASCADE +from .deletion import DO_NOTHING as DO_NOTHING +from .deletion import PROTECT as PROTECT +from .deletion import RESTRICT as RESTRICT +from .deletion import SET as SET +from .deletion import SET_DEFAULT as SET_DEFAULT +from .deletion import SET_NULL as SET_NULL +from .deletion import ProtectedError as ProtectedError +from .deletion import RestrictedError as RestrictedError +from .enums import Choices as Choices +from .enums import IntegerChoices as IntegerChoices +from .enums import TextChoices as TextChoices +from .expressions import Case as Case +from .expressions import Exists as Exists +from .expressions import Expression as Expression +from .expressions import ExpressionList as ExpressionList +from .expressions import ExpressionWrapper as ExpressionWrapper +from .expressions import F as F +from .expressions import Func as Func +from .expressions import OrderBy as OrderBy +from .expressions import OuterRef as OuterRef +from .expressions import RowRange as RowRange +from .expressions import Subquery as Subquery +from .expressions import Value as Value +from .expressions import ValueRange as ValueRange +from .expressions import When as When +from .expressions import Window as Window +from .expressions import WindowFrame as WindowFrame +from .fields import NOT_PROVIDED as NOT_PROVIDED +from .fields import AutoField as AutoField +from .fields import BigAutoField as BigAutoField +from .fields import BigIntegerField as BigIntegerField +from .fields import BinaryField as BinaryField +from .fields import BooleanField as BooleanField +from .fields import CharField as CharField +from .fields import CommaSeparatedIntegerField as CommaSeparatedIntegerField +from .fields import DateField as DateField +from .fields import DateTimeField as DateTimeField +from .fields import DecimalField as DecimalField +from .fields import DurationField as DurationField +from .fields import EmailField as EmailField +from .fields import Field as Field +from .fields import FilePathField as FilePathField +from .fields import FloatField as FloatField +from .fields import GenericIPAddressField as GenericIPAddressField +from .fields import IntegerField as IntegerField +from .fields import IPAddressField as IPAddressField +from .fields import NullBooleanField as NullBooleanField +from .fields import PositiveBigIntegerField as PositiveBigIntegerField +from .fields import PositiveIntegerField as PositiveIntegerField +from .fields import PositiveSmallIntegerField as PositiveSmallIntegerField +from .fields import SlugField as SlugField +from .fields import SmallAutoField as SmallAutoField +from .fields import SmallIntegerField as SmallIntegerField +from .fields import TextField as TextField +from .fields import TimeField as TimeField +from .fields import URLField as URLField +from .fields import UUIDField as UUIDField +from .fields.files import FileField as FileField +from .fields.files import ImageField as ImageField +from .fields.generated import GeneratedField as GeneratedField +from .fields.json import JSONField as JSONField +from .fields.proxy import OrderWrt as OrderWrt +from .fields.related import ForeignKey as ForeignKey +from .fields.related import ForeignObject as ForeignObject +from .fields.related import ForeignObjectRel as ForeignObjectRel +from .fields.related import ManyToManyField as ManyToManyField +from .fields.related import ManyToManyRel as ManyToManyRel +from .fields.related import ManyToOneRel as ManyToOneRel +from .fields.related import OneToOneField as OneToOneField +from .fields.related import OneToOneRel as OneToOneRel +from .indexes import Index as Index +from .lookups import Lookup as Lookup +from .lookups import Transform as Transform +from .manager import Manager as Manager +from .query import Prefetch as Prefetch +from .query import QuerySet as QuerySet +from .query import aprefetch_related_objects as aprefetch_related_objects +from .query import prefetch_related_objects as prefetch_related_objects +from .query_utils import FilteredRelation as FilteredRelation +from .query_utils import Q as Q diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/aggregates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/aggregates.pyi new file mode 100644 index 000000000000..788ee75a4be1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/aggregates.pyi @@ -0,0 +1,23 @@ +from typing import Any, ClassVar + +from django.db.models.expressions import Func +from django.db.models.fields import IntegerField +from django.db.models.functions.mixins import FixDurationInputMixin, NumericOutputFieldMixin + +class Aggregate(Func): + filter_template: str + filter: Any + allow_distinct: bool + empty_result_set_value: int | None + def __init__(self, *expressions: Any, distinct: bool = False, filter: Any | None = None, **extra: Any) -> None: ... + +class Avg(FixDurationInputMixin, NumericOutputFieldMixin, Aggregate): ... + +class Count(Aggregate): + output_field: ClassVar[IntegerField] + +class Max(Aggregate): ... +class Min(Aggregate): ... +class StdDev(NumericOutputFieldMixin, Aggregate): ... +class Sum(FixDurationInputMixin, Aggregate): ... +class Variance(NumericOutputFieldMixin, Aggregate): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/base.pyi new file mode 100644 index 000000000000..47b621044de5 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/base.pyi @@ -0,0 +1,114 @@ +from collections.abc import Collection, Iterable, Sequence +from typing import Any, ClassVar, Final, TypeVar, overload + +from django.core.checks.messages import CheckMessage +from django.core.exceptions import MultipleObjectsReturned as BaseMultipleObjectsReturned +from django.core.exceptions import ObjectDoesNotExist, ValidationError +from django.db.models import BaseConstraint, Field, QuerySet +from django.db.models.manager import Manager +from django.db.models.options import Options +from typing_extensions import Self + +_Self = TypeVar("_Self", bound=Model) + +class ModelStateFieldsCacheDescriptor: + @overload + def __get__(self, inst: None, owner: object) -> Self: ... + @overload + def __get__(self, inst: object, owner: object) -> dict[Any, Any]: ... + +class ModelState: + db: str | None + adding: bool + fields_cache: ModelStateFieldsCacheDescriptor + +class ModelBase(type): + @property + def _default_manager(cls: type[_Self]) -> Manager[_Self]: ... # type: ignore[misc] + @property + def _base_manager(cls: type[_Self]) -> Manager[_Self]: ... # type: ignore[misc] + +class Model(metaclass=ModelBase): + # Note: these two metaclass generated attributes don't really exist on the 'Model' + # class, runtime they are only added on concrete subclasses of 'Model'. The + # metaclass also sets up correct inheritance from concrete parent models exceptions. + # Our mypy plugin aligns with this behaviour and will remove the 2 attributes below + # and re-add them to correct concrete subclasses of 'Model' + DoesNotExist: Final[type[ObjectDoesNotExist]] + MultipleObjectsReturned: Final[type[BaseMultipleObjectsReturned]] + # This 'objects' attribute will be deleted, via the plugin, in favor of managing it + # to only exist on subclasses it exists on during runtime. + objects: ClassVar[Manager[Self]] + + _meta: ClassVar[Options[Self]] + pk: Any + _state: ModelState + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + @classmethod + def add_to_class(cls, name: str, value: Any) -> Any: ... + @classmethod + def from_db(cls, db: str | None, field_names: Collection[str], values: Collection[Any]) -> Self: ... + def _do_update( + self, + base_qs: QuerySet[Self], + using: str | None, + pk_val: Any, + values: Collection[tuple[Field, type[Model] | None, Any]], + update_fields: Iterable[str] | None, + forced_update: bool, + ) -> bool: ... + def delete(self, using: Any | None = None, keep_parents: bool = False) -> tuple[int, dict[str, int]]: ... + async def adelete(self, using: Any | None = None, keep_parents: bool = False) -> tuple[int, dict[str, int]]: ... + def full_clean( + self, exclude: Iterable[str] | None = None, validate_unique: bool = True, validate_constraints: bool = True + ) -> None: ... + def clean(self) -> None: ... + def clean_fields(self, exclude: Collection[str] | None = None) -> None: ... + def validate_unique(self, exclude: Collection[str] | None = None) -> None: ... + def date_error_message(self, lookup_type: str, field_name: str, unique_for: str) -> ValidationError: ... + def unique_error_message(self, model_class: type[Self], unique_check: Sequence[str]) -> ValidationError: ... + def validate_constraints(self, exclude: Collection[str] | None = None) -> None: ... + def get_constraints(self) -> list[tuple[type[Model], Sequence[BaseConstraint]]]: ... + def save( + self, + force_insert: bool | tuple[ModelBase, ...] = False, + force_update: bool = False, + using: str | None = None, + update_fields: Iterable[str] | None = None, + ) -> None: ... + async def asave( + self, + force_insert: bool | tuple[ModelBase, ...] = False, + force_update: bool = False, + using: str | None = None, + update_fields: Iterable[str] | None = None, + ) -> None: ... + def save_base( + self, + raw: bool = False, + force_insert: bool | tuple[ModelBase, ...] = False, + force_update: bool = False, + using: str | None = None, + update_fields: Iterable[str] | None = None, + ) -> None: ... + def refresh_from_db( + self, + using: str | None = None, + fields: Iterable[str] | None = None, + from_queryset: QuerySet[Self] | None = None, + ) -> None: ... + async def arefresh_from_db( + self, + using: str | None = None, + fields: Iterable[str] | None = None, + from_queryset: QuerySet[Self] | None = None, + ) -> None: ... + def serializable_value(self, field_name: str) -> Any: ... + def prepare_database_save(self, field: Field) -> Any: ... + def get_deferred_fields(self) -> set[str]: ... + @classmethod + def check(cls, **kwargs: Any) -> list[CheckMessage]: ... + def __getstate__(self) -> dict: ... + def _get_pk_val(self, meta: Options[Self] | None = None) -> str: ... + +def model_unpickle(model_id: tuple[str, str] | type[Model]) -> Model: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/constants.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/constants.pyi new file mode 100644 index 000000000000..14fc6195e773 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/constants.pyi @@ -0,0 +1,7 @@ +from enum import Enum + +LOOKUP_SEP: str + +class OnConflict(Enum): + IGNORE: str + UPDATE: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/constraints.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/constraints.pyi new file mode 100644 index 000000000000..988f0f4b0adc --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/constraints.pyi @@ -0,0 +1,103 @@ +from collections.abc import Sequence +from enum import Enum +from typing import Any, overload + +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.models.base import Model +from django.db.models.expressions import BaseExpression, Combinable +from django.db.models.query_utils import Q +from django.utils.functional import _StrOrPromise +from typing_extensions import Self, deprecated + +class Deferrable(Enum): + DEFERRED: str + IMMEDIATE: str + +class BaseConstraint: + name: str + violation_error_code: str | None + violation_error_message: _StrOrPromise | None + default_violation_error_message: _StrOrPromise + @overload + def __init__( + self, + *, + name: str, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, + ) -> None: ... + @overload + @deprecated("Passing positional arguments to BaseConstraint is deprecated and will be removed in Django 6.0") + def __init__( + self, + *args: Any, + name: str | None = None, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, + ) -> None: ... + def constraint_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ... + def create_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ... + def remove_sql(self, model: type[Model] | None, schema_editor: BaseDatabaseSchemaEditor | None) -> str: ... + def get_violation_error_message(self) -> str: ... + def deconstruct(self) -> tuple[str, Sequence[Any], dict[str, Any]]: ... + def clone(self) -> Self: ... + +class CheckConstraint(BaseConstraint): + check: Q | BaseExpression + condition: Q | BaseExpression + + @overload + @deprecated("The check keyword argument is deprecated in favor of condition and will be removed in Django 6.0") + def __init__( + self, + *, + name: str, + check: Q | BaseExpression, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, + ) -> None: ... + @overload + def __init__( + self, + *, + name: str, + condition: Q | BaseExpression, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, + ) -> None: ... + +class UniqueConstraint(BaseConstraint): + expressions: Sequence[BaseExpression | Combinable] + fields: Sequence[str] + condition: Q | None + deferrable: Deferrable | None + nulls_distinct: bool | None + + @overload + def __init__( + self, + *expressions: str | BaseExpression | Combinable, + fields: None = None, + name: str | None = None, + condition: Q | None = None, + deferrable: Deferrable | None = None, + include: Sequence[str] | None = None, + opclasses: Sequence[Any] = (), + nulls_distinct: bool | None = None, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, + ) -> None: ... + @overload + def __init__( + self, + *, + fields: Sequence[str], + name: str | None = None, + condition: Q | None = None, + deferrable: Deferrable | None = None, + include: Sequence[str] | None = None, + opclasses: Sequence[Any] = (), + nulls_distinct: bool | None = None, + violation_error_code: str | None = None, + violation_error_message: _StrOrPromise | None = None, + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi new file mode 100644 index 000000000000..56143fe9cf47 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/deletion.pyi @@ -0,0 +1,100 @@ +from collections import defaultdict +from collections.abc import Callable, Iterable, Iterator, Sequence +from typing import Any + +from django.db import IntegrityError +from django.db.models.base import Model +from django.db.models.fields import Field +from django.db.models.options import Options +from django.db.models.query import QuerySet +from django.utils.datastructures import _IndexableCollection + +def CASCADE( + collector: Collector, + field: Field[Any, Any], + sub_objs: QuerySet[Model], + using: str, +) -> None: ... +def SET_NULL( + collector: Collector, + field: Field[Any, Any], + sub_objs: QuerySet[Model], + using: str, +) -> None: ... +def SET_DEFAULT( + collector: Collector, + field: Field[Any, Any], + sub_objs: QuerySet[Model], + using: str, +) -> None: ... +def DO_NOTHING( + collector: Collector, + field: Field[Any, Any], + sub_objs: QuerySet[Model], + using: str, +) -> None: ... +def PROTECT( + collector: Collector, + field: Field[Any, Any], + sub_objs: QuerySet[Model], + using: str, +) -> None: ... +def RESTRICT( + collector: Collector, + field: Field[Any, Any], + sub_objs: QuerySet[Model], + using: str, +) -> None: ... +def SET(value: Any) -> Callable[..., Any]: ... +def get_candidate_relations_to_delete(opts: Options) -> Iterable[Field]: ... + +class ProtectedError(IntegrityError): + protected_objects: set[Model] + def __init__(self, msg: str, protected_objects: set[Model]) -> None: ... + +class RestrictedError(IntegrityError): + restricted_objects: set[Model] + def __init__(self, msg: str, restricted_objects: set[Model]) -> None: ... + +class Collector: + using: str + origin: Model | QuerySet[Model] | None + data: dict[type[Model], set[Model] | list[Model]] + field_updates: defaultdict[tuple[Field, Any], list[Model]] + restricted_objects: defaultdict[Model, defaultdict[Field, set[Model]]] + fast_deletes: list[QuerySet[Model]] + dependencies: defaultdict[Model, set[Model]] + def __init__(self, using: str, origin: Model | QuerySet[Model] | None = None) -> None: ... + def add( + self, + objs: _IndexableCollection[Model], + source: type[Model] | None = None, + nullable: bool = False, + reverse_dependency: bool = False, + ) -> list[Model]: ... + def add_dependency(self, model: type[Model], dependency: type[Model], reverse_dependency: bool = False) -> None: ... + def add_field_update(self, field: Field, value: Any, objs: _IndexableCollection[Model]) -> None: ... + def add_restricted_objects(self, field: Field, objs: _IndexableCollection[Model]) -> None: ... + def clear_restricted_objects_from_set(self, model: type[Model], objs: set[Model]) -> None: ... + def clear_restricted_objects_from_queryset(self, model: type[Model], qs: QuerySet[Model]) -> None: ... + def can_fast_delete(self, objs: Model | Iterable[Model], from_field: Field | None = None) -> bool: ... + def get_del_batches( + self, objs: _IndexableCollection[Model], fields: Iterable[Field] + ) -> Sequence[Sequence[Model]]: ... + def collect( + self, + objs: _IndexableCollection[Model | None], + source: type[Model] | None = None, + nullable: bool = False, + collect_related: bool = True, + source_attr: str | None = None, + reverse_dependency: bool = False, + keep_parents: bool = False, + fail_on_restricted: bool = True, + ) -> None: ... + def related_objects( + self, related_model: type[Model], related_fields: Iterable[Field], objs: _IndexableCollection[Model] + ) -> QuerySet[Model]: ... + def instances_with_model(self) -> Iterator[tuple[type[Model], Model]]: ... + def sort(self) -> None: ... + def delete(self) -> tuple[int, dict[str, int]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/enums.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/enums.pyi new file mode 100644 index 000000000000..1393c4517ece --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/enums.pyi @@ -0,0 +1,85 @@ +import enum +import sys +from typing import Any, TypeVar, overload, type_check_only + +from _typeshed import ConvertibleToInt +from django.utils.functional import _StrOrPromise +from typing_extensions import TypeAlias + +_Self = TypeVar("_Self") + +if sys.version_info >= (3, 11): + _enum_property = enum.property + EnumType = enum.EnumType + IntEnum = enum.IntEnum + StrEnum = enum.StrEnum +else: + _enum_property = property + EnumType = enum.EnumMeta + + class ReprEnum(enum.Enum): ... + class IntEnum(int, ReprEnum): ... + class StrEnum(str, ReprEnum): ... + +class ChoicesMeta(EnumType): + # There's a contradiction between mypy and PYI019 regarding metaclasses. Where mypy + # disallows 'typing_extensions.Self' on metaclasses, while PYI019 try to enforce + # 'typing_extensions.Self' for '__new__' methods.. We've chosen to ignore the + # linter and trust mypy. + def __new__( + metacls: type[_Self], classname: str, bases: tuple[type, ...], classdict: enum._EnumDict, **kwds: Any + ) -> _Self: ... # noqa: PYI019 + def __contains__(self, member: Any) -> bool: ... + @property + def names(self) -> list[str]: ... + @property + def choices(self) -> list[tuple[Any, str]]: ... + @property + def labels(self) -> list[str]: ... + @property + def values(self) -> list[Any]: ... + +ChoicesType: TypeAlias = ChoicesMeta + +class Choices(enum.Enum, metaclass=ChoicesType): + @property + def label(self) -> str: ... + @_enum_property + def value(self) -> Any: ... + @property + def do_not_call_in_templates(self) -> bool: ... + +# fake, to keep simulate class properties +@type_check_only +class _IntegerChoicesMeta(ChoicesType): + @property + def choices(self) -> list[tuple[int, str]]: ... + @property + def values(self) -> list[int]: ... + +# In reality, the `__init__` overloads provided below should also support +# all the arguments of `int.__new__`/`str.__new__` (e.g. `base`, `encoding`). +# They are omitted on purpose to avoid having convoluted stubs for these enums: +class IntegerChoices(Choices, IntEnum, metaclass=_IntegerChoicesMeta): + @overload + def __init__(self, x: ConvertibleToInt) -> None: ... + @overload + def __init__(self, x: ConvertibleToInt, label: _StrOrPromise) -> None: ... + @_enum_property + def value(self) -> int: ... + +# fake, to keep simulate class properties +@type_check_only +class _TextChoicesMeta(ChoicesType): + @property + def choices(self) -> list[tuple[str, str]]: ... + @property + def values(self) -> list[str]: ... + +class TextChoices(Choices, StrEnum, metaclass=_TextChoicesMeta): + @overload + def __init__(self, object: str) -> None: ... + @overload + def __init__(self, object: str, label: _StrOrPromise) -> None: ... + @_enum_property + def value(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/expressions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/expressions.pyi new file mode 100644 index 000000000000..0bbfb3e5b4ff --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/expressions.pyi @@ -0,0 +1,309 @@ +import datetime +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence +from decimal import Decimal +from typing import Any, ClassVar, Generic, Literal, NoReturn, TypeVar + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Q, fields +from django.db.models.fields import Field +from django.db.models.lookups import Lookup, Transform +from django.db.models.query import QuerySet +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from django.db.models.sql.query import Query +from django.utils.deconstruct import _Deconstructible +from django.utils.functional import cached_property +from typing_extensions import Self, TypeAlias + +class SQLiteNumericMixin: + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +_Numeric: TypeAlias = float | Decimal + +class Combinable: + ADD: str + SUB: str + MUL: str + DIV: str + POW: str + MOD: str + BITAND: str + BITOR: str + BITLEFTSHIFT: str + BITRIGHTSHIFT: str + BITXOR: str + def __neg__(self) -> CombinedExpression: ... + def __add__(self, other: datetime.timedelta | Combinable | _Numeric | str | None) -> CombinedExpression: ... + def __sub__(self, other: datetime.timedelta | Combinable | _Numeric) -> CombinedExpression: ... + def __mul__(self, other: datetime.timedelta | Combinable | _Numeric) -> CombinedExpression: ... + def __truediv__(self, other: Combinable | _Numeric) -> CombinedExpression: ... + def __mod__(self, other: int | Combinable) -> CombinedExpression: ... + def __pow__(self, other: _Numeric | Combinable) -> CombinedExpression: ... + def __and__(self, other: Combinable | Q) -> Q: ... + def bitand(self, other: int) -> CombinedExpression: ... + def bitleftshift(self, other: int) -> CombinedExpression: ... + def bitrightshift(self, other: int) -> CombinedExpression: ... + def __xor__(self, other: Combinable | Q) -> Q: ... + def bitxor(self, other: int) -> CombinedExpression: ... + def __or__(self, other: Combinable | Q) -> Q: ... + def bitor(self, other: int) -> CombinedExpression: ... + def __radd__(self, other: datetime.datetime | _Numeric | Combinable | None) -> CombinedExpression: ... + def __rsub__(self, other: _Numeric | Combinable) -> CombinedExpression: ... + def __rmul__(self, other: _Numeric | Combinable) -> CombinedExpression: ... + def __rtruediv__(self, other: _Numeric | Combinable) -> CombinedExpression: ... + def __rmod__(self, other: int | Combinable) -> CombinedExpression: ... + def __rpow__(self, other: _Numeric | Combinable) -> CombinedExpression: ... + def __rand__(self, other: Any) -> Combinable: ... + def __ror__(self, other: Any) -> Combinable: ... + def __rxor__(self, other: Any) -> Combinable: ... + def __invert__(self) -> NegatedExpression[Combinable]: ... + +class BaseExpression: + is_summary: bool + filterable: bool + window_compatible: bool + allowed_default: bool + def __init__(self, output_field: Field | None = None) -> None: ... + def get_db_converters(self, connection: BaseDatabaseWrapper) -> list[Callable]: ... + def get_source_expressions(self) -> list[Any]: ... + def set_source_expressions(self, exprs: Sequence[Combinable | Expression]) -> None: ... + @cached_property + def contains_aggregate(self) -> bool: ... + @cached_property + def contains_over_clause(self) -> bool: ... + @cached_property + def contains_column_references(self) -> bool: ... + @cached_property + def contains_subquery(self) -> bool: ... + def resolve_expression( + self, + query: Any | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, + ) -> Self: ... + @property + def conditional(self) -> bool: ... + @property + def field(self) -> Field: ... + @cached_property + def output_field(self) -> Field: ... + @cached_property + def convert_value(self) -> Callable: ... + def get_lookup(self, lookup: str) -> type[Lookup] | None: ... + def get_transform(self, name: str) -> type[Transform] | None: ... + def relabeled_clone(self, change_map: Mapping[str, str]) -> Self: ... + def copy(self) -> Self: ... + def get_group_by_cols(self) -> list[BaseExpression]: ... + def get_source_fields(self) -> list[Field | None]: ... + def asc( + self, + *, + descending: bool = ..., + nulls_first: bool | None = ..., + nulls_last: bool | None = ..., + ) -> OrderBy: ... + def desc( + self, + *, + nulls_first: bool | None = ..., + nulls_last: bool | None = ..., + ) -> OrderBy: ... + def reverse_ordering(self) -> BaseExpression: ... + def flatten(self) -> Iterator[BaseExpression]: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + +class Expression(_Deconstructible, BaseExpression, Combinable): ... + +class CombinedExpression(SQLiteNumericMixin, Expression): + connector: str + lhs: Combinable + rhs: Combinable + def __init__(self, lhs: Combinable, connector: str, rhs: Combinable, output_field: Field | None = None) -> None: ... + +class DurationExpression(CombinedExpression): + def compile(self, side: Combinable, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + +class TemporalSubtraction(CombinedExpression): + output_field: ClassVar[fields.DurationField] + def __init__(self, lhs: Combinable, rhs: Combinable) -> None: ... + +class F(_Deconstructible, Combinable): + name: str + allowed_default: ClassVar[bool] + def __init__(self, name: str) -> None: ... + def __getitem__(self, subscript: int | slice) -> Sliced: ... + def __contains__(self, other: Any) -> NoReturn: ... + def resolve_expression( + self, + query: Any | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, + ) -> Expression: ... + def replace_expressions(self, replacements: Mapping[F, Any]) -> F: ... + def asc( + self, + *, + descending: bool = ..., + nulls_first: bool | None = ..., + nulls_last: bool | None = ..., + ) -> OrderBy: ... + def desc( + self, + *, + nulls_first: bool | None = ..., + nulls_last: bool | None = ..., + ) -> OrderBy: ... + def copy(self) -> Self: ... + +class Sliced(F): + def __init__(self, obj: F, subscript: int | slice) -> None: ... + def resolve_expression( + self, + query: Any | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, + ) -> Func: ... + +class ResolvedOuterRef(F): + contains_aggregate: ClassVar[bool] + contains_over_clause: ClassVar[bool] + +class OuterRef(F): + contains_aggregate: ClassVar[bool] + contains_over_clause: ClassVar[bool] + def __init__(self, name: str | OuterRef) -> None: ... + def relabeled_clone(self, relabels: Any) -> Self: ... + +class Func(SQLiteNumericMixin, Expression): + function: str + name: str + template: str + arg_joiner: str + arity: int | None + source_expressions: list[Expression] + extra: dict[Any, Any] + def __init__(self, *expressions: Any, output_field: Field | None = None, **extra: Any) -> None: ... + def as_sql( + self, + compiler: SQLCompiler, + connection: BaseDatabaseWrapper, + function: str | None = None, + template: str | None = None, + arg_joiner: str | None = None, + **extra_context: Any, + ) -> _AsSqlType: ... + +class Value(Expression): + value: Any + def __init__(self, value: Any, output_field: Field | None = None) -> None: ... + +class RawSQL(Expression): + params: list[Any] + sql: str + def __init__(self, sql: str, params: Sequence[Any], output_field: Field | None = None) -> None: ... + +class Star(Expression): ... + +class DatabaseDefault(Expression): + def __init__(self, expression: Expression, output_field: Field | None = None) -> None: ... + +class Col(Expression): + target: Field + alias: str + contains_column_references: Literal[True] + possibly_multivalued: Literal[False] + def __init__(self, alias: str, target: Field, output_field: Field | None = None) -> None: ... + +class Ref(Expression): + def __init__(self, refs: str, source: Expression) -> None: ... + +class ExpressionList(Func): + def __init__( + self, *expressions: BaseExpression | Combinable, output_field: Field | None = None, **extra: Any + ) -> None: ... + +class OrderByList(Func): ... + +_E = TypeVar("_E", bound=Q | Combinable) + +class ExpressionWrapper(Expression, Generic[_E]): + def __init__(self, expression: _E, output_field: Field) -> None: ... + expression: _E + +class NegatedExpression(ExpressionWrapper[_E]): + def __init__(self, expression: _E) -> None: ... + def __invert__(self) -> _E: ... # type: ignore[override] + +class When(Expression): + template: str + condition: Any + result: Any + def __init__(self, condition: Any | None = None, then: Any | None = None, **lookups: Any) -> None: ... + +class Case(Expression): + template: str + case_joiner: str + cases: Any + default: Any + extra: Any + def __init__( + self, *cases: Any, default: Any | None = None, output_field: Field | None = None, **extra: Any + ) -> None: ... + +class Subquery(BaseExpression, Combinable): + template: str + subquery: bool + query: Query + extra: dict[Any, Any] + def __init__(self, queryset: Query | QuerySet, output_field: Field | None = None, **extra: Any) -> None: ... + +class Exists(Subquery): + output_field: ClassVar[fields.BooleanField] + def __init__(self, queryset: Query | QuerySet, **kwargs: Any) -> None: ... + +class OrderBy(Expression): + template: str + nulls_first: bool + nulls_last: bool + descending: bool + expression: Expression | F | Subquery + def __init__( + self, + expression: Expression | F | Subquery, + descending: bool = False, + nulls_first: bool | None = None, + nulls_last: bool | None = None, + ) -> None: ... + def asc(self) -> None: ... # type: ignore[override] + def desc(self) -> None: ... # type: ignore[override] + +class Window(SQLiteNumericMixin, Expression): + template: str + contains_aggregate: bool + contains_over_clause: bool + partition_by: ExpressionList | None + order_by: ExpressionList | None + def __init__( + self, + expression: BaseExpression, + partition_by: str | Iterable[BaseExpression | F] | F | BaseExpression | None = None, + order_by: Sequence[BaseExpression | F | str] | BaseExpression | F | str | None = None, + frame: WindowFrame | None = None, + output_field: Field | None = None, + ) -> None: ... + +class WindowFrame(Expression): + template: str + frame_type: str + def __init__(self, start: int | None = None, end: int | None = None) -> None: ... + def window_frame_start_end( + self, connection: BaseDatabaseWrapper, start: int | None, end: int | None + ) -> tuple[int, int]: ... + +class RowRange(WindowFrame): ... +class ValueRange(WindowFrame): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/__init__.pyi new file mode 100644 index 000000000000..68a6c5678fd6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/__init__.pyi @@ -0,0 +1,631 @@ +import decimal +import uuid +from collections.abc import Callable, Iterable, Mapping, Sequence +from datetime import date, time, timedelta +from datetime import datetime as real_datetime +from typing import Any, ClassVar, Generic, Literal, Protocol, TypeVar, overload, type_check_only + +from django import forms +from django.core import validators # due to weird mypy.stubtest error +from django.core.checks import CheckMessage +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Model +from django.db.models.expressions import Col, Combinable, Expression, Func +from django.db.models.fields.reverse_related import ForeignObjectRel +from django.db.models.query_utils import Q, RegisterLookupMixin +from django.forms import Widget +from django.utils.choices import BlankChoiceIterator, _Choice, _ChoiceNamedGroup, _Choices, _ChoicesCallable +from django.utils.datastructures import DictWrapper +from django.utils.functional import _Getter, _StrOrPromise, cached_property +from typing_extensions import Self, TypeAlias + +class Empty: ... +class NOT_PROVIDED: ... + +BLANK_CHOICE_DASH: list[tuple[str, str]] + +_ChoicesList: TypeAlias = Sequence[_Choice] | Sequence[_ChoiceNamedGroup] +_LimitChoicesTo: TypeAlias = Q | dict[str, Any] + +_F = TypeVar("_F", bound=Field, covariant=True) + +@type_check_only +class _FieldDescriptor(Protocol[_F]): + """ + Accessing fields of a model class (not instance) returns an object conforming to this protocol. + Depending on field type this could be DeferredAttribute, ForwardManyToOneDescriptor, FileDescriptor, etc. + """ + + @property + def field(self) -> _F: ... + +_AllLimitChoicesTo: TypeAlias = _LimitChoicesTo | _ChoicesCallable # noqa: PYI047 +_ErrorMessagesMapping: TypeAlias = Mapping[str, _StrOrPromise] +_ErrorMessagesDict: TypeAlias = dict[str, _StrOrPromise] + +# __set__ value type +_ST = TypeVar("_ST", contravariant=True) +# __get__ return type +_GT = TypeVar("_GT", covariant=True) + +class Field(RegisterLookupMixin, Generic[_ST, _GT]): + """ + Typing model fields. + + How does this work? + Let's take a look at the self-contained example + (it is way easier than our django implementation, but has the same concept). + + To understand this example you need: + 1. Be familiar with descriptors: https://docs.python.org/3/howto/descriptor.html + 2. Follow our explanation below + + Let's start with defining our fake model class and fake integer field. + + .. code:: python + + from typing import Generic, Union + + class Model(object): + ... + + _SetType = Union[int, float] # You can assign ints and floats + _GetType = int # access type is always `int` + + class IntField(object): + def __get__(self, instance: Model, owner) -> _GetType: + ... + + def __set__(self, instance, value: _SetType) -> None: + ... + + Now, let's create our own example model, + this would be something like ``User`` in your own apps: + + .. code:: python + + class Example(Model): + count = IntField() + + And now, lets test that our reveal type works: + + .. code:: python + + example = Example() + reveal_type(example.count) + # Revealed type is "builtins.int" + + example.count = 1.5 # ok + example.count = 'a' + # Incompatible types in assignment + # (expression has type "str", variable has type "Union[int, float]") + + Notice, that this is not magic. This is how descriptors work with ``mypy``. + + We also need ``_pyi_private_set_type`` attributes + and friends to help inside our plugin. + It is required to enhance parts like ``filter`` queries. + """ + + _pyi_private_set_type: Any + _pyi_private_get_type: Any + _pyi_lookup_exact_type: Any + + widget: Widget + help_text: _StrOrPromise + attname: str + auto_created: bool + primary_key: bool + remote_field: ForeignObjectRel | None + is_relation: bool + related_model: type[Model] | Literal["self"] | None + generated: ClassVar[bool] + one_to_many: bool | None + one_to_one: bool | None + many_to_many: bool | None + many_to_one: bool | None + max_length: int | None + model: type[Model] + name: str + verbose_name: _StrOrPromise + description: str | _Getter[str] + blank: bool + null: bool + unique: bool + editable: bool + empty_strings_allowed: bool + choices: _ChoicesList | None + db_column: str | None + db_comment: str | None + db_default: type[NOT_PROVIDED] | Expression + column: str + concrete: bool + default: Any + error_messages: _ErrorMessagesDict + empty_values: Sequence[Any] + creation_counter: int + auto_creation_counter: int + default_validators: Sequence[validators._ValidatorCallable] + default_error_messages: _ErrorMessagesDict + hidden: bool + system_check_removed_details: Any | None + system_check_deprecated_details: Any | None + non_db_attrs: tuple[str, ...] + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + primary_key: bool = False, + max_length: int | None = None, + unique: bool = False, + blank: bool = False, + null: bool = False, + db_index: bool = False, + rel: ForeignObjectRel | None = None, + default: Any = ..., + editable: bool = True, + serialize: bool = True, + unique_for_date: str | None = None, + unique_for_month: str | None = None, + unique_for_year: str | None = None, + choices: _Choices | None = None, + help_text: _StrOrPromise = "", + db_column: str | None = None, + db_tablespace: str | None = None, + auto_created: bool = False, + validators: Iterable[validators._ValidatorCallable] = (), + error_messages: _ErrorMessagesMapping | None = None, + db_comment: str | None = None, + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + ) -> None: ... + def __set__(self, instance: Any, value: _ST) -> None: ... + # class access + @overload + def __get__(self, instance: None, owner: Any) -> _FieldDescriptor[Self]: ... + # Model instance access + @overload + def __get__(self, instance: Model, owner: Any) -> _GT: ... + # non-Model instances + @overload + def __get__(self, instance: Any, owner: Any) -> Self: ... + def deconstruct(self) -> tuple[str, str, Sequence[Any], dict[str, Any]]: ... + def set_attributes_from_name(self, name: str) -> None: ... + def db_type_parameters(self, connection: BaseDatabaseWrapper) -> DictWrapper: ... + def db_check(self, connection: BaseDatabaseWrapper) -> str | None: ... + def db_type(self, connection: BaseDatabaseWrapper) -> str | None: ... + def db_parameters(self, connection: BaseDatabaseWrapper) -> dict[str, str | None]: ... + def pre_save(self, model_instance: Model, add: bool) -> Any: ... + def get_prep_value(self, value: Any) -> Any: ... + def get_db_prep_value(self, value: Any, connection: BaseDatabaseWrapper, prepared: bool = False) -> Any: ... + def get_db_prep_save(self, value: Any, connection: BaseDatabaseWrapper) -> Any: ... + def get_internal_type(self) -> str: ... + # TODO: plugin support + def formfield( + self, + form_class: type[forms.Field] | None = None, + choices_form_class: type[forms.ChoiceField] | None = None, + **kwargs: Any, + ) -> forms.Field | None: ... + def save_form_data(self, instance: Model, data: Any) -> None: ... + def contribute_to_class(self, cls: type[Model], name: str, private_only: bool = False) -> None: ... + def to_python(self, value: Any) -> Any: ... + @cached_property + def validators(self) -> list[validators._ValidatorCallable]: ... + def run_validators(self, value: Any) -> None: ... + def validate(self, value: Any, model_instance: Model | None) -> None: ... + def clean(self, value: Any, model_instance: Model | None) -> Any: ... + def get_choices( + self, + include_blank: bool = True, + blank_choice: _ChoicesList = ..., + limit_choices_to: _LimitChoicesTo | None = None, + ordering: Sequence[str] = (), + ) -> BlankChoiceIterator | _ChoicesList: ... + def _get_flatchoices(self) -> list[_Choice]: ... + @property + def flatchoices(self) -> list[_Choice]: ... + def has_default(self) -> bool: ... + def get_default(self) -> Any: ... + def check(self, **kwargs: Any) -> list[CheckMessage]: ... + def get_col(self, alias: str, output_field: Field | None = None) -> Col: ... + @cached_property + def cached_col(self) -> Col: ... + def value_from_object(self, obj: Model) -> _GT: ... + def get_attname(self) -> str: ... + def get_attname_column(self) -> tuple[str, str]: ... + def value_to_string(self, obj: Model) -> str: ... + def slice_expression(self, expression: Expression, start: int, end: int | None) -> Func: ... + +class IntegerField(Field[_ST, _GT]): + _pyi_private_set_type: float | int | str | Combinable + _pyi_private_get_type: int + _pyi_lookup_exact_type: str | int + +class PositiveIntegerRelDbTypeMixin: + def rel_db_type(self, connection: BaseDatabaseWrapper) -> str: ... + +class SmallIntegerField(IntegerField[_ST, _GT]): ... + +class BigIntegerField(IntegerField[_ST, _GT]): + MAX_BIGINT: ClassVar[int] + +class PositiveIntegerField(PositiveIntegerRelDbTypeMixin, IntegerField[_ST, _GT]): ... +class PositiveSmallIntegerField(PositiveIntegerRelDbTypeMixin, SmallIntegerField[_ST, _GT]): ... +class PositiveBigIntegerField(PositiveIntegerRelDbTypeMixin, BigIntegerField[_ST, _GT]): ... + +class FloatField(Field[_ST, _GT]): + _pyi_private_set_type: float | int | str | Combinable + _pyi_private_get_type: float + _pyi_lookup_exact_type: float + +class DecimalField(Field[_ST, _GT]): + _pyi_private_set_type: str | float | decimal.Decimal | Combinable + _pyi_private_get_type: decimal.Decimal + _pyi_lookup_exact_type: str | decimal.Decimal + # attributes + max_digits: int + decimal_places: int + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + max_digits: int | None = None, + decimal_places: int | None = None, + *, + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + +class CharField(Field[_ST, _GT]): + _pyi_private_set_type: str | int | Combinable + _pyi_private_get_type: str + # objects are converted to string before comparison + _pyi_lookup_exact_type: Any + def __init__( + self, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + *, + db_collation: str | None = None, + ) -> None: ... + +class CommaSeparatedIntegerField(CharField[_ST, _GT]): ... + +class SlugField(CharField[_ST, _GT]): + def __init__( + self, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + *, + max_length: int | None = 50, + db_index: bool = True, + allow_unicode: bool = False, + ) -> None: ... + +class EmailField(CharField[_ST, _GT]): + _pyi_private_set_type: str | Combinable + +class URLField(CharField[_ST, _GT]): + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + *, + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + rel: ForeignObjectRel | None = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + auto_created: bool = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + +class TextField(Field[_ST, _GT]): + _pyi_private_set_type: str | Combinable + _pyi_private_get_type: str + # objects are converted to string before comparison + _pyi_lookup_exact_type: Any + def __init__( + self, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + *, + db_collation: str | None = None, + ) -> None: ... + +class BooleanField(Field[_ST, _GT]): + _pyi_private_set_type: bool | Combinable + _pyi_private_get_type: bool + _pyi_lookup_exact_type: bool + +class NullBooleanField(BooleanField[_ST, _GT]): + _pyi_private_set_type: bool | Combinable | None # type: ignore[assignment] + _pyi_private_get_type: bool | None # type: ignore[assignment] + _pyi_lookup_exact_type: bool | None # type: ignore[assignment] + +class IPAddressField(Field[_ST, _GT]): + _pyi_private_set_type: str | Combinable + _pyi_private_get_type: str + +class GenericIPAddressField(Field[_ST, _GT]): + _pyi_private_set_type: str | int | Callable[..., Any] | Combinable + _pyi_private_get_type: str + + default_error_messages: _ErrorMessagesDict + unpack_ipv4: bool + protocol: str + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: Any | None = None, + protocol: str = "both", + unpack_ipv4: bool = False, + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + +class DateTimeCheckMixin: ... + +class DateField(DateTimeCheckMixin, Field[_ST, _GT]): + _pyi_private_set_type: str | date | Combinable + _pyi_private_get_type: date + _pyi_lookup_exact_type: str | date + auto_now: bool + auto_now_add: bool + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + auto_now: bool = False, + auto_now_add: bool = False, + *, + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + +class TimeField(DateTimeCheckMixin, Field[_ST, _GT]): + _pyi_private_set_type: str | time | real_datetime | Combinable + _pyi_private_get_type: time + auto_now: bool + auto_now_add: bool + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + auto_now: bool = False, + auto_now_add: bool = False, + *, + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + +class DateTimeField(DateField[_ST, _GT]): + _pyi_private_set_type: str | real_datetime | date | Combinable + _pyi_private_get_type: real_datetime + _pyi_lookup_exact_type: str | real_datetime + +class UUIDField(Field[_ST, _GT]): + _pyi_private_set_type: str | uuid.UUID + _pyi_private_get_type: uuid.UUID + _pyi_lookup_exact_type: uuid.UUID | str + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + *, + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + rel: ForeignObjectRel | None = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + auto_created: bool = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + +class FilePathField(Field[_ST, _GT]): + path: Any + match: str | None + recursive: bool + allow_files: bool + allow_folders: bool + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + path: str | Callable[..., str] = "", + match: str | None = None, + recursive: bool = False, + allow_files: bool = True, + allow_folders: bool = False, + *, + primary_key: bool = ..., + max_length: int = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + +class BinaryField(Field[_ST, _GT]): + _pyi_private_get_type: bytes | memoryview + +class DurationField(Field[_ST, _GT]): + _pyi_private_get_type: timedelta + +class AutoFieldMixin: + db_returning: bool + def deconstruct(self) -> tuple[str, str, Sequence[Any], dict[str, Any]]: ... + +class AutoFieldMeta(type): ... + +class AutoField(AutoFieldMixin, IntegerField[_ST, _GT], metaclass=AutoFieldMeta): + _pyi_private_set_type: Combinable | int | str + _pyi_private_get_type: int + _pyi_lookup_exact_type: str | int + +class BigAutoField(AutoFieldMixin, BigIntegerField[_ST, _GT]): ... +class SmallAutoField(AutoFieldMixin, SmallIntegerField[_ST, _GT]): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/files.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/files.pyi new file mode 100644 index 000000000000..2e0540a3ad0e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/files.pyi @@ -0,0 +1,120 @@ +from collections.abc import Callable, Iterable +from typing import Any, Protocol, TypeVar, overload, type_check_only + +from django.core import validators # due to weird mypy.stubtest error +from django.core.files.base import File +from django.core.files.images import ImageFile +from django.core.files.storage import Storage +from django.db.models.base import Model +from django.db.models.expressions import Expression +from django.db.models.fields import NOT_PROVIDED, Field, _ErrorMessagesMapping +from django.db.models.query_utils import DeferredAttribute +from django.db.models.utils import AltersData +from django.utils._os import _PathCompatible +from django.utils.choices import _Choices +from django.utils.functional import _StrOrPromise +from typing_extensions import Self + +class FieldFile(File, AltersData): + instance: Model + field: FileField + storage: Storage + name: str | None + def __init__(self, instance: Model, field: FileField, name: str | None) -> None: ... + file: Any + @property + def path(self) -> str: ... + @property + def url(self) -> str: ... + @property + def size(self) -> int: ... + def open(self, mode: str = "rb") -> Self: ... # type: ignore[override] + def save(self, name: str, content: File, save: bool = True) -> None: ... + def delete(self, save: bool = True) -> None: ... + @property + def closed(self) -> bool: ... + def __getstate__(self) -> dict[str, Any]: ... + def __setstate__(self, state: dict[str, Any]) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __hash__(self) -> int: ... + +class FileDescriptor(DeferredAttribute): + field: FileField + def __set__(self, instance: Model, value: Any | None) -> None: ... + def __get__(self, instance: Model | None, cls: type[Model] | None = None) -> FieldFile | FileDescriptor: ... + +_M = TypeVar("_M", bound=Model, contravariant=True) + +@type_check_only +class _UploadToCallable(Protocol[_M]): + def __call__(self, instance: _M, filename: str, /) -> _PathCompatible: ... + +class FileField(Field): + storage: Storage + upload_to: _PathCompatible | _UploadToCallable + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + upload_to: _PathCompatible | _UploadToCallable = "", + storage: Storage | Callable[[], Storage] | None = None, + *, + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | str = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + ) -> None: ... + # class access + @overload + def __get__(self, instance: None, owner: Any) -> FileDescriptor: ... + # Model instance access + @overload + def __get__(self, instance: Model, owner: Any) -> Any: ... + # non-Model instances + @overload + def __get__(self, instance: Any, owner: Any) -> Self: ... + def generate_filename(self, instance: Model | None, filename: _PathCompatible) -> str: ... + +class ImageFileDescriptor(FileDescriptor): + field: ImageField + def __set__(self, instance: Model, value: str | None) -> None: ... + +class ImageFieldFile(ImageFile, FieldFile): + field: ImageField + def delete(self, save: bool = True) -> None: ... + +class ImageField(FileField): + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + width_field: str | None = None, + height_field: str | None = None, + **kwargs: Any, + ) -> None: ... + # class access + @overload + def __get__(self, instance: None, owner: Any) -> ImageFileDescriptor: ... + # Model instance access + @overload + def __get__(self, instance: Model, owner: Any) -> Any: ... + # non-Model instances + @overload + def __get__(self, instance: Any, owner: Any) -> Self: ... + def update_dimension_fields(self, instance: Model, force: bool = False, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/generated.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/generated.pyi new file mode 100644 index 000000000000..1be70f2eaa74 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/generated.pyi @@ -0,0 +1,48 @@ +from typing import Any, ClassVar, Iterable, Literal + +from django.core.validators import _ValidatorCallable +from django.db import models +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.expressions import Expression +from django.db.models.fields import _ErrorMessagesMapping +from django.db.models.sql import Query +from django.utils.choices import _Choices +from django.utils.datastructures import DictWrapper +from django.utils.functional import _StrOrPromise + +class GeneratedField(models.Field): + generated: ClassVar[Literal[True]] + db_returning: Literal[True] + _query: Query | None + output_field: models.Field | None + + def __init__( + self, + *, + expression: Expression, + output_field: models.Field, + db_persist: bool | None = None, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_comment: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[_ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + **kwargs: Any, + ) -> None: ... + def generated_sql(self, connection: BaseDatabaseWrapper) -> tuple[str, Any]: ... + def db_type_parameters(self, connection: BaseDatabaseWrapper) -> DictWrapper: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/json.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/json.pyi new file mode 100644 index 000000000000..eff344b91e83 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/json.pyi @@ -0,0 +1,97 @@ +import json +from collections.abc import Callable +from typing import Any, ClassVar, TypeVar + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import lookups +from django.db.models.expressions import Expression +from django.db.models.fields import TextField +from django.db.models.lookups import PostgresOperatorLookup, Transform +from django.db.models.sql.compiler import SQLCompiler +from django.utils.functional import _StrOrPromise +from typing_extensions import Self + +from . import Field +from .mixins import CheckFieldDefaultMixin + +# __set__ value type +_ST = TypeVar("_ST", contravariant=True, default=Any) +# __get__ return type +_GT = TypeVar("_GT", covariant=True, default=Any) + +class JSONField(CheckFieldDefaultMixin, Field[_ST, _GT]): + encoder: type[json.JSONEncoder] | None + decoder: type[json.JSONDecoder] | None + def __init__( + self, + verbose_name: _StrOrPromise | None = None, + name: str | None = None, + encoder: type[json.JSONEncoder] | None = None, + decoder: type[json.JSONDecoder] | None = None, + **kwargs: Any, + ) -> None: ... + def from_db_value(self, value: str | None, expression: Expression, connection: BaseDatabaseWrapper) -> Any: ... + +class DataContains(PostgresOperatorLookup): ... +class ContainedBy(PostgresOperatorLookup): ... + +class HasKeyLookup(PostgresOperatorLookup): + logical_operator: str | None + def compile_json_path_final_key(self, key_transform: Any) -> str: ... + +class HasKey(HasKeyLookup): + postgres_operator: str + +class HasKeys(HasKeyLookup): + postgres_operator: str + logical_operator: str + +class HasAnyKeys(HasKeys): + postgres_operator: str + logical_operator: str + +class HasKeyOrArrayIndex(HasKey): ... +class JSONExact(lookups.Exact): ... +class CaseInsensitiveMixin: ... +class JSONIContains(CaseInsensitiveMixin, lookups.IContains): ... + +class KeyTransform(Transform): + key_name: str + postgres_operator: str + postgres_nested_operator: str + def __init__(self, key_name: Any, *args: Any, **kwargs: Any) -> None: ... + def preprocess_lhs(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> Any: ... + +class KeyTextTransform(KeyTransform): + postgres_operator: str + postgres_nested_operator: str + output_field: ClassVar[TextField] + @classmethod + def from_lookup(cls, lookup: str) -> Self: ... + +KT: Callable[[str], KeyTextTransform] + +class KeyTransformTextLookupMixin: + def __init__(self, key_transform: Any, *args: Any, **kwargs: Any) -> None: ... + +class KeyTransformIsNull(lookups.IsNull): ... +class KeyTransformIn(lookups.In): ... +class KeyTransformExact(JSONExact): ... +class KeyTransformIExact(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IExact): ... +class KeyTransformIContains(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IContains): ... +class KeyTransformStartsWith(KeyTransformTextLookupMixin, lookups.StartsWith): ... +class KeyTransformIStartsWith(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IStartsWith): ... +class KeyTransformEndsWith(KeyTransformTextLookupMixin, lookups.EndsWith): ... +class KeyTransformIEndsWith(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IEndsWith): ... +class KeyTransformRegex(KeyTransformTextLookupMixin, lookups.Regex): ... +class KeyTransformIRegex(CaseInsensitiveMixin, KeyTransformTextLookupMixin, lookups.IRegex): ... +class KeyTransformNumericLookupMixin: ... +class KeyTransformLt(KeyTransformNumericLookupMixin, lookups.LessThan): ... +class KeyTransformLte(KeyTransformNumericLookupMixin, lookups.LessThanOrEqual): ... +class KeyTransformGt(KeyTransformNumericLookupMixin, lookups.GreaterThan): ... +class KeyTransformGte(KeyTransformNumericLookupMixin, lookups.GreaterThanOrEqual): ... + +class KeyTransformFactory: + key_name: Any + def __init__(self, key_name: Any) -> None: ... + def __call__(self, *args: Any, **kwargs: Any) -> KeyTransform: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/mixins.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/mixins.pyi new file mode 100644 index 000000000000..a77d09fb573e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/mixins.pyi @@ -0,0 +1,18 @@ +from typing import Any + +from django.db.models.base import Model +from django.utils.functional import cached_property + +NOT_PROVIDED: Any + +class FieldCacheMixin: + def get_cache_name(self) -> str: ... + @cached_property + def cache_name(self) -> str: ... + def get_cached_value(self, instance: Model, default: Any = ...) -> Model | None: ... + def is_cached(self, instance: Model) -> bool: ... + def set_cached_value(self, instance: Model, value: Model | None) -> None: ... + def delete_cached_value(self, instance: Model) -> None: ... + +class CheckFieldDefaultMixin: + def check(self, **kwargs: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/proxy.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/proxy.pyi new file mode 100644 index 000000000000..ef647530a68d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/proxy.pyi @@ -0,0 +1,6 @@ +from typing import Any + +from django.db.models import fields + +class OrderWrt(fields.IntegerField): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related.pyi new file mode 100644 index 000000000000..a4579c3a12f9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related.pyi @@ -0,0 +1,310 @@ +from collections.abc import Callable, Iterable, Sequence +from typing import Any, Generic, Literal, TypeVar, overload +from uuid import UUID + +from django.core import validators # due to weird mypy.stubtest error +from django.db.models.base import Model +from django.db.models.expressions import Combinable, Expression +from django.db.models.fields import NOT_PROVIDED, Field, _AllLimitChoicesTo, _ErrorMessagesMapping, _LimitChoicesTo +from django.db.models.fields.mixins import FieldCacheMixin +from django.db.models.fields.related_descriptors import ForwardManyToOneDescriptor as ForwardManyToOneDescriptor +from django.db.models.fields.related_descriptors import ForwardOneToOneDescriptor as ForwardOneToOneDescriptor +from django.db.models.fields.related_descriptors import ManyRelatedManager +from django.db.models.fields.related_descriptors import ManyToManyDescriptor as ManyToManyDescriptor +from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor as ReverseManyToOneDescriptor +from django.db.models.fields.related_descriptors import ReverseOneToOneDescriptor as ReverseOneToOneDescriptor +from django.db.models.fields.reverse_related import ForeignObjectRel as ForeignObjectRel +from django.db.models.fields.reverse_related import ManyToManyRel as ManyToManyRel +from django.db.models.fields.reverse_related import ManyToOneRel as ManyToOneRel +from django.db.models.fields.reverse_related import OneToOneRel as OneToOneRel +from django.db.models.query_utils import FilteredRelation, PathInfo, Q +from django.utils.choices import _Choices +from django.utils.functional import _StrOrPromise, cached_property +from typing_extensions import Self + +RECURSIVE_RELATIONSHIP_CONSTANT: Literal["self"] + +def resolve_relation(scope_model: type[Model], relation: str | type[Model]) -> str | type[Model]: ... + +# __set__ value type +_ST = TypeVar("_ST", contravariant=True) +# __get__ return type +_GT = TypeVar("_GT", covariant=True, default=_ST) + +class RelatedField(FieldCacheMixin, Field[_ST, _GT]): + one_to_many: bool + one_to_one: bool + many_to_many: bool + many_to_one: bool + opts: Any + + remote_field: ForeignObjectRel + rel_class: type[ForeignObjectRel] + swappable: bool + def __init__( + self, + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + *, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + rel: ForeignObjectRel | None = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_tablespace: str | None = ..., + auto_created: bool = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + db_comment: str | None = ..., + ) -> None: ... + @cached_property + def related_model(self) -> type[Model] | Literal["self"]: ... # type: ignore[override] + def get_forward_related_filter(self, obj: Model) -> dict[str, int | UUID]: ... + def get_reverse_related_filter(self, obj: Model) -> Q: ... + @property + def swappable_setting(self) -> str | None: ... + def set_attributes_from_rel(self) -> None: ... + def do_related_class(self, other: type[Model], cls: type[Model]) -> None: ... + def get_limit_choices_to(self) -> _LimitChoicesTo: ... + def related_query_name(self) -> str: ... + @property + def target_field(self) -> Field: ... + +class ForeignObject(RelatedField[_ST, _GT]): + remote_field: ForeignObjectRel + rel_class: type[ForeignObjectRel] + from_fields: Sequence[str] + to_fields: Sequence[str | None] # None occurs in ForeignKey, where to_field defaults to None + swappable: bool + def __init__( + self, + to: type[Model] | str, + on_delete: Callable[..., None], + from_fields: Sequence[str], + to_fields: Sequence[str], + rel: ForeignObjectRel | None = None, + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + swappable: bool = True, + *, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + db_comment: str | None = ..., + ) -> None: ... + # class access + @overload + def __get__(self, instance: None, owner: Any) -> ForwardManyToOneDescriptor[Self]: ... + # Model instance access + @overload + def __get__(self, instance: Model, owner: Any) -> _GT: ... + # non-Model instances + @overload + def __get__(self, instance: Any, owner: Any) -> Self: ... + def resolve_related_fields(self) -> list[tuple[Field, Field]]: ... + @cached_property + def related_fields(self) -> list[tuple[Field, Field]]: ... + @cached_property + def reverse_related_fields(self) -> list[tuple[Field, Field]]: ... + @cached_property + def local_related_fields(self) -> tuple[Field, ...]: ... + @cached_property + def foreign_related_fields(self) -> tuple[Field, ...]: ... + def get_joining_fields(self, reverse_join: bool = False) -> tuple[tuple[Field, Field], ...]: ... + def get_reverse_joining_fields(self) -> tuple[tuple[Field, Field], ...]: ... + +class ForeignKey(ForeignObject[_ST, _GT]): + _pyi_private_set_type: Any | Combinable + _pyi_private_get_type: Any + + remote_field: ManyToOneRel + rel_class: type[ManyToOneRel] + def __init__( + self, + to: type[Model] | str, + on_delete: Callable[..., None], + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + to_field: str | None = None, + db_constraint: bool = True, + *, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + db_comment: str | None = ..., + ) -> None: ... + +class OneToOneField(ForeignKey[_ST, _GT]): + _pyi_private_set_type: Any | Combinable + _pyi_private_get_type: Any + + remote_field: OneToOneRel + rel_class: type[OneToOneRel] + def __init__( + self, + to: type[Model] | str, + on_delete: Any, + to_field: str | None = None, + *, + related_name: str | None = ..., + related_query_name: str | None = ..., + limit_choices_to: _AllLimitChoicesTo | None = ..., + parent_link: bool = ..., + db_constraint: bool = ..., + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + null: bool = ..., + db_index: bool = ..., + default: Any = ..., + db_default: type[NOT_PROVIDED] | Expression | _ST = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_tablespace: str | None = ..., + validators: Iterable[validators._ValidatorCallable] = ..., + error_messages: _ErrorMessagesMapping | None = ..., + db_comment: str | None = ..., + ) -> None: ... + # class access + @overload + def __get__(self, instance: None, owner: Any) -> ForwardOneToOneDescriptor[Self]: ... + # Model instance access + @overload + def __get__(self, instance: Model, owner: Any) -> _GT: ... + # non-Model instances + @overload + def __get__(self, instance: Any, owner: Any) -> Self: ... + +_Through = TypeVar("_Through", bound=Model) +_To = TypeVar("_To", bound=Model) + +class ManyToManyField(RelatedField[Any, Any], Generic[_To, _Through]): + description: _StrOrPromise + has_null_arg: bool + swappable: bool + + many_to_many: Literal[True] + many_to_one: Literal[False] + one_to_many: Literal[False] + one_to_one: Literal[False] + + remote_field: ManyToManyRel + rel_class: type[ManyToManyRel] + def __init__( + self, + to: type[_To] | str, + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + symmetrical: bool | None = None, + through: type[_Through] | str | None = None, + through_fields: tuple[str, str] | None = None, + db_constraint: bool = True, + db_table: str | None = None, + swappable: bool = True, + *, + verbose_name: _StrOrPromise | None = ..., + name: str | None = ..., + primary_key: bool = ..., + max_length: int | None = ..., + unique: bool = ..., + blank: bool = ..., + db_index: bool = ..., + default: Any = ..., + editable: bool = ..., + auto_created: bool = ..., + serialize: bool = ..., + unique_for_date: str | None = ..., + unique_for_month: str | None = ..., + unique_for_year: str | None = ..., + choices: _Choices | None = ..., + help_text: _StrOrPromise = ..., + db_column: str | None = ..., + db_tablespace: str | None = ..., + error_messages: _ErrorMessagesMapping | None = ..., + db_comment: str | None = ..., + ) -> None: ... + # class access + @overload + def __get__(self, instance: None, owner: Any) -> ManyToManyDescriptor[_To, _Through]: ... + # Model instance access + @overload + def __get__(self, instance: Model, owner: Any) -> ManyRelatedManager[_To, _Through]: ... + # non-Model instances + @overload + def __get__(self, instance: Any, owner: Any) -> Self: ... + def get_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... + def get_reverse_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... + def contribute_to_related_class(self, cls: type[Model], related: RelatedField) -> None: ... + def m2m_db_table(self) -> str: ... + def m2m_column_name(self) -> str: ... + def m2m_reverse_name(self) -> str: ... + def m2m_field_name(self) -> str: ... + def m2m_reverse_field_name(self) -> str: ... + def m2m_target_field_name(self) -> str: ... + def m2m_reverse_target_field_name(self) -> str: ... + +def create_many_to_many_intermediary_model(field: ManyToManyField, klass: type[Model]) -> type[Model]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_descriptors.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_descriptors.pyi new file mode 100644 index 000000000000..4deec2d440f2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_descriptors.pyi @@ -0,0 +1,171 @@ +from collections.abc import Callable, Iterable +from typing import Any, Generic, NoReturn, TypeVar, overload, type_check_only + +from django.core.exceptions import ObjectDoesNotExist +from django.db.models.base import Model +from django.db.models.fields import Field +from django.db.models.fields.related import ForeignKey, ManyToManyField, RelatedField +from django.db.models.fields.reverse_related import ManyToManyRel, ManyToOneRel, OneToOneRel +from django.db.models.manager import BaseManager, Manager +from django.db.models.query import QuerySet +from django.db.models.query_utils import DeferredAttribute +from django.utils.functional import cached_property +from typing_extensions import Self + +_M = TypeVar("_M", bound=Model) +_F = TypeVar("_F", bound=Field) +_From = TypeVar("_From", bound=Model) +_Through = TypeVar("_Through", bound=Model, default=Model) +_To = TypeVar("_To", bound=Model) + +class ForeignKeyDeferredAttribute(DeferredAttribute): + field: RelatedField + +class ForwardManyToOneDescriptor(Generic[_F]): + field: _F + def __init__(self, field_with_rel: _F) -> None: ... + @cached_property + def RelatedObjectDoesNotExist(self) -> type[ObjectDoesNotExist]: ... + def is_cached(self, instance: Model) -> bool: ... + def get_queryset(self, **hints: Any) -> QuerySet[Any]: ... + def get_prefetch_queryset( + self, instances: list[Model], queryset: QuerySet[Any] | None = None + ) -> tuple[QuerySet[Any], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... + def get_prefetch_querysets( + self, instances: list[Model], querysets: list[QuerySet[Any]] | None = None + ) -> tuple[QuerySet[Any], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... + def get_object(self, instance: Model) -> Model: ... + def __get__( + self, instance: Model | None, cls: type[Model] | None = None + ) -> Model | ForwardManyToOneDescriptor | None: ... + def __set__(self, instance: Model, value: Model | None) -> None: ... + def __reduce__(self) -> tuple[Callable[..., Any], tuple[type[Model], str]]: ... + +class ForwardOneToOneDescriptor(ForwardManyToOneDescriptor[_F]): + def get_object(self, instance: Model) -> Model: ... + +class ReverseOneToOneDescriptor(Generic[_From, _To]): + """ + In the example:: + + class Restaurant(Model): + place = OneToOneField(Place, related_name='restaurant') + + ``Place.restaurant`` is a ``ReverseOneToOneDescriptor`` instance. + """ + + related: OneToOneRel + def __init__(self, related: OneToOneRel) -> None: ... + @cached_property + def RelatedObjectDoesNotExist(self) -> type[ObjectDoesNotExist]: ... + def is_cached(self, instance: _From) -> bool: ... + def get_queryset(self, **hints: Any) -> QuerySet[_To]: ... + def get_prefetch_queryset( + self, instances: list[_From], queryset: QuerySet[_To] | None = None + ) -> tuple[QuerySet[_To], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... + def get_prefetch_querysets( + self, instances: list[_From], querysets: list[QuerySet[_To]] | None = None + ) -> tuple[QuerySet[_To], Callable[..., Any], Callable[..., Any], bool, str, bool]: ... + @overload + def __get__(self, instance: None, cls: Any | None = None) -> ReverseOneToOneDescriptor[_From, _To]: ... + @overload + def __get__(self, instance: _From, cls: Any | None = None) -> _To: ... + def __set__(self, instance: _From, value: _To | None) -> None: ... + def __reduce__(self) -> tuple[Callable[..., Any], tuple[type[_To], str]]: ... + +class ReverseManyToOneDescriptor(Generic[_To]): + """ + In the example:: + + class Child(Model): + parent = ForeignKey(Parent, related_name='children') + + ``Parent.children`` is a ``ReverseManyToOneDescriptor`` instance. + """ + + rel: ManyToOneRel + field: ForeignKey[_To, _To] + def __init__(self, rel: ManyToOneRel) -> None: ... + @cached_property + def related_manager_cls(self) -> type[RelatedManager[_To]]: ... + @overload + def __get__(self, instance: None, cls: Any | None = None) -> Self: ... + @overload + def __get__(self, instance: Model, cls: Any | None = None) -> RelatedManager[_To]: ... + def __set__(self, instance: Any, value: Any) -> NoReturn: ... + +# Fake class, Django defines 'RelatedManager' inside a function body +@type_check_only +class RelatedManager(Manager[_To], Generic[_To]): + related_val: tuple[int, ...] + def add(self, *objs: _To | int, bulk: bool = ...) -> None: ... + async def aadd(self, *objs: _To | int, bulk: bool = ...) -> None: ... + def remove(self, *objs: _To | int, bulk: bool = ...) -> None: ... + async def aremove(self, *objs: _To | int, bulk: bool = ...) -> None: ... + def set(self, objs: QuerySet[_To] | Iterable[_To | int], *, bulk: bool = ..., clear: bool = ...) -> None: ... + async def aset(self, objs: QuerySet[_To] | Iterable[_To | int], *, bulk: bool = ..., clear: bool = ...) -> None: ... + def clear(self) -> None: ... + async def aclear(self) -> None: ... + def __call__(self, *, manager: str) -> RelatedManager[_To]: ... + +def create_reverse_many_to_one_manager( + superclass: type[BaseManager[_M]], rel: ManyToOneRel +) -> type[RelatedManager[_M]]: ... + +class ManyToManyDescriptor(ReverseManyToOneDescriptor, Generic[_To, _Through]): + """ + In the example:: + + class Pizza(Model): + toppings = ManyToManyField(Topping, related_name='pizzas') + + ``Pizza.toppings`` and ``Topping.pizzas`` are ``ManyToManyDescriptor`` + instances. + """ + + # 'field' here is 'rel.field' + rel: ManyToManyRel # type: ignore[assignment] + field: ManyToManyField[_To, _Through] # type: ignore[assignment] + reverse: bool + def __init__(self, rel: ManyToManyRel, reverse: bool = False) -> None: ... + @property + def through(self) -> type[_Through]: ... + @cached_property + def related_manager_cls(self) -> type[ManyRelatedManager[_To, _Through]]: ... # type: ignore[override] + @overload # type: ignore[override] + def __get__(self, instance: None, cls: Any | None = None) -> Self: ... + @overload + def __get__(self, instance: Model, cls: Any | None = None) -> ManyRelatedManager[_To, _Through]: ... + +# Fake class, Django defines 'ManyRelatedManager' inside a function body +@type_check_only +class ManyRelatedManager(Manager[_To], Generic[_To, _Through]): + related_val: tuple[int, ...] + through: type[_Through] + def add(self, *objs: _To | int, bulk: bool = ..., through_defaults: dict[str, Any] | None = ...) -> None: ... + async def aadd(self, *objs: _To | int, bulk: bool = ..., through_defaults: dict[str, Any] | None = ...) -> None: ... + def remove(self, *objs: _To | int, bulk: bool = ...) -> None: ... + async def aremove(self, *objs: _To | int, bulk: bool = ...) -> None: ... + def set( + self, + objs: QuerySet[_To] | Iterable[_To | int], + *, + bulk: bool = ..., + clear: bool = ..., + through_defaults: dict[str, Any] | None = ..., + ) -> None: ... + async def aset( + self, + objs: QuerySet[_To] | Iterable[_To | int], + *, + bulk: bool = ..., + clear: bool = ..., + through_defaults: dict[str, Any] | None = ..., + ) -> None: ... + def clear(self) -> None: ... + async def aclear(self) -> None: ... + def __call__(self, *, manager: str) -> ManyRelatedManager[_To, _Through]: ... + +def create_forward_many_to_many_manager( + superclass: type[BaseManager[_To]], rel: ManyToManyRel, reverse: bool +) -> type[ManyRelatedManager[_To, _Through]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_lookups.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_lookups.pyi new file mode 100644 index 000000000000..f97a1a03299a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/related_lookups.pyi @@ -0,0 +1,46 @@ +from collections.abc import Iterable, Mapping +from typing import Any + +from django.db.models.fields import Field +from django.db.models.lookups import ( + Exact, + GreaterThan, + GreaterThanOrEqual, + In, + IsNull, + LessThan, + LessThanOrEqual, + Lookup, +) + +class MultiColSource: + alias: str + field: Field + sources: tuple[Field, Field] + targets: tuple[Field, Field] + contains_aggregate: bool + output_field: Field + def __init__( + self, alias: str, targets: tuple[Field, Field], sources: tuple[Field, Field], field: Field + ) -> None: ... + def relabeled_clone(self, relabels: Mapping[str, str]) -> MultiColSource: ... + def get_lookup(self, lookup: str) -> type[Lookup] | None: ... + +def get_normalized_value(value: Any, lhs: Any) -> tuple[Any, ...]: ... + +class RelatedIn(In): + bilateral_transforms: list[Any] + lhs: Any + rhs: Any + def get_prep_lookup(self) -> Iterable[Any]: ... + +class RelatedLookupMixin: + rhs: Any + def get_prep_lookup(self) -> Any: ... + +class RelatedExact(RelatedLookupMixin, Exact): ... +class RelatedLessThan(RelatedLookupMixin, LessThan): ... +class RelatedGreaterThan(RelatedLookupMixin, GreaterThan): ... +class RelatedGreaterThanOrEqual(RelatedLookupMixin, GreaterThanOrEqual): ... +class RelatedLessThanOrEqual(RelatedLookupMixin, LessThanOrEqual): ... +class RelatedIsNull(RelatedLookupMixin, IsNull): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/reverse_related.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/reverse_related.pyi new file mode 100644 index 000000000000..3db9e24df993 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/fields/reverse_related.pyi @@ -0,0 +1,136 @@ +from collections.abc import Callable, Sequence +from typing import Any, Literal + +from django.db.models.base import Model +from django.db.models.fields import AutoField, Field, _AllLimitChoicesTo, _ChoicesList, _LimitChoicesTo +from django.db.models.fields.related import ForeignKey, ForeignObject, ManyToManyField, OneToOneField +from django.db.models.lookups import Lookup, StartsWith, Transform +from django.db.models.query_utils import FilteredRelation, PathInfo +from django.db.models.sql.where import WhereNode +from django.utils.functional import cached_property + +from .mixins import FieldCacheMixin + +# Common note: `model` and `through` can be of type `str` when passed to `__init__`. +# When parent's `contribute_to_class` is called (during startup), +# strings are resolved to real model classes. +# Thus `str` is acceptable in __init__, but instance attribute `model` is always +# `Type[Model]` + +class ForeignObjectRel(FieldCacheMixin): + auto_created: bool + concrete: Literal[False] + editable: bool + is_relation: bool + null: bool + field: ForeignObject + model: type[Model] + related_name: str | None + related_query_name: str | None + limit_choices_to: _AllLimitChoicesTo | None + parent_link: bool + on_delete: Callable + symmetrical: bool + multiple: bool + field_name: str | None + def __init__( + self, + field: ForeignObject, + to: type[Model] | str, + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + on_delete: Callable | None = None, + ) -> None: ... + @cached_property + def hidden(self) -> bool: ... + @cached_property + def name(self) -> str: ... + @property + def remote_field(self) -> ForeignObject: ... + @property + def target_field(self) -> AutoField: ... + @cached_property + def related_model(self) -> type[Model] | Literal["self"]: ... + @cached_property + def many_to_many(self) -> bool: ... + @cached_property + def many_to_one(self) -> bool: ... + @cached_property + def one_to_many(self) -> bool: ... + @cached_property + def one_to_one(self) -> bool: ... + def get_lookup(self, lookup_name: str) -> type[Lookup] | None: ... + def get_lookups(self) -> dict[str, Any]: ... + def get_transform(self, name: str) -> type[Transform] | None: ... + def get_internal_type(self) -> str: ... + @property + def db_type(self) -> Any: ... + # Yes, seems that `get_choices` will fail if `limit_choices_to=None` + # and `self.limit_choices_to` is callable. + def get_choices( + self, + include_blank: bool = True, + blank_choice: _ChoicesList = ..., + limit_choices_to: _LimitChoicesTo | None = None, + ordering: Sequence[str] = (), + ) -> _ChoicesList: ... + def is_hidden(self) -> bool: ... + def get_joining_columns(self) -> tuple: ... + def get_joining_fields(self) -> tuple[tuple[Field, Field], ...]: ... + def get_extra_restriction( + self, where_class: type[WhereNode], alias: str, related_alias: str + ) -> StartsWith | WhereNode | None: ... + def set_field_name(self) -> None: ... + def get_accessor_name(self, model: type[Model] | None = None) -> str | None: ... + def get_path_info(self, filtered_relation: FilteredRelation | None = None) -> list[PathInfo]: ... + +class ManyToOneRel(ForeignObjectRel): + field: ForeignKey + def __init__( + self, + field: ForeignKey, + to: type[Model] | str, + field_name: str, + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + on_delete: Callable | None = None, + ) -> None: ... + def get_related_field(self) -> Field: ... + def get_accessor_name(self, model: type[Model] | None = None) -> str: ... + +class OneToOneRel(ManyToOneRel): + field: OneToOneField + def __init__( + self, + field: OneToOneField, + to: type[Model] | str, + field_name: str | None, + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + parent_link: bool = False, + on_delete: Callable | None = None, + ) -> None: ... + +class ManyToManyRel(ForeignObjectRel): + field: ManyToManyField[Any, Any] # type: ignore[assignment] + through: type[Model] | None + through_fields: tuple[str, str] | None + db_constraint: bool + def __init__( + self, + field: ManyToManyField[Any, Any], + to: type[Model] | str, + related_name: str | None = None, + related_query_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + symmetrical: bool = True, + through: type[Model] | str | None = None, + through_fields: tuple[str, str] | None = None, + db_constraint: bool = True, + ) -> None: ... + def get_related_field(self) -> Field: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/__init__.pyi new file mode 100644 index 000000000000..de7b1d45c1fd --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/__init__.pyi @@ -0,0 +1,90 @@ +from .comparison import Cast as Cast +from .comparison import Coalesce as Coalesce +from .comparison import Collate as Collate +from .comparison import Greatest as Greatest +from .comparison import JSONObject as JSONObject +from .comparison import Least as Least +from .comparison import NullIf as NullIf +from .datetime import Extract as Extract +from .datetime import ExtractDay as ExtractDay +from .datetime import ExtractHour as ExtractHour +from .datetime import ExtractIsoWeekDay as ExtractIsoWeekDay +from .datetime import ExtractIsoYear as ExtractIsoYear +from .datetime import ExtractMinute as ExtractMinute +from .datetime import ExtractMonth as ExtractMonth +from .datetime import ExtractQuarter as ExtractQuarter +from .datetime import ExtractSecond as ExtractSecond +from .datetime import ExtractWeek as ExtractWeek +from .datetime import ExtractWeekDay as ExtractWeekDay +from .datetime import ExtractYear as ExtractYear +from .datetime import Now as Now +from .datetime import Trunc as Trunc +from .datetime import TruncDate as TruncDate +from .datetime import TruncDay as TruncDay +from .datetime import TruncHour as TruncHour +from .datetime import TruncMinute as TruncMinute +from .datetime import TruncMonth as TruncMonth +from .datetime import TruncQuarter as TruncQuarter +from .datetime import TruncSecond as TruncSecond +from .datetime import TruncTime as TruncTime +from .datetime import TruncWeek as TruncWeek +from .datetime import TruncYear as TruncYear +from .math import Abs as Abs +from .math import ACos as ACos +from .math import ASin as ASin +from .math import ATan as ATan +from .math import ATan2 as ATan2 +from .math import Ceil as Ceil +from .math import Cos as Cos +from .math import Cot as Cot +from .math import Degrees as Degrees +from .math import Exp as Exp +from .math import Floor as Floor +from .math import Ln as Ln +from .math import Log as Log +from .math import Mod as Mod +from .math import Pi as Pi +from .math import Power as Power +from .math import Radians as Radians +from .math import Random as Random +from .math import Round as Round +from .math import Sign as Sign +from .math import Sin as Sin +from .math import Sqrt as Sqrt +from .math import Tan as Tan +from .text import MD5 as MD5 +from .text import SHA1 as SHA1 +from .text import SHA224 as SHA224 +from .text import SHA256 as SHA256 +from .text import SHA384 as SHA384 +from .text import SHA512 as SHA512 +from .text import Chr as Chr +from .text import Concat as Concat +from .text import ConcatPair as ConcatPair +from .text import Left as Left +from .text import Length as Length +from .text import Lower as Lower +from .text import LPad as LPad +from .text import LTrim as LTrim +from .text import Ord as Ord +from .text import Repeat as Repeat +from .text import Replace as Replace +from .text import Reverse as Reverse +from .text import Right as Right +from .text import RPad as RPad +from .text import RTrim as RTrim +from .text import StrIndex as StrIndex +from .text import Substr as Substr +from .text import Trim as Trim +from .text import Upper as Upper +from .window import CumeDist as CumeDist +from .window import DenseRank as DenseRank +from .window import FirstValue as FirstValue +from .window import Lag as Lag +from .window import LastValue as LastValue +from .window import Lead as Lead +from .window import NthValue as NthValue +from .window import Ntile as Ntile +from .window import PercentRank as PercentRank +from .window import Rank as Rank +from .window import RowNumber as RowNumber diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/comparison.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/comparison.pyi new file mode 100644 index 000000000000..0d204cb22434 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/comparison.pyi @@ -0,0 +1,23 @@ +from typing import Any, ClassVar + +from django.db.models import Func +from django.db.models.expressions import Combinable +from django.db.models.fields import Field +from django.db.models.fields.json import JSONField + +class Cast(Func): + def __init__(self, expression: Combinable | str, output_field: str | Field) -> None: ... + +class Coalesce(Func): ... + +class Collate(Func): + def __init__(self, expression: Combinable | str, collation: str) -> None: ... + +class Greatest(Func): ... + +class JSONObject(Func): + def __init__(self, **fields: Any) -> None: ... + output_field: ClassVar[JSONField] + +class Least(Func): ... +class NullIf(Func): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/datetime.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/datetime.pyi new file mode 100644 index 000000000000..4843ac38951c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/datetime.pyi @@ -0,0 +1,76 @@ +from datetime import tzinfo +from typing import Any, ClassVar + +from django.db import models +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Func, Transform +from django.db.models.expressions import Combinable +from django.db.models.fields import Field +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType + +class TimezoneMixin: + tzinfo: Any + def get_tzname(self) -> str | None: ... + +class Extract(TimezoneMixin, Transform): + lookup_name: str + output_field: ClassVar[models.IntegerField] + def __init__( + self, expression: Combinable | str, lookup_name: str | None = None, tzinfo: Any | None = None, **extra: Any + ) -> None: ... + +class ExtractYear(Extract): ... +class ExtractIsoYear(Extract): ... +class ExtractMonth(Extract): ... +class ExtractDay(Extract): ... +class ExtractWeek(Extract): ... +class ExtractWeekDay(Extract): ... +class ExtractIsoWeekDay(Extract): ... +class ExtractQuarter(Extract): ... +class ExtractHour(Extract): ... +class ExtractMinute(Extract): ... +class ExtractSecond(Extract): ... + +class Now(Func): + output_field: ClassVar[models.DateTimeField] + + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class TruncBase(TimezoneMixin, Transform): + kind: str + tzinfo: Any + + def __init__( + self, + expression: Combinable | str, + output_field: Field | None = None, + tzinfo: tzinfo | None = None, + **extra: Any, + ) -> None: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... # type: ignore[override] + +class Trunc(TruncBase): + def __init__( + self, + expression: Combinable | str, + kind: str, + output_field: Field | None = None, + tzinfo: tzinfo | None = None, + **extra: Any, + ) -> None: ... + +class TruncYear(TruncBase): ... +class TruncQuarter(TruncBase): ... +class TruncMonth(TruncBase): ... +class TruncWeek(TruncBase): ... +class TruncDay(TruncBase): ... + +class TruncDate(TruncBase): + output_field: ClassVar[models.DateField] + +class TruncTime(TruncBase): + output_field: ClassVar[models.TimeField] + +class TruncHour(TruncBase): ... +class TruncMinute(TruncBase): ... +class TruncSecond(TruncBase): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/math.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/math.pyi new file mode 100644 index 000000000000..eafb68f52df7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/math.pyi @@ -0,0 +1,32 @@ +from typing import Any + +from django.db.models.expressions import Combinable, Func +from django.db.models.functions.mixins import FixDecimalInputMixin, NumericOutputFieldMixin +from django.db.models.lookups import Transform + +class Abs(Transform): ... +class ACos(NumericOutputFieldMixin, Transform): ... +class ASin(NumericOutputFieldMixin, Transform): ... +class ATan(NumericOutputFieldMixin, Transform): ... +class ATan2(NumericOutputFieldMixin, Func): ... +class Ceil(Transform): ... +class Cos(NumericOutputFieldMixin, Transform): ... +class Cot(NumericOutputFieldMixin, Transform): ... +class Degrees(NumericOutputFieldMixin, Transform): ... +class Exp(NumericOutputFieldMixin, Transform): ... +class Floor(Transform): ... +class Ln(NumericOutputFieldMixin, Transform): ... +class Log(FixDecimalInputMixin, NumericOutputFieldMixin, Func): ... +class Mod(FixDecimalInputMixin, NumericOutputFieldMixin, Func): ... +class Pi(NumericOutputFieldMixin, Func): ... +class Power(NumericOutputFieldMixin, Func): ... +class Radians(NumericOutputFieldMixin, Transform): ... +class Random(NumericOutputFieldMixin, Func): ... + +class Round(Transform): + def __init__(self, expression: Combinable | str, precision: int = 0, **extra: Any) -> None: ... + +class Sin(NumericOutputFieldMixin, Transform): ... +class Sqrt(NumericOutputFieldMixin, Transform): ... +class Tan(NumericOutputFieldMixin, Transform): ... +class Sign(Transform): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/mixins.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/mixins.pyi new file mode 100644 index 000000000000..2f6388be3fe3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/mixins.pyi @@ -0,0 +1,3 @@ +class FixDecimalInputMixin: ... +class FixDurationInputMixin: ... +class NumericOutputFieldMixin: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/text.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/text.pyi new file mode 100644 index 000000000000..d4e4f38e6dbb --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/text.pyi @@ -0,0 +1,100 @@ +from typing import Any, ClassVar + +from django.db import models +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Func, Transform +from django.db.models.expressions import Combinable, Expression, Value +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType + +class MySQLSHA2Mixin: + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class OracleHashMixin: + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class PostgreSQLSHAMixin: + def as_postgresql( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... + +class Chr(Transform): + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class ConcatPair(Func): + def coalesce(self) -> ConcatPair: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Concat(Func): + def __init__(self, *expressions: Any, **extra: Any) -> None: ... + +class Left(Func): + output_field: ClassVar[models.CharField] + def __init__(self, expression: Combinable | str, length: Expression | int, **extra: Any) -> None: ... + def get_substr(self) -> Substr: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Length(Transform): + output_field: ClassVar[models.IntegerField] + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Lower(Transform): ... + +class LPad(Func): + output_field: ClassVar[models.CharField] + def __init__( + self, expression: Combinable | str, length: Expression | int | None, fill_text: Expression = ..., **extra: Any + ) -> None: ... + +class LTrim(Transform): ... +class MD5(OracleHashMixin, Transform): ... + +class Ord(Transform): + output_field: ClassVar[models.IntegerField] + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + def as_mysql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Repeat(Func): + output_field: ClassVar[models.CharField] + def __init__(self, expression: Combinable | str, number: Expression | int | None, **extra: Any) -> None: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Replace(Func): + def __init__(self, expression: Combinable | str, text: Value, replacement: Value = ..., **extra: Any) -> None: ... + +class Reverse(Transform): + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Right(Left): + def get_substr(self) -> Substr: ... + +class RPad(LPad): ... +class RTrim(Transform): ... +class SHA1(OracleHashMixin, PostgreSQLSHAMixin, Transform): ... + +class SHA224(MySQLSHA2Mixin, PostgreSQLSHAMixin, Transform): + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class SHA256(MySQLSHA2Mixin, OracleHashMixin, PostgreSQLSHAMixin, Transform): ... +class SHA384(MySQLSHA2Mixin, OracleHashMixin, PostgreSQLSHAMixin, Transform): ... +class SHA512(MySQLSHA2Mixin, OracleHashMixin, PostgreSQLSHAMixin, Transform): ... + +class StrIndex(Func): + output_field: ClassVar[models.IntegerField] + def as_postgresql( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any + ) -> _AsSqlType: ... + +class Substr(Func): + output_field: ClassVar[models.CharField] + def __init__( + self, expression: Combinable | str, pos: Expression | int, length: Expression | int | None = None, **extra: Any + ) -> None: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... + +class Trim(Transform): ... +class Upper(Transform): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/window.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/window.pyi new file mode 100644 index 000000000000..173d0427d4fa --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/functions/window.pyi @@ -0,0 +1,35 @@ +from typing import Any, ClassVar + +from django.db import models +from django.db.models.expressions import Func + +class CumeDist(Func): + output_field: ClassVar[models.FloatField] + +class DenseRank(Func): + output_field: ClassVar[models.IntegerField] + +class FirstValue(Func): ... + +class LagLeadFunction(Func): + def __init__(self, expression: str | None, offset: int = 1, default: int | None = None, **extra: Any) -> None: ... + +class Lag(LagLeadFunction): ... +class LastValue(Func): ... +class Lead(LagLeadFunction): ... + +class NthValue(Func): + def __init__(self, expression: str | None, nth: int = 1, **extra: Any) -> None: ... + +class Ntile(Func): + def __init__(self, num_buckets: int = 1, **extra: Any) -> None: ... + output_field: ClassVar[models.IntegerField] + +class PercentRank(Func): + output_field: ClassVar[models.FloatField] + +class Rank(Func): + output_field: ClassVar[models.IntegerField] + +class RowNumber(Func): + output_field: ClassVar[models.IntegerField] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/indexes.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/indexes.pyi new file mode 100644 index 000000000000..eefdeb36ba88 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/indexes.pyi @@ -0,0 +1,58 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.base.schema import BaseDatabaseSchemaEditor +from django.db.backends.ddl_references import Statement +from django.db.models.base import Model +from django.db.models.expressions import BaseExpression, Combinable, Expression, Func +from django.db.models.query_utils import Q +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType + +class Index: + model: type[Model] + suffix: str + max_name_length: int + fields: Sequence[str] + fields_orders: Sequence[tuple[str, str]] + name: str + db_tablespace: str | None + opclasses: Sequence[str] + condition: Q | None + expressions: Sequence[BaseExpression | Combinable] + include: Sequence[str] + def __init__( + self, + *expressions: BaseExpression | Combinable | str, + fields: Sequence[str] = (), + name: str | None = None, + db_tablespace: str | None = None, + opclasses: Sequence[str] = (), + condition: Q | None = None, + include: Sequence[str] | None = None, + ) -> None: ... + @property + def contains_expressions(self) -> bool: ... + def create_sql( + self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, using: str = "", **kwargs: Any + ) -> Statement: ... + def remove_sql(self, model: type[Model], schema_editor: BaseDatabaseSchemaEditor, **kwargs: Any) -> str: ... + def deconstruct(self) -> tuple[str, Sequence[Any], dict[str, Any]]: ... + def clone(self) -> Index: ... + def set_name_with_model(self, model: type[Model]) -> None: ... + +class IndexExpression(Func): + template: str + wrapper_classes: Sequence[Expression] + def set_wrapper_classes(self, connection: Any | None = None) -> None: ... + @classmethod + def register_wrappers(cls, *wrapper_classes: Expression) -> None: ... + def resolve_expression( + self, + query: Any | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, + ) -> IndexExpression: ... + def as_sqlite(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, **extra_context: Any) -> _AsSqlType: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/lookups.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/lookups.pyi new file mode 100644 index 000000000000..fe4ba2bc81bd --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/lookups.pyi @@ -0,0 +1,143 @@ +from collections.abc import Iterable +from typing import Any, Generic, Literal, Sequence, TypeVar + +from django.core.exceptions import EmptyResultSet +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.expressions import Combinable, Expression, Func +from django.db.models.fields import BooleanField +from django.db.models.query_utils import RegisterLookupMixin +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType, _ParamT +from django.utils.datastructures import OrderedSet +from django.utils.functional import cached_property + +_T = TypeVar("_T") + +class Lookup(Expression, Generic[_T]): + lookup_name: str + prepare_rhs: bool + can_use_none_as_rhs: bool + lhs: Any + rhs: Any + bilateral_transforms: list[type[Transform]] + def __init__(self, lhs: Any, rhs: Any) -> None: ... + def apply_bilateral_transforms(self, value: Expression) -> Expression: ... + def batch_process_rhs( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, rhs: OrderedSet | None = None + ) -> tuple[list[str], list[str]]: ... + def get_source_expressions(self) -> list[Expression]: ... + def set_source_expressions(self, new_exprs: Sequence[Combinable | Expression]) -> None: ... + def get_prep_lookup(self) -> Any: ... + def get_db_prep_lookup(self, value: _ParamT, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + def process_lhs( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, lhs: Expression | None = None + ) -> _AsSqlType: ... + def process_rhs(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + def rhs_is_direct_value(self) -> bool: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + def as_oracle(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + @cached_property + def output_field(self) -> BooleanField: ... + @cached_property + def contains_aggregate(self) -> bool: ... + @cached_property + def contains_over_clause(self) -> bool: ... + @property + def identity(self) -> tuple[type[Lookup], Any, Any]: ... + +class Transform(RegisterLookupMixin, Func): + bilateral: bool + @property + def lhs(self) -> Expression: ... + def get_bilateral_transforms(self) -> list[type[Transform]]: ... + +class BuiltinLookup(Lookup[_T]): + def process_lhs( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, lhs: Expression | None = None + ) -> _AsSqlType: ... + def get_rhs_op(self, connection: BaseDatabaseWrapper, rhs: str) -> str: ... + +class FieldGetDbPrepValueMixin: + get_db_prep_lookup_value_is_iterable: bool + def get_db_prep_lookup(self, value: _ParamT, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + +class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin): + get_db_prep_lookup_value_is_iterable: Literal[True] + def get_prep_lookup(self) -> Iterable[Any]: ... + def resolve_expression_parameter( + self, compiler: SQLCompiler, connection: BaseDatabaseWrapper, sql: str, param: Any + ) -> _AsSqlType: ... + +class PostgresOperatorLookup(Lookup[_T]): + postgres_operator: str | None + def as_postgresql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + +class Exact(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... +class IExact(BuiltinLookup[_T]): ... +class GreaterThan(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... +class GreaterThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... +class LessThan(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... +class LessThanOrEqual(FieldGetDbPrepValueMixin, BuiltinLookup[_T]): ... + +class IntegerFieldOverflow: + underflow_exception: type[EmptyResultSet] + overflow_exception: type[EmptyResultSet] + def process_rhs(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + +class IntegerFieldFloatRounding: + rhs: Any + def get_prep_lookup(self) -> Any: ... + +class IntegerFieldExact(IntegerFieldOverflow, Exact[int | float]): ... +class IntegerGreaterThan(IntegerFieldOverflow, GreaterThan[int | float]): ... +class IntegerGreaterThanOrEqual(IntegerFieldOverflow, IntegerFieldFloatRounding, GreaterThanOrEqual[int | float]): ... +class IntegerLessThan(IntegerFieldOverflow, IntegerFieldFloatRounding, LessThan[int | float]): ... +class IntegerLessThanOrEqual(IntegerFieldOverflow, LessThanOrEqual[int | float]): ... + +class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup): + def split_parameter_list_as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> Any: ... + +class PatternLookup(BuiltinLookup[str]): + param_pattern: str + +class Contains(PatternLookup): ... +class IContains(Contains): ... +class StartsWith(PatternLookup): ... +class IStartsWith(StartsWith): ... +class EndsWith(PatternLookup): ... +class IEndsWith(EndsWith): ... +class Range(FieldGetDbPrepValueIterableMixin, BuiltinLookup[_T]): ... +class IsNull(BuiltinLookup[bool]): ... +class Regex(BuiltinLookup[str]): ... +class IRegex(Regex): ... + +class YearLookup(Lookup): + def year_lookup_bounds(self, connection: BaseDatabaseWrapper, year: int) -> list[str]: ... + def get_direct_rhs_sql(self, connection: BaseDatabaseWrapper, rhs: str) -> str: ... + def get_bound_params(self, start: Any, finish: Any) -> Any: ... + +class YearExact(YearLookup, Exact[_T]): + def get_bound_params(self, start: Any, finish: Any) -> tuple[Any, Any]: ... + +class YearGt(YearLookup, GreaterThan[_T]): + def get_bound_params(self, start: Any, finish: Any) -> tuple[Any]: ... + +class YearGte(YearLookup, GreaterThanOrEqual[_T]): + def get_bound_params(self, start: Any, finish: Any) -> tuple[Any]: ... + +class YearLt(YearLookup, LessThan[_T]): + def get_bound_params(self, start: Any, finish: Any) -> tuple[Any]: ... + +class YearLte(YearLookup, LessThanOrEqual[_T]): + def get_bound_params(self, start: Any, finish: Any) -> tuple[Any]: ... + +class UUIDTextMixin: + rhs: Any + def process_rhs(self, qn: Any, connection: BaseDatabaseWrapper) -> Any: ... + +class UUIDIExact(UUIDTextMixin, IExact[_T]): ... +class UUIDContains(UUIDTextMixin, Contains): ... +class UUIDIContains(UUIDTextMixin, IContains): ... +class UUIDStartsWith(UUIDTextMixin, StartsWith): ... +class UUIDIStartsWith(UUIDTextMixin, IStartsWith): ... +class UUIDEndsWith(UUIDTextMixin, EndsWith): ... +class UUIDIEndsWith(UUIDTextMixin, IEndsWith): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/manager.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/manager.pyi new file mode 100644 index 000000000000..d140eb806637 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/manager.pyi @@ -0,0 +1,159 @@ +import datetime +from collections.abc import AsyncIterator, Collection, Iterable, Iterator, Mapping, Sequence +from typing import Any, Generic, NoReturn, TypeVar, overload + +from django.db.models.base import Model +from django.db.models.expressions import Combinable, OrderBy +from django.db.models.query import QuerySet, RawQuerySet +from typing_extensions import Self + +_T = TypeVar("_T", bound=Model, covariant=True) + +class BaseManager(Generic[_T]): + creation_counter: int + auto_created: bool + use_in_migrations: bool + name: str + model: type[_T] + _db: str | None + def __new__(cls, *args: Any, **kwargs: Any) -> Self: ... + def __init__(self) -> None: ... + def __class_getitem__(cls, *args: Any, **kwargs: Any) -> type[Self]: ... + def deconstruct( + self, + ) -> tuple[bool, str | None, str | None, Sequence[Any] | None, dict[str, Any] | None]: ... + def check(self, **kwargs: Any) -> list[Any]: ... + @classmethod + def from_queryset(cls, queryset_class: type[QuerySet[_T]], class_name: str | None = None) -> type[Self]: ... + @classmethod + def _get_queryset_methods(cls, queryset_class: type) -> dict[str, Any]: ... + def contribute_to_class(self, cls: type[Model], name: str) -> None: ... + def db_manager(self, using: str | None = None, hints: dict[str, Model] | None = None) -> Self: ... + @property + def db(self) -> str: ... + def get_queryset(self) -> QuerySet[_T]: ... + # NOTE: The following methods are in common with QuerySet, but note that the use of QuerySet as a return type + # rather than a self-type (_QS), since Manager's QuerySet-like methods return QuerySets and not Managers. + def iterator(self, chunk_size: int | None = ...) -> Iterator[_T]: ... + def aiterator(self, chunk_size: int = ...) -> AsyncIterator[_T]: ... + def aggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + async def aaggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + def get(self, *args: Any, **kwargs: Any) -> _T: ... + async def aget(self, *args: Any, **kwargs: Any) -> _T: ... + def create(self, **kwargs: Any) -> _T: ... + async def acreate(self, **kwargs: Any) -> _T: ... + def bulk_create( + self, + objs: Iterable[_T], + batch_size: int | None = ..., + ignore_conflicts: bool = ..., + update_conflicts: bool = ..., + update_fields: Collection[str] | None = ..., + unique_fields: Collection[str] | None = ..., + ) -> list[_T]: ... + async def abulk_create( + self, + objs: Iterable[_T], + batch_size: int | None = ..., + ignore_conflicts: bool = ..., + update_conflicts: bool = ..., + update_fields: Collection[str] | None = ..., + unique_fields: Collection[str] | None = ..., + ) -> list[_T]: ... + def bulk_update(self, objs: Iterable[_T], fields: Iterable[str], batch_size: int | None = ...) -> int: ... + async def abulk_update(self, objs: Iterable[_T], fields: Iterable[str], batch_size: int | None = ...) -> int: ... + def get_or_create(self, defaults: Mapping[str, Any] | None = ..., **kwargs: Any) -> tuple[_T, bool]: ... + async def aget_or_create(self, defaults: Mapping[str, Any] | None = ..., **kwargs: Any) -> tuple[_T, bool]: ... + def update_or_create( + self, + defaults: Mapping[str, Any] | None = ..., + create_defaults: Mapping[str, Any] | None = ..., + **kwargs: Any, + ) -> tuple[_T, bool]: ... + async def aupdate_or_create( + self, + defaults: Mapping[str, Any] | None = ..., + create_defaults: Mapping[str, Any] | None = ..., + **kwargs: Any, + ) -> tuple[_T, bool]: ... + def earliest(self, *fields: str | OrderBy) -> _T: ... + async def aearliest(self, *fields: str | OrderBy) -> _T: ... + def latest(self, *fields: str | OrderBy) -> _T: ... + async def alatest(self, *fields: str | OrderBy) -> _T: ... + def first(self) -> _T | None: ... + async def afirst(self) -> _T | None: ... + def last(self) -> _T | None: ... + async def alast(self) -> _T | None: ... + def in_bulk(self, id_list: Iterable[Any] | None = ..., *, field_name: str = ...) -> dict[Any, _T]: ... + async def ain_bulk(self, id_list: Iterable[Any] | None = ..., *, field_name: str = ...) -> dict[Any, _T]: ... + def update(self, **kwargs: Any) -> int: ... + async def aupdate(self, **kwargs: Any) -> int: ... + def exists(self) -> bool: ... + async def aexists(self) -> bool: ... + def explain(self, *, format: Any | None = ..., **options: Any) -> str: ... + async def aexplain(self, *, format: Any | None = ..., **options: Any) -> str: ... + def contains(self, objs: Model) -> bool: ... + async def acontains(self, objs: Model) -> bool: ... + def raw( + self, + raw_query: str, + params: Any = ..., + translations: dict[str, str] | None = ..., + using: str | None = ..., + ) -> RawQuerySet: ... + # The type of values may be overridden to be more specific in the mypy plugin, depending on the fields param + def values(self, *fields: str | Combinable, **expressions: Any) -> QuerySet[_T, dict[str, Any]]: ... + # The type of values_list may be overridden to be more specific in the mypy plugin, depending on the fields param + def values_list(self, *fields: str | Combinable, flat: bool = ..., named: bool = ...) -> QuerySet[_T, Any]: ... + def dates(self, field_name: str, kind: str, order: str = ...) -> QuerySet[_T, datetime.date]: ... + def datetimes( + self, field_name: str, kind: str, order: str = ..., tzinfo: datetime.tzinfo | None = ... + ) -> QuerySet[_T, datetime.datetime]: ... + def none(self) -> QuerySet[_T]: ... + def all(self) -> QuerySet[_T]: ... + def filter(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ... + def exclude(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ... + def complex_filter(self, filter_obj: Any) -> QuerySet[_T]: ... + def count(self) -> int: ... + async def acount(self) -> int: ... + def union(self, *other_qs: Any, all: bool = ...) -> QuerySet[_T]: ... + def intersection(self, *other_qs: Any) -> QuerySet[_T]: ... + def difference(self, *other_qs: Any) -> QuerySet[_T]: ... + def select_for_update( + self, nowait: bool = ..., skip_locked: bool = ..., of: Sequence[str] = ..., no_key: bool = ... + ) -> QuerySet[_T]: ... + def select_related(self, *fields: Any) -> QuerySet[_T]: ... + def prefetch_related(self, *lookups: Any) -> QuerySet[_T]: ... + def annotate(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ... + def alias(self, *args: Any, **kwargs: Any) -> QuerySet[_T]: ... + def order_by(self, *field_names: Any) -> QuerySet[_T]: ... + def distinct(self, *field_names: Any) -> QuerySet[_T]: ... + # extra() return type won't be supported any time soon + def extra( + self, + select: dict[str, Any] | None = ..., + where: list[str] | None = ..., + params: list[Any] | None = ..., + tables: list[str] | None = ..., + order_by: Sequence[str] | None = ..., + select_params: Sequence[Any] | None = ..., + ) -> QuerySet[Any]: ... + def reverse(self) -> QuerySet[_T]: ... + def defer(self, *fields: Any) -> QuerySet[_T]: ... + def only(self, *fields: Any) -> QuerySet[_T]: ... + def using(self, alias: str | None) -> QuerySet[_T]: ... + @property + def ordered(self) -> bool: ... + +class Manager(BaseManager[_T]): ... + +class ManagerDescriptor: + manager: BaseManager + def __init__(self, manager: BaseManager) -> None: ... + @overload + def __get__(self, instance: None, cls: type[Model] | None = None) -> BaseManager: ... + @overload + def __get__(self, instance: Model, cls: type[Model] | None = None) -> NoReturn: ... + +class EmptyManager(Manager[_T]): + def __init__(self, model: type[_T]) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/options.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/options.pyi new file mode 100644 index 000000000000..4e9712b2786a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/options.pyi @@ -0,0 +1,136 @@ +from collections.abc import Iterable, Sequence +from typing import Any, Generic, Literal, TypeVar, overload + +from django.apps.config import AppConfig +from django.apps.registry import Apps +from django.contrib.contenttypes.fields import GenericForeignKey +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.base import Model +from django.db.models.constraints import BaseConstraint, UniqueConstraint +from django.db.models.fields import AutoField, Field +from django.db.models.fields.related import ManyToManyField, OneToOneField +from django.db.models.fields.reverse_related import ForeignObjectRel +from django.db.models.manager import Manager +from django.db.models.query_utils import PathInfo +from django.utils.datastructures import ImmutableList, _ListOrTuple +from django.utils.functional import _StrOrPromise, cached_property +from typing_extensions import TypeAlias + +PROXY_PARENTS: object +EMPTY_RELATION_TREE: Any +IMMUTABLE_WARNING: str +DEFAULT_NAMES: tuple[str, ...] + +_OptionTogetherT: TypeAlias = _ListOrTuple[_ListOrTuple[str] | str] | set[tuple[str, ...]] # noqa: PYI047 + +@overload +def normalize_together(option_together: _ListOrTuple[_ListOrTuple[str] | str]) -> tuple[tuple[str, ...], ...]: ... + +# Any other value will be returned unchanged, but probably only set is semantically allowed +@overload +def normalize_together(option_together: set[tuple[str, ...]]) -> set[tuple[str, ...]]: ... + +_T = TypeVar("_T") + +def make_immutable_fields_list(name: str, data: Iterable[_T]) -> ImmutableList[_T]: ... + +_M = TypeVar("_M", bound=Model) + +class Options(Generic[_M]): + constraints: list[BaseConstraint] + FORWARD_PROPERTIES: set[str] + REVERSE_PROPERTIES: set[str] + default_apps: Any + local_fields: list[Field] + local_many_to_many: list[ManyToManyField] + private_fields: list[Any] + local_managers: list[Manager] + base_manager_name: str | None + default_manager_name: str | None + model_name: str | None + verbose_name: _StrOrPromise | None + verbose_name_plural: _StrOrPromise | None + db_table: str + ordering: Sequence[str] | None + indexes: list[Any] + unique_together: Sequence[tuple[str, ...]] # Are always normalized + index_together: Sequence[tuple[str, ...]] # Are always normalized + select_on_save: bool + default_permissions: Sequence[str] + permissions: list[Any] + object_name: str | None + app_label: str + get_latest_by: Sequence[str] | None + order_with_respect_to: str | None + db_tablespace: str + required_db_features: list[str] + required_db_vendor: Literal["sqlite", "postgresql", "mysql", "oracle"] | None + meta: type | None + pk: Field + auto_field: AutoField | None + abstract: bool + managed: bool + proxy: bool + proxy_for_model: type[Model] | None + concrete_model: type[Model] | None + swappable: str | None + parents: dict[type[Model], GenericForeignKey | Field] + auto_created: bool + related_fkey_lookups: list[Any] + apps: Apps + default_related_name: str | None + model: type[Model] + original_attrs: dict[str, Any] + def __init__(self, meta: type | None, app_label: str | None = None) -> None: ... + @property + def label(self) -> str: ... + @property + def label_lower(self) -> str: ... + @property + def app_config(self) -> AppConfig: ... + @property + def installed(self) -> bool: ... + def contribute_to_class(self, cls: type[Model], name: str) -> None: ... + def add_manager(self, manager: Manager) -> None: ... + def add_field(self, field: GenericForeignKey | Field[Any, Any], private: bool = False) -> None: ... + # if GenericForeignKey is passed as argument, it has primary_key = True set before + def setup_pk(self, field: GenericForeignKey | Field[Any, Any]) -> None: ... + def setup_proxy(self, target: type[Model]) -> None: ... + def can_migrate(self, connection: BaseDatabaseWrapper | str) -> bool: ... + @property + def verbose_name_raw(self) -> str: ... + @property + def swapped(self) -> str | None: ... + @cached_property + def fields_map(self) -> dict[str, Field[Any, Any] | ForeignObjectRel]: ... + @cached_property + def managers(self) -> ImmutableList[Manager]: ... + @cached_property + def managers_map(self) -> dict[str, Manager]: ... + @cached_property + def base_manager(self) -> Manager: ... + @cached_property + def default_manager(self) -> Manager | None: ... + @cached_property + def fields(self) -> ImmutableList[Field[Any, Any]]: ... + def get_field(self, field_name: str) -> Field | ForeignObjectRel | GenericForeignKey: ... + def get_base_chain(self, model: type[Model]) -> list[type[Model]]: ... + def get_parent_list(self) -> list[type[Model]]: ... + def get_ancestor_link(self, ancestor: type[Model]) -> OneToOneField | None: ... + def get_path_to_parent(self, parent: type[Model]) -> list[PathInfo]: ... + def get_path_from_parent(self, parent: type[Model]) -> list[PathInfo]: ... + def get_fields( + self, include_parents: bool = True, include_hidden: bool = False + ) -> list[Field[Any, Any] | ForeignObjectRel | GenericForeignKey]: ... + def _get_fields( + self, + forward: bool = True, + reverse: bool = True, + include_parents: bool | object = True, + include_hidden: bool = False, + topmost_call: bool = True, + ) -> list[Field[Any, Any] | ForeignObjectRel | GenericForeignKey]: ... + @cached_property + def total_unique_constraints(self) -> list[UniqueConstraint]: ... + @cached_property + def db_returning_fields(self) -> list[Field[Any, Any]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/query.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/query.pyi new file mode 100644 index 000000000000..7822e021fb12 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/query.pyi @@ -0,0 +1,251 @@ +import datetime +from collections.abc import AsyncIterator, Collection, Iterable, Iterator, Mapping, Sequence, Sized +from typing import Any, Generic, NamedTuple, overload + +from django.db.backends.utils import _ExecuteQuery +from django.db.models import Manager +from django.db.models.base import Model +from django.db.models.expressions import Combinable, OrderBy +from django.db.models.sql.query import Query, RawQuery +from django.utils.functional import cached_property +from typing_extensions import Self, TypeAlias, TypeVar + +_T = TypeVar("_T", covariant=True) +_Model = TypeVar("_Model", bound=Model, covariant=True) +_Row = TypeVar("_Row", covariant=True, default=_Model) # ONLY use together with _Model +_QS = TypeVar("_QS", bound=_QuerySet) +_TupleT = TypeVar("_TupleT", bound=tuple[Any, ...], covariant=True) + +MAX_GET_RESULTS: int +REPR_OUTPUT_SIZE: int + +class BaseIterable(Generic[_T]): + queryset: QuerySet[Model] + chunked_fetch: bool + chunk_size: int + def __init__(self, queryset: QuerySet[Model], chunked_fetch: bool = False, chunk_size: int = 100) -> None: ... + def __aiter__(self) -> AsyncIterator[_T]: ... + +class ModelIterable(Generic[_Model], BaseIterable[_Model]): + def __iter__(self) -> Iterator[_Model]: ... + +class RawModelIterable(BaseIterable[dict[str, Any]]): + def __iter__(self) -> Iterator[dict[str, Any]]: ... + +class ValuesIterable(BaseIterable[dict[str, Any]]): + def __iter__(self) -> Iterator[dict[str, Any]]: ... + +class ValuesListIterable(BaseIterable[_TupleT]): + def __iter__(self) -> Iterator[_TupleT]: ... + +class NamedValuesListIterable(ValuesListIterable[NamedTuple]): + def __iter__(self) -> Iterator[NamedTuple]: ... + +class FlatValuesListIterable(BaseIterable[_T]): + def __iter__(self) -> Iterator[_T]: ... + +class QuerySet(Generic[_Model, _Row], Iterable[_Row], Sized): + model: type[_Model] + query: Query + _iterable_class: type[BaseIterable] + _result_cache: list[_Row] | None + def __init__( + self, + model: type[Model] | None = None, + query: Query | None = None, + using: str | None = None, + hints: dict[str, Model] | None = None, + ) -> None: ... + @classmethod + def as_manager(cls) -> Manager[_Model]: ... + def __len__(self) -> int: ... + def __bool__(self) -> bool: ... + def __class_getitem__(cls: type[_QS], item: type[_Model]) -> type[_QS]: ... + def __getstate__(self) -> dict[str, Any]: ... + # Technically, the other QuerySet must be of the same type _T, but _T is covariant + def __and__(self, other: QuerySet[_Model, _Row]) -> Self: ... + def __or__(self, other: QuerySet[_Model, _Row]) -> Self: ... + # IMPORTANT: When updating any of the following methods' signatures, please ALSO modify + # the corresponding method in BaseManager. + def iterator(self, chunk_size: int | None = None) -> Iterator[_Row]: ... + def aiterator(self, chunk_size: int = 2000) -> AsyncIterator[_Row]: ... + def aggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + async def aaggregate(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + def get(self, *args: Any, **kwargs: Any) -> _Row: ... + async def aget(self, *args: Any, **kwargs: Any) -> _Row: ... + def create(self, **kwargs: Any) -> _Model: ... + async def acreate(self, **kwargs: Any) -> _Model: ... + def bulk_create( + self, + objs: Iterable[_Model], + batch_size: int | None = None, + ignore_conflicts: bool = False, + update_conflicts: bool = False, + update_fields: Collection[str] | None = None, + unique_fields: Collection[str] | None = None, + ) -> list[_Model]: ... + async def abulk_create( + self, + objs: Iterable[_Model], + batch_size: int | None = None, + ignore_conflicts: bool = False, + update_conflicts: bool = False, + update_fields: Collection[str] | None = None, + unique_fields: Collection[str] | None = None, + ) -> list[_Model]: ... + def bulk_update(self, objs: Iterable[_Model], fields: Iterable[str], batch_size: int | None = None) -> int: ... + async def abulk_update( + self, objs: Iterable[_Model], fields: Iterable[str], batch_size: int | None = None + ) -> int: ... + def get_or_create(self, defaults: Mapping[str, Any] | None = None, **kwargs: Any) -> tuple[_Model, bool]: ... + async def aget_or_create(self, defaults: Mapping[str, Any] | None = None, **kwargs: Any) -> tuple[_Model, bool]: ... + def update_or_create( + self, + defaults: Mapping[str, Any] | None = None, + create_defaults: Mapping[str, Any] | None = None, + **kwargs: Any, + ) -> tuple[_Model, bool]: ... + async def aupdate_or_create( + self, + defaults: Mapping[str, Any] | None = None, + create_defaults: Mapping[str, Any] | None = None, + **kwargs: Any, + ) -> tuple[_Model, bool]: ... + def earliest(self, *fields: str | OrderBy) -> _Row: ... + async def aearliest(self, *fields: str | OrderBy) -> _Row: ... + def latest(self, *fields: str | OrderBy) -> _Row: ... + async def alatest(self, *fields: str | OrderBy) -> _Row: ... + def first(self) -> _Row | None: ... + async def afirst(self) -> _Row | None: ... + def last(self) -> _Row | None: ... + async def alast(self) -> _Row | None: ... + def in_bulk(self, id_list: Iterable[Any] | None = None, *, field_name: str = "pk") -> dict[Any, _Model]: ... + async def ain_bulk(self, id_list: Iterable[Any] | None = None, *, field_name: str = "pk") -> dict[Any, _Model]: ... + def delete(self) -> tuple[int, dict[str, int]]: ... + async def adelete(self) -> tuple[int, dict[str, int]]: ... + def update(self, **kwargs: Any) -> int: ... + async def aupdate(self, **kwargs: Any) -> int: ... + def exists(self) -> bool: ... + async def aexists(self) -> bool: ... + def explain(self, *, format: Any | None = None, **options: Any) -> str: ... + async def aexplain(self, *, format: Any | None = None, **options: Any) -> str: ... + def contains(self, obj: Model) -> bool: ... + async def acontains(self, obj: Model) -> bool: ... + def raw( + self, + raw_query: _ExecuteQuery, + params: Any = (), + translations: dict[str, str] | None = None, + using: str | None = None, + ) -> RawQuerySet: ... + # The type of values may be overridden to be more specific in the mypy plugin, depending on the fields param + def values(self, *fields: str | Combinable, **expressions: Any) -> QuerySet[_Model, dict[str, Any]]: ... + # The type of values_list may be overridden to be more specific in the mypy plugin, depending on the fields param + def values_list( + self, *fields: str | Combinable, flat: bool = False, named: bool = False + ) -> QuerySet[_Model, Any]: ... + def dates(self, field_name: str, kind: str, order: str = "ASC") -> QuerySet[_Model, datetime.date]: ... + def datetimes( + self, field_name: str, kind: str, order: str = "ASC", tzinfo: datetime.tzinfo | None = None + ) -> QuerySet[_Model, datetime.datetime]: ... + def none(self) -> Self: ... + def all(self) -> Self: ... + def filter(self, *args: Any, **kwargs: Any) -> Self: ... + def exclude(self, *args: Any, **kwargs: Any) -> Self: ... + def complex_filter(self, filter_obj: Any) -> Self: ... + def count(self) -> int: ... + async def acount(self) -> int: ... + def union(self, *other_qs: Any, all: bool = False) -> Self: ... + def intersection(self, *other_qs: Any) -> Self: ... + def difference(self, *other_qs: Any) -> Self: ... + def select_for_update( + self, nowait: bool = False, skip_locked: bool = False, of: Sequence[str] = (), no_key: bool = False + ) -> Self: ... + def select_related(self, *fields: Any) -> Self: ... + def prefetch_related(self, *lookups: Any) -> Self: ... + def annotate(self, *args: Any, **kwargs: Any) -> Self: ... + def alias(self, *args: Any, **kwargs: Any) -> Self: ... + def order_by(self, *field_names: Any) -> Self: ... + def distinct(self, *field_names: Any) -> Self: ... + # extra() return type won't be supported any time soon + def extra( + self, + select: dict[str, Any] | None = None, + where: Sequence[str] | None = None, + params: Sequence[Any] | None = None, + tables: Sequence[str] | None = None, + order_by: Sequence[str] | None = None, + select_params: Sequence[Any] | None = None, + ) -> QuerySet[Any, Any]: ... + def reverse(self) -> Self: ... + def defer(self, *fields: Any) -> Self: ... + def only(self, *fields: Any) -> Self: ... + def using(self, alias: str | None) -> Self: ... + @property + def ordered(self) -> bool: ... + @property + def db(self) -> str: ... + def _fetch_all(self) -> None: ... + def resolve_expression(self, *args: Any, **kwargs: Any) -> Any: ... + def __iter__(self) -> Iterator[_Row]: ... + def __aiter__(self) -> AsyncIterator[_Row]: ... + @overload + def __getitem__(self, i: int) -> _Row: ... + @overload + def __getitem__(self, s: slice) -> Self: ... + def __reversed__(self) -> Iterator[_Row]: ... + +class RawQuerySet(Iterable[_Model], Sized): + query: RawQuery + def __init__( + self, + raw_query: RawQuery | str, + model: type[Model] | None = None, + query: Query | None = None, + params: tuple[Any, ...] = (), + translations: dict[str, str] | None = None, + using: str | None = None, + hints: dict[str, Model] | None = None, + ) -> None: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_Model]: ... + def __bool__(self) -> bool: ... + @overload + def __getitem__(self, k: int) -> _Model: ... + @overload + def __getitem__(self, k: str) -> Any: ... + @overload + def __getitem__(self, k: slice) -> RawQuerySet[_Model]: ... + @cached_property + def columns(self) -> list[str]: ... + @property + def db(self) -> str: ... + def iterator(self) -> Iterator[_Model]: ... + @cached_property + def model_fields(self) -> dict[str, str]: ... + def prefetch_related(self, *lookups: Any) -> RawQuerySet[_Model]: ... + def resolve_model_init_order(self) -> tuple[list[str], list[int], list[tuple[str, int]]]: ... + def using(self, alias: str | None) -> RawQuerySet[_Model]: ... + +# Deprecated alias of QuerySet, for compatibility only. +_QuerySet: TypeAlias = QuerySet + +class Prefetch: + prefetch_through: str + prefetch_to: str + queryset: QuerySet | None + to_attr: str | None + def __init__(self, lookup: str, queryset: QuerySet | None = None, to_attr: str | None = None) -> None: ... + def __getstate__(self) -> dict[str, Any]: ... + def add_prefix(self, prefix: str) -> None: ... + def get_current_prefetch_to(self, level: int) -> str: ... + def get_current_to_attr(self, level: int) -> tuple[str, str]: ... + def get_current_queryset(self, level: int) -> QuerySet | None: ... + def get_current_querysets(self, level: int) -> list[QuerySet] | None: ... + +def prefetch_related_objects(model_instances: Iterable[_Model], *related_lookups: str | Prefetch) -> None: ... +async def aprefetch_related_objects(model_instances: Iterable[_Model], *related_lookups: str | Prefetch) -> None: ... +def get_prefetcher(instance: Model, through_attr: str, to_attr: str) -> tuple[Any, Any, bool, bool]: ... + +class InstanceCheckMeta(type): ... +class EmptyQuerySet(metaclass=InstanceCheckMeta): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/query_utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/query_utils.pyi new file mode 100644 index 000000000000..a3bf0970079d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/query_utils.pyi @@ -0,0 +1,95 @@ +from collections import namedtuple +from collections.abc import Collection, Iterable, Iterator, Mapping, Sequence +from typing import Any, ClassVar, Literal, TypeVar + +from _typeshed import Incomplete +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.base import Model +from django.db.models.expressions import BaseExpression +from django.db.models.fields import Field +from django.db.models.fields.mixins import FieldCacheMixin +from django.db.models.lookups import Lookup, Transform +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from django.db.models.sql.query import Query +from django.db.models.sql.where import WhereNode +from django.utils import tree +from django.utils.functional import cached_property + +PathInfo = namedtuple( + "PathInfo", ["from_opts", "to_opts", "target_fields", "join_field", "m2m", "direct", "filtered_relation"] +) + +class InvalidQuery(Exception): ... + +def subclasses(cls: type[RegisterLookupMixin]) -> Iterator[type[RegisterLookupMixin]]: ... + +class Q(tree.Node): + AND: str + OR: str + conditional: bool + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + # Fake signature, the real is + # def __init__(self, *args: Any, _connector: Optional[Any] = ..., _negated: bool = ..., **kwargs: Any) -> None: ... + def __or__(self, other: Q) -> Q: ... + def __and__(self, other: Q) -> Q: ... + def __xor__(self, other: Q) -> Q: ... + def __invert__(self) -> Q: ... + def resolve_expression( + self, + query: Query | None = None, + allow_joins: bool = True, + reuse: set[str] | None = None, + summarize: bool = False, + for_save: bool = False, + ) -> WhereNode: ... + def flatten(self) -> Iterator[Incomplete]: ... + def check(self, against: dict[str, Any], using: str = "default") -> bool: ... + def deconstruct(self) -> tuple[str, Sequence[Any], dict[str, Any]]: ... + @cached_property + def referenced_base_fields(self) -> set[str]: ... + +class DeferredAttribute: + field: Field + def __init__(self, field: Field) -> None: ... + def __get__(self, instance: Model | None, cls: type[Model] | None = None) -> Any: ... + +_R = TypeVar("_R", bound=type) + +class RegisterLookupMixin: + class_lookups: ClassVar[dict[str, Any]] + lookup_name: str + @classmethod + def get_lookups(cls) -> dict[str, Any]: ... + def get_lookup(self, lookup_name: str) -> type[Lookup] | None: ... + def get_transform(self, lookup_name: str) -> type[Transform] | None: ... + @staticmethod + def merge_dicts(dicts: Iterable[dict[str, Any]]) -> dict[str, Any]: ... + @classmethod + def register_lookup(cls, lookup: _R, lookup_name: str | None = None) -> _R: ... + @classmethod + def _unregister_lookup(cls, lookup: type[Lookup], lookup_name: str | None = None) -> None: ... + +def select_related_descend( + field: Field, + restricted: bool, + requested: Mapping[str, Any] | None, + load_fields: Collection[str] | None, + reverse: bool = False, +) -> bool: ... + +_E = TypeVar("_E", bound=BaseExpression) + +def refs_expression( + lookup_parts: Sequence[str], annotations: Mapping[str, _E] +) -> tuple[Literal[False] | _E, Sequence[str]]: ... +def check_rel_lookup_compatibility(model: type[Model], target_opts: Any, field: FieldCacheMixin) -> bool: ... + +class FilteredRelation: + relation_name: str + alias: str | None + condition: Q + def __init__(self, relation_name: str, *, condition: Q = ...) -> None: ... + def clone(self) -> FilteredRelation: ... + def relabeled_clone(self, change_map: dict[str, str]) -> FilteredRelation: ... + def resolve_expression(self, query: Query, reuse: set[str], *args: Any, **kwargs: Any) -> FilteredRelation: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/signals.pyi new file mode 100644 index 000000000000..07784be1e1a0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/signals.pyi @@ -0,0 +1,34 @@ +from collections.abc import Callable + +from django.apps.registry import Apps +from django.db.models.base import Model +from django.dispatch import Signal + +class_prepared: Signal + +class ModelSignal(Signal): + def connect( # type: ignore[override] + self, + receiver: Callable, + sender: type[Model] | str | None = None, + weak: bool = True, + dispatch_uid: str | None = None, + apps: Apps | None = None, + ) -> None: ... + def disconnect( # type: ignore[override] + self, + receiver: Callable | None = None, + sender: type[Model] | str | None = None, + dispatch_uid: str | None = None, + apps: Apps | None = None, + ) -> bool | None: ... + +pre_init: ModelSignal +post_init: ModelSignal +pre_save: ModelSignal +post_save: ModelSignal +pre_delete: ModelSignal +post_delete: ModelSignal +m2m_changed: ModelSignal +pre_migrate: Signal +post_migrate: Signal diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/__init__.pyi new file mode 100644 index 000000000000..ee2ea487452d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/__init__.pyi @@ -0,0 +1,6 @@ +from .query import Query as Query +from .query import RawQuery as RawQuery +from .subqueries import AggregateQuery as AggregateQuery +from .subqueries import DeleteQuery as DeleteQuery +from .subqueries import InsertQuery as InsertQuery +from .subqueries import UpdateQuery as UpdateQuery diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/compiler.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/compiler.pyi new file mode 100644 index 000000000000..93a54ac57ca6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/compiler.pyi @@ -0,0 +1,156 @@ +from collections.abc import Callable, Iterable, Iterator, Sequence +from datetime import date, datetime +from decimal import Decimal +from typing import Any, Literal, overload +from uuid import UUID + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.backends.utils import CursorWrapper +from django.db.models.base import Model +from django.db.models.expressions import BaseExpression, Expression, Ref +from django.db.models.sql.query import Query +from django.db.models.sql.subqueries import AggregateQuery, DeleteQuery, InsertQuery, UpdateQuery +from django.utils.functional import cached_property +from typing_extensions import TypeAlias + +_ParamT: TypeAlias = str | int + +_ParamsT: TypeAlias = list[_ParamT] +_AsSqlType: TypeAlias = tuple[str, _ParamsT] + +class PositionRef(Ref): + def __init__(self, ordinal: str, refs: str, source: Expression) -> None: ... + +class SQLCompiler: + query: Query + connection: BaseDatabaseWrapper + using: str | None + quote_cache: Any + select: Any + annotation_col_map: Any + klass_info: Any + ordering_parts: Any + def __init__(self, query: Query, connection: BaseDatabaseWrapper, using: str | None) -> None: ... + col_count: int | None + def setup_query(self, with_col_aliases: bool = False) -> None: ... + has_extra_select: Any + def pre_sql_setup(self, with_col_aliases: bool = False) -> tuple[ + list[tuple[Expression, _AsSqlType, None]], + list[tuple[Expression, tuple[str, _ParamsT, bool]]], + list[_AsSqlType], + ]: ... + def get_group_by( + self, + select: list[tuple[BaseExpression, _AsSqlType, str | None]], + order_by: list[tuple[Expression, tuple[str, _ParamsT, bool]]], + ) -> list[_AsSqlType]: ... + def collapse_group_by( + self, expressions: list[Expression], having: list[Expression] | tuple + ) -> list[Expression]: ... + def get_select( + self, with_col_aliases: bool = False + ) -> tuple[list[tuple[Expression, _AsSqlType, str | None]], dict[str, Any] | None, dict[str, int]]: ... + def _order_by_pairs(self) -> None: ... + def get_order_by(self) -> list[tuple[Expression, tuple[str, _ParamsT, bool]]]: ... + def get_extra_select( + self, + order_by: list[tuple[Expression, tuple[str, _ParamsT, bool]]], + select: list[tuple[Expression, _AsSqlType, str | None]], + ) -> list[tuple[Expression, _AsSqlType, None]]: ... + def quote_name_unless_alias(self, name: str) -> str: ... + def compile(self, node: BaseExpression) -> _AsSqlType: ... + def get_combinator_sql(self, combinator: str, all: bool) -> tuple[list[str], list[int] | list[str]]: ... + def as_sql(self, with_limits: bool = True, with_col_aliases: bool = False) -> _AsSqlType: ... + def get_default_columns( + self, start_alias: str | None = None, opts: Any | None = None, from_parent: type[Model] | None = None + ) -> list[Expression]: ... + def get_distinct(self) -> tuple[list[Any], list[Any]]: ... + def find_ordering_name( + self, + name: str, + opts: Any, + alias: str | None = None, + default_order: str = "ASC", + already_seen: set[tuple[tuple[tuple[str, str]] | None, tuple[tuple[str, str]]]] | None = None, + ) -> list[tuple[Expression, bool]]: ... + def get_from_clause(self) -> tuple[list[str], _ParamsT]: ... + def get_related_selections( + self, + select: list[tuple[Expression, str | None]], + opts: Any | None = None, + root_alias: str | None = None, + cur_depth: int = 1, + requested: dict[str, dict[str, dict[str, dict[Any, Any]]]] | None = None, + restricted: bool | None = None, + ) -> list[dict[str, Any]]: ... + def get_select_for_update_of_arguments(self) -> list[Any]: ... + def deferred_to_columns(self) -> dict[type[Model], set[str]]: ... + def get_converters(self, expressions: list[Expression]) -> dict[int, tuple[list[Callable], Expression]]: ... + def apply_converters( + self, rows: Iterable[Iterable[Any]], converters: dict[int, tuple[list[Callable], Expression]] + ) -> Iterator[list[None | date | datetime | float | Decimal | UUID | bytes | str]]: ... + def results_iter( + self, + results: Iterable[list[Sequence[Any]]] | None = None, + tuple_expected: bool = False, + chunked_fetch: bool = False, + chunk_size: int = 100, + ) -> Iterator[Sequence[Any]]: ... + def has_results(self) -> bool: ... + @overload + def execute_sql( + self, result_type: Literal["cursor"] = "cursor", chunked_fetch: bool = False, chunk_size: int = 100 + ) -> CursorWrapper: ... + @overload + def execute_sql( + self, + result_type: Literal["no results"] | None = "no results", + chunked_fetch: bool = False, + chunk_size: int = 100, + ) -> None: ... + @overload + def execute_sql( + self, result_type: Literal["single"] = "single", chunked_fetch: bool = False, chunk_size: int = 100 + ) -> Iterable[Sequence[Any]] | None: ... + @overload + def execute_sql( + self, result_type: Literal["multi"] = "multi", chunked_fetch: bool = False, chunk_size: int = 100 + ) -> Iterable[list[Sequence[Any]]] | None: ... + def as_subquery_condition(self, alias: str, columns: list[str], compiler: SQLCompiler) -> _AsSqlType: ... + def explain_query(self) -> Iterator[str]: ... + +class SQLInsertCompiler(SQLCompiler): + query: InsertQuery + returning_fields: Sequence[Any] | None + returning_params: Sequence[Any] + def field_as_sql(self, field: Any, val: Any) -> _AsSqlType: ... + def prepare_value(self, field: Any, value: Any) -> Any: ... + def pre_save_val(self, field: Any, obj: Any) -> Any: ... + def assemble_as_sql(self, fields: Any, value_rows: Any) -> tuple[list[list[str]], list[list[Any]]]: ... + def as_sql(self) -> list[_AsSqlType]: ... # type: ignore[override] + def execute_sql( # type: ignore[override] + self, returning_fields: Sequence[str] | None = None + ) -> list[tuple[Any]]: ... # 1-tuple + +class SQLDeleteCompiler(SQLCompiler): + query: DeleteQuery + @cached_property + def single_alias(self) -> bool: ... + @cached_property + def contains_self_reference_subquery(self) -> bool: ... + def as_sql(self) -> _AsSqlType: ... # type: ignore[override] + +class SQLUpdateCompiler(SQLCompiler): + query: UpdateQuery + def as_sql(self) -> _AsSqlType: ... # type: ignore[override] + def execute_sql(self, result_type: Literal["cursor", "no results"]) -> int: ... # type: ignore[override] + def pre_sql_setup(self) -> None: ... # type: ignore[override] + +class SQLAggregateCompiler(SQLCompiler): + query: AggregateQuery + col_count: int + def as_sql(self) -> _AsSqlType: ... # type: ignore[override] + +def cursor_iter( + cursor: CursorWrapper, sentinel: Any, col_count: int | None, itersize: int +) -> Iterator[list[Sequence[Any]]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/constants.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/constants.pyi new file mode 100644 index 000000000000..a07a5f7c8e1a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/constants.pyi @@ -0,0 +1,13 @@ +from typing import Final, Literal + +GET_ITERATOR_CHUNK_SIZE: Final[int] + +MULTI: Literal["multi"] +SINGLE: Literal["single"] +CURSOR: Literal["cursor"] +NO_RESULTS: Literal["no results"] + +ORDER_DIR: dict[str, tuple[str, str]] + +INNER: Literal["INNER JOIN"] +LOUTER: Literal["LEFT OUTER JOIN"] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/datastructures.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/datastructures.pyi new file mode 100644 index 000000000000..a0d1a538910b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/datastructures.pyi @@ -0,0 +1,47 @@ +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.fields.mixins import FieldCacheMixin +from django.db.models.query_utils import FilteredRelation, PathInfo +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType + +class MultiJoin(Exception): + level: int + names_with_path: list[tuple[str, list[PathInfo]]] + def __init__(self, names_pos: int, path_with_names: list[tuple[str, list[PathInfo]]]) -> None: ... + +class Empty: ... + +class Join: + table_name: str + parent_alias: str + table_alias: str | None + join_type: str + join_cols: tuple + join_field: FieldCacheMixin + nullable: bool + filtered_relation: FilteredRelation | None + def __init__( + self, + table_name: str, + parent_alias: str, + table_alias: str | None, + join_type: str, + join_field: FieldCacheMixin, + nullable: bool, + filtered_relation: FilteredRelation | None = None, + ) -> None: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + def relabeled_clone(self, change_map: dict[str | None, str]) -> Join: ... + def demote(self) -> Join: ... + def promote(self) -> Join: ... + +class BaseTable: + join_type: Any + parent_alias: Any + filtered_relation: Any + table_name: str + table_alias: str | None + def __init__(self, table_name: str, alias: str | None) -> None: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + def relabeled_clone(self, change_map: dict[str | None, str]) -> BaseTable: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/query.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/query.pyi new file mode 100644 index 000000000000..a9dfe39bb31e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/query.pyi @@ -0,0 +1,232 @@ +import collections +from collections import namedtuple +from collections.abc import Iterable, Iterator, Sequence +from typing import Any, Literal + +from django.db.backends.utils import CursorWrapper +from django.db.models import Field, FilteredRelation, Model, Q +from django.db.models.expressions import BaseExpression, Combinable, Expression, OrderBy +from django.db.models.lookups import Lookup, Transform +from django.db.models.options import Options +from django.db.models.query_utils import PathInfo +from django.db.models.sql.datastructures import BaseTable, Join +from django.db.models.sql.where import WhereNode +from django.utils.functional import cached_property + +JoinInfo = namedtuple("JoinInfo", ("final_field", "targets", "opts", "joins", "path", "transform_function")) + +class RawQuery: + high_mark: int | None + low_mark: int | None + params: Any + sql: str + using: str + extra_select: dict[Any, Any] + annotation_select: dict[Any, Any] + cursor: CursorWrapper | None + def __init__(self, sql: str, using: str, params: Any = ()) -> None: ... + def chain(self, using: str) -> RawQuery: ... + def clone(self, using: str) -> RawQuery: ... + def get_columns(self) -> list[str]: ... + def __iter__(self) -> Iterator[Any]: ... + @property + def params_type(self) -> type[dict | tuple] | None: ... + +class Query(BaseExpression): + related_ids: list[int] | None + related_updates: dict[type[Model], list[tuple[Field, None, int | str]]] + values: list[Any] + alias_prefix: str + subq_aliases: frozenset[Any] + compiler: str + base_table_class: type[BaseTable] + model: type[Model] | None + alias_refcount: dict[str, int] + alias_map: dict[str, BaseTable | Join] + external_aliases: dict[str, bool] + table_map: dict[str, list[str]] + default_cols: bool + default_ordering: bool + standard_ordering: bool + used_aliases: set[str] + where: WhereNode + filter_is_sticky: bool + subquery: bool + group_by: None | Sequence[Combinable] | Sequence[str] | Literal[True] + order_by: Sequence[Any] + distinct: bool + distinct_fields: tuple[str, ...] + select: Sequence[BaseExpression] + select_for_update: bool + select_for_update_nowait: bool + select_for_update_skip_locked: bool + select_for_update_of: tuple + select_for_no_key_update: bool + select_related: dict[str, Any] | bool + max_depth: int + join_class: type[Join] + values_select: tuple + annotation_select_mask: list[str] | None + combinator: str | None + combinator_all: bool + combined_queries: tuple + extra_select_mask: set[str] | None + extra_tables: tuple + extra_order_by: Sequence[Any] + deferred_loading: tuple[set[str] | frozenset[str], bool] + explain_query: bool + explain_format: str | None + explain_options: dict[str, int] + high_mark: int | None + low_mark: int + extra: dict[str, Any] + annotations: dict[str, Expression] + empty_result_set_value: Any | None + explain_info: Any | None + def __init__(self, model: type[Model] | None, alias_cols: bool = True) -> None: ... + @property + def output_field(self) -> Field: ... + @property + def has_select_fields(self) -> bool: ... + @cached_property + def base_table(self) -> str: ... + def add_annotation(self, annotation: Any, alias: str, select: bool = True) -> None: ... + def sql_with_params(self) -> tuple[str, tuple]: ... + def __deepcopy__(self, memo: dict[int, Any]) -> Query: ... + def get_compiler( + self, using: str | None = None, connection: Any | None = None, elide_empty: bool = True + ) -> Any: ... + def join_parent_model(self, opts: Any, model: Any | None, alias: str, seen: dict[Any, str]) -> str: ... + def names_to_path( + self, names: list[str], opts: Any, allow_many: bool = True, fail_on_missing: bool = False + ) -> tuple[list[Any], Any, tuple[Any, ...], list[str]]: ... + def get_meta(self) -> Options: ... + def clone(self) -> Query: ... + def chain(self, klass: type[Query] | None = None) -> Query: ... + def get_count(self, using: str) -> int: ... + def get_group_by_cols(self, wrapper: Any | None = None) -> list[Any]: ... + def has_filters(self) -> WhereNode: ... + def get_external_cols(self) -> list[Any]: ... + def exists(self, limit: bool = True) -> Any: ... + def has_results(self, using: str) -> bool: ... + def explain(self, using: str, format: str | None = None, **options: Any) -> str: ... + def combine(self, rhs: Query, connector: str) -> None: ... + def ref_alias(self, alias: str) -> None: ... + def unref_alias(self, alias: str, amount: int = 1) -> None: ... + def promote_joins(self, aliases: Iterable[str]) -> None: ... + def demote_joins(self, aliases: Iterable[str]) -> None: ... + def reset_refcounts(self, to_counts: dict[str, int]) -> None: ... + def check_alias(self, alias: str) -> None: ... + def check_related_objects(self, field: Any, value: Any, opts: Any) -> None: ... + def check_query_object_type(self, value: Any, opts: Any, field: Any) -> None: ... + def change_aliases(self, change_map: dict[str | None, str]) -> None: ... + def bump_prefix(self, other_query: Query, exclude: Any | None = None) -> None: ... + def get_initial_alias(self) -> str: ... + def count_active_tables(self) -> int: ... + def resolve_expression(self, query: Query, *args: Any, **kwargs: Any) -> Query: ... # type: ignore[override] + def resolve_lookup_value( + self, value: Any, can_reuse: set[str] | None, allow_joins: bool, summarize: bool = False + ) -> Any: ... + def solve_lookup_type( + self, lookup: str, summarize: bool = False + ) -> tuple[Sequence[str], Sequence[str], Expression | Literal[False]]: ... + def table_alias( + self, table_name: str, create: bool = False, filtered_relation: Any | None = None + ) -> tuple[str, bool]: ... + def get_aggregation(self, using: Any, aggregate_exprs: dict[str, Any]) -> dict[str, Any]: ... + def build_filter( + self, + filter_expr: Q | Expression | dict[str, str] | tuple[str, Any], + branch_negated: bool = False, + current_negated: bool = False, + can_reuse: set[str] | None = None, + allow_joins: bool = True, + split_subq: bool = True, + check_filterable: bool = True, + summarize: bool = False, + update_join_types: bool = True, + ) -> tuple[WhereNode, Iterable[str]]: ... + def add_select_col(self, col: Any, name: str) -> None: ... + def add_filter(self, filter_lhs: tuple[str, Any], filter_rhs: tuple[str, Any]) -> None: ... + def add_q(self, q_object: Q) -> None: ... + def build_where(self, filter_expr: Q | Expression | dict[str, str] | tuple[str, Any]) -> WhereNode: ... + def add_filtered_relation(self, filtered_relation: FilteredRelation, alias: str) -> None: ... + def setup_joins( + self, + names: Sequence[str], + opts: Any, + alias: str, + can_reuse: set[str] | None = None, + allow_many: bool = True, + ) -> JoinInfo: ... + def trim_joins( + self, targets: tuple[Field, ...], joins: list[str], path: list[PathInfo] + ) -> tuple[tuple[Field, ...], str, list[str]]: ... + def resolve_ref( + self, name: str, allow_joins: bool = True, reuse: set[str] | None = None, summarize: bool = False + ) -> Expression: ... + def split_exclude( + self, + filter_expr: tuple[str, Any], + can_reuse: set[str], + names_with_path: list[tuple[str, list[PathInfo]]], + ) -> tuple[WhereNode, Iterable[str]]: ... + def set_empty(self) -> None: ... + def is_empty(self) -> bool: ... + def set_limits(self, low: int | None = None, high: int | None = None) -> None: ... + def clear_limits(self) -> None: ... + @property + def is_sliced(self) -> bool: ... + def has_limit_one(self) -> bool: ... + def can_filter(self) -> bool: ... + def clear_select_clause(self) -> None: ... + def clear_select_fields(self) -> None: ... + def set_select(self, cols: list[Expression]) -> None: ... + def add_distinct_fields(self, *field_names: Any) -> None: ... + def add_fields(self, field_names: Iterable[str], allow_m2m: bool = True) -> None: ... + def add_ordering(self, *ordering: str | OrderBy) -> None: ... + def clear_where(self) -> None: ... + def clear_ordering(self, force: bool = False, clear_default: bool = True) -> None: ... + def set_group_by(self, allow_aliases: bool = True) -> None: ... + def add_select_related(self, fields: Iterable[str]) -> None: ... + def add_extra( + self, + select: dict[str, Any] | None, + select_params: Iterable[Any] | None, + where: Sequence[str] | None, + params: Sequence[str] | None, + tables: Sequence[str] | None, + order_by: Sequence[str] | None, + ) -> None: ... + def clear_deferred_loading(self) -> None: ... + def add_deferred_loading(self, field_names: Iterable[str]) -> None: ... + def add_immediate_loading(self, field_names: Iterable[str]) -> None: ... + def get_select_mask(self) -> dict[str, Any]: ... + def set_annotation_mask(self, names: Iterable[str] | None) -> None: ... + def append_annotation_mask(self, names: Iterable[str]) -> None: ... + def set_extra_mask(self, names: Iterable[str] | None) -> None: ... + def set_values(self, fields: Iterable[str] | None) -> None: ... + @property + def annotation_select(self) -> dict[str, Any]: ... + @property + def extra_select(self) -> dict[str, Any]: ... + def trim_start(self, names_with_path: list[tuple[str, list[PathInfo]]]) -> tuple[str, bool]: ... + def is_nullable(self, field: Field) -> bool: ... + def check_filterable(self, expression: Any) -> None: ... + def build_lookup(self, lookups: Sequence[str], lhs: Expression | Query, rhs: Any) -> Lookup: ... + def try_transform(self, lhs: Expression | Query, name: str) -> Transform: ... + def join( + self, + join: BaseTable | Join, + reuse: str | None = None, + ) -> str: ... + +class JoinPromoter: + connector: str + negated: bool + effective_connector: str + num_children: int + votes: collections.Counter + def __init__(self, connector: str, num_children: int, negated: bool) -> None: ... + def add_votes(self, votes: Iterable[str]) -> None: ... + def update_join_types(self, query: Query) -> set[str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/subqueries.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/subqueries.pyi new file mode 100644 index 000000000000..b763fcedb41e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/subqueries.pyi @@ -0,0 +1,42 @@ +from collections.abc import Iterable +from typing import Any + +from django.db.models.base import Model +from django.db.models.expressions import Case +from django.db.models.fields import Field +from django.db.models.sql.query import Query +from django.db.models.sql.where import WhereNode + +class DeleteQuery(Query): + select: tuple + where_class: type[WhereNode] + where: WhereNode + def do_query(self, table: str, where: WhereNode, using: str) -> int: ... + def delete_batch(self, pk_list: list[int] | list[str], using: str) -> int: ... + +class UpdateQuery(Query): + select: tuple + where_class: type[WhereNode] + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + where: WhereNode + def update_batch(self, pk_list: list[int], values: dict[str, int | None], using: str) -> None: ... + def add_update_values(self, values: dict[str, Any]) -> None: ... + def add_update_fields(self, values_seq: list[tuple[Field, type[Model] | None, Case]]) -> None: ... + def add_related_update(self, model: type[Model], field: Field, value: int | str) -> None: ... + def get_related_updates(self) -> list[UpdateQuery]: ... + +class InsertQuery(Query): + select: tuple + where: WhereNode + where_class: type[WhereNode] + fields: Iterable[Field] + objs: list[Model] + raw: bool + def __init__(self, *args: Any, ignore_conflicts: bool = ..., **kwargs: Any) -> None: ... + def insert_values(self, fields: Iterable[Field], objs: list[Model], raw: bool = False) -> None: ... + +class AggregateQuery(Query): + select: tuple + sub_params: tuple + where: WhereNode + where_class: type[WhereNode] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/where.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/where.pyi new file mode 100644 index 000000000000..496f699f57e0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/sql/where.pyi @@ -0,0 +1,59 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.expressions import Expression +from django.db.models.fields import BooleanField +from django.db.models.sql.compiler import SQLCompiler, _AsSqlType +from django.db.models.sql.query import Query +from django.utils import tree +from django.utils.functional import cached_property + +AND: str +OR: str + +class WhereNode(tree.Node): + connector: str + negated: bool + default: str + resolved: bool + conditional: bool + def split_having(self, negated: bool = ...) -> tuple[WhereNode | None, WhereNode | None]: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... + def get_group_by_cols(self, alias: str | None = ...) -> list[Expression]: ... + def relabel_aliases(self, change_map: dict[str | None, str]) -> None: ... + def clone(self) -> WhereNode: ... + def relabeled_clone(self, change_map: dict[str | None, str]) -> WhereNode: ... + def resolve_expression(self, *args: Any, **kwargs: Any) -> WhereNode: ... + @cached_property + def output_field(self) -> BooleanField: ... + @cached_property + def contains_aggregate(self) -> bool: ... + @cached_property + def contains_over_clause(self) -> bool: ... + @property + def is_summary(self) -> bool: ... + +class NothingNode: + contains_aggregate: bool + def as_sql( + self, compiler: SQLCompiler | None = None, connection: BaseDatabaseWrapper | None = None + ) -> _AsSqlType: ... + +class ExtraWhere: + contains_aggregate: bool + sqls: Sequence[str] + params: Sequence[int] | Sequence[str] | None + def __init__(self, sqls: Sequence[str], params: Sequence[int] | Sequence[str] | None) -> None: ... + def as_sql( + self, compiler: SQLCompiler | None = None, connection: BaseDatabaseWrapper | None = None + ) -> _AsSqlType: ... + +class SubqueryConstraint: + contains_aggregate: bool + alias: str + columns: list[str] + targets: list[str] + query_object: Query + def __init__(self, alias: str, columns: list[str], targets: list[str], query_object: Query) -> None: ... + def as_sql(self, compiler: SQLCompiler, connection: BaseDatabaseWrapper) -> _AsSqlType: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/models/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/models/utils.pyi new file mode 100644 index 000000000000..4750caeaaff4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/models/utils.pyi @@ -0,0 +1,12 @@ +from collections.abc import Iterable, Iterator, MutableMapping +from typing import Any, NamedTuple + +from django.db.models.base import Model + +def make_model_tuple(model: type[Model] | str | tuple[str, str]) -> tuple[str, str]: ... +def resolve_callables(mapping: MutableMapping[str, Any]) -> Iterator[tuple[str, Any]]: ... +def unpickle_named_row(names: Iterable[str], values: Iterable[Any]) -> NamedTuple: ... +def create_namedtuple_class(*names: str) -> type[NamedTuple]: ... + +class AltersData: + def __init_subclass__(cls, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi new file mode 100644 index 000000000000..9791dad70c6f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/transaction.pyi @@ -0,0 +1,56 @@ +from collections.abc import Callable, Iterator +from contextlib import contextmanager +from types import TracebackType +from typing import Any, TypeVar, overload + +from django.db import ProgrammingError + +class TransactionManagementError(ProgrammingError): ... + +def get_connection(using: str | None = None) -> Any: ... +def get_autocommit(using: str | None = None) -> bool: ... +def set_autocommit(autocommit: bool, using: str | None = None) -> Any: ... +def commit(using: str | None = None) -> None: ... +def rollback(using: str | None = None) -> None: ... +def savepoint(using: str | None = None) -> str: ... +def savepoint_rollback(sid: str, using: str | None = None) -> None: ... +def savepoint_commit(sid: str, using: str | None = None) -> None: ... +def clean_savepoints(using: str | None = None) -> None: ... +def get_rollback(using: str | None = None) -> bool: ... +def set_rollback(rollback: bool, using: str | None = None) -> None: ... +@contextmanager +def mark_for_rollback_on_error(using: str | None = None) -> Iterator[None]: ... +def on_commit(func: Callable[[], object], using: str | None = None, robust: bool = False) -> None: ... + +_C = TypeVar("_C", bound=Callable) # Any callable + +# Don't inherit from ContextDecorator, so we can provide a more specific signature for __call__ +class Atomic: + using: str | None + savepoint: bool + def __init__(self, using: str | None, savepoint: bool, durable: bool) -> None: ... + # When decorating, return the decorated function as-is, rather than clobbering it as ContextDecorator does. + def __call__(self, func: _C) -> _C: ... + def __enter__(self) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + +# Bare decorator +@overload +def atomic(using: _C) -> _C: ... + +# Decorator or context-manager with parameters +@overload +def atomic(using: str | None = None, savepoint: bool = True, durable: bool = False) -> Atomic: ... + +# Bare decorator +@overload +def non_atomic_requests(using: _C) -> _C: ... + +# Decorator with arguments +@overload +def non_atomic_requests(using: str | None = None) -> Callable[[_C], _C]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/db/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/db/utils.pyi new file mode 100644 index 000000000000..59adc8a7385b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/db/utils.pyi @@ -0,0 +1,55 @@ +from collections.abc import Iterable +from types import TracebackType +from typing import Any + +from django.apps import AppConfig +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models import Model +from django.utils.connection import BaseConnectionHandler +from django.utils.functional import cached_property + +DEFAULT_DB_ALIAS: str +DJANGO_VERSION_PICKLE_KEY: str + +class Error(Exception): ... +class InterfaceError(Error): ... +class DatabaseError(Error): ... +class DataError(DatabaseError): ... +class OperationalError(DatabaseError): ... +class IntegrityError(DatabaseError): ... +class InternalError(DatabaseError): ... +class ProgrammingError(DatabaseError): ... +class NotSupportedError(DatabaseError): ... + +class DatabaseErrorWrapper: + def __init__(self, wrapper: Any) -> None: ... + def __enter__(self) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + +def load_backend(backend_name: str) -> Any: ... + +class ConnectionHandler(BaseConnectionHandler[BaseDatabaseWrapper]): + @property + def databases(self) -> dict[str, dict[str, Any]]: ... + def ensure_defaults(self, alias: str) -> None: ... + def prepare_test_settings(self, alias: str) -> None: ... + def create_connection(self, alias: str) -> BaseDatabaseWrapper: ... + def close_all(self) -> None: ... + +class ConnectionRouter: + def __init__(self, routers: Iterable[Any] | None = None) -> None: ... + @cached_property + def routers(self) -> list[Any]: ... + def db_for_read(self, model: type[Model], **hints: Any) -> str: ... + def db_for_write(self, model: type[Model], **hints: Any) -> str: ... + def allow_relation(self, obj1: Model, obj2: Model, **hints: Any) -> bool: ... + def allow_migrate(self, db: str, app_label: str, **hints: Any) -> bool: ... + def allow_migrate_model(self, db: str, model: type[Model]) -> bool: ... + def get_migratable_models( + self, app_config: AppConfig, db: str, include_auto_created: bool = False + ) -> list[type[Model]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/dispatch/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/dispatch/__init__.pyi new file mode 100644 index 000000000000..b22842975b8e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/dispatch/__init__.pyi @@ -0,0 +1,2 @@ +from django.dispatch.dispatcher import Signal as Signal +from django.dispatch.dispatcher import receiver as receiver diff --git a/python/helpers/bundled_stubs/Django/django-stubs/dispatch/dispatcher.pyi b/python/helpers/bundled_stubs/Django/django-stubs/dispatch/dispatcher.pyi new file mode 100644 index 000000000000..2682d9cb74b1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/dispatch/dispatcher.pyi @@ -0,0 +1,40 @@ +import threading +from collections.abc import Callable, Hashable, MutableMapping +from logging import Logger +from typing import Any, TypeVar + +NONE_ID: int +NO_RECEIVERS: Any + +logger: Logger + +class Signal: + receivers: list[Any] + lock: threading.Lock + use_caching: bool + sender_receivers_cache: MutableMapping[Any, Any] + + def __init__(self, use_caching: bool = False) -> None: ... + def connect( + self, receiver: Callable, sender: object | None = None, weak: bool = True, dispatch_uid: Hashable | None = None + ) -> None: ... + def disconnect( + self, receiver: Callable | None = None, sender: object | None = None, dispatch_uid: str | None = None + ) -> bool: ... + def has_listeners(self, sender: Any | None = None) -> bool: ... + def send(self, sender: Any, **named: Any) -> list[tuple[Callable, str | None]]: ... + async def asend(self, sender: Any, **named: Any) -> list[tuple[Callable, str | None]]: ... + def send_robust(self, sender: Any, **named: Any) -> list[tuple[Callable, Exception | Any]]: ... + async def asend_robust(self, sender: Any, **named: Any) -> list[tuple[Callable, Exception | Any]]: ... + def _live_receivers(self, sender: Any) -> list[Callable]: ... + +_F = TypeVar("_F", bound=Callable[..., Any]) + +def receiver( + signal: list[Signal] | tuple[Signal, ...] | Signal, + *, + sender: object | None = ..., + weak: bool = ..., + dispatch_uid: Hashable | None = ..., + **named: Any, +) -> Callable[[_F], _F]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/__init__.pyi new file mode 100644 index 000000000000..cd717d067fad --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/__init__.pyi @@ -0,0 +1,79 @@ +from django.core.exceptions import ValidationError as ValidationError + +from .boundfield import BoundField as BoundField +from .boundfield import BoundWidget as BoundWidget +from .fields import BooleanField as BooleanField +from .fields import CharField as CharField +from .fields import ChoiceField as ChoiceField +from .fields import ComboField as ComboField +from .fields import DateField as DateField +from .fields import DateTimeField as DateTimeField +from .fields import DecimalField as DecimalField +from .fields import DurationField as DurationField +from .fields import EmailField as EmailField +from .fields import Field as Field +from .fields import FileField as FileField +from .fields import FilePathField as FilePathField +from .fields import FloatField as FloatField +from .fields import GenericIPAddressField as GenericIPAddressField +from .fields import ImageField as ImageField +from .fields import IntegerField as IntegerField +from .fields import JSONField as JSONField +from .fields import MultipleChoiceField as MultipleChoiceField +from .fields import MultiValueField as MultiValueField +from .fields import NullBooleanField as NullBooleanField +from .fields import RegexField as RegexField +from .fields import SlugField as SlugField +from .fields import SplitDateTimeField as SplitDateTimeField +from .fields import TimeField as TimeField +from .fields import TypedChoiceField as TypedChoiceField +from .fields import TypedMultipleChoiceField as TypedMultipleChoiceField +from .fields import URLField as URLField +from .fields import UUIDField as UUIDField +from .forms import BaseForm as BaseForm +from .forms import Form as Form +from .formsets import BaseFormSet as BaseFormSet +from .formsets import all_valid as all_valid +from .formsets import formset_factory as formset_factory +from .models import BaseInlineFormSet as BaseInlineFormSet +from .models import BaseModelForm as BaseModelForm +from .models import BaseModelFormSet as BaseModelFormSet +from .models import InlineForeignKeyField as InlineForeignKeyField +from .models import ModelChoiceField as ModelChoiceField +from .models import ModelChoiceIterator as ModelChoiceIterator +from .models import ModelForm as ModelForm +from .models import ModelFormMetaclass as ModelFormMetaclass +from .models import ModelFormOptions as ModelFormOptions +from .models import ModelMultipleChoiceField as ModelMultipleChoiceField +from .models import fields_for_model as fields_for_model +from .models import inlineformset_factory as inlineformset_factory +from .models import model_to_dict as model_to_dict +from .models import modelform_factory as modelform_factory +from .models import modelformset_factory as modelformset_factory +from .widgets import CheckboxInput as CheckboxInput +from .widgets import CheckboxSelectMultiple as CheckboxSelectMultiple +from .widgets import ClearableFileInput as ClearableFileInput +from .widgets import DateInput as DateInput +from .widgets import DateTimeBaseInput as DateTimeBaseInput +from .widgets import DateTimeInput as DateTimeInput +from .widgets import EmailInput as EmailInput +from .widgets import FileInput as FileInput +from .widgets import HiddenInput as HiddenInput +from .widgets import Input as Input +from .widgets import Media as Media +from .widgets import MultipleHiddenInput as MultipleHiddenInput +from .widgets import MultiWidget as MultiWidget +from .widgets import NullBooleanSelect as NullBooleanSelect +from .widgets import NumberInput as NumberInput +from .widgets import PasswordInput as PasswordInput +from .widgets import RadioSelect as RadioSelect +from .widgets import Select as Select +from .widgets import SelectDateWidget as SelectDateWidget +from .widgets import SelectMultiple as SelectMultiple +from .widgets import SplitDateTimeWidget as SplitDateTimeWidget +from .widgets import SplitHiddenDateTimeWidget as SplitHiddenDateTimeWidget +from .widgets import Textarea as Textarea +from .widgets import TextInput as TextInput +from .widgets import TimeInput as TimeInput +from .widgets import URLInput as URLInput +from .widgets import Widget as Widget diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/boundfield.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/boundfield.pyi new file mode 100644 index 000000000000..38ccaa0d2534 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/boundfield.pyi @@ -0,0 +1,85 @@ +from collections.abc import Iterable, Iterator +from typing import Any, overload + +from django.forms.fields import Field +from django.forms.forms import BaseForm +from django.forms.renderers import BaseRenderer +from django.forms.utils import ErrorList, RenderableFieldMixin +from django.forms.widgets import Widget +from django.utils.functional import _StrOrPromise, cached_property +from django.utils.safestring import SafeString +from typing_extensions import TypeAlias + +_AttrsT: TypeAlias = dict[str, str | bool] + +class BoundField(RenderableFieldMixin): + form: BaseForm + field: Field + name: str + html_name: str + html_initial_name: str + html_initial_id: str + label: _StrOrPromise + help_text: _StrOrPromise + renderer: BaseRenderer + def __init__(self, form: BaseForm, field: Field, name: str) -> None: ... + @cached_property + def subwidgets(self) -> list[BoundWidget]: ... + def __bool__(self) -> bool: ... + def __iter__(self) -> Iterator[BoundWidget]: ... + def __len__(self) -> int: ... + @overload + def __getitem__(self, idx: int | str) -> BoundWidget: ... + @overload + def __getitem__(self, idx: slice) -> list[BoundWidget]: ... + @property + def errors(self) -> ErrorList: ... + @property + def template_name(self) -> str: ... + def as_widget( + self, widget: Widget | None = None, attrs: _AttrsT | None = None, only_initial: bool = False + ) -> SafeString: ... + def as_text(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ... + def __html__(self) -> SafeString: ... + def as_textarea(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ... + def as_hidden(self, attrs: _AttrsT | None = None, **kwargs: Any) -> SafeString: ... + @property + def data(self) -> Any: ... + def value(self) -> Any: ... + def label_tag( + self, + contents: str | None = None, + attrs: _AttrsT | None = None, + label_suffix: str | None = None, + tag: str | None = None, + ) -> SafeString: ... + def legend_tag( + self, contents: str | None = None, attrs: _AttrsT | None = None, label_suffix: str | None = None + ) -> SafeString: ... + def css_classes(self, extra_classes: str | Iterable[str] | None = None) -> str: ... + @property + def is_hidden(self) -> bool: ... + @property + def auto_id(self) -> str: ... + @property + def id_for_label(self) -> str: ... + @property + def initial(self) -> Any: ... + def build_widget_attrs(self, attrs: _AttrsT, widget: Widget | None = None) -> _AttrsT: ... + @property + def widget_type(self) -> str: ... + @property + def use_fieldset(self) -> bool: ... + +class BoundWidget: + parent_widget: Widget + data: dict[str, Any] + renderer: BaseRenderer + def __init__(self, parent_widget: Widget, data: dict[str, Any], renderer: BaseRenderer) -> None: ... + def tag(self, wrap_label: bool = False) -> SafeString: ... + @property + def template_name(self) -> str: ... + @property + def id_for_label(self) -> str: ... + @property + def choice_label(self) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi new file mode 100644 index 000000000000..31b93ea6fdc1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/fields.pyi @@ -0,0 +1,558 @@ +import datetime +from collections.abc import Collection, Iterator, Sequence +from decimal import Decimal +from re import Pattern +from typing import Any, Protocol, type_check_only +from uuid import UUID + +from django.core.files import File +from django.core.validators import _ValidatorCallable +from django.db.models.fields import _ErrorMessagesDict, _ErrorMessagesMapping +from django.forms.boundfield import BoundField +from django.forms.forms import BaseForm +from django.forms.widgets import Widget +from django.utils.choices import CallableChoiceIterator, _Choices, _ChoicesCallable +from django.utils.datastructures import _PropertyDescriptor +from django.utils.functional import _StrOrPromise +from typing_extensions import TypeAlias + +# Problem: attribute `widget` is always of type `Widget` after field instantiation. +# However, on class level it can be set to `Type[Widget]` too. +# If we annotate it as `Union[Widget, Type[Widget]]`, every code that uses field +# instances will not typecheck. +# If we annotate it as `Widget`, any widget subclasses that do e.g. +# `widget = Select` will not typecheck. +# `Any` gives too much freedom, but does not create false positives. +_ClassLevelWidgetT: TypeAlias = Any + +class Field: + initial: Any + label: _StrOrPromise | None + required: bool + widget: _ClassLevelWidgetT + hidden_widget: type[Widget] + default_validators: list[_ValidatorCallable] + default_error_messages: _ErrorMessagesDict + empty_values: Sequence[Any] + show_hidden_initial: bool + help_text: _StrOrPromise + disabled: bool + label_suffix: str | None + localize: bool + error_messages: _ErrorMessagesDict + validators: list[_ValidatorCallable] + def __init__( + self, + *, + required: bool = True, + widget: Widget | type[Widget] | None = None, + label: _StrOrPromise | None = None, + initial: Any | None = None, + help_text: _StrOrPromise = "", + error_messages: _ErrorMessagesMapping | None = None, + show_hidden_initial: bool = False, + validators: Sequence[_ValidatorCallable] = (), + localize: bool = False, + disabled: bool = False, + label_suffix: str | None = None, + template_name: str | None = None, + ) -> None: ... + def prepare_value(self, value: Any) -> Any: ... + def to_python(self, value: Any | None) -> Any | None: ... + def validate(self, value: Any) -> None: ... + def run_validators(self, value: Any) -> None: ... + def clean(self, value: Any) -> Any: ... + def bound_data(self, data: Any, initial: Any) -> Any: ... + def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... + def has_changed(self, initial: Any | None, data: Any | None) -> bool: ... + def get_bound_field(self, form: BaseForm, field_name: str) -> BoundField: ... + +class CharField(Field): + max_length: int | None + min_length: int | None + strip: bool + empty_value: str | None + def __init__( + self, + *, + max_length: int | None = None, + min_length: int | None = None, + strip: bool = True, + empty_value: str | None = "", + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def to_python(self, value: Any | None) -> str | None: ... + def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... + +class IntegerField(Field): + max_value: int | None + min_value: int | None + step_size: int | None + re_decimal: Any + def __init__( + self, + *, + max_value: int | None = None, + min_value: int | None = None, + step_size: int | None = None, + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def to_python(self, value: Any | None) -> int | None: ... + def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... + +class FloatField(IntegerField): + def __init__( + self, + *, + max_value: int | float | None = None, + min_value: int | float | None = None, + step_size: int | float | None = None, + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def to_python(self, value: Any | None) -> float | None: ... # type: ignore[override] + def validate(self, value: float) -> None: ... + def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... + +class DecimalField(IntegerField): + decimal_places: int | None + max_digits: int | None + def __init__( + self, + *, + max_value: Decimal | int | float | None = None, + min_value: Decimal | int | float | None = None, + max_digits: int | None = None, + decimal_places: int | None = None, + step_size: Decimal | int | float | None = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def to_python(self, value: Any | None) -> Decimal | None: ... # type: ignore[override] + def validate(self, value: Decimal) -> None: ... + def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... + +class BaseTemporalField(Field): + input_formats: Any + def __init__( + self, + *, + input_formats: Any | None = None, + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def to_python(self, value: str | None) -> Any | None: ... + def strptime(self, value: str, format: str) -> Any: ... + +class DateField(BaseTemporalField): + def to_python(self, value: None | str | datetime.datetime | datetime.date) -> datetime.date | None: ... + def strptime(self, value: str, format: str) -> datetime.date: ... + +class TimeField(BaseTemporalField): + def to_python(self, value: None | str | datetime.time) -> datetime.time | None: ... + def strptime(self, value: str, format: str) -> datetime.time: ... + +class DateTimeFormatsIterator: + def __iter__(self) -> Iterator[str]: ... + +class DateTimeField(BaseTemporalField): + def to_python(self, value: None | str | datetime.datetime | datetime.date) -> datetime.datetime | None: ... + def strptime(self, value: str, format: str) -> datetime.datetime: ... + +class DurationField(Field): + def prepare_value(self, value: datetime.timedelta | str | None) -> str | None: ... + def to_python(self, value: Any | None) -> datetime.timedelta | None: ... + +class RegexField(CharField): + regex: _PropertyDescriptor[str | Pattern[str], Pattern[str]] + def __init__( + self, + regex: str | Pattern[str], + *, + max_length: int | None = ..., + min_length: int | None = ..., + strip: bool = ..., + empty_value: str | None = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + +class EmailField(CharField): + def __init__( + self, + *, + max_length: int | None = ..., + min_length: int | None = ..., + strip: bool = ..., + empty_value: str | None = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + +class FileField(Field): + allow_empty_file: bool + max_length: int | None + def __init__( + self, + *, + max_length: int | None = None, + allow_empty_file: bool = False, + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def clean(self, data: Any, initial: Any | None = None) -> Any: ... + def to_python(self, data: File | None) -> File | None: ... + def bound_data(self, data: Any | None, initial: Any) -> Any: ... + def has_changed(self, initial: Any | None, data: Any | None) -> bool: ... + +class ImageField(FileField): + def to_python(self, data: File | None) -> File | None: ... + def widget_attrs(self, widget: Widget) -> dict[str, Any]: ... + +class URLField(CharField): + def __init__( + self, + *, + max_length: int | None = ..., + min_length: int | None = ..., + strip: bool = ..., + empty_value: str | None = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + assume_scheme: str | None = None, + ) -> None: ... + def to_python(self, value: Any | None) -> str | None: ... + +class BooleanField(Field): + def to_python(self, value: Any | None) -> bool: ... + def validate(self, value: Any) -> None: ... + def has_changed(self, initial: Any | None, data: Any | None) -> bool: ... + +class NullBooleanField(BooleanField): + def to_python(self, value: Any | None) -> bool | None: ... # type: ignore[override] + def validate(self, value: Any) -> None: ... + +class ChoiceField(Field): + choices: _PropertyDescriptor[ + _Choices | _ChoicesCallable | CallableChoiceIterator, + _Choices | CallableChoiceIterator, + ] + widget: _ClassLevelWidgetT + def __init__( + self, + *, + choices: _Choices | _ChoicesCallable = (), + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + # Real return type of `to_python` is `str`, but it results in errors when + # subclassing `ModelChoiceField`: `# type: ignore[override]` is not inherited + def to_python(self, value: Any | None) -> Any: ... + def validate(self, value: Any) -> None: ... + def valid_value(self, value: Any) -> bool: ... + +@type_check_only +class _CoerceCallable(Protocol): + def __call__(self, value: Any, /) -> Any: ... + +class TypedChoiceField(ChoiceField): + coerce: _CoerceCallable + empty_value: str | None + def __init__( + self, + *, + coerce: _CoerceCallable = ..., + empty_value: str | None = "", + choices: _Choices | _ChoicesCallable = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def clean(self, value: Any) -> Any: ... + +class MultipleChoiceField(ChoiceField): + def to_python(self, value: Any | None) -> list[str]: ... + def validate(self, value: Any) -> None: ... + def has_changed(self, initial: Collection[Any] | None, data: Collection[Any] | None) -> bool: ... + +class TypedMultipleChoiceField(MultipleChoiceField): + coerce: _CoerceCallable + empty_value: list[Any] | None + def __init__( + self, + *, + coerce: _CoerceCallable = ..., + empty_value: list[Any] | None = ..., + choices: _Choices | _ChoicesCallable = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def clean(self, value: Any) -> Any: ... + def validate(self, value: Any) -> None: ... + +class ComboField(Field): + fields: Sequence[Field] + def __init__( + self, + fields: Sequence[Field], + *, + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def clean(self, value: Any) -> Any: ... + +class MultiValueField(Field): + require_all_fields: bool + fields: Sequence[Field] + def __init__( + self, + fields: Sequence[Field], + *, + require_all_fields: bool = True, + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def compress(self, data_list: Any) -> Any: ... + def has_changed(self, initial: Any | None, data: Any | None) -> bool: ... + def clean(self, value: Any) -> Any: ... + def validate(self, value: Any) -> None: ... + +class FilePathField(ChoiceField): + allow_files: bool + allow_folders: bool + match: str | None + path: str + recursive: bool + match_re: Pattern[str] | None + def __init__( + self, + path: str, + *, + match: str | None = None, + recursive: bool = False, + allow_files: bool = True, + allow_folders: bool = False, + choices: _Choices | _ChoicesCallable = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + +class SplitDateTimeField(MultiValueField): + def __init__( + self, + *, + input_date_formats: Any | None = None, + input_time_formats: Any | None = None, + fields: Sequence[Field] = ..., + require_all_fields: bool = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def compress(self, data_list: tuple[datetime.date, datetime.time] | None) -> datetime.datetime | None: ... + +class GenericIPAddressField(CharField): + unpack_ipv4: bool + def __init__( + self, + *, + protocol: str = "both", + unpack_ipv4: bool = False, + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + def to_python(self, value: Any) -> str: ... + +class SlugField(CharField): + allow_unicode: bool + def __init__( + self, + *, + allow_unicode: bool = False, + max_length: Any | None = ..., + min_length: Any | None = ..., + strip: bool = ..., + empty_value: str | None = ..., + required: bool = ..., + widget: Widget | type[Widget] | None = ..., + label: _StrOrPromise | None = ..., + initial: Any | None = ..., + help_text: _StrOrPromise = ..., + error_messages: _ErrorMessagesMapping | None = ..., + show_hidden_initial: bool = ..., + validators: Sequence[_ValidatorCallable] = ..., + localize: bool = ..., + disabled: bool = ..., + label_suffix: str | None = ..., + ) -> None: ... + +class UUIDField(CharField): + def prepare_value(self, value: Any | None) -> Any | None: ... + def to_python(self, value: Any) -> UUID | None: ... # type: ignore[override] + +class InvalidJSONInput(str): ... +class JSONString(str): ... + +class JSONField(CharField): + default_error_messages: _ErrorMessagesDict + widget: _ClassLevelWidgetT + encoder: Any + decoder: Any + def __init__(self, encoder: Any | None = None, decoder: Any | None = None, **kwargs: Any) -> None: ... + def to_python(self, value: Any) -> Any: ... + def bound_data(self, data: Any, initial: Any) -> Any: ... + def prepare_value(self, value: Any) -> str: ... + def has_changed(self, initial: Any | None, data: Any | None) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/forms.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/forms.pyi new file mode 100644 index 000000000000..b7000dd05302 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/forms.pyi @@ -0,0 +1,76 @@ +from collections.abc import Iterable, Iterator, Mapping +from typing import Any, ClassVar + +from django.core.exceptions import ValidationError +from django.forms.boundfield import BoundField +from django.forms.fields import Field +from django.forms.renderers import BaseRenderer +from django.forms.utils import ErrorDict, ErrorList, RenderableFormMixin, _DataT, _FilesT +from django.forms.widgets import Media, MediaDefiningClass +from django.utils.functional import _StrOrPromise, cached_property + +class DeclarativeFieldsMetaclass(MediaDefiningClass): ... + +class BaseForm(RenderableFormMixin): + default_renderer: BaseRenderer | type[BaseRenderer] | None + field_order: Iterable[str] | None + use_required_attribute: bool + is_bound: bool + data: _DataT + files: _FilesT + auto_id: bool | str + initial: Mapping[str, Any] + error_class: type[ErrorList] + prefix: str | None + label_suffix: str + empty_permitted: bool + fields: dict[str, Field] + renderer: BaseRenderer + cleaned_data: dict[str, Any] + template_name_div: str + template_name_p: str + template_name_table: str + template_name_ul: str + template_name_label: str + def __init__( + self, + data: _DataT | None = None, + files: _FilesT | None = None, + auto_id: bool | str = "id_%s", + prefix: str | None = None, + initial: Mapping[str, Any] | None = None, + error_class: type[ErrorList] = ..., + label_suffix: str | None = None, + empty_permitted: bool = False, + field_order: Iterable[str] | None = None, + use_required_attribute: bool | None = None, + renderer: BaseRenderer | None = None, + ) -> None: ... + def order_fields(self, field_order: Iterable[str] | None) -> None: ... + def __iter__(self) -> Iterator[BoundField]: ... + def __getitem__(self, name: str) -> BoundField: ... + @property + def errors(self) -> ErrorDict: ... + def is_valid(self) -> bool: ... + def add_prefix(self, field_name: str) -> str: ... + def add_initial_prefix(self, field_name: str) -> str: ... + @property + def template_name(self) -> str: ... + def non_field_errors(self) -> ErrorList: ... + def add_error(self, field: str | None, error: ValidationError | _StrOrPromise) -> None: ... + def has_error(self, field: str | None, code: str | None = None) -> bool: ... + def full_clean(self) -> None: ... + def clean(self) -> dict[str, Any] | None: ... + def has_changed(self) -> bool: ... + @cached_property + def changed_data(self) -> list[str]: ... + @property + def media(self) -> Media: ... + def is_multipart(self) -> bool: ... + def hidden_fields(self) -> list[BoundField]: ... + def visible_fields(self) -> list[BoundField]: ... + def get_initial_for_field(self, field: Field, field_name: str) -> Any: ... + +class Form(BaseForm, metaclass=DeclarativeFieldsMetaclass): + base_fields: ClassVar[dict[str, Field]] + declared_fields: ClassVar[dict[str, Field]] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/formsets.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/formsets.pyi new file mode 100644 index 000000000000..99c2eb9374db --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/formsets.pyi @@ -0,0 +1,126 @@ +from collections.abc import Iterator, Mapping, Sequence, Sized +from typing import Any, Generic, TypeVar + +from django.db.models.fields import _ErrorMessagesDict +from django.forms.forms import BaseForm, Form +from django.forms.renderers import BaseRenderer +from django.forms.utils import ErrorList, RenderableFormMixin, _DataT, _FilesT +from django.forms.widgets import Media, MediaDefiningClass, Widget +from django.utils.functional import cached_property + +TOTAL_FORM_COUNT: str +INITIAL_FORM_COUNT: str +MIN_NUM_FORM_COUNT: str +MAX_NUM_FORM_COUNT: str +ORDERING_FIELD_NAME: str +DELETION_FIELD_NAME: str + +DEFAULT_MIN_NUM: int +DEFAULT_MAX_NUM: int + +_F = TypeVar("_F", bound=BaseForm) + +class ManagementForm(Form): + cleaned_data: dict[str, int | None] + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def clean(self) -> dict[str, int | None]: ... + +class BaseFormSet(Generic[_F], Sized, RenderableFormMixin): + form: type[_F] + extra: int + can_order: bool + can_delete: bool + can_delete_extra: bool + min_num: int + max_num: int + absolute_max: int + validate_min: bool + validate_max: bool + + is_bound: bool + prefix: str | None + auto_id: str + data: _DataT + files: _FilesT + initial: Sequence[Mapping[str, Any]] | None + form_kwargs: dict[str, Any] + error_class: type[ErrorList] + deletion_widget: MediaDefiningClass + ordering_widget: MediaDefiningClass + default_error_messages: _ErrorMessagesDict + template_name_div: str + template_name_p: str + template_name_table: str + template_name_ul: str + def __init__( + self, + data: _DataT | None = None, + files: _FilesT | None = None, + auto_id: str = "id_%s", + prefix: str | None = None, + initial: Sequence[Mapping[str, Any]] | None = None, + error_class: type[ErrorList] = ..., + form_kwargs: dict[str, Any] | None = None, + error_messages: Mapping[str, str] | None = None, + form_renderer: BaseRenderer = ..., + renderer: BaseRenderer = ..., + ) -> None: ... + def __iter__(self) -> Iterator[_F]: ... + def __getitem__(self, index: int) -> _F: ... + def __len__(self) -> int: ... + def __bool__(self) -> bool: ... + @cached_property + def management_form(self) -> ManagementForm: ... + def total_form_count(self) -> int: ... + def initial_form_count(self) -> int: ... + @cached_property + def forms(self) -> list[_F]: ... + def get_form_kwargs(self, index: int | None) -> dict[str, Any]: ... + @property + def initial_forms(self) -> list[_F]: ... + @property + def extra_forms(self) -> list[_F]: ... + @property + def empty_form(self) -> _F: ... + @property + def cleaned_data(self) -> list[dict[str, Any]]: ... + @property + def deleted_forms(self) -> list[_F]: ... + @property + def ordered_forms(self) -> list[_F]: ... + @classmethod + def get_default_prefix(cls) -> str: ... + @classmethod + def get_deletion_widget(cls) -> type[Widget]: ... + @classmethod + def get_ordering_widget(cls) -> type[Widget]: ... + def non_form_errors(self) -> ErrorList: ... + @property + def errors(self) -> list[ErrorList]: ... + def total_error_count(self) -> int: ... + def is_valid(self) -> bool: ... + def full_clean(self) -> None: ... + def clean(self) -> None: ... + def has_changed(self) -> bool: ... + def add_fields(self, form: _F, index: int | None) -> None: ... + def add_prefix(self, index: int | str) -> str: ... + def is_multipart(self) -> bool: ... + @property + def media(self) -> Media: ... + @property + def template_name(self) -> str: ... + +def formset_factory( + form: type[_F], + formset: type[BaseFormSet[_F]] = ..., + extra: int = 1, + can_order: bool = False, + can_delete: bool = False, + max_num: int | None = None, + validate_max: bool = False, + min_num: int | None = None, + validate_min: bool = False, + absolute_max: int | None = None, + can_delete_extra: bool = True, +) -> type[BaseFormSet[_F]]: ... +def all_valid(formsets: Sequence[BaseFormSet[_F]]) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi new file mode 100644 index 000000000000..b0204a3da84a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/models.pyi @@ -0,0 +1,315 @@ +from collections.abc import Callable, Collection, Container, Iterator, Mapping, Sequence +from typing import Any, ClassVar, Generic, Literal, TypeVar, overload +from uuid import UUID + +from django.db import models +from django.db.models import ForeignKey +from django.db.models.base import Model +from django.db.models.fields import _AllLimitChoicesTo, _LimitChoicesTo +from django.db.models.manager import Manager +from django.db.models.query import QuerySet +from django.forms.fields import ChoiceField, Field, _ClassLevelWidgetT +from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass +from django.forms.formsets import BaseFormSet +from django.forms.renderers import BaseRenderer +from django.forms.utils import ErrorList, _DataT, _FilesT +from django.forms.widgets import Widget +from django.utils.choices import BaseChoiceIterator, CallableChoiceIterator, _Choices, _ChoicesCallable +from django.utils.datastructures import _PropertyDescriptor +from django.utils.functional import _StrOrPromise +from typing_extensions import TypeAlias + +ALL_FIELDS: Literal["__all__"] + +_Fields: TypeAlias = Collection[str] | Literal["__all__"] +_Widgets: TypeAlias = dict[str, type[Widget] | Widget] + +_Labels: TypeAlias = dict[str, str] +_HelpTexts: TypeAlias = dict[str, str] +_ErrorMessages: TypeAlias = dict[str, dict[str, str]] +_FormFieldCallback: TypeAlias = Callable[[models.Field], Field] + +_M = TypeVar("_M", bound=Model) +_ParentM = TypeVar("_ParentM", bound=Model) + +def construct_instance( + form: BaseForm, instance: _M, fields: Container[str] | None = None, exclude: Container[str] | None = None +) -> _M: ... +def model_to_dict(instance: Model, fields: _Fields | None = None, exclude: _Fields | None = None) -> dict[str, Any]: ... +def apply_limit_choices_to_to_formfield(formfield: Field) -> None: ... +def fields_for_model( + model: type[Model], + fields: _Fields | None = None, + exclude: _Fields | None = None, + widgets: _Widgets | None = None, + formfield_callback: _FormFieldCallback | None = None, + localized_fields: _Fields | None = None, + labels: _Labels | None = None, + help_texts: _HelpTexts | None = None, + error_messages: _ErrorMessages | None = None, + field_classes: Mapping[str, type[Field]] | None = None, + *, + apply_limit_choices_to: bool = True, + form_declared_fields: _Fields | None = None, +) -> dict[str, Any]: ... + +class ModelFormOptions(Generic[_M]): + model: type[_M] + fields: _Fields | None + exclude: _Fields | None + widgets: _Widgets | None + localized_fields: _Fields | None + labels: _Labels | None + help_texts: _HelpTexts | None + error_messages: _ErrorMessages | None + field_classes: dict[str, type[Field]] | None + formfield_callback: _FormFieldCallback | None + def __init__(self, options: type | None = None) -> None: ... + +class ModelFormMetaclass(DeclarativeFieldsMetaclass): ... + +class BaseModelForm(Generic[_M], BaseForm): + instance: _M + _meta: ModelFormOptions[_M] + def __init__( + self, + data: _DataT | None = None, + files: _FilesT | None = None, + auto_id: bool | str = "id_%s", + prefix: str | None = None, + initial: Mapping[str, Any] | None = None, + error_class: type[ErrorList] = ..., + label_suffix: str | None = None, + empty_permitted: bool = False, + instance: _M | None = None, + use_required_attribute: bool | None = None, + renderer: BaseRenderer | None = None, + ) -> None: ... + def validate_unique(self) -> None: ... + def save(self, commit: bool = True) -> _M: ... + def save_m2m(self) -> None: ... + +class ModelForm(BaseModelForm[_M], metaclass=ModelFormMetaclass): + base_fields: ClassVar[dict[str, Field]] + +def modelform_factory( + model: type[_M], + form: type[ModelForm[_M]] = ..., + fields: _Fields | None = None, + exclude: _Fields | None = None, + formfield_callback: _FormFieldCallback | None = None, + widgets: _Widgets | None = None, + localized_fields: _Fields | None = None, + labels: _Labels | None = None, + help_texts: _HelpTexts | None = None, + error_messages: _ErrorMessages | None = None, + field_classes: Mapping[str, type[Field]] | None = None, +) -> type[ModelForm[_M]]: ... + +_ModelFormT = TypeVar("_ModelFormT", bound=ModelForm) + +class BaseModelFormSet(Generic[_M, _ModelFormT], BaseFormSet[_ModelFormT]): + model: type[_M] + edit_only: bool + unique_fields: Collection[str] + queryset: QuerySet[_M] | None + initial_extra: Sequence[dict[str, Any]] | None + def __init__( + self, + data: _DataT | None = None, + files: _FilesT | None = None, + auto_id: str = "id_%s", + prefix: str | None = None, + queryset: QuerySet[_M] | None = None, + *, + initial: Sequence[dict[str, Any]] | None = None, + **kwargs: Any, + ) -> None: ... + def initial_form_count(self) -> int: ... + def get_queryset(self) -> QuerySet[_M]: ... + def save_new(self, form: _ModelFormT, commit: bool = True) -> _M: ... + def save_existing(self, form: _ModelFormT, obj: _M, commit: bool = True) -> _M: ... + def delete_existing(self, obj: _M, commit: bool = True) -> None: ... + saved_forms: list[_ModelFormT] + def save_m2m(self) -> None: ... + def save(self, commit: bool = True) -> list[_M]: ... + def clean(self) -> None: ... + def validate_unique(self) -> None: ... + def get_unique_error_message(self, unique_check: Sequence[str]) -> str: ... + def get_date_error_message(self, date_check: tuple[str, Literal["date", "year", "month"], str, str]) -> str: ... + def get_form_error(self) -> str: ... + changed_objects: list[tuple[_M, list[str]]] + deleted_objects: list[_M] + def save_existing_objects(self, commit: bool = True) -> list[_M]: ... + new_objects: list[_M] + def save_new_objects(self, commit: bool = True) -> list[_M]: ... + def add_fields(self, form: _ModelFormT, index: int | None) -> None: ... + +def modelformset_factory( + model: type[_M], + form: type[_ModelFormT] = ..., + formfield_callback: _FormFieldCallback | None = None, + formset: type[BaseModelFormSet] = ..., + extra: int = 1, + can_delete: bool = False, + can_order: bool = False, + max_num: int | None = None, + fields: _Fields | None = None, + exclude: _Fields | None = None, + widgets: _Widgets | None = None, + validate_max: bool = False, + localized_fields: _Fields | None = None, + labels: _Labels | None = None, + help_texts: _HelpTexts | None = None, + error_messages: _ErrorMessages | None = None, + min_num: int | None = None, + validate_min: bool = False, + field_classes: Mapping[str, type[Field]] | None = None, + absolute_max: int | None = None, + can_delete_extra: bool = True, + renderer: BaseRenderer | None = None, + edit_only: bool = False, +) -> type[BaseModelFormSet[_M, _ModelFormT]]: ... + +class BaseInlineFormSet(Generic[_M, _ParentM, _ModelFormT], BaseModelFormSet[_M, _ModelFormT]): + instance: _ParentM + save_as_new: bool + unique_fields: Collection[str] + fk: ForeignKey # set by inlineformset_set + def __init__( + self, + data: _DataT | None = None, + files: _FilesT | None = None, + instance: _ParentM | None = None, + save_as_new: bool = False, + prefix: str | None = None, + queryset: QuerySet[_M] | None = None, + **kwargs: Any, + ) -> None: ... + def initial_form_count(self) -> int: ... + @classmethod + def get_default_prefix(cls) -> str: ... + def save_new(self, form: _ModelFormT, commit: bool = True) -> _M: ... + def add_fields(self, form: _ModelFormT, index: int | None) -> None: ... + def get_unique_error_message(self, unique_check: Sequence[str]) -> str: ... + +def inlineformset_factory( + parent_model: type[_ParentM], + model: type[_M], + form: type[_ModelFormT] = ..., + formset: type[BaseInlineFormSet] = ..., + fk_name: str | None = None, + fields: _Fields | None = None, + exclude: _Fields | None = None, + extra: int = 3, + can_order: bool = False, + can_delete: bool = True, + max_num: int | None = None, + formfield_callback: _FormFieldCallback | None = None, + widgets: _Widgets | None = None, + validate_max: bool = False, + localized_fields: Sequence[str] | None = None, + labels: _Labels | None = None, + help_texts: _HelpTexts | None = None, + error_messages: _ErrorMessages | None = None, + min_num: int | None = None, + validate_min: bool = False, + field_classes: Mapping[str, type[Field]] | None = None, + absolute_max: int | None = None, + can_delete_extra: bool = True, + renderer: BaseRenderer | None = None, + edit_only: bool = False, +) -> type[BaseInlineFormSet[_M, _ParentM, _ModelFormT]]: ... + +class InlineForeignKeyField(Field): + disabled: bool + help_text: _StrOrPromise + required: bool + show_hidden_initial: bool + widget: _ClassLevelWidgetT + parent_instance: Model + pk_field: bool + to_field: str | None + def __init__( + self, + parent_instance: Model, + *args: Any, + pk_field: bool = False, + to_field: str | None = None, + **kwargs: Any, + ) -> None: ... + def clean(self, value: Any) -> Model: ... + def has_changed(self, initial: Any, data: Any) -> bool: ... + +class ModelChoiceIteratorValue: + def __init__(self, value: Any, instance: Model) -> None: ... + +class ModelChoiceIterator(BaseChoiceIterator): + field: ModelChoiceField + queryset: QuerySet + def __init__(self, field: ModelChoiceField) -> None: ... + def __iter__(self) -> Iterator[tuple[ModelChoiceIteratorValue | str, str]]: ... + def __len__(self) -> int: ... + def __bool__(self) -> bool: ... + def choice(self, obj: Model) -> tuple[ModelChoiceIteratorValue, str]: ... + +class ModelChoiceField(ChoiceField, Generic[_M]): + disabled: bool + help_text: _StrOrPromise + required: bool + show_hidden_initial: bool + validators: list[Any] + iterator: type[ModelChoiceIterator] + empty_label: _StrOrPromise | None + queryset: QuerySet[_M] | None + limit_choices_to: _AllLimitChoicesTo | None + to_field_name: str | None + def __init__( + self, + queryset: Manager[_M] | QuerySet[_M] | None, + *, + empty_label: _StrOrPromise | None = "---------", + required: bool = True, + widget: Widget | type[Widget] | None = None, + label: _StrOrPromise | None = None, + initial: Any | None = None, + help_text: _StrOrPromise = "", + to_field_name: str | None = None, + limit_choices_to: _AllLimitChoicesTo | None = None, + blank: bool = False, + **kwargs: Any, + ) -> None: ... + def get_limit_choices_to(self) -> _LimitChoicesTo: ... + def label_from_instance(self, obj: _M) -> str: ... + choices: _PropertyDescriptor[ + _Choices | _ChoicesCallable | CallableChoiceIterator, + _Choices | CallableChoiceIterator | ModelChoiceIterator, + ] + def prepare_value(self, value: Any) -> Any: ... + def to_python(self, value: Any | None) -> _M | None: ... + def validate(self, value: _M | None) -> None: ... + def has_changed(self, initial: Model | int | str | UUID | None, data: int | str | None) -> bool: ... + +class ModelMultipleChoiceField(ModelChoiceField[_M]): + disabled: bool + empty_label: _StrOrPromise | None + help_text: _StrOrPromise + required: bool + show_hidden_initial: bool + widget: _ClassLevelWidgetT + hidden_widget: type[Widget] + def __init__(self, queryset: Manager[_M] | QuerySet[_M] | None, **kwargs: Any) -> None: ... + def to_python(self, value: Any) -> list[_M]: ... # type: ignore[override] + def clean(self, value: Any) -> QuerySet[_M]: ... + def prepare_value(self, value: Any) -> Any: ... + def has_changed(self, initial: Collection[Any] | None, data: Collection[Any] | None) -> bool: ... # type: ignore[override] + +def modelform_defines_fields(form_class: type[ModelForm]) -> bool: ... +@overload +def _get_foreign_key( + parent_model: type[Model], model: type[Model], fk_name: str | None = None, can_fail: Literal[True] = True +) -> ForeignKey | None: ... +@overload +def _get_foreign_key( + parent_model: type[Model], model: type[Model], fk_name: str | None = None, can_fail: Literal[False] = False +) -> ForeignKey: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/renderers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/renderers.pyi new file mode 100644 index 000000000000..9b6d4ee4685c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/renderers.pyi @@ -0,0 +1,36 @@ +from typing import Any + +from django.http import HttpRequest +from django.template.backends.base import BaseEngine +from django.template.backends.django import DjangoTemplates as DjangoTemplatesR +from django.template.backends.jinja2 import Jinja2 as Jinja2R +from django.template.base import Template +from django.utils.functional import cached_property + +def get_default_renderer() -> BaseRenderer: ... + +class BaseRenderer: + form_template_name: str + formset_template_name: str + field_template_name: str + def get_template(self, template_name: str) -> Any: ... + def render(self, template_name: str, context: dict[str, Any], request: HttpRequest | None = None) -> str: ... + +class EngineMixin: + def get_template(self, template_name: str) -> Any: ... + @cached_property + def engine(self) -> BaseEngine: ... + +class DjangoTemplates(EngineMixin, BaseRenderer): + backend: type[DjangoTemplatesR] + +class Jinja2(EngineMixin, BaseRenderer): + @cached_property + def backend(self) -> type[Jinja2R]: ... + +class Jinja2DivFormRenderer(Jinja2): + form_template_name: str + formset_template_name: str + +class TemplatesSetting(BaseRenderer): + def get_template(self, template_name: str) -> Template | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/utils.pyi new file mode 100644 index 000000000000..8d0676a92fb8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/utils.pyi @@ -0,0 +1,76 @@ +from collections import UserList +from collections.abc import Mapping, Sequence +from datetime import datetime +from typing import Any + +from django.core.exceptions import ValidationError +from django.core.files.uploadedfile import UploadedFile +from django.forms.renderers import BaseRenderer +from django.utils.datastructures import MultiValueDict +from django.utils.functional import _StrOrPromise +from django.utils.safestring import SafeString +from typing_extensions import TypeAlias + +_DataT: TypeAlias = Mapping[str, Any] # noqa: PYI047 + +_FilesT: TypeAlias = MultiValueDict[str, UploadedFile] # noqa: PYI047 + +def pretty_name(name: str) -> str: ... +def flatatt(attrs: dict[str, Any]) -> SafeString: ... + +class RenderableMixin: + def get_context(self) -> dict[str, Any]: ... + def render( + self, + template_name: str | None = None, + context: dict[str, Any] | None = None, + renderer: BaseRenderer | type[BaseRenderer] | None = None, + ) -> SafeString: ... + # This is a lie, but this is how it is supposed to be used, + # in reallity it is `__str__ = __html__ = render`: + def __str__(self) -> SafeString: ... + def __html__(self) -> SafeString: ... + +class RenderableFieldMixin(RenderableMixin): + def as_field_group(self) -> SafeString: ... + def as_hidden(self) -> SafeString: ... + def as_widget(self) -> SafeString: ... + +class RenderableFormMixin(RenderableMixin): + def as_p(self) -> SafeString: ... + def as_table(self) -> SafeString: ... + def as_ul(self) -> SafeString: ... + def as_div(self) -> SafeString: ... + +class RenderableErrorMixin(RenderableMixin): + def as_json(self, escape_html: bool = False) -> str: ... + def as_text(self) -> SafeString: ... + def as_ul(self) -> SafeString: ... + +class ErrorDict(dict[str, ErrorList], RenderableErrorMixin): + template_name: str + template_name_text: str + template_name_ul: str + renderer: BaseRenderer + + def __init__(self, *args: Any, renderer: BaseRenderer | None = None, **kwargs: Any): ... + def as_data(self) -> dict[str, list[ValidationError]]: ... + def get_json_data(self, escape_html: bool = False) -> dict[str, Any]: ... + +class ErrorList(UserList[ValidationError | _StrOrPromise], RenderableErrorMixin): + template_name: str + template_name_text: str + template_name_ul: str + error_class: str + renderer: BaseRenderer + def __init__( + self, + initlist: ErrorList | Sequence[str | Exception] | None = None, + error_class: str | None = None, + renderer: BaseRenderer | None = None, + ) -> None: ... + def as_data(self) -> list[ValidationError]: ... + def get_json_data(self, escape_html: bool = False) -> list[dict[str, str]]: ... + +def from_current_timezone(value: datetime) -> datetime: ... +def to_current_timezone(value: datetime) -> datetime: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi b/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi new file mode 100644 index 000000000000..87273ec0a5ea --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/forms/widgets.pyi @@ -0,0 +1,286 @@ +import datetime +from collections.abc import Iterable, Iterator, Mapping, Sequence +from typing import Any, Literal, Protocol, type_check_only + +from django.core.files.base import File +from django.forms.renderers import BaseRenderer +from django.forms.utils import _DataT, _FilesT +from django.utils.choices import _Choices +from django.utils.datastructures import _ListOrTuple +from django.utils.safestring import SafeString +from typing_extensions import Self, TypeAlias + +_OptAttrs: TypeAlias = dict[str, Any] + +class MediaOrderConflictWarning(RuntimeWarning): ... + +class Media: + def __init__( + self, + media: type | None = None, + css: dict[str, Sequence[str]] | None = None, + js: Sequence[str] | None = None, + ) -> None: ... + def render(self) -> SafeString: ... + def render_js(self) -> list[SafeString]: ... + def render_css(self) -> Iterable[SafeString]: ... + def absolute_path(self, path: str) -> str: ... + def __getitem__(self, name: str) -> Media: ... + @staticmethod + def merge(*lists: Iterable[Any]) -> list[Any]: ... + def __add__(self, other: Media) -> Media: ... + +class MediaDefiningClass(type): ... + +class Widget(metaclass=MediaDefiningClass): + needs_multipart_form: bool + is_localized: bool + is_required: bool + supports_microseconds: bool + attrs: _OptAttrs + template_name: str + def __init__(self, attrs: _OptAttrs | None = None) -> None: ... + def __deepcopy__(self, memo: dict[int, Any]) -> Self: ... + @property + def is_hidden(self) -> bool: ... + @property + def media(self) -> Media: ... + def subwidgets(self, name: str, value: Any, attrs: _OptAttrs | None = None) -> Iterator[dict[str, Any]]: ... + def format_value(self, value: Any) -> str | None: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def render( + self, name: str, value: Any, attrs: _OptAttrs | None = None, renderer: BaseRenderer | None = None + ) -> SafeString: ... + def build_attrs(self, base_attrs: _OptAttrs, extra_attrs: _OptAttrs | None = None) -> dict[str, Any]: ... + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... + def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... + def id_for_label(self, id_: str) -> str: ... + def use_required_attribute(self, initial: Any) -> bool: ... + +class Input(Widget): + input_type: str + template_name: str + +class TextInput(Input): + input_type: str + template_name: str + +class NumberInput(Input): + input_type: str + template_name: str + +class EmailInput(Input): + input_type: str + template_name: str + +class URLInput(Input): + input_type: str + template_name: str + +class PasswordInput(Input): + render_value: bool + input_type: str + template_name: str + def __init__(self, attrs: _OptAttrs | None = None, render_value: bool = False) -> None: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + +class HiddenInput(Input): + choices: _Choices + input_type: str + template_name: str + +class MultipleHiddenInput(HiddenInput): + template_name: str + +class FileInput(Input): + allow_multiple_selected: bool + input_type: str + template_name: str + needs_multipart_form: bool + def format_value(self, value: Any) -> None: ... + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... + def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... + def use_required_attribute(self, initial: Any) -> bool: ... + +FILE_INPUT_CONTRADICTION: object + +class ClearableFileInput(FileInput): + clear_checkbox_label: str + initial_text: str + input_text: str + template_name: str + checked: bool + def clear_checkbox_name(self, name: str) -> str: ... + def clear_checkbox_id(self, name: str) -> str: ... + def is_initial(self, value: File | str | None) -> bool: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... + def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... + +class Textarea(Widget): + template_name: str + def __init__(self, attrs: _OptAttrs | None = None) -> None: ... + +class DateTimeBaseInput(TextInput): + format_key: str + format: str | None + supports_microseconds: bool + def __init__(self, attrs: _OptAttrs | None = None, format: str | None = None) -> None: ... + +class DateInput(DateTimeBaseInput): + format_key: str + template_name: str + +class DateTimeInput(DateTimeBaseInput): + format_key: str + template_name: str + +class TimeInput(DateTimeBaseInput): + format_key: str + template_name: str + +def boolean_check(v: Any) -> bool: ... +@type_check_only +class _CheckCallable(Protocol): + def __call__(self, value: Any, /) -> bool: ... + +class CheckboxInput(Input): + check_test: _CheckCallable + input_type: str + template_name: str + def __init__(self, attrs: _OptAttrs | None = None, check_test: _CheckCallable | None = None) -> None: ... + +class ChoiceWidget(Widget): + allow_multiple_selected: bool + input_type: str | None + template_name: str + option_template_name: str | None + add_id_index: bool + checked_attribute: Any + option_inherits_attrs: bool + choices: _Choices + def __init__(self, attrs: _OptAttrs | None = None, choices: _Choices = ()) -> None: ... + def subwidgets(self, name: str, value: Any, attrs: _OptAttrs | None = None) -> Iterator[dict[str, Any]]: ... + def options(self, name: str, value: list[str], attrs: _OptAttrs | None = None) -> Iterator[dict[str, Any]]: ... + def optgroups( + self, name: str, value: list[str], attrs: _OptAttrs | None = None + ) -> list[tuple[str | None, list[dict[str, Any]], int | None]]: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def create_option( + self, + name: str, + value: Any, + label: int | str, + selected: bool, + index: int, + subindex: int | None = None, + attrs: _OptAttrs | None = None, + ) -> dict[str, Any]: ... + def id_for_label(self, id_: str, index: str = "0") -> str: ... + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... + def format_value(self, value: Any) -> list[str]: ... # type: ignore[override] + +class Select(ChoiceWidget): + input_type: str | None + template_name: str + option_template_name: str + add_id_index: bool + checked_attribute: Any + option_inherits_attrs: bool + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def use_required_attribute(self, initial: Any) -> bool: ... + +class NullBooleanSelect(Select): + def __init__(self, attrs: _OptAttrs | None = None) -> None: ... + def format_value(self, value: Any) -> str: ... # type: ignore[override] + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> bool | None: ... + +class SelectMultiple(Select): + allow_multiple_selected: bool + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> Any: ... + def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... + +class RadioSelect(ChoiceWidget): + can_add_related: bool + input_type: str + template_name: str + option_template_name: str + +class CheckboxSelectMultiple(ChoiceWidget): + can_add_related: bool + input_type: str + template_name: str + option_template_name: str + def use_required_attribute(self, initial: Any) -> bool: ... + def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... + def id_for_label(self, id_: str, index: str | None = None) -> str: ... + +class MultiWidget(Widget): + template_name: str + widgets: Sequence[Widget] + def __init__( + self, + widgets: dict[str, Widget | type[Widget]] | Sequence[Widget | type[Widget]], + attrs: _OptAttrs | None = None, + ) -> None: ... + @property + def is_hidden(self) -> bool: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def id_for_label(self, id_: str) -> str: ... + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> list[Any]: ... + def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... + def decompress(self, value: Any) -> Any | None: ... + @property + def needs_multipart_form(self) -> bool: ... # type: ignore[override] + +class SplitDateTimeWidget(MultiWidget): + supports_microseconds: bool + template_name: str + widgets: tuple[DateInput, TimeInput] + def __init__( + self, + attrs: _OptAttrs | None = None, + date_format: str | None = None, + time_format: str | None = None, + date_attrs: dict[str, str] | None = None, + time_attrs: dict[str, str] | None = None, + ) -> None: ... + def decompress(self, value: Any) -> tuple[datetime.date | None, datetime.time | None]: ... + +class SplitHiddenDateTimeWidget(SplitDateTimeWidget): + template_name: str + def __init__( + self, + attrs: _OptAttrs | None = None, + date_format: str | None = None, + time_format: str | None = None, + date_attrs: dict[str, str] | None = None, + time_attrs: dict[str, str] | None = None, + ) -> None: ... + +class SelectDateWidget(Widget): + none_value: tuple[Literal[""], str] + month_field: str + day_field: str + year_field: str + template_name: str + input_type: str + select_widget: type[ChoiceWidget] + date_re: Any + years: Iterable[int | str] + months: Mapping[int, str] + year_none_value: tuple[Literal[""], str] + month_none_value: tuple[Literal[""], str] + day_none_value: tuple[Literal[""], str] + def __init__( + self, + attrs: _OptAttrs | None = None, + years: Iterable[int | str] | None = None, + months: Mapping[int, str] | None = None, + empty_label: str | _ListOrTuple[str] | None = None, + ) -> None: ... + def get_context(self, name: str, value: Any, attrs: _OptAttrs | None) -> dict[str, Any]: ... + def format_value(self, value: Any) -> dict[str, str | int | None]: ... # type: ignore[override] + def id_for_label(self, id_: str) -> str: ... + def value_from_datadict(self, data: _DataT, files: _FilesT, name: str) -> str | None | Any: ... + def value_omitted_from_data(self, data: _DataT, files: _FilesT, name: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/http/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/http/__init__.pyi new file mode 100644 index 000000000000..21735370a822 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/__init__.pyi @@ -0,0 +1,23 @@ +from .cookie import SimpleCookie as SimpleCookie +from .cookie import parse_cookie as parse_cookie +from .request import HttpHeaders as HttpHeaders +from .request import HttpRequest as HttpRequest +from .request import QueryDict as QueryDict +from .request import RawPostDataException as RawPostDataException +from .request import UnreadablePostError as UnreadablePostError +from .response import BadHeaderError as BadHeaderError +from .response import FileResponse as FileResponse +from .response import Http404 as Http404 +from .response import HttpResponse as HttpResponse +from .response import HttpResponseBadRequest as HttpResponseBadRequest +from .response import HttpResponseBase as HttpResponseBase +from .response import HttpResponseForbidden as HttpResponseForbidden +from .response import HttpResponseGone as HttpResponseGone +from .response import HttpResponseNotAllowed as HttpResponseNotAllowed +from .response import HttpResponseNotFound as HttpResponseNotFound +from .response import HttpResponseNotModified as HttpResponseNotModified +from .response import HttpResponsePermanentRedirect as HttpResponsePermanentRedirect +from .response import HttpResponseRedirect as HttpResponseRedirect +from .response import HttpResponseServerError as HttpResponseServerError +from .response import JsonResponse as JsonResponse +from .response import StreamingHttpResponse as StreamingHttpResponse diff --git a/python/helpers/bundled_stubs/Django/django-stubs/http/cookie.pyi b/python/helpers/bundled_stubs/Django/django-stubs/http/cookie.pyi new file mode 100644 index 000000000000..efa3fb93a1a9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/cookie.pyi @@ -0,0 +1,3 @@ +from http.cookies import SimpleCookie as SimpleCookie + +def parse_cookie(cookie: str) -> dict[str, str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/http/multipartparser.pyi b/python/helpers/bundled_stubs/Django/django-stubs/http/multipartparser.pyi new file mode 100644 index 000000000000..ac778fa6ed27 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/multipartparser.pyi @@ -0,0 +1,60 @@ +import re +from collections.abc import Iterator, Mapping +from typing import IO, Any, ClassVar, Literal + +from django.http.request import QueryDict +from django.utils.datastructures import ImmutableList, MultiValueDict + +class MultiPartParserError(Exception): ... +class InputStreamExhausted(Exception): ... + +RAW: Literal["raw"] +FILE: Literal["file"] +FIELD: Literal["field"] +FIELD_TYPES: frozenset[str] + +class MultiPartParser: + boundary_re: ClassVar[re.Pattern[str]] + def __init__( + self, + META: Mapping[str, Any], + input_data: IO[bytes], + upload_handlers: list[Any] | ImmutableList[Any], + encoding: str | None = ..., + ) -> None: ... + def parse(self) -> tuple[QueryDict, MultiValueDict]: ... + def handle_file_complete(self, old_field_name: str, counters: list[int]) -> None: ... + def sanitize_file_name(self, file_name: str) -> str | None: ... + def IE_sanitize(self, file_name: str) -> str | None: ... + +class LazyStream: + length: int | None + position: int + def __init__(self, producer: BoundaryIter | ChunkIter, length: int | None = ...) -> None: ... + def tell(self) -> int: ... + def read(self, size: int | None = ...) -> bytes: ... + def __next__(self) -> bytes: ... + def close(self) -> None: ... + def __iter__(self) -> LazyStream: ... + def unget(self, bytes: bytes) -> None: ... + +class ChunkIter: + flo: IO[bytes] + chunk_size: int + def __init__(self, flo: IO[bytes], chunk_size: int = ...) -> None: ... + def __next__(self) -> bytes: ... + def __iter__(self) -> ChunkIter: ... + +class InterBoundaryIter: + def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... + def __iter__(self) -> InterBoundaryIter: ... + def __next__(self) -> LazyStream: ... + +class BoundaryIter: + def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... + def __iter__(self) -> BoundaryIter: ... + def __next__(self) -> bytes: ... + +class Parser: + def __init__(self, stream: LazyStream, boundary: bytes) -> None: ... + def __iter__(self) -> Iterator[tuple[str, dict[str, tuple[str, dict[str, bytes | str]]], LazyStream]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi b/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi new file mode 100644 index 000000000000..08ff956738ce --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/request.pyi @@ -0,0 +1,216 @@ +import datetime +from collections.abc import Iterable, Mapping +from io import BytesIO +from re import Pattern +from typing import Any, Awaitable, BinaryIO, Callable, Literal, NoReturn, TypeVar, overload, type_check_only + +from django.contrib.auth.base_user import _UserModel +from django.contrib.auth.base_user import UserModel1 +from django.contrib.auth.models import AnonymousUser +from django.contrib.sessions.backends.base import SessionBase +from django.contrib.sites.models import Site +from django.core.files import uploadedfile, uploadhandler +from django.urls import ResolverMatch +from django.utils.datastructures import CaseInsensitiveMapping, ImmutableList, MultiValueDict +from django.utils.functional import cached_property +from typing_extensions import Self, TypeAlias + +RAISE_ERROR: object +host_validation_re: Pattern[str] + +class UnreadablePostError(OSError): ... +class RawPostDataException(Exception): ... + +_UploadHandlerList: TypeAlias = list[uploadhandler.FileUploadHandler] | ImmutableList[uploadhandler.FileUploadHandler] + +class HttpHeaders(CaseInsensitiveMapping[str]): + HTTP_PREFIX: str + UNPREFIXED_HEADERS: set[str] + def __init__(self, environ: Mapping[str, Any]) -> None: ... + @classmethod + def parse_header_name(cls, header: str) -> str | None: ... + @classmethod + def to_wsgi_name(cls, header: str) -> str: ... + @classmethod + def to_asgi_name(cls, header: str) -> str: ... + @classmethod + def to_wsgi_names(cls, headers: Mapping[str, Any]) -> dict[str, Any]: ... + @classmethod + def to_asgi_names(cls, headers: Mapping[str, Any]) -> dict[str, Any]: ... + +class HttpRequest(BytesIO): + GET: _ImmutableQueryDict + POST: _ImmutableQueryDict + COOKIES: dict[str, str] + META: dict[str, Any] + FILES: MultiValueDict[str, uploadedfile.UploadedFile] + path: str + path_info: str + method: str | None + resolver_match: ResolverMatch | None + content_type: str | None + content_params: dict[str, str] | None + _body: bytes + _stream: BinaryIO + # Attributes added by optional parts of Django + # django.contrib.admin views: + current_app: str + # django.contrib.auth.middleware.AuthenticationMiddleware: + user: _UserModel | AnonymousUser + # django.contrib.auth.middleware.AuthenticationMiddleware: + auser: Callable[[], Awaitable[_UserModel | AnonymousUser]] + # django.middleware.locale.LocaleMiddleware: + LANGUAGE_CODE: str + # django.contrib.sites.middleware.CurrentSiteMiddleware + site: Site + # django.contrib.sessions.middleware.SessionMiddleware + session: SessionBase + # The magic. If we instantiate HttpRequest directly somewhere, it has + # mutable GET and POST. However, both ASGIRequest and WSGIRequest have immutable, + # so when we use HttpRequest to refer to any of them we want exactly this. + # Case when some function creates *exactly* HttpRequest (not subclass) + # remain uncovered, however it's probably the best solution we can afford. + def __new__(cls) -> _MutableHttpRequest: ... + # When both __init__ and __new__ are present, mypy will prefer __init__ + # (see comments in mypy.checkmember.type_object_type) + # def __init__(self) -> None: ... + def get_host(self) -> str: ... + def get_port(self) -> str: ... + def get_full_path(self, force_append_slash: bool = ...) -> str: ... + def get_full_path_info(self, force_append_slash: bool = ...) -> str: ... + def get_signed_cookie( + self, key: str, default: Any = ..., salt: str = ..., max_age: int | datetime.timedelta | None = ... + ) -> str | None: ... + def build_absolute_uri(self, location: str | None = ...) -> str: ... + @property + def scheme(self) -> str | None: ... + def is_secure(self) -> bool: ... + @property + def encoding(self) -> str | None: ... + @encoding.setter + def encoding(self, val: str) -> None: ... + @property + def upload_handlers(self) -> _UploadHandlerList: ... + @upload_handlers.setter + def upload_handlers(self, upload_handlers: _UploadHandlerList) -> None: ... + @cached_property + def accepted_types(self) -> list[MediaType]: ... + def parse_file_upload( + self, META: Mapping[str, Any], post_data: BinaryIO + ) -> tuple[QueryDict, MultiValueDict[str, uploadedfile.UploadedFile]]: ... + @cached_property + def headers(self) -> HttpHeaders: ... + @property + def body(self) -> bytes: ... + def _load_post_and_files(self) -> None: ... + def accepts(self, media_type: str) -> bool: ... + def readlines(self) -> list[bytes]: ... # type: ignore[override] + +@type_check_only +class _MutableHttpRequest(HttpRequest): + GET: QueryDict # type: ignore[assignment] + POST: QueryDict # type: ignore[assignment] + +_Z = TypeVar("_Z") + +class QueryDict(MultiValueDict[str, str]): + _mutable: bool + # We can make it mutable only by specifying `mutable=True`. + # It can be done a) with kwarg and b) with pos. arg. `overload` has + # some problems with args/kwargs + Literal, so two signatures are required. + # ('querystring', True, [...]) + @overload + def __init__( + self: QueryDict, + query_string: str | bytes | None, + mutable: Literal[True], + encoding: str | None = ..., + ) -> None: ... + # ([querystring='string',] mutable=True, [...]) + @overload + def __init__( + self: QueryDict, + *, + mutable: Literal[True], + query_string: str | bytes | None = ..., + encoding: str | None = ..., + ) -> None: ... + # Otherwise it's immutable + @overload + def __init__( # type: ignore[misc] + self: _ImmutableQueryDict, + query_string: str | bytes | None = ..., + mutable: bool = ..., + encoding: str | None = ..., + ) -> None: ... + @classmethod + def fromkeys( # type: ignore[override] + cls, + iterable: Iterable[bytes | str], + value: str | bytes = ..., + mutable: bool = ..., + encoding: str | None = ..., + ) -> Self: ... + @property + def encoding(self) -> str: ... + @encoding.setter + def encoding(self, value: str) -> None: ... + def __setitem__(self, key: str | bytes, value: str | bytes) -> None: ... + def __delitem__(self, key: str | bytes) -> None: ... + def setlist(self, key: str | bytes, list_: Iterable[str | bytes]) -> None: ... + def setlistdefault(self, key: str | bytes, default_list: list[str] | None = ...) -> list[str]: ... + def appendlist(self, key: str | bytes, value: str | bytes) -> None: ... + # Fake signature (because *args is used in source, but it fails with more that 1 argument) + @overload + def pop(self, key: str | bytes, /) -> str: ... + @overload + def pop(self, key: str | bytes, default: str | _Z = ..., /) -> str | _Z: ... + def popitem(self) -> tuple[str, str]: ... + def clear(self) -> None: ... + def setdefault(self, key: str | bytes, default: str | bytes | None = ...) -> str: ... + def copy(self) -> QueryDict: ... + def urlencode(self, safe: str | None = ...) -> str: ... + +@type_check_only +class _ImmutableQueryDict(QueryDict): + _mutable: Literal[False] + # def __init__( + # self, query_string: Optional[Union[str, bytes]] = ..., mutable: bool = ..., encoding: Optional[str] = ... + # ) -> None: ... + def __setitem__(self, key: str | bytes, value: str | bytes) -> NoReturn: ... + def __delitem__(self, key: str | bytes) -> NoReturn: ... + def setlist(self, key: str | bytes, list_: Iterable[str | bytes]) -> NoReturn: ... + def setlistdefault(self, key: str | bytes, default_list: list[str] | None = ...) -> NoReturn: ... + def appendlist(self, key: str | bytes, value: str | bytes) -> NoReturn: ... + # Fake signature (because *args is used in source, but it fails with more that 1 argument) + @overload + def pop(self, key: str | bytes, /) -> NoReturn: ... + @overload + def pop(self, key: str | bytes, default: str | _Z = ..., /) -> NoReturn: ... + def popitem(self) -> NoReturn: ... + def clear(self) -> NoReturn: ... + def setdefault(self, key: str | bytes, default: str | bytes | None = ...) -> NoReturn: ... + def copy(self) -> QueryDict: ... # type: ignore[override] + def urlencode(self, safe: str | None = ...) -> str: ... + # Fakes for convenience (for `request.GET` and `request.POST`). If dict + # was created by Django, there is no chance to hit `List[object]` (empty list) + # edge case. + def __getitem__(self, key: str) -> str: ... + def dict(self) -> dict[str, str]: ... # type: ignore[override] + +class MediaType: + main_type: str + sub_type: str + params: dict[str, bytes] + def __init__(self, media_type_raw_line: str) -> None: ... + @property + def is_all_types(self) -> bool: ... + def match(self, other: str) -> bool: ... + +@overload +def bytes_to_text(s: None, encoding: str) -> None: ... +@overload +def bytes_to_text(s: bytes | str, encoding: str) -> str: ... +def split_domain_port(host: str) -> tuple[str, str]: ... +def validate_host(host: str, allowed_hosts: Iterable[str]) -> bool: ... +def parse_accept_header(header: str) -> list[MediaType]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/http/response.pyi b/python/helpers/bundled_stubs/Django/django-stubs/http/response.pyi new file mode 100644 index 000000000000..df65b6af8b12 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/http/response.pyi @@ -0,0 +1,157 @@ +import datetime +from collections.abc import AsyncIterable, AsyncIterator, Iterable, Iterator +from http.cookies import SimpleCookie +from io import BytesIO +from json import JSONEncoder +from typing import Any, Literal, TypeVar, overload, type_check_only + +from django.utils.datastructures import CaseInsensitiveMapping, _PropertyDescriptor + +class BadHeaderError(ValueError): ... + +_Z = TypeVar("_Z") + +class ResponseHeaders(CaseInsensitiveMapping[str]): + def __init__(self, data: dict[str, str]) -> None: ... + def _convert_to_charset(self, value: bytes | str | int, charset: str, mime_encode: bool = ...) -> str: ... + def __delitem__(self, key: str) -> None: ... + def __setitem__(self, key: str, value: str | bytes | int) -> None: ... + def pop(self, key: str, default: _Z = ...) -> _Z | tuple[str, str]: ... + def setdefault(self, key: str, value: str | bytes | int) -> None: ... + +class HttpResponseBase: + status_code: int + streaming: bool + cookies: SimpleCookie + closed: bool + headers: ResponseHeaders + def __init__( + self, + content_type: str | None = ..., + status: int | None = ..., + reason: str | None = ..., + charset: str | None = ..., + headers: dict[str, str] | None = ..., + ) -> None: ... + @property + def reason_phrase(self) -> str: ... + @reason_phrase.setter + def reason_phrase(self, value: str) -> None: ... + @property + def charset(self) -> str: ... + @charset.setter + def charset(self, value: str) -> None: ... + def serialize_headers(self) -> bytes: ... + __bytes__ = serialize_headers + def __setitem__(self, header: str, value: str | bytes | int) -> None: ... + def __delitem__(self, header: str) -> None: ... + def __getitem__(self, header: str) -> str: ... + def has_header(self, header: str) -> bool: ... + def __contains__(self, header: str) -> bool: ... + def items(self) -> Iterable[tuple[str, str]]: ... + @overload + def get(self, header: str, alternate: str) -> str: ... + @overload + def get(self, header: str, alternate: None = None) -> str | None: ... + def set_cookie( + self, + key: str, + value: str = ..., + max_age: int | datetime.timedelta | None = ..., + expires: str | datetime.datetime | None = ..., + path: str = ..., + domain: str | None = ..., + secure: bool = ..., + httponly: bool = ..., + samesite: Literal["Lax", "Strict", "None", False] | None = ..., + ) -> None: ... + def setdefault(self, key: str, value: str) -> None: ... + def set_signed_cookie(self, key: str, value: str, salt: str = ..., **kwargs: Any) -> None: ... + def delete_cookie( + self, + key: str, + path: str = ..., + domain: str | None = ..., + samesite: Literal["Lax", "Strict", "None", False] | None = ..., + ) -> None: ... + def make_bytes(self, value: object) -> bytes: ... + def close(self) -> None: ... + def write(self, content: str | bytes) -> None: ... + def flush(self) -> None: ... + def tell(self) -> int: ... + def readable(self) -> bool: ... + def seekable(self) -> bool: ... + def writable(self) -> bool: ... + def writelines(self, lines: Iterable[object]) -> None: ... + + # Fake methods that are implemented by all subclasses + @type_check_only + def __iter__(self) -> Iterator[bytes]: ... + @type_check_only + def getvalue(self) -> bytes: ... + +class HttpResponse(HttpResponseBase, Iterable[bytes]): + content = _PropertyDescriptor[object, bytes]() + csrf_cookie_set: bool + sameorigin: bool + test_server_port: str + test_was_secure_request: bool + xframe_options_exempt: bool + def __init__(self, content: object = ..., *args: Any, **kwargs: Any) -> None: ... + def serialize(self) -> bytes: ... + __bytes__ = serialize + def __iter__(self) -> Iterator[bytes]: ... + def getvalue(self) -> bytes: ... + +class StreamingHttpResponse(HttpResponseBase, Iterable[bytes], AsyncIterable[bytes]): + is_async: bool + streaming_content = _PropertyDescriptor[ + Iterable[object] | AsyncIterable[object], Iterator[bytes] | AsyncIterator[bytes] + ]() + def __init__( + self, streaming_content: Iterable[object] | AsyncIterable[object] = ..., *args: Any, **kwargs: Any + ) -> None: ... + def __iter__(self) -> Iterator[bytes]: ... + def __aiter__(self) -> AsyncIterator[bytes]: ... + def getvalue(self) -> bytes: ... + +class FileResponse(StreamingHttpResponse): + file_to_stream: BytesIO | None + block_size: int + as_attachment: bool + filename: str + def __init__(self, *args: Any, as_attachment: bool = ..., filename: str = ..., **kwargs: Any) -> None: ... + def set_headers(self, filelike: BytesIO) -> None: ... + +class HttpResponseRedirectBase(HttpResponse): + allowed_schemes: list[str] + def __init__(self, redirect_to: str, *args: Any, **kwargs: Any) -> None: ... + @property + def url(self) -> str: ... + +class HttpResponseRedirect(HttpResponseRedirectBase): ... +class HttpResponsePermanentRedirect(HttpResponseRedirectBase): ... + +class HttpResponseNotModified(HttpResponse): + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + +class HttpResponseBadRequest(HttpResponse): ... +class HttpResponseNotFound(HttpResponse): ... +class HttpResponseForbidden(HttpResponse): ... + +class HttpResponseNotAllowed(HttpResponse): + def __init__(self, permitted_methods: Iterable[str], *args: Any, **kwargs: Any) -> None: ... + +class HttpResponseGone(HttpResponse): ... +class HttpResponseServerError(HttpResponse): ... +class Http404(Exception): ... + +class JsonResponse(HttpResponse): + def __init__( + self, + data: Any, + encoder: type[JSONEncoder] = ..., + safe: bool = ..., + json_dumps_params: dict[str, Any] | None = ..., + **kwargs: Any, + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/cache.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/cache.pyi new file mode 100644 index 000000000000..b9f0756ee823 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/cache.pyi @@ -0,0 +1,33 @@ +from typing import Any + +from django.core.cache import BaseCache +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseBase +from django.utils.deprecation import MiddlewareMixin, _AsyncGetResponseCallable, _GetResponseCallable + +class UpdateCacheMiddleware(MiddlewareMixin): + cache_timeout: float + key_prefix: str + cache_alias: str + @property + def cache(self) -> BaseCache: ... + def process_response(self, request: HttpRequest, response: HttpResponseBase | str) -> HttpResponseBase | str: ... + +class FetchFromCacheMiddleware(MiddlewareMixin): + key_prefix: str + cache_alias: str + @property + def cache(self) -> BaseCache: ... + def process_request(self, request: HttpRequest) -> HttpResponse | None: ... + +class CacheMiddleware(UpdateCacheMiddleware, FetchFromCacheMiddleware): + key_prefix: str + cache_alias: str + cache_timeout: float + def __init__( + self, + get_response: _GetResponseCallable | _AsyncGetResponseCallable, + cache_timeout: float | None = ..., + page_timeout: float | None = ..., + **kwargs: Any, + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/clickjacking.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/clickjacking.pyi new file mode 100644 index 000000000000..08f4e181f2ca --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/clickjacking.pyi @@ -0,0 +1,7 @@ +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.utils.deprecation import MiddlewareMixin + +class XFrameOptionsMiddleware(MiddlewareMixin): + def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... + def get_xframe_options_value(self, request: HttpRequest, response: HttpResponse) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/common.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/common.pyi new file mode 100644 index 000000000000..3fb1651f5592 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/common.pyi @@ -0,0 +1,17 @@ +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase, HttpResponsePermanentRedirect +from django.utils.deprecation import MiddlewareMixin + +class CommonMiddleware(MiddlewareMixin): + response_redirect_class: Any + def process_request(self, request: HttpRequest) -> HttpResponsePermanentRedirect | None: ... + def should_redirect_with_slash(self, request: HttpRequest) -> bool: ... + def get_full_path_with_slash(self, request: HttpRequest) -> str: ... + def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + +class BrokenLinkEmailsMiddleware(MiddlewareMixin): + def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def is_internal_request(self, domain: str, referer: str) -> bool: ... + def is_ignorable_request(self, request: HttpRequest, uri: str, domain: str, referer: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/csrf.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/csrf.pyi new file mode 100644 index 000000000000..bd4555aa3c8a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/csrf.pyi @@ -0,0 +1,57 @@ +from collections import defaultdict +from collections.abc import Callable +from logging import Logger +from re import Pattern +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase, HttpResponseForbidden +from django.utils.deprecation import MiddlewareMixin +from django.utils.functional import cached_property + +logger: Logger + +invalid_token_chars_re: Pattern[str] + +REASON_BAD_ORIGIN: str +REASON_NO_REFERER: str +REASON_BAD_REFERER: str +REASON_NO_CSRF_COOKIE: str +REASON_CSRF_TOKEN_MISSING: str +REASON_MALFORMED_REFERER: str +REASON_INSECURE_REFERER: str + +REASON_INCORRECT_LENGTH: str +REASON_INVALID_CHARACTERS: str + +CSRF_SECRET_LENGTH: int +CSRF_TOKEN_LENGTH: Any +CSRF_ALLOWED_CHARS: Any +CSRF_SESSION_KEY: str + +def get_token(request: HttpRequest) -> str: ... +def rotate_token(request: HttpRequest) -> None: ... + +class InvalidTokenFormat(Exception): + reason: str + def __init__(self, reason: str) -> None: ... + +class RejectRequest(Exception): + reason: str + def __init__(self, reason: str) -> None: ... + +class CsrfViewMiddleware(MiddlewareMixin): + @cached_property + def csrf_trusted_origins_hosts(self) -> list[str]: ... + @cached_property + def allowed_origins_exact(self) -> set[str]: ... + @cached_property + def allowed_origin_subdomains(self) -> defaultdict[str, list[str]]: ... + def process_request(self, request: HttpRequest) -> None: ... + def process_view( + self, request: HttpRequest, callback: Callable | None, callback_args: tuple, callback_kwargs: dict[str, Any] + ) -> HttpResponseForbidden | None: ... + def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + +def _get_new_csrf_string() -> str: ... +def _get_new_csrf_token() -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/gzip.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/gzip.pyi new file mode 100644 index 000000000000..e1c10a76829e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/gzip.pyi @@ -0,0 +1,11 @@ +from typing import Any, ClassVar + +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase +from django.utils.deprecation import MiddlewareMixin + +re_accepts_gzip: Any + +class GZipMiddleware(MiddlewareMixin): + max_random_bytes: ClassVar[int] + def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/http.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/http.pyi new file mode 100644 index 000000000000..c0981b7d03ba --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/http.pyi @@ -0,0 +1,7 @@ +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase +from django.utils.deprecation import MiddlewareMixin + +class ConditionalGetMiddleware(MiddlewareMixin): + def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + def needs_etag(self, response: HttpResponseBase) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/locale.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/locale.pyi new file mode 100644 index 000000000000..b772011f79da --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/locale.pyi @@ -0,0 +1,10 @@ +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase +from django.utils.deprecation import MiddlewareMixin + +class LocaleMiddleware(MiddlewareMixin): + response_redirect_class: Any + def process_request(self, request: HttpRequest) -> None: ... + def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/middleware/security.pyi b/python/helpers/bundled_stubs/Django/django-stubs/middleware/security.pyi new file mode 100644 index 000000000000..7277bc5fcf8a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/middleware/security.pyi @@ -0,0 +1,17 @@ +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponsePermanentRedirect +from django.utils.deprecation import MiddlewareMixin + +class SecurityMiddleware(MiddlewareMixin): + sts_seconds: int + sts_include_subdomains: bool + sts_preload: bool + content_type_nosniff: bool + xss_filter: bool + redirect: bool + redirect_host: str | None + redirect_exempt: list[Any] + def process_request(self, request: HttpRequest) -> HttpResponsePermanentRedirect | None: ... + def process_response(self, request: HttpRequest, response: HttpResponse) -> HttpResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi b/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi new file mode 100644 index 000000000000..e00333404190 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/shortcuts.pyi @@ -0,0 +1,40 @@ +from collections.abc import Callable, Mapping, Sequence +from typing import Any, Literal, Protocol, TypeVar, overload, type_check_only + +from django.db.models import Manager, QuerySet +from django.db.models.base import Model +from django.http import HttpRequest +from django.http.response import HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect + +def render( + request: HttpRequest | None, + template_name: str | Sequence[str], + context: Mapping[str, Any] | None = ..., + content_type: str | None = ..., + status: int | None = ..., + using: str | None = ..., +) -> HttpResponse: ... +@type_check_only +class SupportsGetAbsoluteUrl(Protocol): + def get_absolute_url(self) -> str: ... + +@overload +def redirect( + to: Callable[..., Any] | str | SupportsGetAbsoluteUrl, *args: Any, permanent: Literal[True], **kwargs: Any +) -> HttpResponsePermanentRedirect: ... +@overload +def redirect( + to: Callable[..., Any] | str | SupportsGetAbsoluteUrl, *args: Any, permanent: Literal[False] = ..., **kwargs: Any +) -> HttpResponseRedirect: ... +@overload +def redirect( + to: Callable[..., Any] | str | SupportsGetAbsoluteUrl, *args: Any, permanent: bool, **kwargs: Any +) -> HttpResponseRedirect | HttpResponsePermanentRedirect: ... + +_T = TypeVar("_T", bound=Model) + +def get_object_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> _T: ... +async def aget_object_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> _T: ... +def get_list_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> list[_T]: ... +async def aget_list_or_404(klass: type[_T] | Manager[_T] | QuerySet[_T], *args: Any, **kwargs: Any) -> list[_T]: ... +def resolve_url(to: Callable | Model | str, *args: Any, **kwargs: Any) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/__init__.pyi new file mode 100644 index 000000000000..128cc1004745 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/__init__.pyi @@ -0,0 +1,19 @@ +from . import defaultfilters as defaultfilters + +# Template parts +from .base import Node as Node +from .base import NodeList as NodeList +from .base import Origin as Origin +from .base import Template as Template +from .base import Variable as Variable +from .base import VariableDoesNotExist as VariableDoesNotExist +from .context import Context as Context +from .context import ContextPopException as ContextPopException +from .context import RequestContext as RequestContext +from .engine import Engine as Engine +from .exceptions import TemplateDoesNotExist as TemplateDoesNotExist +from .exceptions import TemplateSyntaxError as TemplateSyntaxError +from .library import Library as Library +from .utils import EngineHandler as EngineHandler + +engines: EngineHandler diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/backends/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/backends/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/base.pyi new file mode 100644 index 000000000000..76c1a194d8c3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/base.pyi @@ -0,0 +1,26 @@ +from collections.abc import Iterator, Mapping +from typing import Any, Protocol, type_check_only + +from django.http.request import HttpRequest +from django.utils.functional import cached_property + +class BaseEngine: + name: str + dirs: list[str] + app_dirs: bool + def __init__(self, params: Mapping[str, Any]) -> None: ... + @property + def app_dirname(self) -> str: ... + def from_string(self, template_code: str) -> _EngineTemplate: ... + def get_template(self, template_name: str) -> _EngineTemplate: ... + @cached_property + def template_dirs(self) -> tuple[str, ...]: ... + def iter_template_filenames(self, template_name: str) -> Iterator[str]: ... + +@type_check_only +class _EngineTemplate(Protocol): + def render( + self, + context: dict[str, Any] | None = ..., + request: HttpRequest | None = ..., + ) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/backends/django.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/django.pyi new file mode 100644 index 000000000000..6e99b01d9037 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/django.pyi @@ -0,0 +1,29 @@ +from collections.abc import Iterator +from typing import Any, NoReturn + +from django.template.base import Origin +from django.template.base import Template as _BaseTemplate +from django.template.engine import Engine +from django.template.exceptions import TemplateDoesNotExist + +from .base import BaseEngine, _EngineTemplate + +class DjangoTemplates(BaseEngine): + engine: Engine + 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]: ... + +def copy_exception(exc: TemplateDoesNotExist, backend: DjangoTemplates | None = None) -> TemplateDoesNotExist: ... +def reraise(exc: TemplateDoesNotExist, backend: DjangoTemplates) -> NoReturn: ... +def get_template_tag_modules() -> Iterator[tuple[str, str]]: ... +def get_installed_libraries() -> dict[str, str]: ... +def get_package_libraries(pkg: Any) -> Iterator[str]: ... + +class Template(_EngineTemplate): + template: _BaseTemplate + backend: DjangoTemplates + def __init__(self, template: _BaseTemplate, backend: BaseEngine) -> None: ... + @property + def origin(self) -> Origin: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/backends/dummy.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/dummy.pyi new file mode 100644 index 000000000000..41a5f5dfccfa --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/dummy.pyi @@ -0,0 +1,15 @@ +import string +from typing import Any + +from django.http.request import HttpRequest + +from .base import BaseEngine + +class TemplateStrings(BaseEngine): + def __init__(self, params: dict[str, dict[Any, Any] | list[Any] | bool | str]) -> None: ... + def from_string(self, template_code: str) -> Template: ... + def get_template(self, template_name: str) -> Template: ... + +class Template(string.Template): + template: str + def render(self, context: dict[str, Any] | None = ..., request: HttpRequest | None = ...) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/backends/jinja2.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/jinja2.pyi new file mode 100644 index 000000000000..68db8daaf339 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/jinja2.pyi @@ -0,0 +1,32 @@ +from collections.abc import Callable +from typing import Any + +from _typeshed import Incomplete +from django.http.request import HttpRequest +from django.template.exceptions import TemplateSyntaxError +from django.utils.functional import cached_property + +from .base import BaseEngine + +class Jinja2(BaseEngine): + env: Any + context_processors: list[str] + def __init__(self, params: dict[str, Any]) -> None: ... + def from_string(self, template_code: str) -> Template: ... + def get_template(self, template_name: str) -> Template: ... + @cached_property + def template_context_processors(self) -> list[Callable]: ... + +class Origin: + name: str + template_name: str | None + def __init__(self, name: str, template_name: str | None) -> None: ... + +class Template: + template: Incomplete + backend: Jinja2 + origin: Origin + def __init__(self, template: Incomplete, backend: Jinja2) -> None: ... + def render(self, context: dict[str, Any] | None = ..., request: HttpRequest | None = ...) -> str: ... + +def get_exception_info(exception: TemplateSyntaxError) -> dict[str, Any]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/backends/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/utils.pyi new file mode 100644 index 000000000000..f72ea668fae8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/backends/utils.pyi @@ -0,0 +1,9 @@ +from typing import Any + +from django.http.request import HttpRequest +from django.utils.safestring import SafeString + +def csrf_input(request: HttpRequest) -> SafeString: ... + +csrf_input_lazy: Any +csrf_token_lazy: Any diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/base.pyi new file mode 100644 index 000000000000..fd4d2dc4c74d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/base.pyi @@ -0,0 +1,168 @@ +from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence +from enum import Enum +from logging import Logger +from re import Pattern +from typing import Any + +from django.template.context import Context as Context # Django: imported for backwards compatibility +from django.template.engine import Engine +from django.template.library import Library +from django.template.loaders.base import Loader +from django.utils.safestring import SafeString + +FILTER_SEPARATOR: str +FILTER_ARGUMENT_SEPARATOR: str +VARIABLE_ATTRIBUTE_SEPARATOR: str +BLOCK_TAG_START: str +BLOCK_TAG_END: str +VARIABLE_TAG_START: str +VARIABLE_TAG_END: str +COMMENT_TAG_START: str +COMMENT_TAG_END: str +SINGLE_BRACE_START: str +SINGLE_BRACE_END: str +UNKNOWN_SOURCE: str +tag_re: Pattern[str] +logger: Logger + +class TokenType(Enum): + TEXT: int + VAR: int + BLOCK: int + COMMENT: int + +class VariableDoesNotExist(Exception): + msg: str + params: tuple[dict[str, str] | str] + def __init__(self, msg: str, params: tuple[dict[str, str] | str] = ...) -> None: ... + +class Origin: + name: str + template_name: bytes | str | None + loader: Loader | None + def __init__(self, name: str, template_name: bytes | str | None = None, loader: Loader | None = None) -> None: ... + @property + def loader_name(self) -> str | None: ... + +class Template: + name: str | None + origin: Origin + engine: Engine + source: str + nodelist: NodeList + def __init__( + self, + template_string: Template | str, + origin: Origin | None = None, + name: str | None = None, + engine: Engine | None = None, + ) -> None: ... + def render(self, context: Context) -> SafeString: ... + def compile_nodelist(self) -> NodeList: ... + def get_exception_info(self, exception: Exception, token: Token) -> dict[str, Any]: ... + +def linebreak_iter(template_source: str) -> Iterator[int]: ... + +class Token: + contents: str + token_type: TokenType + lineno: int | None + position: tuple[int, int] | None + def __init__( + self, + token_type: TokenType, + contents: str, + position: tuple[int, int] | None = None, + lineno: int | None = None, + ) -> None: ... + def split_contents(self) -> list[str]: ... + +class Lexer: + template_string: str + verbatim: bool | str + def __init__(self, template_string: str) -> None: ... + def tokenize(self) -> list[Token]: ... + def create_token(self, token_string: str, position: tuple[int, int] | None, lineno: int, in_tag: bool) -> Token: ... + +class DebugLexer(Lexer): + template_string: str + verbatim: bool | str + def tokenize(self) -> list[Token]: ... + +class Parser: + tokens: list[Token] | str + tags: dict[str, Callable] + filters: dict[str, Callable] + command_stack: list[tuple[str, Token]] + libraries: dict[str, Library] + origin: Origin | None + def __init__( + self, + tokens: list[Token] | str, + libraries: dict[str, Library] | None = None, + builtins: list[Library] | None = None, + origin: Origin | None = None, + ) -> None: ... + def parse(self, parse_until: Iterable[str] | None = None) -> NodeList: ... + def skip_past(self, endtag: str) -> None: ... + def extend_nodelist(self, nodelist: NodeList, node: Node, token: Token) -> None: ... + def error(self, token: Token, e: Exception | str) -> Exception: ... + def invalid_block_tag(self, token: Token, command: str, parse_until: Iterable[str] | None = None) -> Any: ... + def unclosed_block_tag(self, parse_until: Iterable[str]) -> Any: ... + def next_token(self) -> Token: ... + def prepend_token(self, token: Token) -> None: ... + def delete_first_token(self) -> None: ... + def add_library(self, lib: Library) -> None: ... + def compile_filter(self, token: str) -> FilterExpression: ... + def find_filter(self, filter_name: str) -> Callable: ... + +constant_string: str +filter_raw_string: str +filter_re: Pattern[str] + +class FilterExpression: + token: str + filters: list[Any] + var: Any + def __init__(self, token: str, parser: Parser) -> None: ... + def resolve(self, context: Context, ignore_failures: bool = False) -> Any: ... + @staticmethod + def args_check(name: str, func: Callable, provided: list[tuple[bool, Any]]) -> bool: ... + +class Variable: + var: dict[Any, Any] | str + literal: SafeString | float | None + lookups: tuple[str, ...] | None + translate: bool + message_context: str | None + def __init__(self, var: dict[Any, Any] | str) -> None: ... + def resolve(self, context: Mapping[str, Mapping[str, Any]] | Context | int | str) -> Any: ... + +class Node: + must_be_first: bool + child_nodelists: Any + origin: Origin + token: Token | None + def render(self, context: Context) -> str: ... + def render_annotated(self, context: Context) -> int | str: ... + def __iter__(self) -> Iterator[Node]: ... + def get_nodes_by_type(self, nodetype: type[Node]) -> list[Node]: ... + +class NodeList(list[Node]): + contains_nontext: bool + def render(self, context: Context) -> SafeString: ... + def get_nodes_by_type(self, nodetype: type[Node]) -> list[Node]: ... + +class TextNode(Node): + s: str + def __init__(self, s: str) -> None: ... + +def render_value_in_context(value: Any, context: Context) -> str: ... + +class VariableNode(Node): + filter_expression: FilterExpression + def __init__(self, filter_expression: FilterExpression) -> None: ... + +kwarg_re: Pattern[str] + +def token_kwargs(bits: Sequence[str], parser: Parser, support_legacy: bool = False) -> dict[str, FilterExpression]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi new file mode 100644 index 000000000000..e61e6e607504 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/context.pyi @@ -0,0 +1,91 @@ +from collections.abc import Callable, Iterable, Iterator +from contextlib import contextmanager +from types import TracebackType +from typing import Any + +from django.http.request import HttpRequest +from django.template.base import Node, Origin, Template +from django.template.loader_tags import IncludeNode +from typing_extensions import Self, TypeAlias + +_ContextKeys: TypeAlias = int | str | Node + +_ContextValues: TypeAlias = dict[str, Any] | Context + +class ContextPopException(Exception): ... + +class ContextDict(dict): + context: BaseContext + def __init__(self, context: BaseContext, *args: Any, **kwargs: Any) -> None: ... + def __enter__(self) -> Self: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + +class BaseContext(Iterable[Any]): + def __init__(self, dict_: Any | None = None) -> None: ... + def __copy__(self) -> Self: ... + def __iter__(self) -> Iterator[Any]: ... + def push(self, *args: Any, **kwargs: Any) -> ContextDict: ... + def pop(self) -> ContextDict: ... + def __setitem__(self, key: _ContextKeys, value: Any) -> None: ... + def set_upward(self, key: _ContextKeys, value: int | str) -> None: ... + def __getitem__(self, key: _ContextKeys) -> Any: ... + def __delitem__(self, key: _ContextKeys) -> None: ... + def __contains__(self, key: _ContextKeys) -> bool: ... + def get(self, key: _ContextKeys, otherwise: Any | None = None) -> Any | None: ... + def setdefault(self, key: _ContextKeys, default: list[Origin] | int | None = None) -> list[Origin] | int | None: ... + def new(self, values: _ContextValues | None = None) -> Context: ... + def flatten(self) -> dict[_ContextKeys, dict[_ContextKeys, type[Any] | str] | int | str | None]: ... + +class Context(BaseContext): + dicts: Any + autoescape: bool + use_l10n: bool | None + use_tz: bool | None + template_name: str | None + render_context: RenderContext + template: Template | None + def __init__( + self, + dict_: Any | None = None, + autoescape: bool = True, + use_l10n: bool | None = None, + use_tz: bool | None = None, + ) -> None: ... + @contextmanager + def bind_template(self, template: Template) -> Iterator[None]: ... + def update(self, other_dict: dict[str, Any] | Context) -> ContextDict: ... + +class RenderContext(BaseContext): + dicts: list[dict[IncludeNode | str, str]] + template: Template | None + @contextmanager + def push_state(self, template: Template, isolated_context: bool = True) -> Iterator[None]: ... + +class RequestContext(Context): + autoescape: bool + dicts: list[dict[str, str]] + render_context: RenderContext + template_name: str | None + use_l10n: bool | None + use_tz: bool | None + request: HttpRequest + def __init__( + self, + request: HttpRequest, + dict_: dict[str, Any] | None = None, + processors: list[Callable] | None = None, + use_l10n: bool | None = None, + use_tz: bool | None = None, + autoescape: bool = True, + ) -> None: ... + template: Template | None + @contextmanager + def bind_template(self, template: Template) -> Iterator[None]: ... + def new(self, values: _ContextValues | None = None) -> RequestContext: ... + +def make_context(context: dict[str, Any] | None, request: HttpRequest | None = None, **kwargs: Any) -> Context: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/context_processors.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/context_processors.pyi new file mode 100644 index 000000000000..15020b8c841f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/context_processors.pyi @@ -0,0 +1,15 @@ +from collections.abc import Callable +from typing import TypeVar + +from django.http.request import HttpRequest +from django.utils.functional import SimpleLazyObject + +_R = TypeVar("_R", bound=HttpRequest) + +def csrf(request: HttpRequest) -> dict[str, SimpleLazyObject]: ... +def debug(request: HttpRequest) -> dict[str, Callable | bool]: ... +def i18n(request: HttpRequest) -> dict[str, list[tuple[str, str]] | bool | str]: ... +def tz(request: HttpRequest) -> dict[str, str]: ... +def static(request: HttpRequest) -> dict[str, str]: ... +def media(request: HttpRequest) -> dict[str, str]: ... +def request(request: _R) -> dict[str, _R]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/defaultfilters.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/defaultfilters.pyi new file mode 100644 index 000000000000..1ceb71282e44 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/defaultfilters.pyi @@ -0,0 +1,69 @@ +from collections.abc import Callable +from datetime import date as _date +from datetime import datetime +from datetime import time as _time +from typing import Any + +from django.utils.safestring import SafeString + +register: Any + +def stringfilter(func: Callable) -> Callable: ... +def addslashes(value: str) -> str: ... +def capfirst(value: str) -> str: ... +def escapejs_filter(value: str) -> SafeString: ... +def json_script(value: dict[str, str], element_id: SafeString) -> SafeString: ... +def floatformat(text: Any | None, arg: int | str = -1) -> str: ... +def iriencode(value: str) -> str: ... +def linenumbers(value: str, autoescape: bool = True) -> SafeString: ... +def lower(value: str) -> str: ... +def make_list(value: str) -> list[str]: ... +def slugify(value: str) -> SafeString: ... +def stringformat(value: Any, arg: str) -> str: ... +def title(value: str) -> str: ... +def truncatechars(value: str, arg: SafeString | int) -> str: ... +def truncatechars_html(value: str, arg: int | str) -> str: ... +def truncatewords(value: str, arg: int | str) -> str: ... +def truncatewords_html(value: str, arg: int | str) -> str: ... +def upper(value: str) -> str: ... +def urlencode(value: str, safe: SafeString | None = None) -> str: ... +def urlize(value: str, autoescape: bool = True) -> SafeString: ... +def urlizetrunc(value: str, limit: SafeString | int, autoescape: bool = True) -> SafeString: ... +def wordcount(value: str) -> int: ... +def wordwrap(value: str, arg: SafeString | int) -> str: ... +def ljust(value: str, arg: SafeString | int) -> str: ... +def rjust(value: str, arg: SafeString | int) -> str: ... +def center(value: str, arg: SafeString | int) -> str: ... +def cut(value: str, arg: str) -> str: ... +def escape_filter(value: str) -> SafeString: ... +def escapeseq(value: list[str]) -> list[SafeString]: ... +def force_escape(value: str) -> SafeString: ... +def linebreaks_filter(value: str, autoescape: bool = True) -> SafeString: ... +def linebreaksbr(value: str, autoescape: bool = True) -> SafeString: ... +def safe(value: str) -> SafeString: ... +def safeseq(value: list[str]) -> list[SafeString]: ... +def striptags(value: str) -> str: ... +def dictsort(value: Any, arg: int | str) -> Any: ... +def dictsortreversed(value: Any, arg: int | str) -> Any: ... +def first(value: Any) -> Any: ... +def join(value: Any, arg: str, autoescape: bool = True) -> Any: ... +def last(value: list[str]) -> str: ... +def length(value: Any) -> int: ... +def length_is(value: Any | None, arg: SafeString | int) -> bool | str: ... +def random(value: list[str]) -> str: ... +def slice_filter(value: Any, arg: str | int) -> Any: ... +def unordered_list(value: Any, autoescape: bool = True) -> Any: ... +def add(value: Any, arg: Any) -> Any: ... +def get_digit(value: Any, arg: int) -> Any: ... +def date(value: _date | datetime | str | None, arg: str | None = None) -> str: ... +def time(value: datetime | _time | str | None, arg: str | None = None) -> str: ... +def timesince_filter(value: _date | None, arg: _date | None = None) -> str: ... +def timeuntil_filter(value: _date | None, arg: _date | None = None) -> str: ... +def default(value: int | str | None, arg: int | str) -> int | str: ... +def default_if_none(value: str | None, arg: int | str) -> int | str: ... +def divisibleby(value: int, arg: int) -> bool: ... +def yesno(value: int | None, arg: str | None = None) -> bool | str | None: ... +def filesizeformat(bytes_: complex | int | str) -> str: ... +def pluralize(value: Any, arg: str = "s") -> str: ... +def phone2numeric_filter(value: str) -> str: ... +def pprint(value: Any) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/defaulttags.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/defaulttags.pyi new file mode 100644 index 000000000000..ec478c32a3d6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/defaulttags.pyi @@ -0,0 +1,205 @@ +from collections import namedtuple +from collections.abc import Iterator, Sequence +from datetime import date as real_date +from typing import Any + +from django.template.base import FilterExpression, Parser, Token +from django.template.context import Context +from django.utils.safestring import SafeString + +from .base import Node, NodeList +from .library import Library +from .smartif import IfParser, Literal + +register: Any + +class AutoEscapeControlNode(Node): + nodelist: NodeList + setting: bool + def __init__(self, setting: bool, nodelist: NodeList) -> None: ... + +class CommentNode(Node): ... +class CsrfTokenNode(Node): ... + +class CycleNode(Node): + cyclevars: list[FilterExpression] + variable_name: str | None + silent: bool + def __init__( + self, cyclevars: list[FilterExpression], variable_name: str | None = None, silent: bool = False + ) -> None: ... + def reset(self, context: Context) -> None: ... + +class DebugNode(Node): ... + +class FilterNode(Node): + filter_expr: FilterExpression + nodelist: NodeList + def __init__(self, filter_expr: FilterExpression, nodelist: NodeList) -> None: ... + +class FirstOfNode(Node): + vars: list[FilterExpression] + asvar: str | None + def __init__(self, variables: list[FilterExpression], asvar: str | None = None) -> None: ... + +class ForNode(Node): + loopvars: list[str] | str + sequence: FilterExpression | str + child_nodelists: Any + is_reversed: bool + nodelist_loop: list[str] | NodeList + nodelist_empty: list[str] | NodeList + def __init__( + self, + loopvars: list[str] | str, + sequence: FilterExpression | str, + is_reversed: bool, + nodelist_loop: list[str] | NodeList, + nodelist_empty: list[str] | NodeList | None = None, + ) -> None: ... + +class IfChangedNode(Node): + nodelist_false: NodeList + nodelist_true: NodeList + child_nodelists: Any + def __init__(self, nodelist_true: NodeList, nodelist_false: NodeList, *varlist: Any) -> None: ... + +class IfEqualNode(Node): + nodelist_false: list[Any] | NodeList + nodelist_true: list[Any] | NodeList + var1: FilterExpression | str + var2: FilterExpression | str + child_nodelists: Any + negate: bool + def __init__( + self, + var1: FilterExpression | str, + var2: FilterExpression | str, + nodelist_true: list[Any] | NodeList, + nodelist_false: list[Any] | NodeList, + negate: bool, + ) -> None: ... + +class IfNode(Node): + conditions_nodelists: list[tuple[TemplateLiteral | None, NodeList]] + def __init__(self, conditions_nodelists: list[tuple[TemplateLiteral | None, NodeList]]) -> None: ... + def __iter__(self) -> Iterator[Node]: ... + @property + def nodelist(self) -> NodeList: ... + +class LoremNode(Node): + common: bool + count: FilterExpression + method: str + def __init__(self, count: FilterExpression, method: str, common: bool) -> None: ... + +GroupedResult = namedtuple("GroupedResult", ["grouper", "list"]) + +class RegroupNode(Node): + expression: FilterExpression + target: FilterExpression + var_name: str + def __init__(self, target: FilterExpression, expression: FilterExpression, var_name: str) -> None: ... + def resolve_expression(self, obj: dict[str, real_date], context: Context) -> int | str: ... + +class LoadNode(Node): ... + +class NowNode(Node): + format_string: str + asvar: str | None + def __init__(self, format_string: str, asvar: str | None = None) -> None: ... + +class ResetCycleNode(Node): + node: CycleNode + def __init__(self, node: CycleNode) -> None: ... + +class SpacelessNode(Node): + nodelist: NodeList + def __init__(self, nodelist: NodeList) -> None: ... + +class TemplateTagNode(Node): + mapping: Any + tagtype: str + def __init__(self, tagtype: str) -> None: ... + +class URLNode(Node): + view_name: FilterExpression + args: list[FilterExpression] + kwargs: dict[str, FilterExpression] + asvar: str | None + def __init__( + self, + view_name: FilterExpression, + args: list[FilterExpression], + kwargs: dict[str, FilterExpression], + asvar: str | None, + ) -> None: ... + +class VerbatimNode(Node): + content: SafeString + def __init__(self, content: SafeString) -> None: ... + +class WidthRatioNode(Node): + val_expr: FilterExpression + max_expr: FilterExpression + max_width: FilterExpression + asvar: str | None + def __init__( + self, + val_expr: FilterExpression, + max_expr: FilterExpression, + max_width: FilterExpression, + asvar: str | None = None, + ) -> None: ... + +class WithNode(Node): + nodelist: NodeList + extra_context: dict[str, Any] + def __init__( + self, + var: str | None, + name: str | None, + nodelist: NodeList | Sequence[Node], + extra_context: dict[str, Any] | None = None, + ) -> None: ... + +def autoescape(parser: Parser, token: Token) -> AutoEscapeControlNode: ... +def comment(parser: Parser, token: Token) -> CommentNode: ... +def cycle(parser: Parser, token: Token) -> CycleNode: ... +def csrf_token(parser: Parser, token: Token) -> CsrfTokenNode: ... +def debug(parser: Parser, token: Token) -> DebugNode: ... +def do_filter(parser: Parser, token: Token) -> FilterNode: ... +def firstof(parser: Parser, token: Token) -> FirstOfNode: ... +def do_for(parser: Parser, token: Token) -> ForNode: ... +def do_ifequal(parser: Parser, token: Token, negate: bool) -> IfEqualNode: ... +def ifequal(parser: Parser, token: Token) -> IfEqualNode: ... +def ifnotequal(parser: Parser, token: Token) -> IfEqualNode: ... + +class TemplateLiteral(Literal): + text: str + def __init__(self, value: FilterExpression, text: str) -> None: ... + def display(self) -> str: ... + +class TemplateIfParser(IfParser): + current_token: TemplateLiteral + pos: int + tokens: list[TemplateLiteral] + error_class: Any + template_parser: Parser + def __init__(self, parser: Parser, *args: Any, **kwargs: Any) -> None: ... + +def do_if(parser: Parser, token: Token) -> IfNode: ... +def ifchanged(parser: Parser, token: Token) -> IfChangedNode: ... +def find_library(parser: Parser, name: str) -> Library: ... +def load_from_library(library: Library, label: str, names: list[str]) -> Library: ... +def load(parser: Parser, token: Token) -> LoadNode: ... +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: ... +def do_with(parser: Parser, token: Token) -> WithNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/engine.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/engine.pyi new file mode 100644 index 000000000000..e8816325cecf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/engine.pyi @@ -0,0 +1,58 @@ +from collections.abc import Callable, Sequence +from typing import Any + +from django.template.base import Origin +from django.template.library import Library +from django.template.loaders.base import Loader +from django.utils.functional import cached_property +from django.utils.safestring import SafeString +from typing_extensions import TypeAlias + +from .base import Template + +_Loader: TypeAlias = Any + +class Engine: + default_builtins: Any + dirs: list[str] + app_dirs: bool + autoescape: bool + context_processors: list[str] | tuple[str, ...] + debug: bool + loaders: Sequence[_Loader] + string_if_invalid: str + file_charset: str + libraries: dict[str, str] + template_libraries: dict[str, Library] + builtins: list[str] + template_builtins: list[Library] + def __init__( + self, + dirs: list[str] | None = None, + app_dirs: bool = False, + context_processors: list[str] | tuple[str, ...] | None = None, + debug: bool = False, + loaders: Sequence[_Loader] | None = None, + string_if_invalid: str = "", + file_charset: str = "utf-8", + libraries: dict[str, str] | None = None, + builtins: list[str] | None = None, + autoescape: bool = True, + ) -> None: ... + @staticmethod + def get_default() -> Engine: ... + @cached_property + def template_context_processors(self) -> Sequence[Callable]: ... + def get_template_builtins(self, builtins: list[str]) -> list[Library]: ... + def get_template_libraries(self, libraries: dict[str, str]) -> dict[str, Library]: ... + @cached_property + def template_loaders(self) -> list[Loader]: ... + def get_template_loaders(self, template_loaders: Sequence[_Loader]) -> list[Loader]: ... + def find_template_loader(self, loader: _Loader) -> Loader: ... + def find_template( + self, name: str, dirs: None = None, skip: list[Origin] | None = None + ) -> tuple[Template, Origin]: ... + def from_string(self, template_code: str) -> Template: ... + def get_template(self, template_name: str) -> Template: ... + def render_to_string(self, template_name: str, context: dict[str, Any] | None = None) -> SafeString: ... + def select_template(self, template_name_list: list[str]) -> Template: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/exceptions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/exceptions.pyi new file mode 100644 index 000000000000..57b33421abf4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/exceptions.pyi @@ -0,0 +1,16 @@ +from django.template.backends.base import BaseEngine +from django.template.base import Origin + +class TemplateDoesNotExist(Exception): + backend: BaseEngine | None + tried: list[tuple[Origin, str]] + chain: list[TemplateDoesNotExist] + def __init__( + self, + msg: Origin | str, + tried: list[tuple[Origin, str]] | None = None, + backend: BaseEngine | None = None, + chain: list[TemplateDoesNotExist] | None = None, + ) -> None: ... + +class TemplateSyntaxError(Exception): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/library.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/library.pyi new file mode 100644 index 000000000000..f9d146723402 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/library.pyi @@ -0,0 +1,103 @@ +from collections.abc import Callable, Collection, Iterable, Mapping, Sequence, Sized +from typing import Any, TypeVar, overload + +from django.template.base import FilterExpression, Origin, Parser, Token +from django.template.context import Context +from django.utils.safestring import SafeString + +from .base import Node, Template + +class InvalidTemplateLibrary(Exception): ... + +_C = TypeVar("_C", bound=Callable[..., Any]) + +class Library: + filters: dict[str, Callable] + tags: dict[str, Callable] + def __init__(self) -> None: ... + @overload + def tag(self, name: _C) -> _C: ... + @overload + def tag(self, name: str, compile_function: _C) -> _C: ... + @overload + def tag(self, name: str | None = None, compile_function: None = None) -> Callable[[_C], _C]: ... + def tag_function(self, func: _C) -> _C: ... + @overload + def filter(self, name: _C, filter_func: None = None, **flags: Any) -> _C: ... + @overload + def filter(self, name: str | None, filter_func: _C, **flags: Any) -> _C: ... + @overload + def filter(self, name: str | None = None, filter_func: None = None, **flags: Any) -> Callable[[_C], _C]: ... + @overload + def simple_tag(self, func: _C, takes_context: bool | None = None, name: str | None = None) -> _C: ... + @overload + def simple_tag(self, takes_context: bool | None = None, name: str | None = None) -> Callable[[_C], _C]: ... + def inclusion_tag( + self, + filename: Template | str, + func: Callable | None = None, + takes_context: bool | None = None, + name: str | None = None, + ) -> Callable[[_C], _C]: ... + +class TagHelperNode(Node): + func: Any + takes_context: Any + args: Any + kwargs: Any + def __init__( + self, + func: Callable, + takes_context: bool | None, + args: list[FilterExpression], + kwargs: dict[str, FilterExpression], + ) -> None: ... + def get_resolved_arguments(self, context: Context) -> tuple[list[int], dict[str, SafeString | int]]: ... + +class SimpleNode(TagHelperNode): + args: list[FilterExpression] + func: Callable + kwargs: dict[str, FilterExpression] + origin: Origin + takes_context: bool | None + token: Token + target_var: str | None + def __init__( + self, + func: Callable, + takes_context: bool | None, + args: list[FilterExpression], + kwargs: dict[str, FilterExpression], + target_var: str | None, + ) -> None: ... + +class InclusionNode(TagHelperNode): + args: list[FilterExpression] + func: Callable + kwargs: dict[str, FilterExpression] + origin: Origin + takes_context: bool | None + token: Token + filename: Template | str + def __init__( + self, + func: Callable, + takes_context: bool | None, + args: list[FilterExpression], + kwargs: dict[str, FilterExpression], + filename: Template | str | None, + ) -> None: ... + +def parse_bits( + parser: Parser, + bits: Iterable[str], + params: Sequence[str], + varargs: str | None, + varkw: str | None, + defaults: Sized | None, + kwonly: Collection[str], + kwonly_defaults: Mapping[str, int] | None, + takes_context: bool | None, + name: str, +) -> tuple[list[FilterExpression], dict[str, FilterExpression]]: ... +def import_library(name: str) -> Library: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/loader.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/loader.pyi new file mode 100644 index 000000000000..284f0a4d167d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/loader.pyi @@ -0,0 +1,17 @@ +from collections.abc import Mapping, Sequence +from typing import Any + +from django.http.request import HttpRequest +from django.template.exceptions import TemplateDoesNotExist as TemplateDoesNotExist +from django.utils.safestring import SafeString + +from .backends.base import _EngineTemplate + +def get_template(template_name: str, using: str | None = None) -> _EngineTemplate: ... +def select_template(template_name_list: Sequence[str] | str, using: str | None = None) -> Any: ... +def render_to_string( + template_name: Sequence[str] | str, + context: Mapping[str, Any] | None = None, + request: HttpRequest | None = None, + using: str | None = None, +) -> SafeString: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/loader_tags.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/loader_tags.pyi new file mode 100644 index 000000000000..f90168e7b716 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/loader_tags.pyi @@ -0,0 +1,68 @@ +import collections +from typing import Any + +from django.template.base import FilterExpression, NodeList, Origin, Parser, Token +from django.template.context import Context +from django.utils.safestring import SafeString + +from .base import Node, Template + +register: Any +BLOCK_CONTEXT_KEY: str + +class BlockContext: + blocks: collections.defaultdict[str, list[BlockNode]] + def __init__(self) -> None: ... + def add_blocks(self, blocks: dict[str, BlockNode]) -> None: ... + def pop(self, name: str) -> BlockNode: ... + def push(self, name: str, block: BlockNode) -> None: ... + def get_block(self, name: str) -> BlockNode: ... + +class BlockNode(Node): + context: Context + name: str + nodelist: NodeList + origin: Origin + parent: Node | None + token: Token + def __init__(self, name: str, nodelist: NodeList, parent: Node | None = None) -> None: ... + def render(self, context: Context) -> SafeString: ... + def super(self) -> SafeString: ... + +class ExtendsNode(Node): + origin: Origin + token: Token + must_be_first: bool + context_key: str + nodelist: NodeList + parent_name: FilterExpression | Node + template_dirs: list[Any] | None + blocks: dict[str, BlockNode] + def __init__( + self, nodelist: NodeList, parent_name: FilterExpression | Node, template_dirs: list[Any] | None = None + ) -> None: ... + def find_template(self, template_name: str, context: Context) -> Template: ... + def get_parent(self, context: Context) -> Template: ... + def render(self, context: Context) -> Any: ... + +class IncludeNode(Node): + origin: Origin + token: Token + context_key: str + template: FilterExpression + extra_context: dict[str, FilterExpression] + isolated_context: bool + def __init__( + self, + template: FilterExpression, + *args: Any, + extra_context: Any | None = None, + isolated_context: bool = False, + **kwargs: Any, + ) -> None: ... + def render(self, context: Context) -> SafeString: ... + +def do_block(parser: Parser, token: Token) -> BlockNode: ... +def construct_relative_path(current_template_name: str | None, relative_name: str) -> str: ... +def do_extends(parser: Parser, token: Token) -> ExtendsNode: ... +def do_include(parser: Parser, token: Token) -> IncludeNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/app_directories.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/app_directories.pyi new file mode 100644 index 000000000000..a1c59b9259f7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/app_directories.pyi @@ -0,0 +1,3 @@ +from .filesystem import Loader as FilesystemLoader + +class Loader(FilesystemLoader): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/base.pyi new file mode 100644 index 000000000000..d7f5c9a992a4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/base.pyi @@ -0,0 +1,13 @@ +from collections.abc import Iterable +from typing import Any + +from django.template.base import Origin, Template +from django.template.engine import Engine + +class Loader: + engine: Engine + get_template_cache: dict[str, Any] + def __init__(self, engine: Engine) -> None: ... + def get_template(self, template_name: str, skip: list[Origin] | None = None) -> Template: ... + def get_template_sources(self, template_name: str) -> Iterable[Origin]: ... + def reset(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/cached.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/cached.pyi new file mode 100644 index 000000000000..c0b09745a609 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/cached.pyi @@ -0,0 +1,15 @@ +from collections.abc import Sequence +from typing import Any + +from django.template.base import Origin +from django.template.engine import Engine + +from .base import Loader as BaseLoader + +class Loader(BaseLoader): + template_cache: dict[str, Any] + loaders: list[BaseLoader] + def __init__(self, engine: Engine, loaders: Sequence[Any]) -> None: ... + def get_contents(self, origin: Origin) -> str: ... + def cache_key(self, template_name: str, skip: list[Origin] | None = None) -> str: ... + def generate_hash(self, values: list[str]) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/filesystem.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/filesystem.pyi new file mode 100644 index 000000000000..fecc8edc0370 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/filesystem.pyi @@ -0,0 +1,14 @@ +from collections.abc import Iterator +from pathlib import Path + +from django.template.base import Origin +from django.template.engine import Engine + +from .base import Loader as BaseLoader + +class Loader(BaseLoader): + dirs: list[str | Path] | None + def __init__(self, engine: Engine, dirs: list[str | Path] | None = None) -> None: ... + def get_dirs(self) -> list[str | Path]: ... + def get_contents(self, origin: Origin) -> str: ... + def get_template_sources(self, template_name: str) -> Iterator[Origin]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/locmem.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/locmem.pyi new file mode 100644 index 000000000000..339906e6bb7f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/loaders/locmem.pyi @@ -0,0 +1,9 @@ +from django.template.base import Origin +from django.template.engine import Engine + +from .base import Loader as BaseLoader + +class Loader(BaseLoader): + templates_dict: dict[str, str] + def __init__(self, engine: Engine, templates_dict: dict[str, str]) -> None: ... + def get_contents(self, origin: Origin) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/response.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/response.pyi new file mode 100644 index 000000000000..902d086f29ae --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/response.pyi @@ -0,0 +1,73 @@ +import functools +from collections.abc import Callable, Iterator, Sequence +from http.cookies import SimpleCookie +from typing import Any + +from django.core.handlers.wsgi import WSGIRequest +from django.http import HttpResponse +from django.http.request import HttpRequest +from django.template.base import Template +from django.template.context import RequestContext +from django.test.client import Client +from django.utils.datastructures import _ListOrTuple +from typing_extensions import TypeAlias + +_TemplateForResponseT: TypeAlias = _ListOrTuple[str] | Template | str + +class ContentNotRenderedError(Exception): ... + +class SimpleTemplateResponse(HttpResponse): + content: Any + closed: bool + cookies: SimpleCookie + status_code: int + rendering_attrs: Any + template_name: _TemplateForResponseT + context_data: dict[str, Any] | None + using: str | None + def __init__( + self, + template: _TemplateForResponseT, + context: dict[str, Any] | None = ..., + content_type: str | None = ..., + status: int | None = ..., + charset: str | None = ..., + using: str | None = ..., + headers: dict[str, Any] | None = ..., + ) -> None: ... + def resolve_template(self, template: Sequence[str] | Template | str) -> Template: ... + def resolve_context(self, context: dict[str, Any] | None) -> dict[str, Any] | None: ... + @property + def rendered_content(self) -> str: ... + def add_post_render_callback(self, callback: Callable) -> None: ... + def render(self) -> SimpleTemplateResponse: ... + @property + def is_rendered(self) -> bool: ... + def __iter__(self) -> Iterator[Any]: ... + +class TemplateResponse(SimpleTemplateResponse): + client: Client + closed: bool + context: RequestContext + context_data: dict[str, Any] | None + cookies: SimpleCookie + csrf_cookie_set: bool + json: functools.partial + _request: HttpRequest + status_code: int + template_name: _TemplateForResponseT + templates: list[Template] + using: str | None + wsgi_request: WSGIRequest + rendering_attrs: Any + def __init__( + self, + request: HttpRequest, + template: _TemplateForResponseT, + context: dict[str, Any] | None = ..., + content_type: str | None = ..., + status: int | None = ..., + charset: str | None = ..., + using: str | None = ..., + headers: dict[str, Any] | None = ..., + ) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/smartif.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/smartif.pyi new file mode 100644 index 000000000000..001076627cc4 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/smartif.pyi @@ -0,0 +1,44 @@ +from typing import Any + +from django.template.defaulttags import TemplateLiteral +from typing_extensions import TypeAlias + +_Token: TypeAlias = list[int] | int | str + +class TokenBase: + id: Any + value: Any + first: Any + second: Any + def nud(self, parser: Any) -> None: ... + def led(self, left: Any, parser: Any) -> None: ... + def display(self) -> Any: ... + +def infix(bp: Any, func: Any) -> type[TokenBase]: ... +def prefix(bp: Any, func: Any) -> type[TokenBase]: ... + +OPERATORS: Any + +class Literal(TokenBase): + id: str + lbp: int + value: _Token | None + def __init__(self, value: _Token | None) -> None: ... + def display(self) -> str: ... + def eval(self, context: dict[Any, Any]) -> _Token | None: ... + +class EndToken(TokenBase): + lbp: int + def nud(self, parser: Any) -> None: ... + +class IfParser: + error_class: Any + tokens: Any + pos: int + current_token: Any + def __init__(self, tokens: list[_Token | None]) -> None: ... + def translate_token(self, token: _Token | None) -> Literal: ... + def next_token(self) -> Literal: ... + def parse(self) -> TemplateLiteral: ... + def expression(self, rbp: int = 0) -> Literal: ... + def create_var(self, value: _Token | None) -> Literal: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/template/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/template/utils.pyi new file mode 100644 index 000000000000..6c3245aad869 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/template/utils.pyi @@ -0,0 +1,19 @@ +from collections.abc import Iterator +from pathlib import Path +from typing import Any + +from django.core.exceptions import ImproperlyConfigured +from django.template.backends.base import BaseEngine +from django.utils.functional import cached_property + +class InvalidTemplateEngineError(ImproperlyConfigured): ... + +class EngineHandler: + def __init__(self, templates: list[dict[str, Any]] | None = None) -> None: ... + @cached_property + def templates(self) -> dict[str, Any]: ... + def __getitem__(self, alias: str) -> BaseEngine: ... + def __iter__(self) -> Iterator[Any]: ... + def all(self) -> list[BaseEngine]: ... + +def get_app_template_dirs(dirname: str) -> tuple[Path, ...]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/templatetags/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/templatetags/cache.pyi b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/cache.pyi new file mode 100644 index 000000000000..83167db76329 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/cache.pyi @@ -0,0 +1,23 @@ +from typing import Any + +from django.template import Node +from django.template.base import FilterExpression, NodeList, Parser, Token + +register: Any + +class CacheNode(Node): + nodelist: NodeList + expire_time_var: FilterExpression + fragment_name: str + vary_on: list[FilterExpression] + cache_name: FilterExpression | None + def __init__( + self, + nodelist: NodeList, + expire_time_var: FilterExpression, + fragment_name: str, + vary_on: list[FilterExpression], + cache_name: FilterExpression | None, + ) -> None: ... + +def do_cache(parser: Parser, token: Token) -> CacheNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/templatetags/i18n.pyi b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/i18n.pyi new file mode 100644 index 000000000000..db0d930bc326 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/i18n.pyi @@ -0,0 +1,92 @@ +from typing import Any + +from django.template import Node +from django.template.base import FilterExpression, NodeList, Parser, Token +from django.template.context import Context + +register: Any + +class GetAvailableLanguagesNode(Node): + variable: str + def __init__(self, variable: str) -> None: ... + def render(self, context: Context) -> str: ... + +class GetLanguageInfoNode(Node): + lang_code: FilterExpression + variable: str + def __init__(self, lang_code: FilterExpression, variable: str) -> None: ... + def render(self, context: Context) -> str: ... + +class GetLanguageInfoListNode(Node): + languages: FilterExpression + variable: str + def __init__(self, languages: FilterExpression, variable: str) -> None: ... + def get_language_info(self, language: Any) -> Any: ... + def render(self, context: Context) -> str: ... + +class GetCurrentLanguageNode(Node): + variable: str + def __init__(self, variable: str) -> None: ... + def render(self, context: Context) -> str: ... + +class GetCurrentLanguageBidiNode(Node): + variable: str + def __init__(self, variable: str) -> None: ... + def render(self, context: Context) -> str: ... + +class TranslateNode(Node): + noop: bool + asvar: str | None + message_context: FilterExpression | None + filter_expression: FilterExpression + def __init__( + self, + filter_expression: FilterExpression, + noop: bool, + asvar: str | None = None, + message_context: FilterExpression | None = None, + ) -> None: ... + def render(self, context: Context) -> str: ... + +class BlockTranslateNode(Node): + extra_context: dict[str, FilterExpression] + singular: list[Token] + plural: list[Token] + countervar: str | None + counter: FilterExpression | None + message_context: FilterExpression | None + trimmed: bool + asvar: str | None + def __init__( + self, + extra_context: dict[str, FilterExpression], + singular: list[Token], + plural: list[Token] | None = None, + countervar: str | None = None, + counter: FilterExpression | None = None, + message_context: FilterExpression | None = None, + trimmed: bool = False, + asvar: str | None = None, + tag_name: str = "blocktranslate", + ) -> None: ... + def render_token_list(self, tokens: list[Token]) -> tuple[str, list[str]]: ... + def render(self, context: Context, nested: bool = False) -> str: ... + +class LanguageNode(Node): + nodelist: NodeList + language: FilterExpression + def __init__(self, nodelist: NodeList, language: FilterExpression) -> None: ... + def render(self, context: Context) -> str: ... + +def do_get_available_languages(parser: Parser, token: Token) -> GetAvailableLanguagesNode: ... +def do_get_language_info(parser: Parser, token: Token) -> GetLanguageInfoNode: ... +def do_get_language_info_list(parser: Parser, token: Token) -> GetLanguageInfoListNode: ... +def language_name(lang_code: str) -> str: ... +def language_name_translated(lang_code: str) -> str: ... +def language_name_local(lang_code: str) -> str: ... +def language_bidi(lang_code: str) -> bool: ... +def do_get_current_language(parser: Parser, token: Token) -> GetCurrentLanguageNode: ... +def do_get_current_language_bidi(parser: Parser, token: Token) -> GetCurrentLanguageBidiNode: ... +def do_translate(parser: Parser, token: Token) -> TranslateNode: ... +def do_block_translate(parser: Parser, token: Token) -> BlockTranslateNode: ... +def language(parser: Parser, token: Token) -> LanguageNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/templatetags/l10n.pyi b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/l10n.pyi new file mode 100644 index 000000000000..bbbf1d99ad51 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/l10n.pyi @@ -0,0 +1,16 @@ +from typing import Any + +from django.template import Node +from django.template.base import Parser, Token + +register: Any + +def localize(value: Any) -> str: ... +def unlocalize(value: Any) -> str: ... + +class LocalizeNode(Node): + nodelist: list[Node] + use_l10n: bool + def __init__(self, nodelist: list[Node], use_l10n: bool) -> None: ... + +def localize_tag(parser: Parser, token: Token) -> LocalizeNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/templatetags/static.pyi b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/static.pyi new file mode 100644 index 000000000000..85d1a4154b5b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/static.pyi @@ -0,0 +1,32 @@ +from typing import Any + +from django import template +from django.template.base import FilterExpression, Parser, Token +from django.template.context import Context + +register: Any + +class PrefixNode(template.Node): + varname: str | None + name: str + def __init__(self, varname: str | None = None, name: str | None = None) -> None: ... + @classmethod + def handle_token(cls, parser: Parser, token: Token, name: str) -> PrefixNode: ... + @classmethod + def handle_simple(cls, name: str) -> str: ... + +def get_static_prefix(parser: Parser, token: Token) -> PrefixNode: ... +def get_media_prefix(parser: Parser, token: Token) -> PrefixNode: ... + +class StaticNode(template.Node): + path: FilterExpression + varname: str | None + def __init__(self, varname: str | None = None, path: FilterExpression | None = None) -> None: ... + def url(self, context: Context) -> str: ... + @classmethod + def handle_simple(cls, path: str) -> str: ... + @classmethod + def handle_token(cls, parser: Parser, token: Token) -> StaticNode: ... + +def do_static(parser: Parser, token: Token) -> StaticNode: ... +def static(path: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/templatetags/tz.pyi b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/tz.pyi new file mode 100644 index 000000000000..2a1a5209d566 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/templatetags/tz.pyi @@ -0,0 +1,31 @@ +from datetime import datetime, tzinfo +from typing import Any + +from django.template import Node +from django.template.base import FilterExpression, NodeList, Parser, Token + +register: Any + +class datetimeobject(datetime): ... + +def localtime(value: datetime | str | None) -> Any: ... +def utc(value: datetime | str | None) -> Any: ... +def do_timezone(value: datetime | str | None, arg: tzinfo | str | None) -> Any: ... + +class LocalTimeNode(Node): + nodelist: NodeList + use_tz: bool + def __init__(self, nodelist: NodeList, use_tz: bool) -> None: ... + +class TimezoneNode(Node): + nodelist: NodeList + tz: FilterExpression + def __init__(self, nodelist: NodeList, tz: FilterExpression) -> None: ... + +class GetCurrentTimezoneNode(Node): + variable: str + def __init__(self, variable: str) -> None: ... + +def localtime_tag(parser: Parser, token: Token) -> LocalTimeNode: ... +def timezone_tag(parser: Parser, token: Token) -> TimezoneNode: ... +def get_current_timezone_tag(parser: Parser, token: Token) -> GetCurrentTimezoneNode: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/__init__.pyi new file mode 100644 index 000000000000..d536c6b76115 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/__init__.pyi @@ -0,0 +1,16 @@ +from .client import AsyncClient as AsyncClient +from .client import AsyncRequestFactory as AsyncRequestFactory +from .client import Client as Client +from .client import RequestFactory as RequestFactory +from .testcases import LiveServerTestCase as LiveServerTestCase +from .testcases import SimpleTestCase as SimpleTestCase +from .testcases import TestCase as TestCase +from .testcases import TransactionTestCase as TransactionTestCase +from .testcases import skipIfDBFeature as skipIfDBFeature +from .testcases import skipUnlessAnyDBFeature as skipUnlessAnyDBFeature +from .testcases import skipUnlessDBFeature as skipUnlessDBFeature +from .utils import ignore_warnings as ignore_warnings +from .utils import modify_settings as modify_settings +from .utils import override_settings as override_settings +from .utils import override_system_checks as override_system_checks +from .utils import tag as tag diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/client.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/client.pyi new file mode 100644 index 000000000000..a67b06458d4d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/client.pyi @@ -0,0 +1,421 @@ +from collections.abc import AsyncIterable, AsyncIterator, Awaitable, Callable, Iterable, Iterator, Mapping +from http import HTTPStatus +from http.cookies import SimpleCookie +from io import BytesIO, IOBase +from json import JSONEncoder +from re import Pattern +from types import TracebackType +from typing import Any, Generic, Literal, NoReturn, TypedDict, TypeVar, type_check_only + +from asgiref.typing import ASGIVersions +from django.contrib.auth.base_user import _UserModel +from django.contrib.sessions.backends.base import SessionBase +from django.core.handlers.asgi import ASGIRequest +from django.core.handlers.base import BaseHandler +from django.core.handlers.wsgi import WSGIRequest +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase +from django.template.base import Template +from django.test.utils import ContextList +from django.urls import ResolverMatch +from typing_extensions import TypeAlias + +BOUNDARY: str +MULTIPART_CONTENT: str +CONTENT_TYPE_RE: Pattern[str] +JSON_CONTENT_TYPE_RE: Pattern[str] +REDIRECT_STATUS_CODES: frozenset[HTTPStatus] + +class RedirectCycleError(Exception): + last_response: HttpResponseBase + redirect_chain: list[tuple[str, int]] + def __init__(self, message: str, last_response: HttpResponseBase) -> None: ... + +class FakePayload(IOBase): + read_started: bool + def __init__(self, initial_bytes: bytes | str | None = ...) -> None: ... + def __len__(self) -> int: ... + def read(self, size: int = ...) -> bytes: ... + def readline(self, size: int | None = ..., /) -> bytes: ... + def write(self, content: bytes | str) -> None: ... + +_T = TypeVar("_T") + +def closing_iterator_wrapper(iterable: Iterable[_T], close: Callable[[], Any]) -> Iterator[_T]: ... +async def aclosing_iterator_wrapper(iterable: AsyncIterable[_T], close: Callable[[], Any]) -> AsyncIterator[_T]: ... +def conditional_content_removal(request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... +@type_check_only +class _WSGIResponse(HttpResponseBase): + wsgi_request: WSGIRequest + +@type_check_only +class _ASGIResponse(HttpResponseBase): + asgi_request: ASGIRequest + +class ClientHandler(BaseHandler): + enforce_csrf_checks: bool + def __init__(self, enforce_csrf_checks: bool = ..., *args: Any, **kwargs: Any) -> None: ... + def __call__(self, environ: dict[str, Any]) -> _WSGIResponse: ... + +class AsyncClientHandler(BaseHandler): + enforce_csrf_checks: bool + def __init__(self, enforce_csrf_checks: bool = ..., *args: Any, **kwargs: Any) -> None: ... + async def __call__(self, scope: dict[str, Any]) -> _ASGIResponse: ... + +def encode_multipart(boundary: str, data: dict[str, Any]) -> bytes: ... +def encode_file(boundary: str, key: str, file: Any) -> list[bytes]: ... + +_GetDataType: TypeAlias = ( + Mapping[str, str | bytes | int | Iterable[str | bytes | int]] + | Iterable[tuple[str, str | bytes | int | Iterable[str | bytes | int]]] + | None +) + +@type_check_only +class _RequestFactory(Generic[_T]): + json_encoder: type[JSONEncoder] + defaults: dict[str, str] + cookies: SimpleCookie + errors: BytesIO + def __init__( + self, *, json_encoder: type[JSONEncoder] = ..., headers: Mapping[str, Any] | None = ..., **defaults: Any + ) -> None: ... + def request(self, **request: Any) -> _T: ... + def get( + self, + path: str, + data: _GetDataType = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _T: ... + def post( + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _T: ... + def head( + self, path: str, data: Any = ..., secure: bool = ..., *, headers: Mapping[str, Any] | None = ..., **extra: Any + ) -> _T: ... + def trace(self, path: str, secure: bool = ..., *, headers: Mapping[str, Any] | None = ..., **extra: Any) -> _T: ... + def options( + self, + path: str, + data: dict[str, str] | str = ..., + content_type: str = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _T: ... + def put( + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _T: ... + def patch( + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _T: ... + def delete( + self, + path: str, + data: Any = ..., + content_type: str = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _T: ... + def generic( + self, + method: str, + path: str, + data: Any = ..., + content_type: str | None = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _T: ... + +class RequestFactory(_RequestFactory[WSGIRequest]): ... + +# A non total duplication of `asgiref.typing.HTTPScope` +@type_check_only +class _HTTPScope(TypedDict, total=False): + type: Literal["http"] + asgi: ASGIVersions + http_version: str + method: str + scheme: str + path: str + raw_path: bytes + query_string: bytes + root_path: str + headers: Iterable[tuple[bytes, bytes]] + client: tuple[str, int] | None + server: tuple[str, int | None] | None + state: dict[str, Any] + extensions: dict[str, dict[object, object]] | None + +@type_check_only +class _AsyncRequestFactory(_RequestFactory[_T]): + defaults: _HTTPScope # type: ignore[assignment] + +class AsyncRequestFactory(_AsyncRequestFactory[ASGIRequest]): ... + +# fakes to distinguish WSGIRequest and ASGIRequest +@type_check_only +class _MonkeyPatchedWSGIResponse(_WSGIResponse): + def json(self) -> Any: ... + request: dict[str, Any] + client: Client + templates: list[Template] + context: ContextList | dict[str, Any] + content: bytes + resolver_match: ResolverMatch + redirect_chain: list[tuple[str, int]] + +@type_check_only +class _MonkeyPatchedASGIResponse(_ASGIResponse): + def json(self) -> Any: ... + request: dict[str, Any] + client: AsyncClient + templates: list[Template] + context: ContextList | dict[str, Any] + content: bytes + resolver_match: ResolverMatch + redirect_chain: list[tuple[str, int]] + +class ClientMixin: + def store_exc_info(self, **kwargs: Any) -> None: ... + def check_exception(self, response: HttpResponseBase) -> NoReturn: ... + @property + def session(self) -> SessionBase: ... + async def asession(self) -> SessionBase: ... + def login(self, **credentials: Any) -> bool: ... + async def alogin(self, **credentials: Any) -> bool: ... + def force_login(self, user: _UserModel, backend: str | None = ...) -> None: ... + async def aforce_login(self, user: _UserModel, backend: str | None = ...) -> None: ... + def logout(self) -> None: ... + async def alogout(self) -> None: ... + +class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]): + handler: ClientHandler + raise_request_exception: bool + exc_info: tuple[type[BaseException], BaseException, TracebackType] | None + extra: dict[str, Any] | None + headers: dict[str, Any] + def __init__( + self, + enforce_csrf_checks: bool = ..., + raise_request_exception: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **defaults: Any, + ) -> None: ... + def request(self, **request: Any) -> _MonkeyPatchedWSGIResponse: ... + def get( # type: ignore[override] + self, + path: str, + data: _GetDataType = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedWSGIResponse: ... + def post( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedWSGIResponse: ... + def head( # type: ignore[override] + self, + path: str, + data: Any = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedWSGIResponse: ... + def options( # type: ignore[override] + self, + path: str, + data: dict[str, str] | str = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedWSGIResponse: ... + def put( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedWSGIResponse: ... + def patch( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedWSGIResponse: ... + def delete( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedWSGIResponse: ... + def trace( # type: ignore[override] + self, + path: str, + data: Any = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedWSGIResponse: ... + +class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGIResponse]]): + handler: AsyncClientHandler + raise_request_exception: bool + exc_info: Any + extra: dict[str, Any] | None + headers: dict[str, Any] + def __init__( + self, + enforce_csrf_checks: bool = ..., + raise_request_exception: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **defaults: Any, + ) -> None: ... + async def request(self, **request: Any) -> _MonkeyPatchedASGIResponse: ... + async def get( # type: ignore[override] + self, + path: str, + data: _GetDataType = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def post( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def head( # type: ignore[override] + self, + path: str, + data: Any = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def options( # type: ignore[override] + self, + path: str, + data: dict[str, str] | str = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def put( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def patch( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def delete( # type: ignore[override] + self, + path: str, + data: Any = ..., + content_type: str = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... + async def trace( # type: ignore[override] + self, + path: str, + data: Any = ..., + follow: bool = ..., + secure: bool = ..., + *, + headers: Mapping[str, Any] | None = ..., + **extra: Any, + ) -> _MonkeyPatchedASGIResponse: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/html.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/html.pyi new file mode 100644 index 000000000000..3495d7b7d0a7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/html.pyi @@ -0,0 +1,42 @@ +from collections.abc import Sequence +from html.parser import HTMLParser +from re import Pattern +from typing import Any + +from typing_extensions import TypeAlias + +ASCII_WHITESPACE: Pattern[str] +BOOLEAN_ATTRIBUTES: set[str] + +def normalize_whitespace(string: str) -> str: ... +def normalize_attributes(attributes: list[tuple[str, str | None]]) -> list[tuple[str, str | None]]: ... + +_ElementAttribute: TypeAlias = tuple[str, str | None] + +class Element: + name: str | None + attributes: list[_ElementAttribute] + children: list[Any] + def __init__(self, name: str | None, attributes: Sequence[_ElementAttribute]) -> None: ... + def append(self, element: Element | str) -> None: ... + def finalize(self) -> None: ... + def __contains__(self, element: Element | str) -> bool: ... + def count(self, element: Element | str) -> int: ... + def __getitem__(self, key: int) -> Any: ... + +class RootElement(Element): + def __init__(self) -> None: ... + +class HTMLParseError(Exception): ... + +class Parser(HTMLParser): + root: Any + open_tags: Any + element_positions: Any + def __init__(self) -> None: ... + def error(self, msg: str) -> HTMLParseError: ... + def format_position(self, position: Any = ..., element: Any = ...) -> str: ... + @property + def current(self) -> Element: ... + +def parse_html(html: str) -> Element: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/runner.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/runner.pyi new file mode 100644 index 000000000000..47f6ae69ad71 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/runner.pyi @@ -0,0 +1,171 @@ +import logging +from argparse import ArgumentParser +from collections.abc import Iterator, Sequence +from contextlib import contextmanager +from io import StringIO +from typing import Any, Literal +from unittest import TestCase, TestLoader, TestSuite, TextTestResult, TextTestRunner + +from django.db.backends.base.base import BaseDatabaseWrapper +from django.test.testcases import SimpleTestCase +from django.test.utils import TimeKeeperProtocol +from django.utils.datastructures import OrderedSet + +class DebugSQLTextTestResult(TextTestResult): + buffer: bool + descriptions: bool + dots: bool + expectedFailures: list[Any] + failfast: bool + shouldStop: bool + showAll: bool + skipped: list[Any] + tb_locals: bool + testsRun: int + unexpectedSuccesses: list[Any] + logger: logging.Logger + # typeshed thinks it's TextIO, but unittest wraps it with _WritelnDecorator + # adding `writeln` method + # See https://github.com/python/cpython/blob/main/Lib/unittest/runner.py + stream: Any + def __init__(self, stream: Any, descriptions: bool, verbosity: int) -> None: ... + debug_sql_stream: StringIO + handler: logging.StreamHandler + def startTest(self, test: TestCase) -> None: ... + def stopTest(self, test: TestCase) -> None: ... + def addError(self, test: Any, err: Any) -> None: ... + def addFailure(self, test: Any, err: Any) -> None: ... + +class PDBDebugResult(TextTestResult): ... + +class RemoteTestResult: + events: list[Any] + failfast: bool + shouldStop: bool + testsRun: int + def __init__(self) -> None: ... + @property + def test_index(self) -> int: ... + def check_picklable(self, test: Any, err: Any) -> None: ... + def _confirm_picklable(self, obj: Any) -> None: ... + def check_subtest_picklable(self, test: Any, subtest: Any) -> None: ... + def stop_if_failfast(self) -> None: ... + def stop(self) -> None: ... + def startTestRun(self) -> None: ... + def stopTestRun(self) -> None: ... + def startTest(self, test: Any) -> None: ... + def stopTest(self, test: Any) -> None: ... + def addDuration(self, test: Any, elapsed: Any) -> None: ... + def addError(self, test: Any, err: Any) -> None: ... + def addFailure(self, test: Any, err: Any) -> None: ... + def addSubTest(self, test: Any, subtest: Any, err: Any) -> None: ... + def addSuccess(self, test: Any) -> None: ... + def addSkip(self, test: Any, reason: Any) -> None: ... + def addExpectedFailure(self, test: Any, err: Any) -> None: ... + def addUnexpectedSuccess(self, test: Any) -> None: ... + +class RemoteTestRunner: + resultclass: Any + failfast: bool + buffer: bool + def __init__(self, failfast: bool = ..., resultclass: Any | None = ..., buffer: bool = ...) -> None: ... + def run(self, test: Any) -> Any: ... + +def default_test_processes() -> int: ... + +class ParallelTestSuite(TestSuite): + init_worker: Any + run_subsuite: Any + runner_class: Any + subsuites: list[TestSuite] + processes: int + failfast: bool + buffer: bool + initial_settings: Any + serialized_contents: Any + used_aliases: set[str] | None + def __init__( + self, subsuites: list[TestSuite], processes: int, failfast: bool = ..., buffer: bool = ... + ) -> None: ... + def run(self, result: Any) -> Any: ... # type: ignore[override] + +class DiscoverRunner: + test_suite: type[TestSuite] + parallel_test_suite: type[ParallelTestSuite] + test_runner: type[TextTestRunner] + test_loader: TestLoader + reorder_by: tuple[SimpleTestCase, ...] + pattern: str | None + top_level: str | None + verbosity: int + interactive: bool + failfast: bool + keepdb: bool + reverse: bool + debug_mode: bool + debug_sql: bool + parallel: int + tags: set[str] + exclude_tags: set[str] + pdb: bool + buffer: bool + test_name_patterns: set[str] | None + time_keeper: TimeKeeperProtocol + shuffle: int | Literal[False] + logger: logging.Logger | None + def __init__( + self, + pattern: str | None = ..., + top_level: str | None = ..., + verbosity: int = ..., + interactive: bool = ..., + failfast: bool = ..., + keepdb: bool = ..., + reverse: bool = ..., + debug_mode: bool = ..., + debug_sql: bool = ..., + parallel: int = ..., + tags: list[str] | None = ..., + exclude_tags: list[str] | None = ..., + test_name_patterns: list[str] | None = ..., + pdb: bool = ..., + buffer: bool = ..., + enable_faulthandler: bool = ..., + timing: bool = ..., + shuffle: int | Literal[False] = ..., + logger: logging.Logger | None = ..., + durations: int | None = ..., + **kwargs: Any, + ) -> None: ... + @classmethod + def add_arguments(cls, parser: ArgumentParser) -> None: ... + @property + def shuffle_seed(self) -> int | None: ... + def log(self, msg: str, level: int | None) -> None: ... + def setup_test_environment(self, **kwargs: Any) -> None: ... + def setup_shuffler(self) -> None: ... + @contextmanager + def load_with_patterns(self) -> Iterator[None]: ... + def load_tests_for_label(self, label: str, discover_kwargs: dict[str, str]) -> TestSuite: ... + def build_suite(self, test_labels: Sequence[str] | None = ..., **kwargs: Any) -> TestSuite: ... + def setup_databases(self, **kwargs: Any) -> list[tuple[BaseDatabaseWrapper, str, bool]]: ... + def get_resultclass(self) -> type[TextTestResult] | None: ... + def get_test_runner_kwargs(self) -> dict[str, Any]: ... + def run_checks(self, databases: set[str]) -> None: ... + def run_suite(self, suite: TestSuite, **kwargs: Any) -> TextTestResult: ... + def teardown_databases(self, old_config: list[tuple[BaseDatabaseWrapper, str, bool]], **kwargs: Any) -> None: ... + def teardown_test_environment(self, **kwargs: Any) -> None: ... + def suite_result(self, suite: TestSuite, result: TextTestResult, **kwargs: Any) -> int: ... + def _get_databases(self, suite: TestSuite) -> set[str]: ... + def get_databases(self, suite: TestSuite) -> set[str]: ... + def run_tests(self, test_labels: list[str], **kwargs: Any) -> int: ... + +def is_discoverable(label: str) -> bool: ... +def reorder_suite( + suite: TestSuite, classes: tuple[type[TestCase], type[SimpleTestCase]], reverse: bool = ... +) -> TestSuite: ... +def partition_suite_by_type( + suite: TestSuite, classes: tuple[type[TestCase], type[SimpleTestCase]], bins: list[OrderedSet], reverse: bool = ... +) -> None: ... +def partition_suite_by_case(suite: Any) -> list[Any]: ... +def filter_tests_by_tags(suite: TestSuite, tags: set[str], exclude_tags: set[str]) -> TestSuite: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi new file mode 100644 index 000000000000..ffed31dd90ef --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/selenium.pyi @@ -0,0 +1,18 @@ +from collections.abc import Generator +from contextlib import contextmanager +from typing import Any + +from django.test import LiveServerTestCase + +class SeleniumTestCaseBase: + browsers: Any + browser: Any + @classmethod + def import_webdriver(cls, browser: Any) -> type[Any]: ... # Type[WebDriver] + def create_webdriver(self) -> Any: ... # WebDriver + +class SeleniumTestCase(LiveServerTestCase): + implicit_wait: int + selenium: Any + @contextmanager + def disable_implicit_wait(self) -> Generator[None, None, None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/signals.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/signals.pyi new file mode 100644 index 000000000000..00ef8e95e651 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/signals.pyi @@ -0,0 +1,23 @@ +from typing import Any + +from django.core.signals import setting_changed as setting_changed + +template_rendered: Any +COMPLEX_OVERRIDE_SETTINGS: Any + +def clear_cache_handlers(*, setting: str, **kwargs: Any) -> None: ... +def update_installed_apps(*, setting: str, **kwargs: Any) -> None: ... +def update_connections_time_zone(*, setting: str, **kwargs: Any) -> None: ... +def clear_routers_cache(*, setting: str, **kwargs: Any) -> None: ... +def reset_template_engines(*, setting: str, **kwargs: Any) -> None: ... +def storages_changed(*, setting: str, **kwargs: Any) -> None: ... +def clear_serializers_cache(*, setting: str, **kwargs: Any) -> None: ... +def language_changed(*, setting: str, **kwargs: Any) -> None: ... +def localize_settings_changed(*, setting: str, **kwargs: Any) -> None: ... +def file_storage_changed(*, setting: str, **kwargs: Any) -> None: ... +def complex_setting_changed(*, setting: str, enter: bool, **kwargs: Any) -> None: ... +def root_urlconf_changed(*, setting: str, **kwargs: Any) -> None: ... +def static_storage_changed(*, setting: str, **kwargs: Any) -> None: ... +def static_finders_changed(*, setting: str, **kwargs: Any) -> None: ... +def auth_password_validators_changed(*, setting: str, **kwargs: Any) -> None: ... +def user_model_swapped(*, setting: str, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi new file mode 100644 index 000000000000..7b898c932b55 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/testcases.pyi @@ -0,0 +1,269 @@ +import threading +import unittest +from collections.abc import Callable, Collection, Generator, Iterable, Iterator, Mapping, Sequence +from contextlib import contextmanager +from types import TracebackType +from typing import Any, overload + +from django.core.exceptions import ImproperlyConfigured +from django.core.handlers.wsgi import WSGIHandler +from django.core.servers.basehttp import ThreadedWSGIServer, WSGIRequestHandler +from django.db import connections as connections +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.base import Model +from django.db.models.query import QuerySet, RawQuerySet +from django.forms import BaseFormSet, Form +from django.forms.fields import EmailField +from django.http import HttpRequest +from django.http.response import FileResponse, HttpResponseBase +from django.template.base import Template +from django.test.client import AsyncClient, Client +from django.test.html import Element +from django.test.utils import CaptureQueriesContext, ContextList +from django.utils.functional import classproperty +from typing_extensions import Self + +def to_list(value: Any) -> list[Any]: ... +def assert_and_parse_html(self: Any, html: str, user_msg: str, msg: str) -> Element: ... + +class _AssertNumQueriesContext(CaptureQueriesContext): + test_case: SimpleTestCase + num: int + def __init__(self, test_case: Any, num: Any, connection: BaseDatabaseWrapper) -> None: ... + +class _AssertTemplateUsedContext: + test_case: SimpleTestCase + template_name: str + rendered_templates: list[Template] + context: ContextList + def __init__(self, test_case: Any, template_name: Any) -> None: ... + def on_template_render(self, sender: Any, signal: Any, template: Any, context: Any, **kwargs: Any) -> None: ... + def test(self) -> None: ... + def message(self) -> str: ... + def __enter__(self) -> Self: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + +class _AssertTemplateNotUsedContext(_AssertTemplateUsedContext): ... + +class _DatabaseFailure: + wrapped: Any + message: str + def __init__(self, wrapped: Any, message: str) -> None: ... + def __call__(self) -> None: ... + +class SimpleTestCase(unittest.TestCase): + client_class: type[Client] + client: Client + async_client_class: type[AsyncClient] + async_client: AsyncClient + # TODO: str -> Literal['__all__'] + databases: set[str] | str + def __call__(self, result: unittest.TestResult | None = ...) -> None: ... + def settings(self, **kwargs: Any) -> Any: ... + def modify_settings(self, **kwargs: Any) -> Any: ... + def assertRedirects( + self, + response: HttpResponseBase, + expected_url: str, + status_code: int = ..., + target_status_code: int = ..., + msg_prefix: str = ..., + fetch_redirect_response: bool = ..., + ) -> None: ... + def assertURLEqual( + self, + url1: str | Any, # Any for reverse_lazy() support + url2: str | Any, + msg_prefix: str = ..., + ) -> None: ... + def assertContains( + self, + response: HttpResponseBase, + text: bytes | int | str, + count: int | None = ..., + status_code: int = ..., + msg_prefix: str = ..., + html: bool = ..., + ) -> None: ... + def assertNotContains( + self, + response: HttpResponseBase, + text: bytes | str, + status_code: int = ..., + msg_prefix: str = ..., + html: bool = ..., + ) -> None: ... + def assertFormError( + self, + form: Form, + field: str | None, + errors: list[str] | str, + msg_prefix: str = ..., + ) -> None: ... + # assertFormsetError (lowercase "set") deprecated in Django 4.2 + def assertFormsetError( + self, + formset: BaseFormSet, + form_index: int | None, + field: str | None, + errors: list[str] | str, + msg_prefix: str = ..., + ) -> None: ... + def assertFormSetError( + self, + formset: BaseFormSet, + form_index: int | None, + field: str | None, + errors: list[str] | str, + msg_prefix: str = ..., + ) -> None: ... + def assertTemplateUsed( + self, + response: HttpResponseBase | str | None = ..., + template_name: str | None = ..., + msg_prefix: str = ..., + count: int | None = ..., + ) -> _AssertTemplateUsedContext | None: ... + def assertTemplateNotUsed( + self, response: HttpResponseBase | str | None = ..., template_name: str | None = ..., msg_prefix: str = ... + ) -> _AssertTemplateNotUsedContext | None: ... + def assertRaisesMessage( + self, expected_exception: type[Exception], expected_message: str, *args: Any, **kwargs: Any + ) -> Any: ... + def assertWarnsMessage( + self, expected_warning: type[Exception], expected_message: str, *args: Any, **kwargs: Any + ) -> Any: ... + def assertFieldOutput( + self, + fieldclass: type[EmailField], + valid: dict[str, str], + invalid: dict[str, list[str]], + field_args: Iterable[Any] | None = ..., + field_kwargs: Mapping[str, Any] | None = ..., + empty_value: str = ..., + ) -> Any: ... + def assertHTMLEqual(self, html1: str, html2: str, msg: str | None = ...) -> None: ... + def assertHTMLNotEqual(self, html1: str, html2: str, msg: str | None = ...) -> None: ... + def assertInHTML(self, needle: str, haystack: str, count: int | None = ..., msg_prefix: str = ...) -> None: ... + def assertJSONEqual( + self, + raw: str, + expected_data: dict[str, Any] | list[Any] | str | int | float | bool | None, + msg: str | None = ..., + ) -> None: ... + def assertJSONNotEqual( + self, + raw: str, + expected_data: dict[str, Any] | list[Any] | str | int | float | bool | None, + msg: str | None = ..., + ) -> None: ... + def assertXMLEqual(self, xml1: str, xml2: str, msg: str | None = ...) -> None: ... + def assertXMLNotEqual(self, xml1: str, xml2: str, msg: str | None = ...) -> None: ... + +class TransactionTestCase(SimpleTestCase): + reset_sequences: bool + available_apps: Any + fixtures: Any + multi_db: bool + serialized_rollback: bool + # assertQuerysetEqual (lowercase "set") deprecated in Django 4.2 + def assertQuerysetEqual( + self, + qs: Iterator[Any] | list[Model] | QuerySet | RawQuerySet, + values: Collection[Any], + transform: Callable[[Model], Any] | type[str] = ..., + ordered: bool = ..., + msg: str | None = ..., + ) -> None: ... + def assertQuerySetEqual( + self, + qs: Iterator[Any] | list[Model] | QuerySet | RawQuerySet, + values: Collection[Any], + transform: Callable[[Model], Any] | type[str] | None = ..., + ordered: bool = ..., + msg: str | None = ..., + ) -> None: ... + @overload + def assertNumQueries(self, num: int, func: None = None, *, using: str = ...) -> _AssertNumQueriesContext: ... + @overload + def assertNumQueries( + self, num: int, func: Callable[..., Any], *args: Any, using: str = ..., **kwargs: Any + ) -> None: ... + +class TestCase(TransactionTestCase): + @classmethod + def setUpTestData(cls) -> None: ... + @classmethod + @contextmanager + def captureOnCommitCallbacks( + cls, *, using: str = ..., execute: bool = ... + ) -> Generator[list[Callable[[], Any]], None, None]: ... + +class CheckCondition: + conditions: Sequence[tuple[Callable, str]] + def __init__(self, *conditions: tuple[Callable, str]) -> None: ... + def add_condition(self, condition: Callable, reason: str) -> CheckCondition: ... + def __get__(self, instance: None, cls: type[TransactionTestCase] | None = ...) -> bool: ... + +def skipIfDBFeature(*features: Any) -> Callable: ... +def skipUnlessDBFeature(*features: Any) -> Callable: ... +def skipUnlessAnyDBFeature(*features: Any) -> Callable: ... + +class QuietWSGIRequestHandler(WSGIRequestHandler): ... + +class FSFilesHandler(WSGIHandler): + application: Any + base_url: Any + def __init__(self, application: Any) -> None: ... + def file_path(self, url: Any) -> str: ... + def serve(self, request: HttpRequest) -> FileResponse: ... + +class _StaticFilesHandler(FSFilesHandler): + def get_base_dir(self) -> str: ... + def get_base_url(self) -> str: ... + +class _MediaFilesHandler(FSFilesHandler): + def get_base_dir(self) -> str: ... + def get_base_url(self) -> str: ... + +class LiveServerThread(threading.Thread): + host: str + port: int + is_ready: threading.Event + error: ImproperlyConfigured | None + static_handler: type[WSGIHandler] + connections_override: dict[str, BaseDatabaseWrapper] + def __init__( + self, + host: str, + static_handler: type[WSGIHandler], + connections_override: dict[str, BaseDatabaseWrapper] = ..., + port: int = ..., + ) -> None: ... + httpd: ThreadedWSGIServer + def terminate(self) -> None: ... + +class LiveServerTestCase(TransactionTestCase): + host: str + port: int + server_thread_class: type[Any] + server_thread: Any + static_handler: Any + @classproperty + def live_server_url(cls: Any) -> str: ... + @classproperty + def allowed_host(cls: Any) -> str: ... + +class SerializeMixin: + lockfile: Any + @classmethod + def setUpClass(cls) -> None: ... + @classmethod + def tearDownClass(cls) -> None: ... + +def connections_support_transactions(aliases: Iterable[str] | None = ...) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi new file mode 100644 index 000000000000..860cd47aa931 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/test/utils.pyi @@ -0,0 +1,177 @@ +import decimal +from collections.abc import Callable, Iterable, Iterator, Mapping +from contextlib import AbstractContextManager, contextmanager +from decimal import Decimal +from io import StringIO +from logging import Logger +from types import TracebackType +from typing import Any, Protocol, SupportsIndex, TypeVar, type_check_only + +from django.apps.registry import Apps +from django.conf import LazySettings, Settings +from django.core.checks.registry import CheckRegistry +from django.db.backends.base.base import BaseDatabaseWrapper +from django.db.models.lookups import Lookup, Transform +from django.db.models.query_utils import RegisterLookupMixin +from django.test.runner import DiscoverRunner +from django.test.testcases import SimpleTestCase +from typing_extensions import Self, TypeAlias + +_TestClass: TypeAlias = type[SimpleTestCase] + +_DecoratedTest: TypeAlias = Callable | _TestClass +_DT = TypeVar("_DT", bound=_DecoratedTest) +_C = TypeVar("_C", bound=Callable) # Any callable + +TZ_SUPPORT: bool + +class Approximate: + val: decimal.Decimal | float + places: int + def __init__(self, val: Decimal | float, places: int = ...) -> None: ... + +class ContextList(list[dict[str, Any]]): + def __getitem__(self, key: str | SupportsIndex | slice) -> Any: ... + def get(self, key: str, default: Any | None = ...) -> Any: ... + def __contains__(self, key: object) -> bool: ... + def keys(self) -> set[str]: ... + +class _TestState: ... + +def setup_test_environment(debug: bool | None = ...) -> None: ... +def teardown_test_environment() -> None: ... +def get_runner(settings: LazySettings, test_runner_class: str | None = ...) -> type[DiscoverRunner]: ... + +class TestContextDecorator: + attr_name: str | None + kwarg_name: str | None + def __init__(self, attr_name: str | None = ..., kwarg_name: str | None = ...) -> None: ... + def enable(self) -> Any: ... + def disable(self) -> None: ... + def __enter__(self) -> Apps | None: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + def decorate_class(self, cls: _TestClass) -> _TestClass: ... + def decorate_callable(self, func: _C) -> _C: ... + def __call__(self, decorated: _DT) -> _DT: ... + +class override_settings(TestContextDecorator): + enable_exception: Exception | None + options: dict[str, Any] + def __init__(self, **kwargs: Any) -> None: ... + wrapped: Settings + def save_options(self, test_func: _DecoratedTest) -> None: ... + def decorate_class(self, cls: type) -> type: ... + +class modify_settings(override_settings): + wrapped: Settings + operations: list[tuple[str, dict[str, list[str] | str]]] + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def save_options(self, test_func: _DecoratedTest) -> None: ... + options: dict[str, list[tuple[str, str] | str]] + +class override_system_checks(TestContextDecorator): + registry: CheckRegistry + new_checks: list[Callable] + deployment_checks: list[Callable] | None + def __init__(self, new_checks: list[Callable], deployment_checks: list[Callable] | None = ...) -> None: ... + old_checks: set[Callable] + old_deployment_checks: set[Callable] + +class CaptureQueriesContext: + connection: BaseDatabaseWrapper + force_debug_cursor: bool + initial_queries: int + final_queries: int | None + def __init__(self, connection: BaseDatabaseWrapper) -> None: ... + def __iter__(self) -> Iterator[dict[str, str]]: ... + def __getitem__(self, index: int) -> dict[str, str]: ... + def __len__(self) -> int: ... + @property + def captured_queries(self) -> list[dict[str, str]]: ... + def __enter__(self) -> Self: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + +class ignore_warnings(TestContextDecorator): + ignore_kwargs: dict[str, Any] + filter_func: Callable + def __init__(self, **kwargs: Any) -> None: ... + catch_warnings: AbstractContextManager[list | None] + +requires_tz_support: Any + +@contextmanager +def isolate_lru_cache(lru_cache_object: Callable) -> Iterator[None]: ... + +class override_script_prefix(TestContextDecorator): + prefix: str + def __init__(self, prefix: str) -> None: ... + old_prefix: str + +class LoggingCaptureMixin: + logger: Logger + old_stream: Any + logger_output: Any + def setUp(self) -> None: ... + def tearDown(self) -> None: ... + +class isolate_apps(TestContextDecorator): + installed_apps: tuple[str, ...] + def __init__(self, *installed_apps: Any, **kwargs: Any) -> None: ... + old_apps: Apps + +@contextmanager +def extend_sys_path(*paths: str) -> Iterator[None]: ... +@contextmanager +def captured_output(stream_name: str) -> Iterator[StringIO]: ... +def captured_stdin() -> AbstractContextManager: ... +def captured_stdout() -> AbstractContextManager: ... +def captured_stderr() -> AbstractContextManager: ... +@contextmanager +def freeze_time(t: float) -> Iterator[None]: ... +def tag(*tags: str) -> Callable[[_C], _C]: ... + +_Signature: TypeAlias = str +_TestDatabase: TypeAlias = tuple[str, list[str]] + +@type_check_only +class TimeKeeperProtocol(Protocol): + @contextmanager + def timed(self, name: Any) -> Iterator[None]: ... + def print_results(self) -> None: ... + +def dependency_ordered( + test_databases: Iterable[tuple[_Signature, _TestDatabase]], dependencies: Mapping[str, list[str]] +) -> list[tuple[_Signature, _TestDatabase]]: ... +def get_unique_databases_and_mirrors( + aliases: set[str] | None = ..., +) -> tuple[dict[_Signature, _TestDatabase], dict[str, Any]]: ... +def setup_databases( + verbosity: int, + interactive: bool, + *, + time_keeper: TimeKeeperProtocol | None = ..., + keepdb: bool = ..., + debug_sql: bool = ..., + parallel: int = ..., + aliases: Mapping[str, Any] | None = ..., + serialized_aliases: Iterable[str] | None = ..., + **kwargs: Any, +) -> list[tuple[BaseDatabaseWrapper, str, bool]]: ... +def teardown_databases( + old_config: Iterable[tuple[Any, str, bool]], verbosity: int, parallel: int = ..., keepdb: bool = ... +) -> None: ... +def require_jinja2(test_func: _C) -> _C: ... +@contextmanager +def register_lookup( + field: type[RegisterLookupMixin], *lookups: type[Lookup | Transform], lookup_name: str | None = ... +) -> Iterator[None]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/urls/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/urls/__init__.pyi new file mode 100644 index 000000000000..7949b5f932f2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/urls/__init__.pyi @@ -0,0 +1,40 @@ +from typing_extensions import TypeAlias + +# noinspection PyUnresolvedReferences +from .base import clear_script_prefix as clear_script_prefix +from .base import clear_url_caches as clear_url_caches +from .base import get_script_prefix as get_script_prefix +from .base import get_urlconf as get_urlconf +from .base import is_valid_path as is_valid_path +from .base import resolve as resolve +from .base import reverse as reverse +from .base import reverse_lazy as reverse_lazy +from .base import set_script_prefix as set_script_prefix +from .base import set_urlconf as set_urlconf +from .base import translate_url as translate_url + +# noinspection PyUnresolvedReferences +from .conf import include as include +from .conf import path as path +from .conf import re_path as re_path + +# noinspection PyUnresolvedReferences +from .converters import register_converter as register_converter + +# noinspection PyUnresolvedReferences +from .exceptions import NoReverseMatch as NoReverseMatch +from .exceptions import Resolver404 as Resolver404 + +# noinspection PyUnresolvedReferences +from .resolvers import LocalePrefixPattern as LocalePrefixPattern +from .resolvers import ResolverMatch as ResolverMatch +from .resolvers import URLPattern as URLPattern +from .resolvers import URLResolver as URLResolver +from .resolvers import get_ns_resolver as get_ns_resolver +from .resolvers import get_resolver as get_resolver + +# noinspection PyUnresolvedReferences +from .utils import get_callable as get_callable +from .utils import get_mod_func as get_mod_func + +_AnyURL: TypeAlias = URLPattern | URLResolver # noqa: PYI047 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/urls/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/urls/base.pyi new file mode 100644 index 000000000000..e2b8dd904762 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/urls/base.pyi @@ -0,0 +1,25 @@ +from collections.abc import Callable, Sequence +from typing import Any, Literal + +from django.http.response import HttpResponse +from django.urls.resolvers import ResolverMatch + +def resolve(path: str, urlconf: str | None = ...) -> ResolverMatch: ... +def reverse( + viewname: Callable[..., HttpResponse] | str | None, + urlconf: str | None = ..., + args: Sequence[Any] | None = ..., + kwargs: dict[str, Any] | None = ..., + current_app: str | None = ..., +) -> str: ... + +reverse_lazy: Any + +def clear_url_caches() -> None: ... +def set_script_prefix(prefix: str) -> None: ... +def get_script_prefix() -> str: ... +def clear_script_prefix() -> None: ... +def set_urlconf(urlconf_name: str | None) -> None: ... +def get_urlconf(default: str | None = ...) -> str | None: ... +def is_valid_path(path: str, urlconf: str | None = ...) -> Literal[False] | ResolverMatch: ... +def translate_url(url: str, lang_code: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/urls/conf.pyi b/python/helpers/bundled_stubs/Django/django-stubs/urls/conf.pyi new file mode 100644 index 000000000000..e278805de518 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/urls/conf.pyi @@ -0,0 +1,56 @@ +from collections.abc import Callable, Sequence +from types import ModuleType +from typing import Any, Coroutine, overload + +from django.urls import URLPattern, URLResolver, _AnyURL +from django.utils.functional import _StrOrPromise +from typing_extensions import TypeAlias + +from ..conf.urls import _IncludedURLConf +from ..http.response import HttpResponseBase + +_URLConf: TypeAlias = str | ModuleType | Sequence[_AnyURL] + +def include(arg: _URLConf | tuple[_URLConf, str], namespace: str | None = ...) -> _IncludedURLConf: ... + +# path() +@overload +def path( + route: _StrOrPromise, view: Callable[..., HttpResponseBase], kwargs: dict[str, Any] = ..., name: str = ... +) -> URLPattern: ... +@overload +def path( + route: _StrOrPromise, + view: Callable[..., Coroutine[Any, Any, HttpResponseBase]], + kwargs: dict[str, Any] = ..., + name: str = ..., +) -> URLPattern: ... +@overload +def path( + route: _StrOrPromise, view: _IncludedURLConf, kwargs: dict[str, Any] = ..., name: str = ... +) -> URLResolver: ... +@overload +def path( + route: _StrOrPromise, view: Sequence[URLResolver | str], kwargs: dict[str, Any] = ..., name: str = ... +) -> URLResolver: ... + +# re_path() +@overload +def re_path( + route: _StrOrPromise, view: Callable[..., HttpResponseBase], kwargs: dict[str, Any] = ..., name: str = ... +) -> URLPattern: ... +@overload +def re_path( + route: _StrOrPromise, + view: Callable[..., Coroutine[Any, Any, HttpResponseBase]], + kwargs: dict[str, Any] = ..., + name: str = ..., +) -> URLPattern: ... +@overload +def re_path( + route: _StrOrPromise, view: _IncludedURLConf, kwargs: dict[str, Any] = ..., name: str = ... +) -> URLResolver: ... +@overload +def re_path( + route: _StrOrPromise, view: Sequence[URLResolver | str], kwargs: dict[str, Any] = ..., name: str = ... +) -> URLResolver: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/urls/converters.pyi b/python/helpers/bundled_stubs/Django/django-stubs/urls/converters.pyi new file mode 100644 index 000000000000..a8c07a6019a8 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/urls/converters.pyi @@ -0,0 +1,33 @@ +from typing import Any, Protocol +from uuid import UUID + +class _Converter(Protocol): + regex: str + def __init__(self) -> None: ... + def to_python(self, value: str) -> Any: ... + def to_url(self, value: Any) -> str: ... + +class IntConverter: + regex: str + def to_python(self, value: str) -> int: ... + def to_url(self, value: str | int) -> str: ... + +class StringConverter: + regex: str + def to_python(self, value: str) -> str: ... + def to_url(self, value: str) -> str: ... + +class UUIDConverter: + regex: str + def to_python(self, value: str) -> UUID: ... + def to_url(self, value: str | UUID) -> str: ... + +class SlugConverter(StringConverter): ... +class PathConverter(StringConverter): ... + +DEFAULT_CONVERTERS: dict[str, _Converter] +REGISTERED_CONVERTERS: dict[str, _Converter] + +def register_converter(converter: type[_Converter], type_name: str) -> None: ... +def get_converters() -> dict[str, _Converter]: ... +def get_converter(raw_converter: str) -> _Converter: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/urls/exceptions.pyi b/python/helpers/bundled_stubs/Django/django-stubs/urls/exceptions.pyi new file mode 100644 index 000000000000..f3ad4c6203c3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/urls/exceptions.pyi @@ -0,0 +1,4 @@ +from django.http import Http404 + +class Resolver404(Http404): ... +class NoReverseMatch(Exception): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/urls/resolvers.pyi b/python/helpers/bundled_stubs/Django/django-stubs/urls/resolvers.pyi new file mode 100644 index 000000000000..4793854006ef --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/urls/resolvers.pyi @@ -0,0 +1,136 @@ +from collections.abc import Callable, Iterator, Sequence +from re import Pattern +from types import ModuleType +from typing import Any, overload + +from django.core.checks.messages import CheckMessage +from django.http import HttpRequest, HttpResponse +from django.urls import _AnyURL +from django.utils.datastructures import MultiValueDict +from django.utils.functional import cached_property +from typing_extensions import TypeAlias + +class ResolverMatch: + func: Callable + args: tuple[Any, ...] + kwargs: dict[str, Any] + url_name: str | None + app_names: list[str] + app_name: str + namespaces: list[str] + namespace: str + view_name: str + route: str + tried: Any | None + _func_path: str + def __init__( + self, + func: Callable, + args: tuple[Any, ...], + kwargs: dict[str, Any], + url_name: str | None = ..., + app_names: list[str | None] | None = ..., + namespaces: list[str | None] | None = ..., + route: str | None = ..., + tried: Any | None = ..., + captured_kwargs: dict[str, Any] | None = ..., + extra_kwargs: dict[str, Any] | None = ..., + ) -> None: ... + def __getitem__(self, index: int) -> Any: ... + # for tuple unpacking + def __iter__(self) -> Iterator[Any]: ... + +def get_resolver(urlconf: str | None = ...) -> URLResolver: ... +def get_ns_resolver(ns_pattern: str, resolver: URLResolver, converters: tuple) -> URLResolver: ... + +_Pattern: TypeAlias = RegexPattern | RoutePattern | LocalePrefixPattern + +class LocaleRegexDescriptor: + attr: str + def __init__(self, attr: Any) -> None: ... + @overload + def __get__(self, instance: None, cls: type[_Pattern] = ...) -> LocaleRegexDescriptor: ... + @overload + def __get__(self, instance: _Pattern, cls: type[_Pattern] = ...) -> Pattern[str]: ... + +class CheckURLMixin: + def describe(self) -> str: ... + +class RegexPattern(CheckURLMixin): + regex: LocaleRegexDescriptor + name: str | None + converters: dict[str, Any] + def __init__(self, regex: str, name: str | None = ..., is_endpoint: bool = ...) -> None: ... + def match(self, path: str) -> tuple[str, tuple, dict[str, str]] | None: ... + def check(self) -> list[CheckMessage]: ... + +class RoutePattern(CheckURLMixin): + regex: LocaleRegexDescriptor + name: str | None + converters: dict[str, Any] + def __init__(self, route: str, name: str | None = ..., is_endpoint: bool = ...) -> None: ... + def match(self, path: str) -> tuple[str, tuple, dict[str, int | str]] | None: ... + def check(self) -> list[CheckMessage]: ... + +class LocalePrefixPattern: + prefix_default_language: bool + converters: dict[str, Any] + def __init__(self, prefix_default_language: bool = ...) -> None: ... + @property + def regex(self) -> Pattern[str]: ... + @property + def language_prefix(self) -> str: ... + def match(self, path: str) -> tuple[str, tuple, dict[str, Any]] | None: ... + def check(self) -> list[CheckMessage]: ... + def describe(self) -> str: ... + +class URLPattern: + pattern: _Pattern + callback: Callable + default_args: dict[str, Any] + name: str | None + def __init__( + self, + pattern: _Pattern, + callback: Callable, + default_args: dict[str, Any] | None = ..., + name: str | None = ..., + ) -> None: ... + def check(self) -> list[CheckMessage]: ... + def resolve(self, path: str) -> ResolverMatch | None: ... + @cached_property + def lookup_str(self) -> str: ... + +class URLResolver: + pattern: _Pattern + urlconf_name: str | Sequence[_AnyURL] | ModuleType + callback: None + default_kwargs: dict[str, Any] + namespace: str | None + app_name: str | None + _local: Any + _reverse_dict: MultiValueDict + def __init__( + self, + pattern: _Pattern, + urlconf_name: str | Sequence[_AnyURL] | ModuleType, + default_kwargs: dict[str, Any] | None = ..., + app_name: str | None = ..., + namespace: str | None = ..., + ) -> None: ... + @property + def reverse_dict(self) -> MultiValueDict: ... + @property + def namespace_dict(self) -> dict[str, tuple[str, URLResolver]]: ... + @property + def app_dict(self) -> dict[str, list[str]]: ... + @cached_property + def urlconf_module(self) -> ModuleType | None | Sequence[_AnyURL]: ... + @cached_property + def url_patterns(self) -> list[_AnyURL]: ... + def resolve(self, path: str) -> ResolverMatch: ... + def resolve_error_handler(self, view_type: int) -> Callable[[HttpRequest], HttpResponse]: ... + def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ... + def _is_callback(self, name: str) -> bool: ... + def _populate(self) -> None: ... + def check(self) -> list[CheckMessage]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/urls/utils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/urls/utils.pyi new file mode 100644 index 000000000000..bfd09c115196 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/urls/utils.pyi @@ -0,0 +1,4 @@ +from collections.abc import Callable + +def get_callable(lookup_view: Callable | str) -> Callable: ... +def get_mod_func(callback: str) -> tuple[str, str]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/_os.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/_os.pyi new file mode 100644 index 000000000000..808b840cef2f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/_os.pyi @@ -0,0 +1,10 @@ +import os +from pathlib import Path + +from typing_extensions import TypeAlias + +_PathCompatible: TypeAlias = str | os.PathLike[str] + +def safe_join(base: _PathCompatible, *paths: _PathCompatible) -> str: ... +def symlinks_supported() -> bool: ... +def to_path(value: Path | str) -> Path: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/archive.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/archive.pyi new file mode 100644 index 000000000000..8fcae8db19ee --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/archive.pyi @@ -0,0 +1,44 @@ +from collections.abc import Iterable, Sequence +from types import TracebackType +from typing import Any + +from typing_extensions import Self + +class ArchiveException(Exception): ... +class UnrecognizedArchiveFormat(ArchiveException): ... + +def extract(path: str, to_path: str) -> None: ... + +class Archive: + def __init__(self, file: str) -> None: ... + def __enter__(self) -> Self: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + traceback: TracebackType | None, + ) -> None: ... + def extract(self, to_path: str) -> None: ... + def list(self) -> None: ... + def close(self) -> None: ... + +class BaseArchive: + def split_leading_dir(self, path: str) -> Sequence[str]: ... + def has_leading_dir(self, paths: Iterable[str]) -> bool: ... + def target_filename(self, to_path: str, name: str) -> str: ... + def extract(self, to_path: str) -> None: ... + def list(self, *args: Any, **kwargs: Any) -> None: ... + +class TarArchive(BaseArchive): + def __init__(self, file: str) -> None: ... + def list(self, *args: Any, **kwargs: Any) -> None: ... + def close(self) -> None: ... + def extract(self, to_path: str) -> None: ... + +class ZipArchive(BaseArchive): + def __init__(self, file: str) -> None: ... + def list(self, *args: Any, **kwargs: Any) -> None: ... + def extract(self, to_path: str) -> None: ... + def close(self) -> None: ... + +extension_map: dict[str, type[BaseArchive]] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/asyncio.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/asyncio.pyi new file mode 100644 index 000000000000..00cedc50f098 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/asyncio.pyi @@ -0,0 +1,9 @@ +from collections.abc import Callable +from typing import TypeVar, overload + +_C = TypeVar("_C", bound=Callable) + +@overload +def async_unsafe(message: str) -> Callable[[_C], _C]: ... +@overload +def async_unsafe(message: _C) -> _C: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/autoreload.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/autoreload.pyi new file mode 100644 index 000000000000..78c473128f61 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/autoreload.pyi @@ -0,0 +1,76 @@ +import threading +import types +from collections.abc import Callable, Iterable, Iterator +from logging import Logger +from pathlib import Path +from typing import Any + +from django.apps.registry import Apps +from django.dispatch import Signal +from django.utils._os import _PathCompatible +from typing_extensions import ParamSpec + +_P = ParamSpec("_P") + +logger: Logger +autoreload_started: Signal +file_changed: Signal +DJANGO_AUTORELOAD_ENV: str + +def is_django_module(module: types.ModuleType) -> bool: ... +def is_django_path(path: _PathCompatible) -> bool: ... +def check_errors(fn: Callable[_P, Any]) -> Callable[_P, None]: ... +def raise_last_exception() -> None: ... +def ensure_echo_on() -> None: ... +def iter_all_python_module_files() -> set[Path]: ... +def iter_modules_and_files( + modules: Iterable[types.ModuleType], extra_files: Iterable[_PathCompatible] +) -> frozenset[Path]: ... +def common_roots(paths: Iterable[Path]) -> Iterable[Path]: ... +def sys_path_directories() -> Iterator[Path]: ... +def get_child_arguments() -> list[str]: ... +def trigger_reload(filename: str) -> None: ... +def restart_with_reloader() -> int: ... + +class BaseReloader: + extra_files: set[Path] + directory_globs: dict[Path, set[str]] + def __init__(self) -> None: ... + def watch_dir(self, path: _PathCompatible, glob: str) -> None: ... + def watched_files(self, include_globs: bool = True) -> Iterator[Path]: ... + def wait_for_apps_ready(self, app_reg: Apps, django_main_thread: threading.Thread) -> bool: ... + def run(self, django_main_thread: threading.Thread) -> None: ... + def run_loop(self) -> None: ... + def tick(self) -> Iterator[None]: ... + @classmethod + def check_availability(cls) -> bool | None: ... + def notify_file_changed(self, path: _PathCompatible) -> None: ... + @property + def should_stop(self) -> bool: ... + def stop(self) -> None: ... + +class StatReloader(BaseReloader): + SLEEP_TIME: int + def snapshot_files(self) -> Iterator[tuple[Path, float]]: ... + @classmethod + def check_availability(cls) -> bool: ... + +class WatchmanUnavailable(RuntimeError): ... + +class WatchmanReloader(BaseReloader): + processed_request: threading.Event + client_timeout: int + def __init__(self) -> None: ... + @property + def client(self) -> Any: ... + def watched_roots(self, watched_files: Iterable[Path]) -> frozenset[Path]: ... + def update_watches(self) -> None: ... + def request_processed(self, **kwargs: Any) -> None: ... + def check_server_status(self, inner_ex: BaseException | None = None) -> bool: ... + @classmethod + def check_availability(cls) -> None: ... + def stop(self) -> None: ... + +def get_reloader() -> BaseReloader: ... +def start_django(reloader: BaseReloader, main_func: Callable, *args: Any, **kwargs: Any) -> None: ... +def run_with_reloader(main_func: Callable, *args: Any, **kwargs: Any) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi new file mode 100644 index 000000000000..45449c7cae63 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/cache.pyi @@ -0,0 +1,32 @@ +from collections.abc import Iterable +from typing import Any + +from django.core.cache.backends.base import BaseCache +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseBase + +cc_delim_re: Any + +def patch_cache_control(response: HttpResponseBase, **kwargs: Any) -> None: ... +def get_max_age(response: HttpResponse) -> int | None: ... +def set_response_etag(response: HttpResponseBase) -> HttpResponseBase: ... +def get_conditional_response( + request: HttpRequest, + etag: str | None = ..., + last_modified: int | None = ..., + response: HttpResponse | None = ..., +) -> HttpResponse | None: ... +def patch_response_headers(response: HttpResponseBase, cache_timeout: int | None = ...) -> None: ... +def add_never_cache_headers(response: HttpResponseBase) -> None: ... +def patch_vary_headers(response: HttpResponseBase, newheaders: Iterable[str]) -> None: ... +def has_vary_header(response: HttpResponse, header_query: str) -> bool: ... +def get_cache_key( + request: HttpRequest, key_prefix: str | None = ..., method: str = ..., cache: BaseCache | None = ... +) -> str | None: ... +def learn_cache_key( + request: HttpRequest, + response: HttpResponse, + cache_timeout: float | None = ..., + key_prefix: str | None = ..., + cache: BaseCache | None = ..., +) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/choices.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/choices.pyi new file mode 100644 index 000000000000..dbbca54903ce --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/choices.pyi @@ -0,0 +1,31 @@ +from collections.abc import Iterable, Iterator +from typing import Any, Protocol, TypeVar, type_check_only + +from typing_extensions import TypeAlias + +_Choice: TypeAlias = tuple[Any, Any] +_ChoiceNamedGroup: TypeAlias = tuple[str, Iterable[_Choice]] +_Choices: TypeAlias = Iterable[_Choice | _ChoiceNamedGroup] + +@type_check_only +class _ChoicesCallable(Protocol): + def __call__(self) -> _Choices: ... + +class BaseChoiceIterator: + def __getitem__(self, index: int) -> _Choice | _ChoiceNamedGroup: ... + def __iter__(self) -> Iterator[_Choice | _ChoiceNamedGroup]: ... + +class BlankChoiceIterator(BaseChoiceIterator): + choices: _Choices + blank_choice: _Choices + def __init__(self, choices: _Choices, blank_choice: _Choices) -> None: ... + +class CallableChoiceIterator(BaseChoiceIterator): + func: _ChoicesCallable + def __init__(self, func: _ChoicesCallable) -> None: ... + +_V = TypeVar("_V") +_L = TypeVar("_L") + +def flatten_choices(choices: Iterable[tuple[_V, _L | Iterable[tuple[_V, _L]]]]) -> Iterator[tuple[_V, _L]]: ... +def normalize_choices(value: Any, *, depth: int = 0) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/connection.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/connection.pyi new file mode 100644 index 000000000000..45aac7fb7b49 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/connection.pyi @@ -0,0 +1,32 @@ +from collections.abc import Iterator, Sequence +from typing import Any, Generic, TypeVar + +from django.utils.functional import cached_property + +_T = TypeVar("_T") + +class ConnectionProxy(Generic[_T]): + def __init__(self, connections: BaseConnectionHandler[_T], alias: str) -> None: ... + def __getattr__(self, item: str) -> Any: ... + def __setattr__(self, name: str, value: Any) -> None: ... + def __delattr__(self, name: str) -> None: ... + def __contains__(self, key: str) -> bool: ... + def __eq__(self, other: object) -> bool: ... + +class ConnectionDoesNotExist(Exception): ... + +class BaseConnectionHandler(Generic[_T]): + settings_name: str | None + exception_class: type[Exception] + thread_critical: bool + @cached_property + def settings(self) -> dict[str, Any]: ... + def __init__(self, settings: Any | None = None) -> None: ... + def configure_settings(self, settings: dict[str, Any] | None) -> dict[str, Any]: ... + def create_connection(self, alias: str) -> _T: ... + def __getitem__(self, alias: str) -> _T: ... + def __setitem__(self, key: str, value: _T) -> None: ... + def __delitem__(self, key: str) -> None: ... + def __iter__(self) -> Iterator[str]: ... + def all(self, initialized_only: bool = False) -> Sequence[_T]: ... + def close_all(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/crypto.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/crypto.pyi new file mode 100644 index 000000000000..e4414108da25 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/crypto.pyi @@ -0,0 +1,19 @@ +from collections.abc import Callable +from hmac import HMAC + +RANDOM_STRING_CHARS: str + +class InvalidAlgorithm(ValueError): ... + +def salted_hmac( + key_salt: bytes | str, value: bytes | str, secret: bytes | str | None = None, *, algorithm: str = "sha1" +) -> HMAC: ... +def get_random_string(length: int, allowed_chars: str = ...) -> str: ... +def constant_time_compare(val1: bytes | str, val2: bytes | str) -> bool: ... +def pbkdf2( + password: bytes | str, + salt: bytes | str, + iterations: int, + dklen: int = 0, + digest: Callable | None = None, +) -> bytes: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/datastructures.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/datastructures.pyi new file mode 100644 index 000000000000..48adc4bd8d25 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/datastructures.pyi @@ -0,0 +1,118 @@ +from collections.abc import Collection, Iterable, Iterator, Mapping, MutableMapping, MutableSet +from typing import Any, Generic, NoReturn, Protocol, TypeVar, overload, type_check_only + +from _typeshed import Incomplete +from typing_extensions import Self, TypeAlias + +_K = TypeVar("_K") +_V = TypeVar("_V") +_Z = TypeVar("_Z") +_I = TypeVar("_I", covariant=True) + +# Unfortunately, there's often check `if isinstance(var, (list, tuple))` in django +# codebase. So we need sometimes to declare exactly list or tuple. +_ListOrTuple: TypeAlias = list[_K] | tuple[_K, ...] | tuple[()] # noqa: PYI047 + +@type_check_only +class _PropertyDescriptor(Generic[_K, _V]): + """ + This helper property descriptor allows defining asynmetric getter/setters + which mypy currently doesn't support with either: + + class HttpResponse: + @property + def content(...): ... + @property.setter + def content(...): ... + + or: + + class HttpResponse: + def _get_content(...): ... + def _set_content(...): ... + content = property(_get_content, _set_content) + """ + + def __get__(self, instance: Any, owner: Any | None) -> _V: ... + def __set__(self, instance: Any, value: _K) -> None: ... + +@type_check_only +class _IndexableCollection(Protocol[_I], Collection[_I]): # noqa: PYI046 + @overload + def __getitem__(self, index: int) -> _I: ... + @overload + def __getitem__(self, index: slice) -> Self: ... + +class OrderedSet(MutableSet[_K]): + dict: dict[_K, None] + def __init__(self, iterable: Iterable[_K] | None = None) -> None: ... + def __contains__(self, item: object) -> bool: ... + def __iter__(self) -> Iterator[_K]: ... + def __reversed__(self) -> Iterator[_K]: ... + def __bool__(self) -> bool: ... + def __len__(self) -> int: ... + def add(self, item: _K) -> None: ... + def remove(self, item: _K) -> None: ... + def discard(self, item: _K) -> None: ... + +class MultiValueDictKeyError(KeyError): ... + +class MultiValueDict(dict[_K, _V]): + @overload + def __init__(self, key_to_list_mapping: Mapping[_K, list[_V] | None]) -> None: ... + @overload + def __init__(self, key_to_list_mapping: Iterable[tuple[_K, list[_V]]] = ()) -> None: ... + @overload + def get(self, key: _K) -> _V | None: ... + @overload + def get(self, key: _K, default: _Z) -> _V | _Z: ... + def getlist(self, key: _K, default: _Z | None = None) -> list[_V] | _Z: ... + def setlist(self, key: _K, list_: list[_V]) -> None: ... + @overload + def setdefault(self: MultiValueDict[_K, _V | None], key: _K, default: None = None) -> _V | None: ... + @overload + def setdefault(self, key: _K, default: _V) -> _V: ... + def setlistdefault(self, key: _K, default_list: list[_V] | None = None) -> list[_V]: ... + def appendlist(self, key: _K, value: _V) -> None: ... + def items(self) -> Iterator[tuple[_K, _V | list[object]]]: ... # type: ignore[override] + def lists(self) -> Iterable[tuple[_K, list[_V]]]: ... + def dict(self) -> dict[_K, _V | list[object]]: ... + def copy(self) -> Self: ... + def __getitem__(self, key: _K) -> _V | list[object]: ... # type: ignore[override] + def __setitem__(self, key: _K, value: _V) -> None: ... + # These overrides are needed to convince mypy that this isn't an abstract class + def __delitem__(self, item: _K) -> None: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_K]: ... + # Fake to make `values` work properly + def values(self) -> Iterator[_V | list[object]]: ... # type: ignore[override] + def __copy__(self) -> Self: ... + def __deepcopy__(self, memo: MutableMapping[int, Incomplete]) -> Self: ... + +class ImmutableList(tuple[_V, ...]): + warning: str + def __new__(cls, *args: Any, warning: str = "ImmutableList object is immutable.", **kwargs: Any) -> Self: ... + def complain(self, *args: Any, **kwargs: Any) -> NoReturn: ... + +@type_check_only +class _ItemCallable(Protocol[_V]): + """Don't mess with arguments when assigning in class body in stub""" + + def __call__(self, value: _V, /) -> _V: ... + +class DictWrapper(dict[str, _V]): + func: _ItemCallable[_V] + prefix: str + @overload + def __init__(self, data: Mapping[str, _V], func: _ItemCallable[_V], prefix: str) -> None: ... + @overload + def __init__(self, data: Iterable[tuple[str, _V]], func: _ItemCallable[_V], prefix: str) -> None: ... + def __getitem__(self, key: str) -> _V: ... + +class CaseInsensitiveMapping(Mapping[str, _V]): + _store: dict[str, tuple[str, _V]] + def __init__(self, data: Mapping[str, _V] | Iterable[tuple[str, _V]]) -> None: ... + def __getitem__(self, key: str) -> _V: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[str]: ... + def copy(self) -> Self: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/dateformat.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/dateformat.pyi new file mode 100644 index 000000000000..6e39d813428d --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/dateformat.pyi @@ -0,0 +1,64 @@ +from datetime import date, tzinfo +from datetime import datetime as builtin_datetime +from datetime import time as builtin_time +from re import Pattern +from typing import Any, Literal + +re_formatchars: Pattern[str] +re_escaped: Pattern[str] + +class Formatter: + def format(self, formatstr: str) -> str: ... + +class TimeFormat(Formatter): + data: builtin_datetime | builtin_time + timezone: tzinfo | None + def __init__(self, obj: builtin_datetime | builtin_time) -> None: ... + def a(self) -> str: ... + def A(self) -> str: ... + def e(self) -> str: ... + def f(self) -> int | str: ... + def g(self) -> int: ... + def G(self) -> int: ... + def h(self) -> str: ... + def H(self) -> str: ... + def i(self) -> str: ... + def O(self) -> str: ... + def P(self) -> str: ... + def s(self) -> str: ... + def T(self) -> str: ... + def u(self) -> str: ... + def Z(self) -> int | Literal[""]: ... + +class DateFormat(TimeFormat): + data: builtin_datetime | date | builtin_time # type: ignore[assignment] + timezone: tzinfo | None + year_days: Any + def __init__(self, obj: builtin_datetime | builtin_time | date) -> None: ... + def b(self) -> str: ... + def c(self) -> str: ... + def d(self) -> str: ... + def D(self) -> str: ... + def E(self) -> str: ... + def F(self) -> str: ... + def I(self) -> str: ... + def j(self) -> int: ... + def l(self) -> str: ... + def L(self) -> bool: ... + def m(self) -> str: ... + def M(self) -> str: ... + def n(self) -> int: ... + def N(self) -> str: ... + def o(self) -> int: ... + def r(self) -> str: ... + def S(self) -> str: ... + def t(self) -> str: ... + def U(self) -> int: ... + def w(self) -> int: ... + def W(self) -> int: ... + def y(self) -> str: ... + def Y(self) -> int: ... + def z(self) -> int: ... + +def format(value: builtin_datetime | date | builtin_time, format_string: str) -> str: ... +def time_format(value: builtin_datetime | builtin_time, format_string: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/dateparse.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/dateparse.pyi new file mode 100644 index 000000000000..7bac1bb61e36 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/dateparse.pyi @@ -0,0 +1,15 @@ +from datetime import date, time, timedelta +from datetime import datetime as builtin_datetime +from re import Pattern + +date_re: Pattern[str] +time_re: Pattern[str] +datetime_re: Pattern[str] +standard_duration_re: Pattern[str] +iso8601_duration_re: Pattern[str] +postgres_interval_re: Pattern[str] + +def parse_date(value: str) -> date | None: ... +def parse_time(value: str) -> time | None: ... +def parse_datetime(value: str) -> builtin_datetime | None: ... +def parse_duration(value: str) -> timedelta | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/dates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/dates.pyi new file mode 100644 index 000000000000..61b1e64fb613 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/dates.pyi @@ -0,0 +1,6 @@ +WEEKDAYS: dict[int, str] +WEEKDAYS_ABBR: dict[int, str] +MONTHS: dict[int, str] +MONTHS_3: dict[int, str] +MONTHS_AP: dict[int, str] +MONTHS_ALT: dict[int, str] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/deconstruct.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/deconstruct.pyi new file mode 100644 index 000000000000..8ee1e96b315f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/deconstruct.pyi @@ -0,0 +1,18 @@ +from collections.abc import Callable, Sequence +from typing import Any, TypeVar, overload, type_check_only + +from typing_extensions import Self + +# Contains additions from a class being decorated with '@deconstructible' +@type_check_only +class _Deconstructible: + def __new__(cls, *args: Any, **kwargs: Any) -> Self: ... + def deconstruct(obj) -> tuple[str, Sequence[Any], dict[str, Any]]: ... + +_T = TypeVar("_T") +_TCallable = TypeVar("_TCallable", bound=Callable[..., Any]) + +@overload +def deconstructible(_type: type[_T]) -> type[_T]: ... +@overload +def deconstructible(*, path: str | None = None) -> Callable[[_TCallable], _TCallable]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/decorators.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/decorators.pyi new file mode 100644 index 000000000000..8729a3df24a2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/decorators.pyi @@ -0,0 +1,23 @@ +from collections.abc import Callable, Iterable +from typing import Any, TypeVar + +from django.http.response import HttpResponseBase +from django.utils.deprecation import MiddlewareMixin +from django.views.generic.base import View +from typing_extensions import TypeAlias + +_ViewType = TypeVar("_ViewType", bound=View | Callable[..., Any]) # Any callable +_CallableType = TypeVar("_CallableType", bound=Callable[..., Any]) +_DECORATOR: TypeAlias = Callable[..., Callable[..., HttpResponseBase] | Callable[..., Callable[..., HttpResponseBase]]] + +classonlymethod = classmethod + +def method_decorator( + decorator: _DECORATOR | Iterable[_DECORATOR], name: str = "" +) -> Callable[[_ViewType], _ViewType]: ... +def decorator_from_middleware_with_args(middleware_class: type) -> _DECORATOR: ... +def decorator_from_middleware(middleware_class: type) -> _DECORATOR: ... +def make_middleware_decorator(middleware_class: type[MiddlewareMixin]) -> _DECORATOR: ... +def sync_and_async_middleware(func: _CallableType) -> _CallableType: ... +def sync_only_middleware(func: _CallableType) -> _CallableType: ... +def async_only_middleware(func: _CallableType) -> _CallableType: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi new file mode 100644 index 000000000000..f97d6268d2f3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/deprecation.pyi @@ -0,0 +1,47 @@ +from collections.abc import Awaitable, Callable +from typing import Any, Protocol, type_check_only + +from django.http.request import HttpRequest +from django.http.response import HttpResponseBase +from typing_extensions import TypeAlias + +class RemovedInNextVersionWarning(DeprecationWarning): ... +class RemovedInDjango60Warning(PendingDeprecationWarning): ... + +RemovedAfterNextVersionWarning: TypeAlias = RemovedInDjango60Warning + +class warn_about_renamed_method: + class_name: str + old_method_name: str + new_method_name: str + deprecation_warning: type[DeprecationWarning] + def __init__( + self, class_name: str, old_method_name: str, new_method_name: str, deprecation_warning: type[DeprecationWarning] + ) -> None: ... + def __call__(self, f: Callable) -> Callable: ... + +class RenameMethodsBase(type): + renamed_methods: Any + def __new__(cls, name: Any, bases: Any, attrs: Any) -> type: ... + +class DeprecationInstanceCheck(type): + alternative: str + deprecation_warning: type[Warning] + def __instancecheck__(self, instance: Any) -> bool: ... + +@type_check_only +class _GetResponseCallable(Protocol): + def __call__(self, request: HttpRequest, /) -> HttpResponseBase: ... + +@type_check_only +class _AsyncGetResponseCallable(Protocol): + def __call__(self, request: HttpRequest, /) -> Awaitable[HttpResponseBase]: ... + +class MiddlewareMixin: + sync_capable: bool + async_capable: bool + + get_response: _GetResponseCallable | _AsyncGetResponseCallable + def __init__(self, get_response: _GetResponseCallable | _AsyncGetResponseCallable) -> None: ... + def __call__(self, request: HttpRequest) -> HttpResponseBase | Awaitable[HttpResponseBase]: ... + async def __acall__(self, request: HttpRequest) -> HttpResponseBase: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/duration.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/duration.pyi new file mode 100644 index 000000000000..4d49555a89d0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/duration.pyi @@ -0,0 +1,5 @@ +from datetime import timedelta + +def duration_string(duration: timedelta) -> str: ... +def duration_iso_string(duration: timedelta) -> str: ... +def duration_microseconds(delta: timedelta) -> int: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/encoding.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/encoding.pyi new file mode 100644 index 000000000000..88f77bfa2077 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/encoding.pyi @@ -0,0 +1,75 @@ +import datetime +from decimal import Decimal +from typing import Any, Literal, TypeVar, overload + +from django.utils.functional import Promise +from typing_extensions import TypeGuard + +class DjangoUnicodeDecodeError(UnicodeDecodeError): + obj: bytes + def __init__(self, obj: bytes, *args: Any) -> None: ... + +_P = TypeVar("_P", bound=Promise) +_S = TypeVar("_S", bound=str) +_B = TypeVar("_B", bound=bytes) +_PT = TypeVar("_PT", None, int, float, Decimal, datetime.datetime, datetime.date, datetime.time) + +@overload +def smart_str(s: _P, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _P: ... +@overload +def smart_str(s: _S, encoding: str = "utf-8", *, errors: str = "strict") -> _S: ... +@overload +def smart_str(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> str: ... +@overload +def smart_str(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ... +@overload +def smart_str(s: _S, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _S: ... +@overload +def smart_str(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> str: ... +def is_protected_type(obj: Any) -> TypeGuard[_PT]: ... +@overload +def force_str(s: _S, encoding: str = "utf-8", *, errors: str = "strict") -> _S: ... +@overload +def force_str(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> str: ... +@overload +def force_str(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ... +@overload +def force_str(s: _S, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _S: ... +@overload +def force_str(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> str: ... +@overload +def smart_bytes(s: _P, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> _P: ... +@overload +def smart_bytes(s: _B, encoding: Literal["utf-8"] = "utf-8", *, errors: str = "strict") -> _B: ... +@overload +def smart_bytes(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> bytes: ... +@overload +def smart_bytes(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ... +@overload +def smart_bytes(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> bytes: ... +@overload +def force_bytes(s: _B, encoding: Literal["utf-8"] = "utf-8", *, errors: str = "strict") -> _B: ... +@overload +def force_bytes(s: Any, encoding: str = "utf-8", *, errors: str = "strict") -> bytes: ... +@overload +def force_bytes(s: _PT, encoding: str = "utf-8", strings_only: Literal[True] = True, errors: str = "strict") -> _PT: ... +@overload +def force_bytes(s: Any, encoding: str = "utf-8", strings_only: bool = False, errors: str = "strict") -> bytes: ... +@overload +def iri_to_uri(iri: None) -> None: ... +@overload +def iri_to_uri(iri: str | Promise) -> str: ... +@overload +def uri_to_iri(uri: None) -> None: ... +@overload +def uri_to_iri(uri: Any) -> str: ... +def escape_uri_path(path: str) -> str: ... +def punycode(domain: str) -> str: ... +def repercent_broken_unicode(path: bytes) -> bytes: ... +@overload +def filepath_to_uri(path: None) -> None: ... +@overload +def filepath_to_uri(path: str) -> str: ... +def get_system_encoding() -> str: ... + +DEFAULT_LOCALE_ENCODING: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/feedgenerator.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/feedgenerator.pyi new file mode 100644 index 000000000000..edb8bde4e6b1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/feedgenerator.pyi @@ -0,0 +1,84 @@ +import datetime +from collections.abc import Sequence +from typing import Any + +from django.utils.xmlutils import SimplerXMLGenerator +from typing_extensions import TypeAlias + +def rfc2822_date(date: datetime.date) -> str: ... +def rfc3339_date(date: datetime.date) -> str: ... +def get_tag_uri(url: str, date: datetime.date | None) -> str: ... + +class SyndicationFeed: + feed: dict[str, Any] + items: list[dict[str, Any]] + def __init__( + self, + title: str, + link: str, + description: str | None, + language: str | None = ..., + author_email: str | None = ..., + author_name: str | None = ..., + author_link: str | None = ..., + subtitle: str | None = ..., + categories: tuple[str, str] | None = ..., + feed_url: str | None = ..., + feed_copyright: str | None = ..., + feed_guid: str | None = ..., + ttl: int | None = ..., + **kwargs: Any, + ) -> None: ... + def add_item( + self, + title: str, + link: str, + description: str, + author_email: str | None = ..., + author_name: str | None = ..., + author_link: str | None = ..., + pubdate: datetime.datetime | None = ..., + comments: str | None = ..., + unique_id: str | None = ..., + unique_id_is_permalink: bool | None = ..., + categories: Sequence[str | None] | None = ..., + item_copyright: str | None = ..., + ttl: int | None = ..., + updateddate: datetime.datetime | None = ..., + enclosures: list[Enclosure] | None = ..., + **kwargs: Any, + ) -> None: ... + def num_items(self) -> int: ... + def root_attributes(self) -> dict[Any, Any]: ... + def add_root_elements(self, handler: SimplerXMLGenerator) -> None: ... + def item_attributes(self, item: dict[str, Any]) -> dict[Any, Any]: ... + def add_item_elements( + self, + handler: SimplerXMLGenerator, + item: dict[str, Any], + ) -> None: ... + def write(self, outfile: Any, encoding: Any) -> None: ... + def writeString(self, encoding: str) -> str: ... + def latest_post_date(self) -> datetime.datetime: ... + +class Enclosure: + length: Any + mime_type: str + url: str + def __init__(self, url: str, length: int | str, mime_type: str) -> None: ... + +class RssFeed(SyndicationFeed): + content_type: str + def rss_attributes(self) -> dict[str, str]: ... + def write_items(self, handler: SimplerXMLGenerator) -> None: ... + def endChannelElement(self, handler: SimplerXMLGenerator) -> None: ... + +class RssUserland091Feed(RssFeed): ... +class Rss201rev2Feed(RssFeed): ... + +class Atom1Feed(SyndicationFeed): + content_type: str + ns: str + def write_items(self, handler: SimplerXMLGenerator) -> None: ... + +DefaultFeed: TypeAlias = Rss201rev2Feed diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/formats.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/formats.pyi new file mode 100644 index 000000000000..22fdf81e7cdf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/formats.pyi @@ -0,0 +1,47 @@ +import types +from collections.abc import Iterator +from datetime import date, time +from datetime import datetime as builtin_datetime +from decimal import Decimal +from typing import Any, TypeVar, overload + +ISO_INPUT_FORMATS: dict[str, list[str]] +FORMAT_SETTINGS: frozenset[str] + +def reset_format_cache() -> None: ... +def iter_format_modules(lang: str, format_module_path: list[str] | str | None = None) -> Iterator[types.ModuleType]: ... +def get_format_modules(lang: str | None = None) -> list[types.ModuleType]: ... +def get_format(format_type: str, lang: str | None = None, use_l10n: bool | None = None) -> Any: ... + +get_format_lazy: Any + +def date_format( + value: date | builtin_datetime | str, format: str | None = None, use_l10n: bool | None = None +) -> str: ... +def time_format( + value: time | builtin_datetime | str, format: str | None = None, use_l10n: bool | None = None +) -> str: ... +def number_format( + value: Decimal | float | str, + decimal_pos: int | None = None, + use_l10n: bool | None = None, + force_grouping: bool = False, +) -> str: ... + +_T = TypeVar("_T") + +# Mypy considers this invalid (overlapping signatures), but thanks to implementation +# details it works as expected (all values from Union are `localize`d to str, +# while type of others is preserved) +@overload +def localize(value: builtin_datetime | date | time | Decimal | float | str, use_l10n: bool | None = None) -> str: ... +@overload +def localize(value: _T, use_l10n: bool | None = None) -> _T: ... +@overload +def localize_input( + value: builtin_datetime | date | time | Decimal | float | str, default: str | None = None +) -> str: ... +@overload +def localize_input(value: _T, default: str | None = None) -> _T: ... +def sanitize_separators(value: _T) -> _T: ... +def sanitize_strftime_format(fmt: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/functional.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/functional.pyi new file mode 100644 index 000000000000..954cfec7b839 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/functional.pyi @@ -0,0 +1,109 @@ +from collections.abc import Callable + +# Mypy has special handling for functools.cached_property, reuse typeshed's definition instead of defining our own +from functools import cached_property as cached_property +from typing import Any, Generic, Protocol, SupportsIndex, TypeVar, overload, type_check_only + +from django.db.models.base import Model +from typing_extensions import Self, TypeAlias + +_T = TypeVar("_T") + +# Promise is only subclassed by a proxy class defined in the lazy function +# so it makes sense for it to have all the methods available in that proxy class +class Promise: + def __init__(self, args: Any, kw: Any) -> None: ... + def __reduce__(self) -> tuple[Any, tuple[Any]]: ... + def __lt__(self, other: Any) -> bool: ... + def __mod__(self, rhs: Any) -> Any: ... + def __add__(self, other: Any) -> Any: ... + def __radd__(self, other: Any) -> Any: ... + def __deepcopy__(self, memo: Any) -> Self: ... + +@type_check_only +class _StrPromise(Promise): + def __add__(self, s: str, /) -> str: ... + def __contains__(self, o: str, /) -> bool: ... + def __ge__(self, x: str, /) -> bool: ... + def __getitem__(self, i: SupportsIndex | slice, /) -> str: ... + def __gt__(self, x: str, /) -> bool: ... + def __le__(self, x: str, /) -> bool: ... + # __len__ needed here because it defined abstract in Sequence[str] + def __len__(self) -> int: ... + def __lt__(self, x: str, /) -> bool: ... + def __mod__(self, x: Any, /) -> str: ... + def __mul__(self, n: SupportsIndex, /) -> str: ... + def __rmul__(self, n: SupportsIndex, /) -> str: ... + # Mypy requires this for the attribute hook to take effect + def __getattribute__(self, name: str, /) -> Any: ... + +_StrOrPromise: TypeAlias = str | _StrPromise # noqa: PYI047 +_C = TypeVar("_C", bound=Callable) + +def lazy(func: _C, *resultclasses: Any) -> _C: ... +def lazystr(text: Any) -> _StrPromise: ... +def keep_lazy(*resultclasses: Any) -> Callable: ... +def keep_lazy_text(func: Callable) -> Callable: ... + +empty: object + +def new_method_proxy(func: Callable[..., _T]) -> Callable[..., _T]: ... + +class LazyObject: + def __init__(self) -> None: ... + __getattr__: Callable + def __setattr__(self, name: str, value: Any) -> None: ... + def __delattr__(self, name: str) -> None: ... + def __reduce__(self) -> tuple[Callable, tuple[Model]]: ... + def __copy__(self) -> LazyObject: ... + # TODO: Deepcopy can return a LazyObject or a wrapped object, but we'll need to make LazyObject generic first + def __deepcopy__(self, memo: dict[int, Any]) -> Any: ... + __bytes__: Callable + __bool__: Callable + __dir__: Callable + __ne__: Callable + __hash__: Callable + __getitem__: Callable + __setitem__: Callable + __delitem__: Callable + __iter__: Callable + __len__: Callable + __contains__: Callable + __gt__: Callable + __lt__: Callable + __add__: Callable + __str__: Callable[..., str] + +def unpickle_lazyobject(wrapped: Model) -> Model: ... + +class SimpleLazyObject(LazyObject): + def __init__(self, func: Callable[[], Any]) -> None: ... + def __copy__(self) -> SimpleLazyObject: ... + __radd__: Callable + +_PartitionMember = TypeVar("_PartitionMember") + +def partition( + predicate: Callable[[_PartitionMember], int | bool], values: list[_PartitionMember] +) -> tuple[list[_PartitionMember], list[_PartitionMember]]: ... + +_Get = TypeVar("_Get", covariant=True) + +class classproperty(Generic[_Get]): + fget: Callable[[Any], _Get] | None + def __init__(self, method: Callable[[Any], _Get] | None = None) -> None: ... + def __get__(self, instance: Any | None, cls: type[Any] | None = None) -> _Get: ... + def getter(self, method: Callable[[Any], _Get]) -> classproperty[_Get]: ... + +@type_check_only +class _Getter(Protocol[_Get]): # noqa: PYI046 + """Type fake to declare some read-only properties (until `property` builtin is generic) + + We can use something like `Union[_Getter[str], str]` in base class to avoid errors + when redefining attribute with property or property with attribute. + """ + + @overload + def __get__(self, instance: None, typeobj: type[Any] | None, /) -> Self: ... + @overload + def __get__(self, instance: Any, typeobj: type[Any] | None, /) -> _Get: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/hashable.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/hashable.pyi new file mode 100644 index 000000000000..a049be9788a3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/hashable.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def make_hashable(value: Any) -> Any: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/html.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/html.pyi new file mode 100644 index 000000000000..b72f961f0aba --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/html.pyi @@ -0,0 +1,79 @@ +from collections.abc import Iterable +from functools import cached_property +from html.parser import HTMLParser +from json import JSONEncoder +from re import Pattern +from typing import Any + +from _typeshed import Incomplete +from django.utils.functional import SimpleLazyObject, _StrOrPromise +from django.utils.safestring import SafeData, SafeString + +VOID_ELEMENTS: frozenset[str] +MAX_URL_LENGTH: int + +def escape(text: Any) -> SafeString: ... +def escapejs(value: Any) -> SafeString: ... +def json_script(value: Any, element_id: str | None = None, encoder: type[JSONEncoder] | None = None) -> SafeString: ... + +# conditional_escape could use a protocol to be more precise, see https://github.com/typeddjango/django-stubs/issues/1474 +def conditional_escape(text: _StrOrPromise | SafeData) -> SafeString: ... +def format_html(format_string: str, *args: Any, **kwargs: Any) -> SafeString: ... +def format_html_join(sep: str, format_string: str, args_generator: Iterable[Iterable[Any]]) -> SafeString: ... +def linebreaks(value: Any, autoescape: bool = False) -> str: ... + +class MLStripper(HTMLParser): + fed: Any + def __init__(self) -> None: ... + def handle_data(self, d: str) -> None: ... + def handle_entityref(self, name: str) -> None: ... + def handle_charref(self, name: str) -> None: ... + def get_data(self) -> str: ... + +def strip_tags(value: str) -> str: ... +def strip_spaces_between_tags(value: str) -> str: ... +def smart_urlquote(url: str) -> str: ... +def urlize(text: str, trim_url_limit: int | None = None, nofollow: bool = False, autoescape: bool = False) -> str: ... +def avoid_wrapping(value: str) -> str: ... +def html_safe(klass: type) -> type: ... + +class CountsDict(dict[str, Any]): + def __init__(self, *args: Any, word: str, **kwargs: Any) -> None: ... + def __missing__(self, key: str) -> Any: ... + +class Urlizer: + trailing_punctuation_chars: str + wrapping_punctuation: Incomplete + word_split_re: Pattern[str] | SimpleLazyObject + simple_url_re: Pattern[str] | SimpleLazyObject + simple_url_2_re: Pattern[str] | SimpleLazyObject + mailto_template: str + url_template: str + def __call__( + self, + text: Incomplete, + trim_url_limit: Incomplete | None = None, + nofollow: bool = False, + autoescape: bool = False, + ) -> Incomplete: ... + def handle_word( + self, + word: Incomplete, + *, + safe_input: Incomplete, + trim_url_limit: Incomplete | None = None, + nofollow: bool = False, + autoescape: bool = False, + ) -> Incomplete: ... + def trim_url(self, x: str, *, limit: int | None) -> Incomplete: ... + def trim_punctuation(self, word: str) -> tuple[str, str, str]: ... + @staticmethod + def is_email_simple(value: str) -> bool: ... + @cached_property + def wrapping_punctuation_openings(self) -> str: ... + @cached_property + def trailing_punctuation_chars_no_semicolon(self) -> str: ... + @cached_property + def trailing_punctuation_chars_has_semicolon(self) -> bool: ... + +urlizer: Urlizer diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/http.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/http.pyi new file mode 100644 index 000000000000..173b8c920489 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/http.pyi @@ -0,0 +1,35 @@ +from collections.abc import Iterable, Mapping +from re import Pattern + +ETAG_MATCH: Pattern[str] +MONTHS: list[str] +RFC1123_DATE: Pattern[str] +RFC850_DATE: Pattern[str] +ASCTIME_DATE: Pattern[str] +RFC3986_GENDELIMS: str +RFC3986_SUBDELIMS: str + +def urlencode( + query: ( + Mapping[str, str | bytes | int | Iterable[str | bytes | int]] + | Iterable[tuple[str, str | bytes | int | Iterable[str | bytes | int]]] + | None + ), + doseq: bool = False, +) -> str: ... +def http_date(epoch_seconds: float | None = None) -> str: ... +def parse_http_date(date: str) -> int: ... +def parse_http_date_safe(date: str) -> int | None: ... +def base36_to_int(s: str) -> int: ... +def int_to_base36(i: int) -> str: ... +def urlsafe_base64_encode(s: bytes) -> str: ... +def urlsafe_base64_decode(s: str) -> bytes: ... +def parse_etags(etag_str: str) -> list[str]: ... +def quote_etag(etag_str: str) -> str: ... +def is_same_domain(host: str, pattern: str) -> bool: ... +def url_has_allowed_host_and_scheme( + url: str | None, allowed_hosts: str | Iterable[str] | None, require_https: bool = False +) -> bool: ... +def escape_leading_slashes(url: str) -> str: ... +def content_disposition_header(as_attachment: bool, filename: str) -> str | None: ... +def parse_header_parameters(line: str) -> tuple[str, dict[str, str]]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/inspect.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/inspect.pyi new file mode 100644 index 000000000000..a1ebae5f3dad --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/inspect.pyi @@ -0,0 +1,12 @@ +from collections.abc import Callable +from inspect import _ParameterKind +from typing import Any + +ARG_KINDS: frozenset[_ParameterKind] + +def get_func_args(func: Callable[..., Any]) -> list[str]: ... +def get_func_full_args(func: Callable[..., Any]) -> list[tuple[str, str] | tuple[str]]: ... +def func_accepts_kwargs(func: Callable[..., Any]) -> bool: ... +def func_accepts_var_args(func: Callable[..., Any]) -> bool: ... +def method_has_no_args(meth: Callable[..., Any]) -> bool: ... +def func_supports_parameter(func: Callable[..., Any], name: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/ipv6.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/ipv6.pyi new file mode 100644 index 000000000000..8ee5ecbb46ca --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/ipv6.pyi @@ -0,0 +1,4 @@ +from typing import Any + +def clean_ipv6_address(ip_str: Any, unpack_ipv4: bool = False, error_message: str = ...) -> str: ... +def is_valid_ipv6_address(ip_str: str) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/itercompat.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/itercompat.pyi new file mode 100644 index 000000000000..5c15fee5d6ba --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/itercompat.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def is_iterable(x: Any) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/jslex.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/jslex.pyi new file mode 100644 index 000000000000..e34a9ca60650 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/jslex.pyi @@ -0,0 +1,27 @@ +from collections.abc import Iterator +from typing import Any + +class Tok: + num: int + id: int + name: str + regex: str + next: str | None + def __init__(self, name: str, regex: str, next: str | None = None) -> None: ... + +def literals(choices: str, prefix: str = "", suffix: str = "") -> str: ... + +class Lexer: + regexes: Any + toks: dict[str, Tok] + state: str + def __init__(self, states: dict[str, list[Tok]], first: str) -> None: ... + def lex(self, text: str) -> Iterator[tuple[str, str]]: ... + +class JsLexer(Lexer): + both_before: list[Tok] + both_after: list[Tok] + states: dict[str, list[Tok]] + def __init__(self) -> None: ... + +def prepare_js_for_gettext(js: str) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/log.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/log.pyi new file mode 100644 index 000000000000..89fdeaa66f43 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/log.pyi @@ -0,0 +1,53 @@ +import logging.config +from collections.abc import Callable +from logging import Logger, LogRecord +from typing import Any + +from django.core.management.color import Style +from django.http import HttpRequest, HttpResponse +from django.utils.functional import _StrOrPromise + +request_logger: Logger +DEFAULT_LOGGING: Any + +def configure_logging(logging_config: str, logging_settings: dict[str, Any]) -> None: ... + +class AdminEmailHandler(logging.Handler): + include_html: bool + email_backend: str | None + def __init__( + self, + include_html: bool = False, + email_backend: str | None = None, + reporter_class: str | None = None, + ) -> None: ... + def send_mail(self, subject: _StrOrPromise, message: _StrOrPromise, *args: Any, **kwargs: Any) -> None: ... + def connection(self) -> Any: ... + def format_subject(self, subject: str) -> str: ... + +class CallbackFilter(logging.Filter): + callback: Callable[[str | LogRecord], bool] + def __init__(self, callback: Callable[[str | LogRecord], bool]) -> None: ... + def filter(self, record: str | LogRecord) -> bool: ... + +class RequireDebugFalse(logging.Filter): + def filter(self, record: str | LogRecord) -> bool: ... + +class RequireDebugTrue(logging.Filter): + def filter(self, record: str | LogRecord) -> bool: ... + +class ServerFormatter(logging.Formatter): + default_time_format: str + style: Style + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def uses_server_time(self) -> bool: ... + +def log_response( + message: str, + *args: Any, + response: HttpResponse | None = None, + request: HttpRequest | None = None, + logger: Logger = ..., + level: str | None = None, + exception: BaseException | None = None, +) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/lorem_ipsum.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/lorem_ipsum.pyi new file mode 100644 index 000000000000..e0547fa1fd37 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/lorem_ipsum.pyi @@ -0,0 +1,10 @@ +from typing import Any + +COMMON_P: str +WORDS: Any +COMMON_WORDS: Any + +def sentence() -> str: ... +def paragraph() -> str: ... +def paragraphs(count: int, common: bool = True) -> list[str]: ... +def words(count: int, common: bool = True) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/module_loading.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/module_loading.pyi new file mode 100644 index 000000000000..6bd68b4506df --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/module_loading.pyi @@ -0,0 +1,7 @@ +from typing import Any + +def cached_import(module_path: str, class_name: str) -> Any: ... +def import_string(dotted_path: str) -> Any: ... +def autodiscover_modules(*args: Any, **kwargs: Any) -> None: ... +def module_has_submodule(package: Any, module_name: str) -> bool: ... +def module_dir(module: Any) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/numberformat.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/numberformat.pyi new file mode 100644 index 000000000000..caab011c900c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/numberformat.pyi @@ -0,0 +1,12 @@ +from collections.abc import Iterable +from decimal import Decimal + +def format( + number: Decimal | float | str, + decimal_sep: str, + decimal_pos: int | None = None, + grouping: int | Iterable[int] = 0, + thousand_sep: str = "", + force_grouping: bool = False, + use_l10n: bool | None = None, +) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/regex_helper.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/regex_helper.pyi new file mode 100644 index 000000000000..cfb0bb19071f --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/regex_helper.pyi @@ -0,0 +1,23 @@ +from collections.abc import Iterator, Mapping +from re import Pattern +from typing import TypeVar + +ESCAPE_MAPPINGS: Mapping[str, str | None] + +class Choice(list): ... +class Group(list): ... +class NonCapture(list): ... + +def normalize(pattern: str) -> list[tuple[str, list[str]]]: ... +def next_char(input_iter: Iterator[str]) -> Iterator[tuple[str, bool]]: ... +def walk_to_end(ch: str, input_iter: Iterator[tuple[str, bool]]) -> None: ... +def get_quantifier(ch: str, input_iter: Iterator[tuple[str, bool]]) -> tuple[int, str | None]: ... +def contains(source: Group | NonCapture | str, inst: type[Group]) -> bool: ... +def flatten_result( + source: list[Choice | Group | str] | Group | NonCapture | None, +) -> tuple[list[str], list[list[str]]]: ... + +# Returns SimpleLazyObject, but we can safely ignore it +_P = TypeVar("_P", str, bytes) + +def _lazy_re_compile(regex: _P | Pattern[_P], flags: int = 0) -> Pattern[_P]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/safestring.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/safestring.pyi new file mode 100644 index 000000000000..cf563d052ca3 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/safestring.pyi @@ -0,0 +1,26 @@ +from collections.abc import Callable +from typing import Any, TypeVar, overload + +from typing_extensions import Self, TypeAlias + +_SD = TypeVar("_SD", bound=SafeData) + +class SafeData: + def __html__(self) -> Self: ... + +class SafeString(str, SafeData): + @overload + def __add__(self, rhs: SafeString) -> SafeString: ... + @overload + def __add__(self, rhs: str) -> str: ... + +SafeText: TypeAlias = SafeString + +_C = TypeVar("_C", bound=Callable) + +@overload +def mark_safe(s: _SD) -> _SD: ... +@overload +def mark_safe(s: _C) -> _C: ... +@overload +def mark_safe(s: Any) -> SafeString: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/termcolors.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/termcolors.pyi new file mode 100644 index 000000000000..187f1d684e10 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/termcolors.pyi @@ -0,0 +1,19 @@ +from collections.abc import Callable, Sequence +from typing import Any, Literal + +color_names: tuple[str, ...] +foreground: dict[str, str] +background: dict[str, str] +RESET: Literal["0"] +opt_dict: dict[str, str] + +def colorize(text: str | None = "", opts: Sequence[str] = (), *, fg: str = ..., bg: str = ...) -> str: ... +def make_style(opts: Sequence[str] = (), *, fg: str = ..., bg: str = ...) -> Callable[[str | None], str]: ... + +NOCOLOR_PALETTE: str +DARK_PALETTE: str +LIGHT_PALETTE: str +PALETTES: Any +DEFAULT_PALETTE: str + +def parse_color_setting(config_string: str) -> dict[str, dict[str, tuple[str, ...] | str]] | None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/text.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/text.pyi new file mode 100644 index 000000000000..c7187358f3f1 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/text.pyi @@ -0,0 +1,62 @@ +from collections.abc import Callable, Iterable, Iterator +from html.parser import HTMLParser +from io import BytesIO +from re import Pattern +from typing import ClassVar, TypeVar, overload + +from django.db.models.base import Model +from django.utils.functional import SimpleLazyObject, _StrOrPromise, cached_property + +_StrOrPromiseT = TypeVar("_StrOrPromiseT", bound=_StrOrPromise) +_StrOrPromiseOrNoneT = TypeVar("_StrOrPromiseOrNoneT", bound=_StrOrPromise | None) + +def capfirst(x: _StrOrPromiseOrNoneT) -> _StrOrPromiseOrNoneT: ... + +re_newlines: Pattern[str] +re_camel_case: Pattern[str] + +def wrap(text: _StrOrPromiseT, width: int) -> _StrOrPromiseT: ... +def add_truncation_text(text: str, truncate: str | None = None) -> str: ... +def calculate_truncate_chars_length(length: int, replacement: str | None) -> int: ... + +class TruncateHTMLParser(HTMLParser): + TruncationCompleted: ClassVar[type[Exception]] + def __init__(self, *, length: int, replacement: str | None, convert_charrefs: bool = True) -> None: ... + @cached_property + def void_elements(self) -> frozenset[str]: ... + +class TruncateCharsHTMLParser(TruncateHTMLParser): + def process(self, data: str) -> tuple[str, str]: ... + +class TruncateWordsHTMLParser(TruncateHTMLParser): + def process(self, data: str) -> tuple[str, str]: ... + +class Truncator(SimpleLazyObject): + MAX_LENGTH_HTML: ClassVar[int] + def __init__(self, text: Model | str) -> None: ... + def chars(self, num: int, truncate: str | None = None, html: bool = False) -> str: ... + def words(self, num: int, truncate: str | None = None, html: bool = False) -> str: ... + +def get_valid_filename(name: _StrOrPromiseT) -> _StrOrPromiseT: ... +@overload +def get_text_list(list_: list[str], last_word: str = ...) -> str: ... +@overload +def get_text_list(list_: list[_StrOrPromise], last_word: _StrOrPromise = ...) -> _StrOrPromise: ... +def normalize_newlines(text: _StrOrPromiseT) -> _StrOrPromiseT: ... +def phone2numeric(phone: _StrOrPromiseT) -> _StrOrPromiseT: ... +def compress_string(s: bytes, *, max_random_bytes: int | None = None) -> bytes: ... + +class StreamingBuffer(BytesIO): + vals: list[bytes] + def read(self) -> bytes: ... # type: ignore[override] + +def compress_sequence(sequence: Iterable[bytes], *, max_random_bytes: int | None = None) -> Iterator[bytes]: ... + +smart_split_re: Pattern[str] + +def smart_split(text: str) -> Iterator[str]: ... +def unescape_string_literal(s: _StrOrPromiseT) -> _StrOrPromiseT: ... +def slugify(value: _StrOrPromiseT, allow_unicode: bool = False) -> _StrOrPromiseT: ... +def camel_case_to_spaces(value: str) -> str: ... + +format_lazy: Callable[..., str] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/timesince.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/timesince.pyi new file mode 100644 index 000000000000..c1089993d91a --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/timesince.pyi @@ -0,0 +1,15 @@ +from datetime import date + +TIME_STRINGS: dict[str, str] +TIME_STRINGS_KEYS: list[str] +TIME_CHUNKS: list[int] +MONTHS_DAYS: tuple[int, ...] + +def timesince( + d: date, + now: date | None = None, + reversed: bool = False, + time_strings: dict[str, str] | None = None, + depth: int = 2, +) -> str: ... +def timeuntil(d: date, now: date | None = None, time_strings: dict[str, str] | None = None, depth: int = 2) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/timezone.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/timezone.pyi new file mode 100644 index 000000000000..d91ae571aa4c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/timezone.pyi @@ -0,0 +1,40 @@ +from contextlib import ContextDecorator +from datetime import date, datetime, time, timedelta, timezone, tzinfo +from types import TracebackType +from typing import Literal, overload + +import zoneinfo # type: ignore[import-not-found,unused-ignore] + +def get_fixed_timezone(offset: timedelta | int) -> timezone: ... +def get_default_timezone() -> zoneinfo.ZoneInfo: ... +def get_default_timezone_name() -> str: ... +def get_current_timezone() -> zoneinfo.ZoneInfo: ... +def get_current_timezone_name() -> str: ... +def activate(timezone: tzinfo | str) -> None: ... +def deactivate() -> None: ... + +class override(ContextDecorator): + timezone: str | tzinfo | None + old_timezone: tzinfo | None + def __init__(self, timezone: str | tzinfo | None) -> None: ... + def __enter__(self) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + +def localtime(value: datetime | None = None, timezone: tzinfo | None = None) -> datetime: ... +def localdate(value: datetime | None = None, timezone: tzinfo | None = None) -> date: ... +def now() -> datetime: ... +@overload +def is_aware(value: time) -> Literal[False]: ... +@overload +def is_aware(value: datetime) -> bool: ... +@overload +def is_naive(value: time) -> Literal[True]: ... +@overload +def is_naive(value: datetime) -> bool: ... +def make_aware(value: datetime, timezone: tzinfo | None = None) -> datetime: ... +def make_naive(value: datetime, timezone: tzinfo | None = None) -> datetime: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/__init__.pyi new file mode 100644 index 000000000000..90152ff88a84 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/__init__.pyi @@ -0,0 +1,49 @@ +from contextlib import ContextDecorator +from types import TracebackType +from typing import Any + +from django.http.request import HttpRequest +from django.utils.functional import _StrPromise + +class TranslatorCommentWarning(SyntaxWarning): ... + +def gettext_noop(message: str) -> str: ... +def gettext(message: str) -> str: ... +def ngettext(singular: str, plural: str, number: float) -> str: ... +def pgettext(context: str, message: str) -> str: ... +def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... + +# lazy evaluated translation functions +def gettext_lazy(message: str) -> _StrPromise: ... +def pgettext_lazy(context: str, message: str) -> _StrPromise: ... +def ngettext_lazy(singular: str, plural: str, number: int | str | None = None) -> _StrPromise: ... +def npgettext_lazy(context: str, singular: str, plural: str, number: int | str | None = None) -> _StrPromise: ... +def activate(language: str) -> None: ... +def deactivate() -> None: ... + +class override(ContextDecorator): + language: str | None + deactivate: bool + def __init__(self, language: str | None, deactivate: bool = False) -> None: ... + old_language: str | None + def __enter__(self) -> None: ... + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: ... + +def get_language() -> str: ... +def get_language_from_path(path: str) -> str | None: ... +def get_language_bidi() -> bool: ... +def check_for_language(lang_code: str | None) -> bool: ... +def to_language(locale: str) -> str: ... +def to_locale(language: str) -> str: ... +def get_language_from_request(request: HttpRequest, check_path: bool = False) -> str: ... +def templatize(src: str, **kwargs: Any) -> str: ... +def deactivate_all() -> None: ... +def get_supported_language_variant(lang_code: str, *, strict: bool = False) -> str: ... +def get_language_info(lang_code: str) -> Any: ... +def trim_whitespace(s: str) -> str: ... +def round_away_from_one(value: int) -> int: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/reloader.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/reloader.pyi new file mode 100644 index 000000000000..190c7b6a32b7 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/reloader.pyi @@ -0,0 +1,7 @@ +from pathlib import Path +from typing import Any + +from django.utils.autoreload import BaseReloader + +def watch_for_translation_changes(sender: BaseReloader, **kwargs: Any) -> None: ... +def translation_file_changed(sender: BaseReloader | None, file_path: Path, **kwargs: Any) -> bool: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/template.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/template.pyi new file mode 100644 index 000000000000..66086d8bc982 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/template.pyi @@ -0,0 +1,16 @@ +from re import Pattern + +TRANSLATOR_COMMENT_MARK: str + +dot_re: Pattern[str] + +def blankout(src: str, char: str) -> str: ... + +context_re: Pattern[str] +inline_re: Pattern[str] +block_re: Pattern[str] +endblock_re: Pattern[str] +plural_re: Pattern[str] +constant_re: Pattern[str] + +def templatize(src: str, origin: str | None = None) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_null.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_null.pyi new file mode 100644 index 000000000000..8e40e4a827de --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_null.pyi @@ -0,0 +1,25 @@ +from django.http.request import HttpRequest + +def gettext(message: str) -> str: ... + +gettext_noop = gettext +gettext_lazy = gettext +_ = gettext + +def ngettext(singular: str, plural: str, number: int) -> str: ... + +ngettext_lazy = ngettext + +def pgettext(context: str, message: str) -> str: ... +def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... +def activate(x: str) -> None: ... +def deactivate() -> None: ... + +deactivate_all = deactivate + +def get_language() -> str: ... +def get_language_bidi() -> bool: ... +def check_for_language(x: str) -> bool: ... +def get_language_from_request(request: HttpRequest, check_path: bool = False) -> str: ... +def get_language_from_path(request: str) -> None: ... +def get_supported_language_variant(lang_code: str, strict: bool = False) -> str: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_real.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_real.pyi new file mode 100644 index 000000000000..28664c6530ff --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/translation/trans_real.pyi @@ -0,0 +1,70 @@ +import gettext as gettext_module +from collections.abc import Iterator +from gettext import NullTranslations +from re import Pattern + +# switch to tuple once https://github.com/python/mypy/issues/11098 is fixed +from typing import Any, Literal, Protocol, TypeVar, type_check_only + +from django.http.request import HttpRequest +from typing_extensions import TypeAlias + +CONTEXT_SEPARATOR: Literal["\x04"] +LANGUAGE_CODE_MAX_LENGTH: int + +accept_language_re: Pattern[str] +language_code_re: Pattern[str] +language_code_prefix_re: Pattern[str] + +@type_check_only +class _PluralCallable(Protocol): + def __call__(self, n: int, /) -> int: ... + +def reset_cache(*, setting: str, **kwargs: Any) -> None: ... + +# switch to tuple once https://github.com/python/mypy/issues/11098 is fixed +_KeyT: TypeAlias = str | tuple[str, int] + +_Z = TypeVar("_Z") + +class TranslationCatalog: + _catalogs: list[dict[_KeyT, str]] + def __init__(self, trans: gettext_module.NullTranslations | None = None) -> None: ... + def __getitem__(self, key: _KeyT) -> str: ... + def __setitem__(self, key: _KeyT, value: str) -> None: ... + def __contains__(self, key: _KeyT) -> bool: ... + def items(self) -> Iterator[tuple[_KeyT, str]]: ... + def keys(self) -> Iterator[_KeyT]: ... + def update(self, trans: gettext_module.NullTranslations) -> None: ... + def get(self, key: _KeyT, default: _Z | None = None) -> str | _Z: ... + def plural(self, msgid: str, num: int) -> str: ... + +class DjangoTranslation(gettext_module.GNUTranslations): + domain: str + plural: _PluralCallable + def __init__(self, language: str, domain: str | None = None, localedirs: list[str] | None = None) -> None: ... + def merge(self, other: NullTranslations) -> None: ... + def language(self) -> str: ... + def to_language(self) -> str: ... + def ngettext(self, msgid1: str, msgid2: str, n: int) -> str: ... + +def translation(language: str) -> DjangoTranslation: ... +def activate(language: str) -> None: ... +def deactivate() -> None: ... +def deactivate_all() -> None: ... +def get_language() -> str: ... +def get_language_bidi() -> bool: ... +def catalog() -> DjangoTranslation: ... +def gettext(message: str) -> str: ... +def pgettext(context: str, message: str) -> str: ... +def gettext_noop(message: str) -> str: ... +def do_ntranslate(singular: str, plural: str, number: float, translation_function: str) -> str: ... +def ngettext(singular: str, plural: str, number: float) -> str: ... +def npgettext(context: str, singular: str, plural: str, number: int) -> str: ... +def all_locale_paths() -> list[str]: ... +def check_for_language(lang_code: str | None) -> bool: ... +def get_languages() -> dict[str, str]: ... +def get_supported_language_variant(lang_code: str | None, strict: bool = False) -> str: ... +def get_language_from_path(path: str, strict: bool = False) -> str | None: ... +def get_language_from_request(request: HttpRequest, check_path: bool = False) -> str: ... +def parse_accept_lang_header(lang_string: str) -> tuple[tuple[str, float], ...]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/tree.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/tree.pyi new file mode 100644 index 000000000000..06704fd80073 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/tree.pyi @@ -0,0 +1,29 @@ +from collections.abc import Sequence +from typing import Any + +from django.db.models.sql.where import NothingNode +from typing_extensions import TypeAlias + +_NodeChildren: TypeAlias = list[Node | NothingNode | Sequence[Any]] + +class Node: + children: _NodeChildren + default: str + connector: str + negated: bool + def __init__( + self, children: _NodeChildren | None = None, connector: str | None = None, negated: bool = False + ) -> None: ... + @classmethod + def create( + cls, children: _NodeChildren | None = None, connector: str | None = None, negated: bool = False + ) -> Node: ... + def copy(self) -> Node: ... + def __copy__(self) -> Node: ... + def __deepcopy__(self, memodict: dict[Any, Any]) -> Node: ... + def __len__(self) -> int: ... + def __bool__(self) -> bool: ... + def __contains__(self, other: tuple[str, int]) -> bool: ... + def __hash__(self) -> int: ... + def add(self, data: Any, conn_type: str) -> Any: ... + def negate(self) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/version.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/version.pyi new file mode 100644 index 000000000000..10004882e3fe --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/version.pyi @@ -0,0 +1,19 @@ +from typing_extensions import TypeAlias + +PYPY: bool + +PY38: bool +PY39: bool +PY310: bool +PY311: bool +PY312: bool +PY313: bool + +_VT: TypeAlias = tuple[int, int, int, str, int] + +def get_version(version: _VT | None = None) -> str: ... +def get_main_version(version: _VT | None = None) -> str: ... +def get_complete_version(version: _VT | None = None) -> _VT: ... +def get_docs_version(version: _VT | None = None) -> str: ... +def get_git_changeset() -> str | None: ... +def get_version_tuple(version: str) -> tuple[int, int, int]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/utils/xmlutils.pyi b/python/helpers/bundled_stubs/Django/django-stubs/utils/xmlutils.pyi new file mode 100644 index 000000000000..78f5bda2b328 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/utils/xmlutils.pyi @@ -0,0 +1,9 @@ +from xml.sax.saxutils import XMLGenerator +from xml.sax.xmlreader import AttributesImpl + +class UnserializableContentError(ValueError): ... + +class SimplerXMLGenerator(XMLGenerator): + def addQuickElement(self, name: str, contents: str | None = ..., attrs: dict[str, str] | None = ...) -> None: ... + def characters(self, content: str) -> None: ... + def startElement(self, name: str, attrs: AttributesImpl) -> None: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/__init__.pyi new file mode 100644 index 000000000000..cff086f3edaf --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/__init__.pyi @@ -0,0 +1 @@ +from .generic.base import View as View diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/csrf.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/csrf.pyi new file mode 100644 index 000000000000..047eb07e397c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/csrf.pyi @@ -0,0 +1,9 @@ +from pathlib import Path + +from django.http.request import HttpRequest +from django.http.response import HttpResponseForbidden + +CSRF_FAILURE_TEMPLATE_NAME: str + +def builtin_template_path(name: str) -> Path: ... +def csrf_failure(request: HttpRequest, reason: str = ..., template_name: str = ...) -> HttpResponseForbidden: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/debug.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/debug.pyi new file mode 100644 index 000000000000..19a149bf8b43 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/debug.pyi @@ -0,0 +1,76 @@ +import re +from collections.abc import Callable, ItemsView, Iterator +from pathlib import Path +from types import TracebackType +from typing import Any + +from django.http.request import HttpRequest, QueryDict +from django.http.response import Http404, HttpResponse +from django.template import Engine +from django.utils.safestring import SafeString + +DEBUG_ENGINE: Engine + +class CallableSettingWrapper: + def __init__(self, callable_setting: Callable | type[Any]) -> None: ... + +class ExceptionCycleWarning(UserWarning): ... + +def technical_500_response( + request: HttpRequest, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + tb: TracebackType | None, + status_code: int = ..., +) -> HttpResponse: ... +def get_default_exception_reporter_filter() -> SafeExceptionReporterFilter: ... +def get_exception_reporter_filter(request: HttpRequest | None) -> SafeExceptionReporterFilter: ... + +class SafeExceptionReporterFilter: + cleansed_substitute: str + hidden_settings: re.Pattern[str] + def cleanse_setting(self, key: int | str, value: Any) -> Any: ... + def get_safe_settings(self) -> dict[str, Any]: ... + def get_safe_request_meta(self, request: HttpRequest) -> dict[str, Any]: ... + def get_safe_cookies(self, request: HttpRequest) -> dict[str, Any]: ... + def is_active(self, request: HttpRequest | None) -> bool: ... + def get_cleansed_multivaluedict(self, request: HttpRequest, multivaluedict: QueryDict) -> QueryDict: ... + def get_post_parameters(self, request: HttpRequest | None) -> dict[str, Any]: ... + def cleanse_special_types(self, request: HttpRequest | None, value: Any) -> Any: ... + def get_traceback_frame_variables(self, request: Any, tb_frame: Any) -> ItemsView[str, Any]: ... + +class ExceptionReporter: + request: HttpRequest | None + filter: SafeExceptionReporterFilter + exc_type: type[BaseException] | None + exc_value: BaseException | None + tb: TracebackType | None + is_email: bool + template_info: Any | None + template_does_not_exist: bool + postmortem: Any | None + @property + def html_template_path(self) -> Path: ... + @property + def text_template_path(self) -> Path: ... + def __init__( + self, + request: HttpRequest | None, + exc_type: type[BaseException] | None, + exc_value: BaseException | None, + tb: TracebackType | None, + is_email: bool = ..., + ) -> None: ... + def get_traceback_data(self) -> dict[str, Any]: ... + def get_traceback_html(self) -> SafeString: ... + def get_traceback_text(self) -> SafeString: ... + def get_traceback_frames(self) -> list[Any]: ... + def get_exception_traceback_frames( + self, exc_value: BaseException | None, tb: TracebackType | None + ) -> Iterator[dict[str, Any]]: ... + +def technical_404_response(request: HttpRequest, exception: Http404) -> HttpResponse: ... +def default_urlconf(request: HttpResponse | None) -> HttpResponse: ... +def builtin_template_path(name: str) -> Path: ... +def get_caller(request: HttpRequest) -> str: ... +def get_exception_reporter_class(request: HttpRequest) -> ExceptionReporter: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/cache.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/cache.pyi new file mode 100644 index 000000000000..cb6e5a087aa6 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/cache.pyi @@ -0,0 +1,10 @@ +from collections.abc import Callable +from typing import Any, TypeVar + +_F = TypeVar("_F", bound=Callable[..., Any]) + +def cache_page( + timeout: float | None, *, cache: Any | None = ..., key_prefix: Any | None = ... +) -> Callable[[_F], _F]: ... +def cache_control(**kwargs: Any) -> Callable[[_F], _F]: ... +def never_cache(view_func: _F) -> _F: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/clickjacking.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/clickjacking.pyi new file mode 100644 index 000000000000..f0ba61c7e166 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/clickjacking.pyi @@ -0,0 +1,8 @@ +from collections.abc import Callable +from typing import Any, TypeVar + +_F = TypeVar("_F", bound=Callable[..., Any]) + +def xframe_options_deny(view_func: _F) -> _F: ... +def xframe_options_sameorigin(view_func: _F) -> _F: ... +def xframe_options_exempt(view_func: _F) -> _F: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/common.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/common.pyi new file mode 100644 index 000000000000..a129e01e7d69 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/common.pyi @@ -0,0 +1,6 @@ +from collections.abc import Callable +from typing import Any, TypeVar + +_C = TypeVar("_C", bound=Callable[..., Any]) + +def no_append_slash(view_func: _C) -> _C: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/csrf.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/csrf.pyi new file mode 100644 index 000000000000..a9e8b2bcad2c --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/csrf.pyi @@ -0,0 +1,18 @@ +from collections.abc import Callable +from typing import Any, TypeVar + +from django.middleware.csrf import CsrfViewMiddleware + +csrf_protect: Callable[[_F], _F] + +class _EnsureCsrfToken(CsrfViewMiddleware): ... + +requires_csrf_token: Callable[[_F], _F] + +class _EnsureCsrfCookie(CsrfViewMiddleware): ... + +ensure_csrf_cookie: Callable[[_F], _F] + +_F = TypeVar("_F", bound=Callable[..., Any]) + +def csrf_exempt(view_func: _F) -> _F: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/debug.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/debug.pyi new file mode 100644 index 000000000000..240bd095784e --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/debug.pyi @@ -0,0 +1,9 @@ +from collections.abc import Callable +from typing import Any, Literal, TypeVar + +_F = TypeVar("_F", bound=Callable[..., Any]) + +coroutine_functions_to_sensitive_variables: dict[int, Literal["__ALL__"] | tuple[str, ...]] + +def sensitive_variables(*variables: str) -> Callable[[_F], _F]: ... +def sensitive_post_parameters(*parameters: str) -> Callable[[_F], _F]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/gzip.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/gzip.pyi new file mode 100644 index 000000000000..9a9de9880bdc --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/gzip.pyi @@ -0,0 +1,6 @@ +from collections.abc import Callable +from typing import Any, TypeVar + +_C = TypeVar("_C", bound=Callable[..., Any]) + +gzip_page: Callable[[_C], _C] diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/http.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/http.pyi new file mode 100644 index 000000000000..9147bec1f8a2 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/http.pyi @@ -0,0 +1,19 @@ +from collections.abc import Callable, Container +from datetime import datetime +from typing import Any, TypeVar + +_F = TypeVar("_F", bound=Callable[..., Any]) + +conditional_page: Callable[[_F], _F] + +def require_http_methods(request_method_list: Container[str]) -> Callable[[_F], _F]: ... + +require_GET: Callable[[_F], _F] +require_POST: Callable[[_F], _F] +require_safe: Callable[[_F], _F] + +def condition( + etag_func: Callable[..., str | None] | None = ..., last_modified_func: Callable[..., datetime | None] | None = ... +) -> Callable[[_F], _F]: ... +def etag(etag_func: Callable[..., str | None]) -> Callable[[_F], _F]: ... +def last_modified(last_modified_func: Callable[..., datetime | None]) -> Callable[[_F], _F]: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/vary.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/vary.pyi new file mode 100644 index 000000000000..7c8b1d159c72 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/decorators/vary.pyi @@ -0,0 +1,7 @@ +from collections.abc import Callable +from typing import Any, TypeVar + +_F = TypeVar("_F", bound=Callable[..., Any]) + +def vary_on_headers(*headers: str) -> Callable[[_F], _F]: ... +def vary_on_cookie(func: _F) -> _F: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/defaults.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/defaults.pyi new file mode 100644 index 000000000000..f77b8590c010 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/defaults.pyi @@ -0,0 +1,22 @@ +from django.http.request import HttpRequest +from django.http.response import ( + HttpResponseBadRequest, + HttpResponseForbidden, + HttpResponseNotFound, + HttpResponseServerError, +) + +ERROR_404_TEMPLATE_NAME: str +ERROR_403_TEMPLATE_NAME: str +ERROR_400_TEMPLATE_NAME: str +ERROR_500_TEMPLATE_NAME: str +ERROR_PAGE_TEMPLATE: str + +def page_not_found( + request: HttpRequest, exception: Exception | None, template_name: str = ... +) -> HttpResponseNotFound: ... +def server_error(request: HttpRequest, template_name: str = ...) -> HttpResponseServerError: ... +def bad_request(request: HttpRequest, exception: Exception, template_name: str = ...) -> HttpResponseBadRequest: ... +def permission_denied( + request: HttpRequest, exception: Exception, template_name: str = ... +) -> HttpResponseForbidden: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/__init__.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/__init__.pyi new file mode 100644 index 000000000000..f8cae74a89a0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/__init__.pyi @@ -0,0 +1,18 @@ +from .base import RedirectView as RedirectView +from .base import TemplateView as TemplateView +from .base import View as View +from .dates import ArchiveIndexView as ArchiveIndexView +from .dates import DateDetailView as DateDetailView +from .dates import DayArchiveView as DayArchiveView +from .dates import MonthArchiveView as MonthArchiveView +from .dates import TodayArchiveView as TodayArchiveView +from .dates import WeekArchiveView as WeekArchiveView +from .dates import YearArchiveView as YearArchiveView +from .detail import DetailView as DetailView +from .edit import CreateView as CreateView +from .edit import DeleteView as DeleteView +from .edit import FormView as FormView +from .edit import UpdateView as UpdateView +from .list import ListView as ListView + +class GenericViewError(Exception): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/base.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/base.pyi new file mode 100644 index 000000000000..05f703a12ffc --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/base.pyi @@ -0,0 +1,53 @@ +import logging +from collections.abc import Callable, Sequence +from typing import Any, Mapping + +from django.http.request import HttpRequest +from django.http.response import HttpResponse, HttpResponseBase +from django.utils.functional import _Getter + +logger: logging.Logger + +class ContextMixin: + extra_context: Mapping[str, Any] | None + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + +class View: + http_method_names: Sequence[str] + request: HttpRequest + args: Any + kwargs: Any + def __init__(self, **kwargs: Any) -> None: ... + view_is_async: _Getter[bool] | bool + @classmethod + def as_view(cls: Any, **initkwargs: Any) -> Callable[..., HttpResponseBase]: ... + def setup(self, request: HttpRequest, *args: Any, **kwargs: Any) -> None: ... + def dispatch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + def http_method_not_allowed(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def options(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + +class TemplateResponseMixin: + template_name: str | None + template_engine: str | None + response_class: type[HttpResponse] + content_type: str | None + request: HttpRequest + def render_to_response(self, context: dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... + def get_template_names(self) -> list[str]: ... + +class TemplateView(TemplateResponseMixin, ContextMixin, View): + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + +class RedirectView(View): + permanent: bool + url: str | None + pattern_name: str | None + query_string: bool + def get_redirect_url(self, *args: Any, **kwargs: Any) -> str | None: ... + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + def head(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + def options(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + def delete(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + def put(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... + def patch(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponseBase: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/dates.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/dates.pyi new file mode 100644 index 000000000000..57c791749e62 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/dates.pyi @@ -0,0 +1,115 @@ +import datetime +from collections.abc import Sequence +from typing import Any, TypeVar + +from django.db import models +from django.db.models.query import QuerySet +from django.http import HttpRequest, HttpResponse +from django.utils.datastructures import _IndexableCollection +from django.utils.functional import _Getter +from django.views.generic.base import View +from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResponseMixin +from django.views.generic.list import MultipleObjectMixin, MultipleObjectTemplateResponseMixin +from typing_extensions import TypeAlias + +_M = TypeVar("_M", bound=models.Model) +_DatedItems: TypeAlias = tuple[_IndexableCollection[datetime.date] | None, _IndexableCollection[_M], dict[str, Any]] + +class YearMixin: + year_format: str + year: str | None + def get_year_format(self) -> str: ... + def get_year(self) -> str: ... + def get_next_year(self, date: datetime.date) -> datetime.date | None: ... + def get_previous_year(self, date: datetime.date) -> datetime.date | None: ... + +class MonthMixin: + month_format: str + month: str | None + def get_month_format(self) -> str: ... + def get_month(self) -> str: ... + def get_next_month(self, date: datetime.date) -> datetime.date | None: ... + def get_previous_month(self, date: datetime.date) -> datetime.date | None: ... + +class DayMixin: + day_format: str + day: str | None + def get_day_format(self) -> str: ... + def get_day(self) -> str: ... + def get_next_day(self, date: datetime.date) -> datetime.date | None: ... + def get_previous_day(self, date: datetime.date) -> datetime.date | None: ... + +class WeekMixin: + week_format: str + week: str | None + def get_week_format(self) -> str: ... + def get_week(self) -> str: ... + def get_next_week(self, date: datetime.date) -> datetime.date | None: ... + def get_previous_week(self, date: datetime.date) -> datetime.date | None: ... + +class DateMixin: + date_field: str | None + allow_future: bool + def get_date_field(self) -> str: ... + def get_allow_future(self) -> bool: ... + uses_datetime_field: _Getter[bool] | bool + +class BaseDateListView(MultipleObjectMixin[_M], DateMixin, View): + date_list_period: str + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def get_dated_items(self) -> _DatedItems: ... + def get_ordering(self) -> str | Sequence[str]: ... + def get_dated_queryset(self, **lookup: Any) -> models.query.QuerySet[_M]: ... + def get_date_list_period(self) -> str: ... + def get_date_list( + self, queryset: models.query.QuerySet, date_type: str | None = ..., ordering: str = ... + ) -> models.query.QuerySet: ... + +class BaseArchiveIndexView(BaseDateListView[_M]): + context_object_name: str + def get_dated_items(self) -> _DatedItems[_M]: ... + +class ArchiveIndexView(MultipleObjectTemplateResponseMixin, BaseArchiveIndexView): + template_name_suffix: str + +class BaseYearArchiveView(YearMixin, BaseDateListView[_M]): + date_list_period: str + make_object_list: bool + def get_dated_items(self) -> _DatedItems[_M]: ... + def get_make_object_list(self) -> bool: ... + +class YearArchiveView(MultipleObjectTemplateResponseMixin, BaseYearArchiveView): + template_name_suffix: str + +class BaseMonthArchiveView(YearMixin, MonthMixin, BaseDateListView[_M]): + date_list_period: str + def get_dated_items(self) -> _DatedItems[_M]: ... + +class MonthArchiveView(MultipleObjectTemplateResponseMixin, BaseMonthArchiveView): + template_name_suffix: str + +class BaseWeekArchiveView(YearMixin, WeekMixin, BaseDateListView[_M]): + def get_dated_items(self) -> _DatedItems[_M]: ... + +class WeekArchiveView(MultipleObjectTemplateResponseMixin, BaseWeekArchiveView): + template_name_suffix: str + +class BaseDayArchiveView(YearMixin, MonthMixin, DayMixin, BaseDateListView[_M]): + def get_dated_items(self) -> _DatedItems[_M]: ... + +class DayArchiveView(MultipleObjectTemplateResponseMixin, BaseDayArchiveView): + template_name_suffix: str + +class BaseTodayArchiveView(BaseDayArchiveView[_M]): + def get_dated_items(self) -> _DatedItems[_M]: ... + +class TodayArchiveView(MultipleObjectTemplateResponseMixin, BaseTodayArchiveView): + template_name_suffix: str + +class BaseDateDetailView(YearMixin, MonthMixin, DayMixin, DateMixin, BaseDetailView[_M]): + def get_object(self, queryset: QuerySet[_M] | None = ...) -> _M: ... + +class DateDetailView(SingleObjectTemplateResponseMixin, BaseDateDetailView): + template_name_suffix: str + +def timezone_today() -> datetime.date: ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/detail.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/detail.pyi new file mode 100644 index 000000000000..b2f04dc470e9 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/detail.pyi @@ -0,0 +1,33 @@ +from typing import Any, Generic, TypeVar, overload + +from django.db import models +from django.http import HttpRequest, HttpResponse +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View + +_M = TypeVar("_M", bound=models.Model) + +class SingleObjectMixin(Generic[_M], ContextMixin): + model: type[_M] + queryset: models.query.QuerySet[_M] | None + slug_field: str + context_object_name: str | None + slug_url_kwarg: str + pk_url_kwarg: str + query_pk_and_slug: bool + def get_object(self, queryset: models.query.QuerySet[_M] | None = ...) -> _M: ... + def get_queryset(self) -> models.query.QuerySet[_M]: ... + def get_slug_field(self) -> str: ... + @overload + def get_context_object_name(self, obj: _M) -> str: ... + @overload + def get_context_object_name(self, obj: Any) -> str | None: ... + +class BaseDetailView(SingleObjectMixin[_M], View): + object: _M + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + +class SingleObjectTemplateResponseMixin(TemplateResponseMixin): + template_name_field: str | None + template_name_suffix: str + +class DetailView(SingleObjectTemplateResponseMixin, BaseDetailView[_M]): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/edit.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/edit.pyi new file mode 100644 index 000000000000..0ec2af6518d0 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/edit.pyi @@ -0,0 +1,73 @@ +from typing import Any, Generic, Literal, TypeVar + +from django.db import models +from django.forms.forms import BaseForm +from django.forms.models import BaseModelForm +from django.http import HttpRequest, HttpResponse +from django.utils.datastructures import _ListOrTuple +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View +from django.views.generic.detail import BaseDetailView, SingleObjectMixin, SingleObjectTemplateResponseMixin + +_FormT = TypeVar("_FormT", bound=BaseForm) +_ModelFormT = TypeVar("_ModelFormT", bound=BaseModelForm) +_M = TypeVar("_M", bound=models.Model) + +class FormMixin(Generic[_FormT], ContextMixin): + initial: dict[str, Any] + form_class: type[_FormT] | None + success_url: str | None + prefix: str | None + def get_initial(self) -> dict[str, Any]: ... + def get_prefix(self) -> str | None: ... + def get_form_class(self) -> type[_FormT]: ... + def get_form(self, form_class: type[_FormT] | None = ...) -> _FormT: ... + def get_form_kwargs(self) -> dict[str, Any]: ... + def get_success_url(self) -> str: ... + def form_valid(self, form: _FormT) -> HttpResponse: ... + def form_invalid(self, form: _FormT) -> HttpResponse: ... + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + +class ModelFormMixin(Generic[_M, _ModelFormT], FormMixin[_ModelFormT], SingleObjectMixin[_M]): + fields: _ListOrTuple[str] | Literal["__all__"] | None + def get_form_class(self) -> type[_ModelFormT]: ... + def get_form_kwargs(self) -> dict[str, Any]: ... + def get_success_url(self) -> str: ... + def form_valid(self, form: _ModelFormT) -> HttpResponse: ... + +class ProcessFormView(View): + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def put(self, *args: Any, **kwargs: Any) -> HttpResponse: ... + +class BaseFormView(FormMixin[_FormT], ProcessFormView): ... +class FormView(TemplateResponseMixin, BaseFormView[_FormT]): ... + +class BaseCreateView(ModelFormMixin[_M, _ModelFormT], ProcessFormView): + object: _M | None + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + +class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView[_M, _ModelFormT]): + template_name_suffix: str + +class BaseUpdateView(ModelFormMixin[_M, _ModelFormT], ProcessFormView): + object: _M + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + +class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView[_M, _ModelFormT]): + template_name_suffix: str + +class DeletionMixin(Generic[_M]): + success_url: str | None + object: _M + def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def delete(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def get_success_url(self) -> str: ... + +class BaseDeleteView(Generic[_M, _ModelFormT], DeletionMixin[_M], FormMixin[_ModelFormT], BaseDetailView[_M]): + object: _M + +class DeleteView(Generic[_M, _ModelFormT], SingleObjectTemplateResponseMixin, BaseDeleteView[_M, _ModelFormT]): + object: _M + template_name_suffix: str diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/generic/list.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/list.pyi new file mode 100644 index 000000000000..785a81aa8e3b --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/generic/list.pyi @@ -0,0 +1,57 @@ +from collections.abc import Sequence +from typing import Any, Generic, Protocol, TypeVar, overload, type_check_only + +from django.core.paginator import Page, Paginator, _SupportsPagination +from django.db.models import Model, QuerySet +from django.http import HttpRequest, HttpResponse +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View + +_M = TypeVar("_M", bound=Model) + +@type_check_only +class _HasModel(Protocol): + @property + def model(self) -> type[Model]: ... + +class MultipleObjectMixin(Generic[_M], ContextMixin): + allow_empty: bool + queryset: QuerySet[_M] | None + model: type[_M] | None + paginate_by: int | None + paginate_orphans: int + context_object_name: str | None + paginator_class: type[Paginator] + page_kwarg: str + ordering: str | Sequence[str] | None + def get_queryset(self) -> QuerySet[_M]: ... + def get_ordering(self) -> str | Sequence[str] | None: ... + def paginate_queryset( + self, queryset: _SupportsPagination[_M], page_size: int + ) -> tuple[Paginator, Page, _SupportsPagination[_M], bool]: ... + def get_paginate_by(self, queryset: QuerySet[_M]) -> int | None: ... + def get_paginator( + self, + queryset: _SupportsPagination[_M], + per_page: int, + orphans: int = ..., + allow_empty_first_page: bool = ..., + **kwargs: Any, + ) -> Paginator: ... + def get_paginate_orphans(self) -> int: ... + def get_allow_empty(self) -> bool: ... + @overload + def get_context_object_name(self, object_list: _HasModel) -> str: ... + @overload + def get_context_object_name(self, object_list: Any) -> str | None: ... + def get_context_data( + self, *, object_list: _SupportsPagination[_M] | None = ..., **kwargs: Any + ) -> dict[str, Any]: ... + +class BaseListView(MultipleObjectMixin[_M], View): + object_list: _SupportsPagination[_M] + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + +class MultipleObjectTemplateResponseMixin(TemplateResponseMixin): + template_name_suffix: str + +class ListView(MultipleObjectTemplateResponseMixin, BaseListView[_M]): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/i18n.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/i18n.pyi new file mode 100644 index 000000000000..48031f8cb714 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/i18n.pyi @@ -0,0 +1,28 @@ +from collections.abc import Callable +from pathlib import Path +from typing import Any + +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.utils.translation.trans_real import DjangoTranslation +from django.views.generic import View + +LANGUAGE_QUERY_PARAMETER: str + +def builtin_template_path(name: str) -> Path: ... +def set_language(request: HttpRequest) -> HttpResponse: ... +def get_formats() -> dict[str, list[str] | int | str]: ... + +class JavaScriptCatalog(View): + head: Callable + domain: str + packages: list[str] | None + translation: DjangoTranslation + def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def get_paths(self, packages: list[str]) -> list[str]: ... + def get_plural(self) -> list[str] | None: ... + def get_catalog(self) -> dict[str, list[str] | str]: ... + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + def render_to_response(self, context: dict[str, Any], **response_kwargs: Any) -> HttpResponse: ... + +class JSONCatalog(JavaScriptCatalog): ... diff --git a/python/helpers/bundled_stubs/Django/django-stubs/views/static.pyi b/python/helpers/bundled_stubs/Django/django-stubs/views/static.pyi new file mode 100644 index 000000000000..acc1124ea020 --- /dev/null +++ b/python/helpers/bundled_stubs/Django/django-stubs/views/static.pyi @@ -0,0 +1,15 @@ +from pathlib import Path +from typing import Any + +from django.http import FileResponse, HttpResponse +from django.http.request import HttpRequest + +def builtin_template_path(name: str) -> Path: ... +def serve( + request: HttpRequest, path: str, document_root: str | None = ..., show_indexes: bool = ... +) -> FileResponse: ... + +template_translatable: Any + +def directory_index(path: Any, fullpath: Any) -> HttpResponse: ... +def was_modified_since(header: str | None = ..., mtime: float = ...) -> bool: ...