run black over stubs, add checking to travis

This commit is contained in:
Maxim Kurnikov
2018-12-03 18:52:44 +03:00
parent d5bc7d4ab2
commit cf6119bf9b
420 changed files with 2295 additions and 8384 deletions

View File

@@ -9,17 +9,13 @@ from django.db.models.fields import Field
from .topological_sort import stable_topological_sort
class MigrationAutodetector:
from_state: django.db.migrations.state.ProjectState = ...
to_state: django.db.migrations.state.ProjectState = ...
questioner: django.db.migrations.questioner.MigrationQuestioner = ...
existing_apps: Set[Any] = ...
def __init__(
self,
from_state: ProjectState,
to_state: ProjectState,
questioner: Optional[MigrationQuestioner] = ...,
self, from_state: ProjectState, to_state: ProjectState, questioner: Optional[MigrationQuestioner] = ...
) -> None: ...
def changes(
self,
@@ -32,18 +28,12 @@ class MigrationAutodetector:
def only_relation_agnostic_fields(
self, fields: List[Tuple[str, Field]]
) -> List[Tuple[str, List[Any], Dict[str, Union[Callable, int, str]]]]: ...
def check_dependency(
self,
operation: Operation,
dependency: Tuple[str, str, Optional[str], Union[bool, str]],
) -> bool: ...
def check_dependency(self, operation: Operation, dependency: Tuple[str, str, Optional[str], Union[bool, str]]) -> bool: ...
def add_operation(
self,
app_label: str,
operation: Operation,
dependencies: Optional[
List[Tuple[str, str, Optional[str], Union[bool, str]]]
] = ...,
dependencies: Optional[List[Tuple[str, str, Optional[str], Union[bool, str]]]] = ...,
beginning: bool = ...,
) -> None: ...
def swappable_first_key(self, item: Tuple[str, str]) -> Tuple[str, str]: ...
@@ -69,10 +59,7 @@ class MigrationAutodetector:
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: Optional[str] = ...,
self, changes: Dict[str, List[Migration]], graph: MigrationGraph, migration_name: Optional[str] = ...
) -> Dict[str, List[Migration]]: ...
@classmethod
def suggest_name(cls, ops: List[Operation]) -> str: ...

View File

@@ -3,7 +3,6 @@ from typing import Any, Optional, Tuple
from django.db.migrations.migration import Migration
from django.db.utils import DatabaseError
class AmbiguityError(Exception): ...
class BadMigrationError(Exception): ...
class CircularDependencyError(Exception): ...
@@ -15,12 +14,7 @@ class NodeNotFoundError(LookupError):
message: str = ...
origin: None = ...
node: Tuple[str, str] = ...
def __init__(
self,
message: str,
node: Tuple[str, str],
origin: Optional[Migration] = ...,
) -> None: ...
def __init__(self, message: str, node: Tuple[str, str], origin: Optional[Migration] = ...) -> None: ...
class MigrationSchemaMissing(DatabaseError): ...
class InvalidMigrationPlan(ValueError): ...

View File

@@ -10,7 +10,6 @@ from .loader import MigrationLoader
from .recorder import MigrationRecorder
from .state import ProjectState
class MigrationExecutor:
connection: django.db.backends.sqlite3.base.DatabaseWrapper = ...
loader: django.db.migrations.loader.MigrationLoader = ...
@@ -18,15 +17,11 @@ class MigrationExecutor:
progress_callback: Callable = ...
def __init__(
self,
connection: Optional[
Union[DefaultConnectionProxy, BaseDatabaseWrapper]
],
connection: Optional[Union[DefaultConnectionProxy, BaseDatabaseWrapper]],
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[List[Tuple[str, Optional[str]]], Set[Tuple[str, str]]], clean_start: bool = ...
) -> List[Tuple[Migration, bool]]: ...
def migrate(
self,
@@ -38,16 +33,8 @@ class MigrationExecutor:
) -> ProjectState: ...
def collect_sql(self, plan: List[Tuple[Migration, bool]]) -> List[str]: ...
def apply_migration(
self,
state: ProjectState,
migration: Migration,
fake: bool = ...,
fake_initial: bool = ...,
) -> ProjectState: ...
def unapply_migration(
self, state: ProjectState, migration: Migration, fake: bool = ...
self, state: ProjectState, migration: Migration, fake: bool = ..., fake_initial: bool = ...
) -> ProjectState: ...
def unapply_migration(self, state: ProjectState, migration: Migration, fake: bool = ...) -> ProjectState: ...
def check_replacements(self) -> None: ...
def detect_soft_applied(
self, project_state: Optional[ProjectState], migration: Migration
) -> Tuple[bool, ProjectState]: ...
def detect_soft_applied(self, project_state: Optional[ProjectState], migration: Migration) -> Tuple[bool, ProjectState]: ...

