diff --git a/django-stubs/core/management/commands/check.pyi b/django-stubs/core/management/commands/check.pyi new file mode 100644 index 0000000..ff363ff --- /dev/null +++ b/django-stubs/core/management/commands/check.pyi @@ -0,0 +1,8 @@ +from django.apps import apps as apps +from django.core import checks as checks +from django.core.checks.registry import registry as registry +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError +from typing import Any, List + +class Command(BaseCommand): + def handle(self, *app_labels: List[str], **options: Any) -> None: ... diff --git a/django-stubs/core/management/commands/compilemessages.pyi b/django-stubs/core/management/commands/compilemessages.pyi new file mode 100644 index 0000000..f841ee4 --- /dev/null +++ b/django-stubs/core/management/commands/compilemessages.pyi @@ -0,0 +1,16 @@ +import os +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError, CommandParser as CommandParser +from django.core.management.utils import find_command as find_command, popen_wrapper as popen_wrapper +from typing import List, Tuple, Union + +_PathType = Union[str, bytes, os.PathLike] + +def has_bom(fn: _PathType) -> bool: ... +def is_writable(path: _PathType) -> bool: ... + +class Command(BaseCommand): + program: str = ... + program_options: List[str] = ... + verbosity: int = ... + has_errors: bool = ... + def compile_messages(self, locations: List[Tuple[_PathType, _PathType]]) -> None: ... diff --git a/django-stubs/core/management/commands/createcachetable.pyi b/django-stubs/core/management/commands/createcachetable.pyi new file mode 100644 index 0000000..19a5e0f --- /dev/null +++ b/django-stubs/core/management/commands/createcachetable.pyi @@ -0,0 +1,11 @@ +from django.conf import settings as settings +from django.core.cache import caches as caches +from django.core.cache.backends.db import BaseDatabaseCache as BaseDatabaseCache +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, DatabaseError as DatabaseError, connections as connections, models as models, router as router, transaction as transaction +from typing import Any, List + +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/django-stubs/core/management/commands/dbshell.pyi b/django-stubs/core/management/commands/dbshell.pyi new file mode 100644 index 0000000..b392dc8 --- /dev/null +++ b/django-stubs/core/management/commands/dbshell.pyi @@ -0,0 +1,4 @@ +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError, CommandParser as CommandParser +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections + +class Command(BaseCommand): ... diff --git a/django-stubs/core/management/commands/diffsettings.pyi b/django-stubs/core/management/commands/diffsettings.pyi new file mode 100644 index 0000000..d4c5168 --- /dev/null +++ b/django-stubs/core/management/commands/diffsettings.pyi @@ -0,0 +1,8 @@ +from django.core.management.base import BaseCommand as BaseCommand +from typing import Any, Callable, Dict, List + +def module_to_dict(module: Any, omittable: Callable[[str], bool] = ...) -> Dict[str, str]: ... + +class Command(BaseCommand): + 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/django-stubs/core/management/commands/flush.pyi b/django-stubs/core/management/commands/flush.pyi new file mode 100644 index 0000000..41f123d --- /dev/null +++ b/django-stubs/core/management/commands/flush.pyi @@ -0,0 +1,10 @@ +from django.apps import apps as apps +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError +from django.core.management.color import Style, no_style as no_style +from django.core.management.sql import emit_post_migrate_signal as emit_post_migrate_signal, sql_flush as sql_flush +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections +from typing import Tuple + +class Command(BaseCommand): + stealth_options: Tuple[str] = ... + style: Style = ... diff --git a/django-stubs/core/management/commands/inspectdb.pyi b/django-stubs/core/management/commands/inspectdb.pyi new file mode 100644 index 0000000..2d8367f --- /dev/null +++ b/django-stubs/core/management/commands/inspectdb.pyi @@ -0,0 +1,12 @@ +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections +from django.db.models.constants import LOOKUP_SEP as LOOKUP_SEP +from typing import Any, Dict, Iterable, List, Tuple + +class Command(BaseCommand): + stealth_options: Tuple[str] = ... + db_module: str = ... + 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 get_field_type(self, connection: Any, table_name: Any, row: Any) -> Tuple[str, Dict[str, str], List[str]]: ... + def get_meta(self, table_name: str, constraints: Any, column_to_field_name: Any, is_view: Any, is_partition: Any) -> List[str]: ... diff --git a/django-stubs/core/management/commands/makemigrations.pyi b/django-stubs/core/management/commands/makemigrations.pyi new file mode 100644 index 0000000..b2125a5 --- /dev/null +++ b/django-stubs/core/management/commands/makemigrations.pyi @@ -0,0 +1,23 @@ +from django.apps import apps as apps +from django.conf import settings as settings +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError, no_translations as no_translations +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, OperationalError as OperationalError, connections as connections, router as router +from django.db.migrations import Migration as Migration +from django.db.migrations.autodetector import MigrationAutodetector as MigrationAutodetector +from django.db.migrations.loader import MigrationLoader as MigrationLoader +from django.db.migrations.questioner import InteractiveMigrationQuestioner as InteractiveMigrationQuestioner, MigrationQuestioner as MigrationQuestioner, NonInteractiveMigrationQuestioner as NonInteractiveMigrationQuestioner +from django.db.migrations.state import ProjectState as ProjectState +from django.db.migrations.utils import get_migration_name_timestamp as get_migration_name_timestamp +from django.db.migrations.writer import MigrationWriter as MigrationWriter +from typing import Any, Dict + +class Command(BaseCommand): + verbosity: int = ... + interactive: bool = ... + dry_run: bool = ... + merge: bool = ... + empty: bool = ... + migration_name: str = ... + include_header: bool = ... + def write_migration_files(self, changes: Dict[str, Any]) -> None: ... + def handle_merge(self, loader: MigrationLoader, conflicts: Dict[str, Any]) -> None: ... diff --git a/django-stubs/core/management/commands/migrate.pyi b/django-stubs/core/management/commands/migrate.pyi new file mode 100644 index 0000000..d5e0b8b --- /dev/null +++ b/django-stubs/core/management/commands/migrate.pyi @@ -0,0 +1,21 @@ +from django.apps import apps as apps +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError, no_translations as no_translations +from django.core.management.sql import emit_post_migrate_signal as emit_post_migrate_signal, emit_pre_migrate_signal as emit_pre_migrate_signal +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections, router as router +from django.db.migrations.autodetector import MigrationAutodetector as MigrationAutodetector +from django.db.migrations.executor import MigrationExecutor as MigrationExecutor +from django.db.migrations.loader import AmbiguityError as AmbiguityError +from django.db.migrations.operations.base import Operation +from django.db.migrations.state import ModelState as ModelState, ProjectState as ProjectState +from django.utils.module_loading import module_has_submodule as module_has_submodule +from django.utils.text import Truncator as Truncator +from typing import Any, List, Optional + +class Command(BaseCommand): + verbosity: int = ... + interactive: bool = ... + start: float = ... + def migration_progress_callback(self, action: str, migration: Optional[Any] = ..., fake: bool = ...) -> None: ... + def sync_apps(self, connection: Any, app_labels: List[str]) -> None: ... + @staticmethod + def describe_operation(operation: Operation, backwards: bool) -> str: ... diff --git a/django-stubs/core/management/commands/sendtestemail.pyi b/django-stubs/core/management/commands/sendtestemail.pyi new file mode 100644 index 0000000..8e7058a --- /dev/null +++ b/django-stubs/core/management/commands/sendtestemail.pyi @@ -0,0 +1,6 @@ +from django.core.mail import mail_admins as mail_admins, mail_managers as mail_managers, send_mail as send_mail +from django.core.management.base import BaseCommand as BaseCommand +from django.utils import timezone as timezone + +class Command(BaseCommand): + missing_args_message: str = ... diff --git a/django-stubs/core/management/commands/shell.pyi b/django-stubs/core/management/commands/shell.pyi new file mode 100644 index 0000000..4fbb76b --- /dev/null +++ b/django-stubs/core/management/commands/shell.pyi @@ -0,0 +1,9 @@ +from django.core.management import BaseCommand as BaseCommand, CommandError as CommandError +from django.utils.datastructures import OrderedSet as OrderedSet +from typing import Any, List + +class Command(BaseCommand): + shells: List[str] = ... + def ipython(self, options: Any) -> None: ... + def bpython(self, options: Any) -> None: ... + def python(self, options: Any) -> None: ... diff --git a/django-stubs/core/management/commands/showmigrations.pyi b/django-stubs/core/management/commands/showmigrations.pyi new file mode 100644 index 0000000..52272e6 --- /dev/null +++ b/django-stubs/core/management/commands/showmigrations.pyi @@ -0,0 +1,10 @@ +from django.apps import apps as apps +from django.core.management.base import BaseCommand as BaseCommand +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections +from django.db.migrations.loader import MigrationLoader as MigrationLoader +from typing import Any, List, Optional + +class Command(BaseCommand): + verbosity: int = ... + def show_list(self, connection: Any, app_names: Optional[List[str]] = ...) -> None: ... + def show_plan(self, connection: Any, app_names: Optional[List[str]] = ...) -> None: ... diff --git a/django-stubs/core/management/commands/sqlflush.pyi b/django-stubs/core/management/commands/sqlflush.pyi new file mode 100644 index 0000000..3d2b99c --- /dev/null +++ b/django-stubs/core/management/commands/sqlflush.pyi @@ -0,0 +1,6 @@ +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.sql import sql_flush as sql_flush +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections + +class Command(BaseCommand): + output_transaction: bool = ... diff --git a/django-stubs/core/management/commands/sqlmigrate.pyi b/django-stubs/core/management/commands/sqlmigrate.pyi new file mode 100644 index 0000000..8223ce3 --- /dev/null +++ b/django-stubs/core/management/commands/sqlmigrate.pyi @@ -0,0 +1,9 @@ +from django.apps import apps as apps +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections +from django.db.migrations.loader import AmbiguityError as AmbiguityError, MigrationLoader as MigrationLoader +from typing import Any + +class Command(BaseCommand): + output_transaction: bool = ... + def execute(self, *args: Any, **options: Any): ... diff --git a/django-stubs/core/management/commands/sqlsequencereset.pyi b/django-stubs/core/management/commands/sqlsequencereset.pyi new file mode 100644 index 0000000..9ffc546 --- /dev/null +++ b/django-stubs/core/management/commands/sqlsequencereset.pyi @@ -0,0 +1,4 @@ +from django.core.management.base import AppCommand as AppCommand +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections + +class Command(AppCommand): ... diff --git a/django-stubs/core/management/commands/squashmigrations.pyi b/django-stubs/core/management/commands/squashmigrations.pyi new file mode 100644 index 0000000..27a81d6 --- /dev/null +++ b/django-stubs/core/management/commands/squashmigrations.pyi @@ -0,0 +1,15 @@ +from django.apps import apps as apps +from django.conf import settings as settings +from django.core.management.base import BaseCommand as BaseCommand, CommandError as CommandError +from django.db import DEFAULT_DB_ALIAS as DEFAULT_DB_ALIAS, connections as connections, migrations as migrations +from django.db.migrations.migration import Migration +from django.db.migrations.loader import AmbiguityError as AmbiguityError, MigrationLoader as MigrationLoader +from django.db.migrations.migration import SwappableTuple as SwappableTuple +from django.db.migrations.optimizer import MigrationOptimizer as MigrationOptimizer +from django.db.migrations.writer import MigrationWriter as MigrationWriter +from django.utils.version import get_docs_version as get_docs_version + +class Command(BaseCommand): + verbosity: int = ... + interactive: bool = ... + def find_migration(self, loader: MigrationLoader, app_label: str, name: str) -> Migration: ... diff --git a/django-stubs/core/management/commands/startapp.pyi b/django-stubs/core/management/commands/startapp.pyi new file mode 100644 index 0000000..2c0b011 --- /dev/null +++ b/django-stubs/core/management/commands/startapp.pyi @@ -0,0 +1,5 @@ +from django.core.management.templates import TemplateCommand as TemplateCommand +from typing import Any + +class Command(TemplateCommand): + missing_args_message: str = ... diff --git a/django-stubs/core/management/commands/startproject.pyi b/django-stubs/core/management/commands/startproject.pyi new file mode 100644 index 0000000..9adf946 --- /dev/null +++ b/django-stubs/core/management/commands/startproject.pyi @@ -0,0 +1,5 @@ +from ..utils import get_random_secret_key as get_random_secret_key +from django.core.management.templates import TemplateCommand as TemplateCommand + +class Command(TemplateCommand): + missing_args_message: str = ... diff --git a/django-stubs/core/management/commands/test.pyi b/django-stubs/core/management/commands/test.pyi new file mode 100644 index 0000000..da74c45 --- /dev/null +++ b/django-stubs/core/management/commands/test.pyi @@ -0,0 +1,10 @@ +from django.conf import settings as settings +from django.core.management.base import BaseCommand as BaseCommand +from django.core.management.utils import get_command_line_option as get_command_line_option +from django.test.utils import get_runner as get_runner +from typing import Any + +class Command(BaseCommand): + test_runner: Any = ... + def run_from_argv(self, argv: Any) -> None: ... + def add_arguments(self, parser: Any) -> None: ... diff --git a/django-stubs/core/management/utils.pyi b/django-stubs/core/management/utils.pyi index 23b5696..cf84aa6 100644 --- a/django-stubs/core/management/utils.pyi +++ b/django-stubs/core/management/utils.pyi @@ -1,4 +1,4 @@ -from typing import List, Optional, Set, Tuple, Type +from typing import Any, List, Optional, Set, Tuple, Type from django.apps.config import AppConfig from django.db.models.base import Model @@ -8,3 +8,4 @@ def handle_extensions(extensions: List[str]) -> Set[str]: ... def find_command(cmd: str, path: Optional[str] = ..., pathext: Optional[str] = ...) -> Optional[str]: ... def get_random_secret_key(): ... def parse_apps_and_model_labels(labels: List[str]) -> Tuple[Set[Type[Model]], Set[AppConfig]]: ... +def get_command_line_option(argv: Any, option: Any): ... diff --git a/django-stubs/db/migrations/loader.pyi b/django-stubs/db/migrations/loader.pyi index bd475aa..ec0b505 100644 --- a/django-stubs/db/migrations/loader.pyi +++ b/django-stubs/db/migrations/loader.pyi @@ -3,6 +3,8 @@ from typing import Any, Dict, Optional, Sequence, Set, Tuple, Union from django.db.migrations.migration import Migration from django.db.migrations.state import ProjectState +from .exceptions import AmbiguityError as AmbiguityError, BadMigrationError as BadMigrationError, InconsistentMigrationHistory as InconsistentMigrationHistory, NodeNotFoundError as NodeNotFoundError + MIGRATIONS_MODULE_NAME: str class MigrationLoader: diff --git a/django-stubs/db/migrations/operations/base.pyi b/django-stubs/db/migrations/operations/base.pyi index 601aeb7..cf9928d 100644 --- a/django-stubs/db/migrations/operations/base.pyi +++ b/django-stubs/db/migrations/operations/base.pyi @@ -10,8 +10,8 @@ class Operation: def state_forwards(self, app_label: Any, state: Any) -> None: ... def database_forwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ... def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ... - def describe(self): ... + 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: Any, model: Any): ... + def allow_migrate_model(self, connection_alias: Any, model: Any) -> bool: ... def reduce(self, operation: Operation, in_between: List[Operation], app_label: str = ...) -> bool: ...