Update MigrationExecutor stubs to use Sequence (#749)

There is no need for a specific List type here, using a higher type
works fine and allows more working code to pass type-checking.
This commit is contained in:
Avery Fischer (biggerfisch)
2021-11-12 12:10:24 -05:00
committed by GitHub
parent 48aaf3d2ac
commit b5c20100ff

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, List, Optional, Set, Tuple, Union
from typing import Any, Callable, List, Optional, Sequence, Set, Tuple, Union
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.migrations.migration import Migration
@@ -18,17 +18,17 @@ class MigrationExecutor:
progress_callback: Optional[Callable] = ...,
) -> None: ...
def migration_plan(
self, targets: Union[List[Tuple[str, Optional[str]]], Set[Tuple[str, str]]], clean_start: bool = ...
self, targets: Union[Sequence[Tuple[str, Optional[str]]], Set[Tuple[str, str]]], clean_start: bool = ...
) -> List[Tuple[Migration, bool]]: ...
def migrate(
self,
targets: Optional[List[Tuple[str, Optional[str]]]],
plan: Optional[List[Tuple[Migration, bool]]] = ...,
targets: Optional[Sequence[Tuple[str, Optional[str]]]],
plan: Optional[Sequence[Tuple[Migration, bool]]] = ...,
state: Optional[ProjectState] = ...,
fake: bool = ...,
fake_initial: bool = ...,
) -> ProjectState: ...
def collect_sql(self, plan: List[Tuple[Migration, bool]]) -> List[str]: ...
def collect_sql(self, plan: Sequence[Tuple[Migration, bool]]) -> List[str]: ...
def apply_migration(
self, state: ProjectState, migration: Migration, fake: bool = ..., fake_initial: bool = ...
) -> ProjectState: ...