View File

@@ -27,9 +27,7 @@ class DummyNode(Node):
parents: Set[Any]
origin: Any = ...
error_message: Any = ...
def __init__(
self, key: Tuple[str, str], origin: Migration, error_message: str
) -> None: ...
def __init__(self, key: Tuple[str, str], origin: Migration, error_message: str) -> None: ...
__class__: Any = ...
def promote(self) -> None: ...
def raise_error(self) -> None: ...
@@ -39,12 +37,8 @@ class MigrationGraph:
nodes: Dict[Any, Any] = ...
cached: bool = ...
def __init__(self) -> None: ...
def add_node(
self, key: Tuple[str, str], migration: Optional[Migration]
) -> None: ...
def add_dummy_node(
self, key: Tuple[str, str], origin: Migration, error_message: str
) -> None: ...
def add_node(self, key: Tuple[str, str], migration: Optional[Migration]) -> None: ...
def add_dummy_node(self, key: Tuple[str, str], origin: Migration, error_message: str) -> None: ...
def add_dependency(
self,
migration: Optional[Union[Migration, str]],
@@ -52,32 +46,17 @@ class MigrationGraph:
parent: Tuple[str, str],
skip_validation: bool = ...,
) -> 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 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 clear_cache(self) -> None: ...
def forwards_plan(
self, target: Tuple[str, str]
) -> List[Tuple[str, str]]: ...
def backwards_plan(
self, target: Union[Tuple[str, str], Node]
) -> List[Tuple[str, str]]: ...
def forwards_plan(self, target: Tuple[str, str]) -> List[Tuple[str, str]]: ...
def backwards_plan(self, target: Union[Tuple[str, str], Node]) -> List[Tuple[str, str]]: ...
def iterative_dfs(self, start: Any, forwards: bool = ...): ...
def root_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ...
def leaf_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ...
def ensure_not_cyclic(
self, start: Union[Tuple[str, str], Node], get_children: Callable
) -> None: ...
def ensure_not_cyclic(self, start: Union[Tuple[str, str], Node], get_children: Callable) -> None: ...
def make_state(
self,
nodes: Optional[Tuple[str, str]] = ...,
at_end: bool = ...,
real_apps: List[str] = ...,
self, nodes: Optional[Tuple[str, str]] = ..., at_end: bool = ..., real_apps: List[str] = ...
) -> ProjectState: ...
def __contains__(
self, node: Union[Tuple[str, str], SwappableTuple]
) -> bool: ...
def __contains__(self, node: Union[Tuple[str, str], SwappableTuple]) -> bool: ...

View File

@@ -6,53 +6,34 @@ from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.migrations.migration import Migration, SwappableTuple
from django.db.migrations.state import ProjectState
from .exceptions import (AmbiguityError, BadMigrationError,
InconsistentMigrationHistory, NodeNotFoundError)
from .exceptions import AmbiguityError, BadMigrationError, InconsistentMigrationHistory, NodeNotFoundError
MIGRATIONS_MODULE_NAME: str
class MigrationLoader:
connection: django.db.backends.sqlite3.base.DatabaseWrapper = ...
disk_migrations: Dict[
Tuple[str, str], django.db.migrations.migration.Migration
] = ...
disk_migrations: Dict[Tuple[str, str], django.db.migrations.migration.Migration] = ...
applied_migrations: None = ...
ignore_no_migrations: bool = ...
def __init__(
self,
connection: Optional[
Union[DefaultConnectionProxy, BaseDatabaseWrapper]
],
connection: Optional[Union[DefaultConnectionProxy, BaseDatabaseWrapper]],
load: bool = ...,
ignore_no_migrations: bool = ...,
) -> None: ...
@classmethod
def migrations_module(
cls, app_label: str
) -> Tuple[Optional[str], bool]: ...
def migrations_module(cls, app_label: str) -> Tuple[Optional[str], 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: Union[Tuple[str, str], SwappableTuple], current_app: str
) -> Optional[Tuple[str, str]]: ...
def add_internal_dependencies(
self, key: Tuple[str, str], migration: Migration
) -> None: ...
def add_external_dependencies(
self, key: Tuple[str, str], migration: Migration
) -> None: ...
def get_migration_by_prefix(self, app_label: str, name_prefix: str) -> Migration: ...
def check_key(self, key: Union[Tuple[str, str], SwappableTuple], current_app: str) -> Optional[Tuple[str, str]]: ...
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: Union[DefaultConnectionProxy, DatabaseWrapper]
) -> None: ...
def check_consistent_history(self, connection: Union[DefaultConnectionProxy, DatabaseWrapper]) -> None: ...
def detect_conflicts(self) -> Dict[str, Set[str]]: ...
def project_state(
self, nodes: Optional[Tuple[str, str]] = ..., at_end: bool = ...
) -> ProjectState: ...
def project_state(self, nodes: Optional[Tuple[str, str]] = ..., at_end: bool = ...) -> ProjectState: ...

View File

@@ -3,7 +3,6 @@ from typing import Any, Tuple, Type, List
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
from django.db.migrations.state import ProjectState
class Migration:
operations: List[Any] = ...
dependencies: List[Any] = ...
@@ -16,26 +15,16 @@ class Migration:
def __init__(self, name: str, app_label: str) -> None: ...
def __eq__(self, other: Migration) -> bool: ...
def __hash__(self) -> int: ...
def mutate_state(
self, project_state: ProjectState, preserve: bool = ...
) -> ProjectState: ...
def mutate_state(self, project_state: ProjectState, preserve: bool = ...) -> ProjectState: ...
def apply(
self,
project_state: ProjectState,
schema_editor: DatabaseSchemaEditor,
collect_sql: bool = ...,
self, project_state: ProjectState, schema_editor: DatabaseSchemaEditor, collect_sql: bool = ...
) -> ProjectState: ...
def unapply(
self,
project_state: ProjectState,
schema_editor: DatabaseSchemaEditor,
collect_sql: bool = ...,
self, project_state: ProjectState, schema_editor: DatabaseSchemaEditor, collect_sql: bool = ...
) -> ProjectState: ...
class SwappableTuple(tuple):
setting: str = ...
def __new__(
cls: Type[SwappableTuple], value: Tuple[str, str], setting: str
) -> SwappableTuple: ...
def __new__(cls: Type[SwappableTuple], value: Tuple[str, str], setting: str) -> SwappableTuple: ...
def swappable_dependency(value: str) -> SwappableTuple: ...

View File

@@ -2,12 +2,7 @@
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from .fields import (
AddField as AddField,
AlterField as AlterField,
RemoveField as RemoveField,
RenameField as RenameField,
)
from .fields import AddField as AddField, AlterField as AlterField, RemoveField as RemoveField, RenameField as RenameField
from .models import (
AddIndex as AddIndex,
AlterIndexTogether as AlterIndexTogether,
@@ -21,11 +16,7 @@ from .models import (
RemoveIndex as RemoveIndex,
RenameModel as RenameModel,
)
from .special import (
RunPython as RunPython,
RunSQL as RunSQL,
SeparateDatabaseAndState as SeparateDatabaseAndState,
)
from .special import RunPython as RunPython, RunSQL as RunSQL, SeparateDatabaseAndState as SeparateDatabaseAndState
from .fields import AddField, AlterField, RemoveField, RenameField
from .models import (
AddIndex,

View File

@@ -1,32 +1,18 @@
from typing import Any, List, Optional, Type
class Operation:
reversible: bool = ...
reduces_to_sql: bool = ...
atomic: bool = ...
elidable: bool = ...
serialization_expand_args: Any = ...
def __new__(
cls: Type[Operation], *args: Any, **kwargs: Any
) -> Operation: ...
def __new__(cls: Type[Operation], *args: Any, **kwargs: Any) -> Operation: ...
def deconstruct(self): ...
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 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 references_model(self, name: str, app_label: str = ...) -> bool: ...
def references_field(
self, model_name: str, 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 reduce(
self,
operation: Operation,
in_between: List[Operation],
app_label: str = ...,
) -> bool: ...
def reduce(self, operation: Operation, in_between: List[Operation], app_label: str = ...) -> bool: ...

View File

@@ -8,7 +8,6 @@ from django.db.models.fields import Field, SlugField
from .base import Operation
from .utils import is_referenced_by_foreign_key
class FieldOperation(Operation):
model_name: Any = ...
name: Any = ...
@@ -17,54 +16,24 @@ class FieldOperation(Operation):
def name_lower(self) -> str: ...
def is_same_model_operation(self, operation: FieldOperation) -> bool: ...
def is_same_field_operation(self, operation: AddField) -> bool: ...
def references_model(
self, name: str, app_label: Optional[str] = ...
) -> bool: ...
def references_field(
self, model_name: str, name: str, app_label: str = ...
) -> bool: ...
def reduce(
self,
operation: Operation,
in_between: List[Operation],
app_label: str = ...,
) -> bool: ...
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
def references_field(self, model_name: str, name: str, app_label: str = ...) -> bool: ...
def reduce(self, operation: Operation, in_between: List[Operation], app_label: str = ...) -> bool: ...
class AddField(FieldOperation):
field: Any = ...
preserve_default: Any = ...
def __init__(
self,
model_name: str,
name: str,
field: Field,
preserve_default: bool = ...,
) -> None: ...
def deconstruct(
self
) -> Tuple[str, List[Any], Dict[str, Union[bool, Field, str]]]: ...
def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = ...) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[bool, Field, str]]]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def describe(self) -> str: ...
def reduce(
self,
operation: Operation,
in_between: List[Operation],
app_label: str = ...,
) -> bool: ...
def reduce(self, operation: Operation, in_between: List[Operation], app_label: str = ...) -> bool: ...
class RemoveField(FieldOperation):
model_name: str
@@ -73,73 +42,36 @@ class RemoveField(FieldOperation):
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def describe(self) -> str: ...
class AlterField(FieldOperation):
field: Any = ...
preserve_default: Any = ...
def __init__(
self,
model_name: str,
name: str,
field: Field,
preserve_default: bool = ...,
) -> None: ...
def deconstruct(
self
) -> Tuple[str, List[Any], Dict[str, Union[SlugField, str]]]: ...
def __init__(self, model_name: str, name: str, field: Field, preserve_default: bool = ...) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[SlugField, str]]]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
) -> None: ...
def database_backwards(
self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(self, app_label: Any, schema_editor: Any, from_state: Any, to_state: Any) -> None: ...
def describe(self) -> str: ...
def reduce(
self,
operation: Operation,
in_between: List[AlterField],
app_label: str = ...,
) -> bool: ...
def reduce(self, operation: Operation, in_between: List[AlterField], app_label: str = ...) -> bool: ...
class RenameField(FieldOperation):
old_name: Any = ...
new_name: Any = ...
def __init__(
self, model_name: str, old_name: str, new_name: str
) -> None: ...
def __init__(self, model_name: str, old_name: str, new_name: str) -> None: ...
def old_name_lower(self): ...
def new_name_lower(self) -> str: ...
def deconstruct(self): ...
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 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 references_field(
self, model_name: str, name: str, app_label: str = ...
) -> bool: ...
def reduce(
self, operation: Operation, in_between: List[Any], app_label: str = ...
) -> bool: ...
def references_field(self, model_name: str, name: str, app_label: str = ...) -> bool: ...
def reduce(self, operation: Operation, in_between: List[Any], app_label: str = ...) -> bool: ...

View File

@@ -8,25 +8,12 @@ from django.db.models.fields import Field
from django.db.models.indexes import Index
from django.db.models.manager import Manager
class ModelOperation(Operation):
name: Any = ...
def __init__(self, name: str) -> None: ...
def name_lower(self) -> str: ...
def references_model(
self, name: str, app_label: Optional[str] = ...
) -> bool: ...
def reduce(
self,
operation: Operation,
in_between: List[Operation],
app_label: str = ...,
) -> bool: ...
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
def reduce(self, operation: Operation, in_between: List[Operation], app_label: str = ...) -> bool: ...
class CreateModel(ModelOperation):
serialization_expand_args: Any = ...
@@ -34,337 +21,151 @@ class CreateModel(ModelOperation):
options: Any = ...
bases: Any = ...
managers: Any = ...
def __init__(
self,
name: str,
fields: List[Tuple[str, Union[CIText, Field]]],
options: Optional[Dict[str, Any]] = ...,
bases: Optional[
Union[Tuple[Type[Any], ...],
Tuple[str, ...]]] = ...,
managers: Optional[List[Tuple[str, Manager]]] = ...,
self,
name: str,
fields: List[Tuple[str, Union[CIText, Field]]],
options: Optional[Dict[str, Any]] = ...,
bases: Optional[Union[Tuple[Type[Any], ...], Tuple[str, ...]]] = ...,
managers: Optional[List[Tuple[str, Manager]]] = ...,
) -> None: ...
def deconstruct(
self
) -> Tuple[
str,
List[Any],
Dict[str, Union[Dict[str, str], List[Tuple[str, Field]], str]],
]: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[Dict[str, str], List[Tuple[str, Field]], str]]]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def describe(self) -> str: ...
def references_model(self, name: str, app_label: str = ...) -> bool: ...
def model_to_key(self, model: str) -> List[str]: ...
def reduce(
self,
operation: Operation,
in_between: List[Operation],
app_label: str = ...,
self, operation: Operation, in_between: List[Operation], app_label: str = ...
) -> Union[List[CreateModel], bool]: ...
class DeleteModel(ModelOperation):
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def describe(self) -> str: ...
class RenameModel(ModelOperation):
old_name: Any = ...
new_name: Any = ...
def __init__(self, old_name: str, new_name: str) -> None: ...
def old_name_lower(self) -> str: ...
def new_name_lower(self) -> str: ...
def deconstruct(self): ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def references_model(self, name: Any, app_label: Optional[Any] = ...): ...
def describe(self): ...
def reduce(
self,
operation: AlterModelTable,
in_between: List[Any],
app_label: str = ...,
) -> bool: ...
def reduce(self, operation: AlterModelTable, in_between: List[Any], app_label: str = ...) -> bool: ...
class AlterModelTable(ModelOperation):
table: Any = ...
def __init__(self, name: str, table: Optional[str]) -> None: ...
def deconstruct(self): ...
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
): ...
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): ...
def describe(self): ...
def reduce(
self, operation: Any, in_between: Any, app_label: Optional[Any] = ...
): ...
def reduce(self, operation: Any, in_between: Any, app_label: Optional[Any] = ...): ...
class ModelOptionOperation(ModelOperation):
def reduce(
self,
operation: Operation,
in_between: List[DeleteModel],
app_label: str = ...,
) -> bool: ...
def reduce(self, operation: Operation, in_between: List[DeleteModel], app_label: str = ...) -> bool: ...
class FieldRelatedOptionOperation(ModelOptionOperation):
def reduce(
self, operation: Operation, in_between: List[Any], app_label: str = ...
) -> Union[List[Operation], bool]: ...
def reduce(self, operation: Operation, in_between: List[Any], app_label: str = ...) -> Union[List[Operation], bool]: ...
class AlterUniqueTogether(FieldRelatedOptionOperation):
option_name: str = ...
unique_together: Any = ...
def __init__(
self, name: str, unique_together: Set[Tuple[str, ...]]
) -> None: ...
def deconstruct(
self
) -> Tuple[str, List[Any], Dict[str, Union[Set[Tuple[str, str]], str]]]: ...
def __init__(self, name: str, unique_together: Set[Tuple[str, ...]]) -> None: ...
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[Set[Tuple[str, str]], str]]]: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def references_field(
self, model_name: str, name: str, app_label: Optional[str] = ...
) -> bool: ...
def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ...
def describe(self) -> str: ...
class AlterIndexTogether(FieldRelatedOptionOperation):
option_name: str = ...
index_together: Any = ...
def __init__(
self, name: str, index_together: Set[Tuple[str, str]]
) -> None: ...
def __init__(self, name: str, index_together: Set[Tuple[str, str]]) -> None: ...
def deconstruct(self): ...
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
): ...
def references_field(
self, model_name: str, name: str, app_label: Optional[str] = ...
) -> bool: ...
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): ...
def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ...
def describe(self): ...
class AlterOrderWithRespectTo(FieldRelatedOptionOperation):
name: str
order_with_respect_to: str = ...
def __init__(self, name: str, order_with_respect_to: str) -> None: ...
def deconstruct(self): ...
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 references_field(
self, model_name: str, name: str, app_label: None = ...
) -> bool: ...
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 references_field(self, model_name: str, name: str, app_label: None = ...) -> bool: ...
def describe(self): ...
class AlterModelOptions(ModelOptionOperation):
ALTER_OPTION_KEYS: Any = ...
options: Any = ...
def __init__(self, name: str, options: Dict[str, str]) -> None: ...
def deconstruct(self): ...
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 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): ...
class AlterModelManagers(ModelOptionOperation):
serialization_expand_args: Any = ...
managers: Any = ...
def __init__(self, name: Any, managers: Any) -> None: ...
def deconstruct(self): ...
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 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): ...
class IndexOperation(Operation):
option_name: str = ...
def model_name_lower(self): ...
class AddIndex(IndexOperation):
model_name: str = ...
index: django.db.models.indexes.Index = ...
def __init__(self, model_name: str, index: Index) -> None: ...
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 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 deconstruct(self): ...
def describe(self): ...
class RemoveIndex(IndexOperation):
model_name: str = ...
name: str = ...
def __init__(self, model_name: str, name: str) -> None: ...
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 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 deconstruct(self): ...
def describe(self): ...

View File

@@ -6,31 +6,18 @@ from django.db.migrations.state import ProjectState, StateApps
from .base import Operation
class SeparateDatabaseAndState(Operation):
serialization_expand_args: Any = ...
database_operations: Any = ...
state_operations: Any = ...
def __init__(
self,
database_operations: List[Any] = ...,
state_operations: List[CreateModel] = ...,
) -> None: ...
def __init__(self, database_operations: List[Any] = ..., state_operations: List[CreateModel] = ...) -> None: ...
def deconstruct(self): ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def describe(self): ...
@@ -53,12 +40,8 @@ class RunSQL(Operation):
@property
def reversible(self): ...
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 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): ...
class RunPython(Operation):
@@ -81,18 +64,10 @@ class RunPython(Operation):
def reversible(self) -> bool: ...
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
def database_forwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def database_backwards(
self,
app_label: str,
schema_editor: DatabaseSchemaEditor,
from_state: ProjectState,
to_state: ProjectState,
self, app_label: str, schema_editor: DatabaseSchemaEditor, from_state: ProjectState, to_state: ProjectState
) -> None: ...
def describe(self): ...
@staticmethod

View File

@@ -3,7 +3,4 @@ from typing import Any, Optional
from django.db.migrations.state import ProjectState
from django.db.models.fields import Field
def is_referenced_by_foreign_key(
state: ProjectState, model_name_lower: str, field: Field, field_name: str
) -> bool: ...
def is_referenced_by_foreign_key(state: ProjectState, model_name_lower: str, field: Field, field_name: str) -> bool: ...

View File

@@ -2,11 +2,6 @@ from typing import Any, List, Optional
from django.db.migrations.operations.base import Operation
class MigrationOptimizer:
def optimize(
self, operations: List[Operation], app_label: str = ...
) -> List[Operation]: ...
def optimize_inner(
self, operations: List[Operation], app_label: str = ...
) -> List[Operation]: ...
def optimize(self, operations: List[Operation], app_label: str = ...) -> List[Operation]: ...
def optimize_inner(self, operations: List[Operation], app_label: str = ...) -> List[Operation]: ...

View File

@@ -5,62 +5,36 @@ from django.db.models.fields import Field
from .loader import MigrationLoader
class MigrationQuestioner:
defaults: Dict[Any, Any] = ...
specified_apps: Set[Any] = ...
dry_run: None = ...
def __init__(
self,
defaults: Optional[Dict[str, bool]] = ...,
specified_apps: Optional[Set[str]] = ...,
dry_run: Optional[bool] = ...,
self, defaults: Optional[Dict[str, bool]] = ..., specified_apps: Optional[Set[str]] = ..., dry_run: Optional[bool] = ...
) -> None: ...
def ask_initial(self, app_label: str) -> bool: ...
def ask_not_null_addition(
self, field_name: str, model_name: str
) -> None: ...
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
def ask_not_null_alteration(self, field_name: Any, model_name: 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_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
) -> None: ...
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ...
class InteractiveMigrationQuestioner(MigrationQuestioner):
defaults: Dict[Any, Any]
dry_run: bool
specified_apps: Set[str]
def ask_not_null_addition(
self, field_name: str, model_name: str
) -> None: ...
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
def ask_not_null_alteration(self, field_name: Any, model_name: Any): ...
def ask_rename(
self, model_name: Any, old_name: Any, new_name: Any, field_instance: Any
): ...
def ask_rename(self, model_name: Any, old_name: Any, new_name: Any, field_instance: Any): ...
def ask_rename_model(self, old_model_state: Any, new_model_state: Any): ...
def ask_merge(self, app_label: str) -> bool: ...
def ask_auto_now_add_addition(
self, field_name: str, model_name: str
) -> int: ...
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> int: ...
class NonInteractiveMigrationQuestioner(MigrationQuestioner):
defaults: Dict[Any, Any]
dry_run: bool
specified_apps: Set[str]
def ask_not_null_addition(
self, field_name: Any, model_name: Any
) -> None: ...
def ask_not_null_addition(self, field_name: Any, model_name: Any) -> None: ...
def ask_not_null_alteration(self, field_name: Any, model_name: Any): ...
def ask_auto_now_add_addition(
self, field_name: Any, model_name: Any
) -> None: ...
def ask_auto_now_add_addition(self, field_name: Any, model_name: Any) -> None: ...

View File

@@ -6,7 +6,6 @@ from django.db.models.query import QuerySet
from .exceptions import MigrationSchemaMissing
class MigrationRecorder:
class Migration(models.Model):
app: Any = ...
@@ -17,12 +16,7 @@ class MigrationRecorder:
app_label: str = ...
db_table: str = ...
connection: django.db.backends.sqlite3.base.DatabaseWrapper = ...
def __init__(
self,
connection: Optional[
Union[DefaultConnectionProxy, BaseDatabaseWrapper]
],
) -> None: ...
def __init__(self, connection: Optional[Union[DefaultConnectionProxy, BaseDatabaseWrapper]]) -> None: ...
@property
def migration_qs(self) -> QuerySet: ...
def has_table(self) -> bool: ...

View File

@@ -1,6 +1,5 @@
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
class BaseSerializer:
value: Any = ...
def __init__(self, value: Any) -> None: ...

View File

@@ -7,7 +7,6 @@ from django.db.models.fields import Field
from django.db.models.indexes import Index
from django.db.models.manager import Manager
class AppConfigStub:
apps: None
label: str
@@ -41,9 +40,7 @@ class ModelState:
def clone(self) -> ModelState: ...
def construct_managers(self) -> Iterator[Tuple[str, Manager]]: ...
@classmethod
def from_model(
cls, model: Type[Model], exclude_rels: bool = ...
) -> ModelState: ...
def from_model(cls, model: Type[Model], exclude_rels: bool = ...) -> ModelState: ...
def get_field_by_name(self, name: str) -> Field: ...
@cached_property
def name_lower(self) -> str: ...
@@ -54,9 +51,7 @@ class ProjectState:
models: Dict[Any, Any]
real_apps: List[str]
def __init__(
self,
models: Optional[Dict[Tuple[str, str], ModelState]] = ...,
real_apps: Optional[List[str]] = ...,
self, models: Optional[Dict[Tuple[str, str], ModelState]] = ..., real_apps: Optional[List[str]] = ...
) -> None: ...
def add_model(self, model_state: ModelState) -> None: ...
@cached_property
@@ -67,9 +62,7 @@ class ProjectState:
def concrete_apps(self) -> StateApps: ...
@classmethod
def from_apps(cls, apps: Apps) -> ProjectState: ...
def reload_model(
self, app_label: str, model_name: str, delay: bool = ...
) -> None: ...
def reload_model(self, app_label: str, model_name: str, delay: bool = ...) -> None: ...
def reload_models(self, models: List[Any], delay: bool = ...) -> None: ...
def remove_model(self, app_label: str, model_name: str) -> None: ...
@@ -82,12 +75,7 @@ class StateApps:
ready: bool
real_models: List[django.db.migrations.state.ModelState]
stored_app_configs: List[Any]
def __init__(
self,
real_apps: List[str],
models: Dict[Tuple[str, str], ModelState],
ignore_swappable: bool = ...,
) -> None: ...
def __init__(self, real_apps: List[str], models: Dict[Tuple[str, str], ModelState], ignore_swappable: bool = ...) -> None: ...
def bulk_update(self) -> Iterator[None]: ...
def clone(self) -> StateApps: ...
def render_multiple(self, model_states: List[ModelState]) -> None: ...

View File

@@ -2,10 +2,5 @@ from typing import Any, Dict, Iterator, List, Optional, Set
from django.db.migrations.operations.base import Operation
def topological_sort_as_sets(
dependency_graph: Dict[Operation, Set[Operation]]
) -> Iterator[Set[Operation]]: ...
def stable_topological_sort(
l: List[Operation], dependency_graph: Dict[Operation, Set[Operation]]
) -> List[Operation]: ...
def topological_sort_as_sets(dependency_graph: Dict[Operation, Set[Operation]]) -> Iterator[Set[Operation]]: ...
def stable_topological_sort(l: List[Operation], dependency_graph: Dict[Operation, Set[Operation]]) -> List[Operation]: ...

View File

@@ -3,11 +3,8 @@ from typing import Any, Optional, Set, Tuple, Type
from django.db.migrations.migration import Migration
from django.db.migrations.operations.base import Operation
class SettingsReference(str):
def __new__(
self: Type[SettingsReference], value: str, setting_name: str
) -> SettingsReference: ...
def __new__(self: Type[SettingsReference], value: str, setting_name: str) -> SettingsReference: ...
setting_name: str = ...
def __init__(self, value: str, setting_name: str) -> None: ...
@@ -15,9 +12,7 @@ class OperationWriter:
operation: django.db.migrations.operations.models.CreateModel = ...
buff: List[Any] = ...
indentation: int = ...
def __init__(
self, operation: Operation, indentation: int = ...
) -> None: ...
def __init__(self, operation: Operation, indentation: int = ...) -> None: ...
def serialize(self) -> Tuple[str, Set[str]]: ...
def indent(self) -> None: ...
def unindent(self) -> None: ...