mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-18 18:05:58 +08:00
initial commit
This commit is contained in:
114
django/db/migrations/autodetector.pyi
Normal file
114
django/db/migrations/autodetector.pyi
Normal file
@@ -0,0 +1,114 @@
|
||||
from django.db.migrations.graph import MigrationGraph
|
||||
from django.db.migrations.migration import Migration
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from django.db.migrations.operations.fields import FieldOperation
|
||||
from django.db.migrations.operations.models import (
|
||||
CreateModel,
|
||||
DeleteModel,
|
||||
FieldRelatedOptionOperation,
|
||||
ModelOperation,
|
||||
)
|
||||
from django.db.migrations.questioner import MigrationQuestioner
|
||||
from django.db.migrations.state import ProjectState
|
||||
from django.db.models.fields.related import (
|
||||
ForeignKey,
|
||||
ManyToManyField,
|
||||
)
|
||||
from django.db.models.fields.reverse_related import ManyToOneRel
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class MigrationAutodetector:
|
||||
def __init__(
|
||||
self,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState,
|
||||
questioner: Optional[MigrationQuestioner] = ...
|
||||
) -> None: ...
|
||||
def _build_migration_list(self, graph: Optional[MigrationGraph] = ...) -> None: ...
|
||||
def _detect_changes(
|
||||
self,
|
||||
convert_apps: Optional[Set[str]] = ...,
|
||||
graph: Optional[MigrationGraph] = ...
|
||||
) -> Dict[str, List[Migration]]: ...
|
||||
def _generate_added_field(self, app_label: str, model_name: str, field_name: str) -> None: ...
|
||||
def _generate_altered_foo_together(
|
||||
self,
|
||||
operation: Type[FieldRelatedOptionOperation]
|
||||
) -> None: ...
|
||||
def _generate_removed_field(self, app_label: str, model_name: str, field_name: str) -> None: ...
|
||||
def _generate_through_model_map(self) -> None: ...
|
||||
def _get_dependencies_for_foreign_key(
|
||||
self,
|
||||
field: Union[ManyToOneRel, ManyToManyField, ForeignKey]
|
||||
) -> List[Tuple[str, str, None, bool]]: ...
|
||||
def _optimize_migrations(self) -> None: ...
|
||||
def _prepare_field_lists(self) -> None: ...
|
||||
def _sort_migrations(self) -> None: ...
|
||||
def _trim_to_apps(
|
||||
self,
|
||||
changes: Dict[str, List[Migration]],
|
||||
app_labels: Set[str]
|
||||
) -> Dict[str, List[Migration]]: ...
|
||||
def add_operation(
|
||||
self,
|
||||
app_label: str,
|
||||
operation: Operation,
|
||||
dependencies: Any = ...,
|
||||
beginning: bool = ...
|
||||
) -> None: ...
|
||||
def arrange_for_graph(
|
||||
self,
|
||||
changes: Dict[str, List[Migration]],
|
||||
graph: MigrationGraph,
|
||||
migration_name: Optional[str] = ...
|
||||
) -> Dict[str, List[Migration]]: ...
|
||||
def changes(
|
||||
self,
|
||||
graph: MigrationGraph,
|
||||
trim_to_apps: Optional[Set[str]] = ...,
|
||||
convert_apps: Optional[Set[str]] = ...,
|
||||
migration_name: None = ...
|
||||
) -> Dict[str, List[Migration]]: ...
|
||||
def check_dependency(
|
||||
self,
|
||||
operation: Operation,
|
||||
dependency: Union[Tuple[str, str, str, str], Tuple[str, str, str, bool], Tuple[str, str, None, bool]]
|
||||
) -> bool: ...
|
||||
def create_altered_indexes(self) -> None: ...
|
||||
def deep_deconstruct(self, obj: Any) -> Any: ...
|
||||
def generate_added_fields(self) -> None: ...
|
||||
def generate_added_indexes(self) -> None: ...
|
||||
def generate_altered_db_table(self) -> None: ...
|
||||
def generate_altered_fields(self) -> None: ...
|
||||
def generate_altered_index_together(self) -> None: ...
|
||||
def generate_altered_managers(self) -> None: ...
|
||||
def generate_altered_options(self) -> None: ...
|
||||
def generate_altered_order_with_respect_to(self) -> None: ...
|
||||
def generate_altered_unique_together(self) -> None: ...
|
||||
def generate_created_models(self) -> None: ...
|
||||
def generate_created_proxies(self) -> None: ...
|
||||
def generate_deleted_models(self) -> None: ...
|
||||
def generate_deleted_proxies(self) -> None: ...
|
||||
def generate_removed_fields(self) -> None: ...
|
||||
def generate_removed_indexes(self) -> None: ...
|
||||
def generate_renamed_fields(self) -> None: ...
|
||||
def generate_renamed_models(self) -> None: ...
|
||||
def only_relation_agnostic_fields(self, fields: Any) -> Any: ...
|
||||
@classmethod
|
||||
def parse_number(cls, name: str) -> int: ...
|
||||
@classmethod
|
||||
def suggest_name(
|
||||
cls,
|
||||
ops: Union[List[Union[CreateModel, FieldOperation]], List[CreateModel], List[ModelOperation], List[DeleteModel]]
|
||||
) -> str: ...
|
||||
def swappable_first_key(self, item: Tuple[str, str]) -> Tuple[str, str]: ...
|
||||
16
django/db/migrations/exceptions.pyi
Normal file
16
django/db/migrations/exceptions.pyi
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.db.migrations.migration import Migration
|
||||
from typing import (
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class NodeNotFoundError:
|
||||
def __init__(
|
||||
self,
|
||||
message: str,
|
||||
node: Tuple[str, str],
|
||||
origin: Optional[Union[str, Migration]] = ...
|
||||
) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
63
django/db/migrations/executor.pyi
Normal file
63
django/db/migrations/executor.pyi
Normal file
@@ -0,0 +1,63 @@
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.migrations.migration import Migration
|
||||
from django.db.migrations.state import ProjectState
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class MigrationExecutor:
|
||||
def __init__(
|
||||
self,
|
||||
connection: Optional[Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper]],
|
||||
progress_callback: Optional[Callable] = ...
|
||||
) -> None: ...
|
||||
def _create_project_state(self, with_applied_migrations: bool = ...) -> ProjectState: ...
|
||||
def _migrate_all_backwards(self, plan: Any, full_plan: Any, fake: bool) -> ProjectState: ...
|
||||
def _migrate_all_forwards(
|
||||
self,
|
||||
state: ProjectState,
|
||||
plan: Any,
|
||||
full_plan: Any,
|
||||
fake: bool,
|
||||
fake_initial: bool
|
||||
) -> ProjectState: ...
|
||||
def apply_migration(
|
||||
self,
|
||||
state: ProjectState,
|
||||
migration: Migration,
|
||||
fake: bool = ...,
|
||||
fake_initial: bool = ...
|
||||
) -> ProjectState: ...
|
||||
def check_replacements(self) -> None: ...
|
||||
def detect_soft_applied(
|
||||
self,
|
||||
project_state: None,
|
||||
migration: Migration
|
||||
) -> Tuple[bool, ProjectState]: ...
|
||||
def migrate(
|
||||
self,
|
||||
targets: Optional[Union[List[Tuple[str, str]], List[Tuple[str, None]]]],
|
||||
plan: Any = ...,
|
||||
state: Optional[ProjectState] = ...,
|
||||
fake: bool = ...,
|
||||
fake_initial: bool = ...
|
||||
) -> ProjectState: ...
|
||||
def migration_plan(
|
||||
self,
|
||||
targets: Union[Set[Tuple[str, str]], List[Tuple[str, str]], List[Tuple[str, None]]],
|
||||
clean_start: bool = ...
|
||||
) -> Any: ...
|
||||
def unapply_migration(
|
||||
self,
|
||||
state: ProjectState,
|
||||
migration: Migration,
|
||||
fake: bool = ...
|
||||
) -> ProjectState: ...
|
||||
65
django/db/migrations/graph.pyi
Normal file
65
django/db/migrations/graph.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
from django.db.migrations.migration import SwappableTuple
|
||||
from django.db.migrations.state import ProjectState
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class DummyNode:
|
||||
def __init__(self, key: Tuple[str, str], origin: Any, error_message: str) -> None: ...
|
||||
def promote(self) -> None: ...
|
||||
def raise_error(self): ...
|
||||
|
||||
|
||||
class MigrationGraph:
|
||||
def __contains__(self, node: Union[SwappableTuple, Tuple[str, str]]) -> bool: ...
|
||||
def __init__(self) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _generate_plan(self, nodes: List[Tuple[str, str]], at_end: bool) -> List[Tuple[str, str]]: ...
|
||||
def _nodes_and_edges(self) -> Tuple[int, int]: ...
|
||||
def add_dependency(
|
||||
self,
|
||||
migration: Any,
|
||||
child: Tuple[str, str],
|
||||
parent: Tuple[str, str],
|
||||
skip_validation: bool = ...
|
||||
) -> None: ...
|
||||
def add_dummy_node(self, key: Tuple[str, str], origin: Any, error_message: str) -> None: ...
|
||||
def add_node(self, key: Tuple[str, str], migration: Any) -> None: ...
|
||||
def backwards_plan(self, target: Union[Tuple[str, str], Node]) -> List[Tuple[str, str]]: ...
|
||||
def clear_cache(self) -> None: ...
|
||||
def ensure_not_cyclic(
|
||||
self,
|
||||
start: Union[Node, Tuple[str, str]],
|
||||
get_children: Callable
|
||||
) -> None: ...
|
||||
def forwards_plan(self, target: Tuple[str, str]) -> List[Tuple[str, str]]: ...
|
||||
def leaf_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ...
|
||||
def make_state(
|
||||
self,
|
||||
nodes: Optional[Tuple[str, str]] = ...,
|
||||
at_end: bool = ...,
|
||||
real_apps: List[str] = ...
|
||||
) -> ProjectState: ...
|
||||
def remove_replaced_nodes(self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]]) -> None: ...
|
||||
def remove_replacement_node(self, replacement: Tuple[str, str], replaced: List[Tuple[str, str]]) -> None: ...
|
||||
def root_nodes(self, app: Optional[str] = ...) -> List[Tuple[str, str]]: ...
|
||||
def validate_consistency(self) -> None: ...
|
||||
|
||||
|
||||
class Node:
|
||||
def __eq__(self, other: Tuple[str, str]) -> bool: ...
|
||||
def __getitem__(self, item: int) -> str: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __init__(self, key: Tuple[str, str]) -> None: ...
|
||||
def __lt__(self, other: Union[Node, Tuple[str, str]]) -> bool: ...
|
||||
def add_child(self, child: Node) -> None: ...
|
||||
def add_parent(self, parent: Node) -> None: ...
|
||||
def ancestors(self) -> List[Tuple[str, str]]: ...
|
||||
def descendants(self) -> List[Tuple[str, str]]: ...
|
||||
54
django/db/migrations/loader.pyi
Normal file
54
django/db/migrations/loader.pyi
Normal file
@@ -0,0 +1,54 @@
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||
from django.db.migrations.migration import (
|
||||
Migration,
|
||||
SwappableTuple,
|
||||
)
|
||||
from django.db.migrations.state import ProjectState
|
||||
from typing import (
|
||||
Dict,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class MigrationLoader:
|
||||
def __init__(
|
||||
self,
|
||||
connection: Optional[Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]],
|
||||
load: bool = ...,
|
||||
ignore_no_migrations: bool = ...
|
||||
) -> None: ...
|
||||
def add_external_dependencies(
|
||||
self,
|
||||
key: Tuple[str, str],
|
||||
migration: Migration
|
||||
) -> None: ...
|
||||
def add_internal_dependencies(
|
||||
self,
|
||||
key: Tuple[str, str],
|
||||
migration: Migration
|
||||
) -> None: ...
|
||||
def build_graph(self) -> None: ...
|
||||
def check_consistent_history(
|
||||
self,
|
||||
connection: Union[DefaultConnectionProxy, backends.sqlite3.base.DatabaseWrapper]
|
||||
) -> None: ...
|
||||
def check_key(
|
||||
self,
|
||||
key: Union[SwappableTuple, Tuple[str, str]],
|
||||
current_app: str
|
||||
) -> Optional[Tuple[str, str]]: ...
|
||||
def detect_conflicts(self) -> Dict[str, Set[str]]: ...
|
||||
def get_migration(self, app_label: str, name_prefix: str) -> Migration: ...
|
||||
def get_migration_by_prefix(self, app_label: str, name_prefix: str) -> Migration: ...
|
||||
def load_disk(self) -> None: ...
|
||||
@classmethod
|
||||
def migrations_module(cls, app_label: str) -> Union[Tuple[None, bool], Tuple[str, bool]]: ...
|
||||
def project_state(
|
||||
self,
|
||||
nodes: Optional[Tuple[str, str]] = ...,
|
||||
at_end: bool = ...
|
||||
) -> ProjectState: ...
|
||||
43
django/db/migrations/migration.pyi
Normal file
43
django/db/migrations/migration.pyi
Normal file
@@ -0,0 +1,43 @@
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.state import ProjectState
|
||||
from typing import (
|
||||
Tuple,
|
||||
Type,
|
||||
)
|
||||
|
||||
|
||||
def swappable_dependency(value: str) -> SwappableTuple: ...
|
||||
|
||||
|
||||
class Migration:
|
||||
def __eq__(self, other: Migration) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __init__(self, name: str, app_label: str) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def apply(
|
||||
self,
|
||||
project_state: ProjectState,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
collect_sql: bool = ...
|
||||
) -> ProjectState: ...
|
||||
def mutate_state(
|
||||
self,
|
||||
project_state: ProjectState,
|
||||
preserve: bool = ...
|
||||
) -> ProjectState: ...
|
||||
def unapply(
|
||||
self,
|
||||
project_state: ProjectState,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
collect_sql: bool = ...
|
||||
) -> ProjectState: ...
|
||||
|
||||
|
||||
class SwappableTuple:
|
||||
@staticmethod
|
||||
def __new__(
|
||||
cls: Type[SwappableTuple],
|
||||
value: Tuple[str, str],
|
||||
setting: str
|
||||
) -> SwappableTuple: ...
|
||||
22
django/db/migrations/operations/base.pyi
Normal file
22
django/db/migrations/operations/base.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
from django.db.migrations.operations.models import CreateModel
|
||||
from typing import (
|
||||
Any,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class Operation:
|
||||
@staticmethod
|
||||
def __new__(cls: Any, *args, **kwargs) -> Operation: ...
|
||||
def _get_model_tuple(self, remote_model: str, app_label: str, model_name: str) -> Tuple[str, str]: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: Operation,
|
||||
in_between: Any,
|
||||
app_label: Optional[str] = ...
|
||||
) -> Union[bool, List[CreateModel]]: ...
|
||||
def references_field(self, model_name: str, name: str, app_label: str = ...) -> bool: ...
|
||||
def references_model(self, name: str, app_label: str = ...) -> bool: ...
|
||||
141
django/db/migrations/operations/fields.pyi
Normal file
141
django/db/migrations/operations/fields.pyi
Normal file
@@ -0,0 +1,141 @@
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from django.db.migrations.operations.models import (
|
||||
AlterUniqueTogether,
|
||||
DeleteModel,
|
||||
)
|
||||
from django.db.migrations.state import ProjectState
|
||||
from django.db.models.fields import (
|
||||
CharField,
|
||||
Field,
|
||||
IntegerField,
|
||||
SlugField,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class AddField:
|
||||
def __init__(
|
||||
self,
|
||||
model_name: str,
|
||||
name: str,
|
||||
field: Field,
|
||||
preserve_default: bool = ...
|
||||
) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def describe(self) -> str: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: Operation,
|
||||
in_between: List[AddField],
|
||||
app_label: Optional[str] = ...
|
||||
) -> Union[bool, List[AddField]]: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class AlterField:
|
||||
def __init__(
|
||||
self,
|
||||
model_name: str,
|
||||
name: str,
|
||||
field: Field,
|
||||
preserve_default: bool = ...
|
||||
) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(
|
||||
self
|
||||
) -> Union[Tuple[str, List[Any], Dict[str, Union[str, SlugField]]], Tuple[str, List[Any], Dict[str, Union[str, CharField]]], Tuple[str, List[Any], Dict[str, Union[str, IntegerField]]]]: ...
|
||||
def describe(self) -> str: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: Union[DeleteModel, AlterField, AlterUniqueTogether],
|
||||
in_between: List[Any],
|
||||
app_label: str = ...
|
||||
) -> bool: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class FieldOperation:
|
||||
def __init__(self, model_name: str, name: str) -> None: ...
|
||||
def is_same_field_operation(self, operation: FieldOperation) -> bool: ...
|
||||
def is_same_model_operation(self, operation: FieldOperation) -> bool: ...
|
||||
@cached_property
|
||||
def model_name_lower(self) -> str: ...
|
||||
@cached_property
|
||||
def name_lower(self) -> str: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: Operation,
|
||||
in_between: Any,
|
||||
app_label: str = ...
|
||||
) -> bool: ...
|
||||
def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ...
|
||||
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
|
||||
|
||||
|
||||
class RemoveField:
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
|
||||
def describe(self) -> str: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class RenameField:
|
||||
def __init__(self, model_name: str, old_name: str, new_name: str) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
|
||||
@cached_property
|
||||
def old_name_lower(self) -> str: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: Union[FieldOperation, AlterUniqueTogether],
|
||||
in_between: List[Any],
|
||||
app_label: Optional[str] = ...
|
||||
) -> Union[bool, List[RenameField]]: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
258
django/db/migrations/operations/models.pyi
Normal file
258
django/db/migrations/operations/models.pyi
Normal file
@@ -0,0 +1,258 @@
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from django.db.migrations.state import ProjectState
|
||||
from django.db.models.indexes import Index
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def _check_for_duplicates(arg_name: str, objs: Iterator[Any]) -> None: ...
|
||||
|
||||
|
||||
class AddIndex:
|
||||
def __init__(self, model_name: str, index: Index) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def describe(self) -> str: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class AlterIndexTogether:
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
index_together: Optional[Union[List[List[str]], List[Tuple[str, str]], Set[Tuple[str, str]]]]
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Set[Tuple[str, str]]]]]: ...
|
||||
def references_field(self, model_name: str, name: str, app_label: None = ...) -> bool: ...
|
||||
|
||||
|
||||
class AlterModelManagers:
|
||||
def __init__(self, name: str, managers: List[Any]) -> None: ...
|
||||
def describe(self) -> str: ...
|
||||
|
||||
|
||||
class AlterModelOptions:
|
||||
def __init__(self, name: str, options: Dict[str, Union[List[Tuple[str, str]], str]]) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Dict[str, List[Tuple[str, str]]]]]]: ...
|
||||
|
||||
|
||||
class AlterModelTable:
|
||||
def __init__(self, name: str, table: str) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
|
||||
def describe(self) -> str: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: DeleteModel,
|
||||
in_between: List[Any],
|
||||
app_label: None = ...
|
||||
) -> List[DeleteModel]: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class AlterOrderWithRespectTo:
|
||||
def __init__(self, name: str, order_with_respect_to: str) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
|
||||
def describe(self) -> str: ...
|
||||
def references_field(self, model_name: str, name: str, app_label: None = ...) -> bool: ...
|
||||
|
||||
|
||||
class AlterUniqueTogether:
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
unique_together: Optional[Union[List[List[str]], Set[Tuple[str, str]], List[Tuple[str, str]]]]
|
||||
) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, Union[str, Set[Tuple[str, str]]]]]: ...
|
||||
def describe(self) -> str: ...
|
||||
def references_field(self, model_name: str, name: str, app_label: Optional[str] = ...) -> bool: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class CreateModel:
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
fields: Any,
|
||||
options: Any = ...,
|
||||
bases: Any = ...,
|
||||
managers: Any = ...
|
||||
) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Any: ...
|
||||
def describe(self) -> str: ...
|
||||
def model_to_key(self, model: str) -> List[str]: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: Operation,
|
||||
in_between: Any,
|
||||
app_label: Optional[str] = ...
|
||||
) -> Union[bool, List[CreateModel]]: ...
|
||||
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class DeleteModel:
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
|
||||
def describe(self) -> str: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class FieldRelatedOptionOperation:
|
||||
def reduce(
|
||||
self,
|
||||
operation: Operation,
|
||||
in_between: List[DeleteModel],
|
||||
app_label: Optional[str] = ...
|
||||
) -> Any: ...
|
||||
|
||||
|
||||
class IndexOperation:
|
||||
@cached_property
|
||||
def model_name_lower(self) -> str: ...
|
||||
|
||||
|
||||
class ModelOperation:
|
||||
def __init__(self, name: str) -> None: ...
|
||||
@cached_property
|
||||
def name_lower(self) -> str: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: Operation,
|
||||
in_between: Any,
|
||||
app_label: Optional[str] = ...
|
||||
) -> bool: ...
|
||||
def references_model(self, name: str, app_label: Optional[str] = ...) -> bool: ...
|
||||
|
||||
|
||||
class ModelOptionOperation:
|
||||
def reduce(
|
||||
self,
|
||||
operation: Operation,
|
||||
in_between: List[DeleteModel],
|
||||
app_label: Optional[str] = ...
|
||||
) -> Union[bool, List[AlterUniqueTogether]]: ...
|
||||
|
||||
|
||||
class RemoveIndex:
|
||||
def __init__(self, model_name: str, name: str) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class RenameModel:
|
||||
def __init__(self, old_name: str, new_name: str) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def deconstruct(self) -> Tuple[str, List[Any], Dict[str, str]]: ...
|
||||
@cached_property
|
||||
def new_name_lower(self) -> str: ...
|
||||
@cached_property
|
||||
def old_name_lower(self) -> str: ...
|
||||
def reduce(
|
||||
self,
|
||||
operation: AlterModelTable,
|
||||
in_between: List[Any],
|
||||
app_label: str = ...
|
||||
) -> bool: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
89
django/db/migrations/operations/special.pyi
Normal file
89
django/db/migrations/operations/special.pyi
Normal file
@@ -0,0 +1,89 @@
|
||||
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.operations.fields import AddField
|
||||
from django.db.migrations.operations.models import (
|
||||
CreateModel,
|
||||
ModelOperation,
|
||||
)
|
||||
from django.db.migrations.state import (
|
||||
ProjectState,
|
||||
StateApps,
|
||||
)
|
||||
from typing import (
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class RunPython:
|
||||
def __init__(
|
||||
self,
|
||||
code: Union[str, Callable],
|
||||
reverse_code: Optional[Callable] = ...,
|
||||
atomic: None = ...,
|
||||
hints: Optional[Dict[str, str]] = ...,
|
||||
elidable: bool = ...
|
||||
) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def describe(self) -> str: ...
|
||||
@staticmethod
|
||||
def noop(
|
||||
apps: StateApps,
|
||||
schema_editor: DatabaseSchemaEditor
|
||||
) -> None: ...
|
||||
@property
|
||||
def reversible(self) -> bool: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
|
||||
|
||||
class RunSQL:
|
||||
def _run_sql(
|
||||
self,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
sqls: Union[str, List[str]]
|
||||
) -> None: ...
|
||||
def database_backwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
|
||||
|
||||
class SeparateDatabaseAndState:
|
||||
def __init__(
|
||||
self,
|
||||
database_operations: List[ModelOperation] = ...,
|
||||
state_operations: Union[List[AddField], List[CreateModel], List[ModelOperation]] = ...
|
||||
) -> None: ...
|
||||
def database_forwards(
|
||||
self,
|
||||
app_label: str,
|
||||
schema_editor: DatabaseSchemaEditor,
|
||||
from_state: ProjectState,
|
||||
to_state: ProjectState
|
||||
) -> None: ...
|
||||
def state_forwards(self, app_label: str, state: ProjectState) -> None: ...
|
||||
10
django/db/migrations/operations/utils.pyi
Normal file
10
django/db/migrations/operations/utils.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from django.db.migrations.state import ProjectState
|
||||
from django.db.models.fields import Field
|
||||
|
||||
|
||||
def is_referenced_by_foreign_key(
|
||||
state: ProjectState,
|
||||
model_name_lower: str,
|
||||
field: Field,
|
||||
field_name: str
|
||||
) -> bool: ...
|
||||
9
django/db/migrations/optimizer.pyi
Normal file
9
django/db/migrations/optimizer.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
class MigrationOptimizer:
|
||||
def optimize(self, operations: Any, app_label: Optional[str] = ...) -> Any: ...
|
||||
def optimize_inner(self, operations: Any, app_label: Optional[str] = ...) -> Any: ...
|
||||
40
django/db/migrations/questioner.pyi
Normal file
40
django/db/migrations/questioner.pyi
Normal file
@@ -0,0 +1,40 @@
|
||||
from django.db.migrations.state import ModelState
|
||||
from django.db.models.fields import IntegerField
|
||||
from django.db.models.fields.related import ForeignKey
|
||||
from typing import (
|
||||
Dict,
|
||||
Optional,
|
||||
Set,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class InteractiveMigrationQuestioner:
|
||||
def _ask_default(self, default: str = ...) -> int: ...
|
||||
def _boolean_input(self, question: str, default: bool = ...) -> bool: ...
|
||||
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> int: ...
|
||||
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
|
||||
|
||||
|
||||
class MigrationQuestioner:
|
||||
def __init__(
|
||||
self,
|
||||
defaults: Optional[Dict[str, bool]] = ...,
|
||||
specified_apps: Optional[Set[str]] = ...,
|
||||
dry_run: Optional[bool] = ...
|
||||
) -> None: ...
|
||||
def ask_auto_now_add_addition(self, field_name: str, model_name: str) -> None: ...
|
||||
def ask_initial(self, app_label: str) -> bool: ...
|
||||
def ask_not_null_addition(self, field_name: str, model_name: str) -> None: ...
|
||||
def ask_rename(
|
||||
self,
|
||||
model_name: str,
|
||||
old_name: str,
|
||||
new_name: str,
|
||||
field_instance: Union[IntegerField, related.ForeignKey]
|
||||
) -> bool: ...
|
||||
def ask_rename_model(
|
||||
self,
|
||||
old_model_state: ModelState,
|
||||
new_model_state: ModelState
|
||||
) -> bool: ...
|
||||
24
django/db/migrations/recorder.pyi
Normal file
24
django/db/migrations/recorder.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
from django.db import DefaultConnectionProxy
|
||||
from django.db.backends.base.base import BaseDatabaseWrapper
|
||||
from django.db.models.query import QuerySet
|
||||
from typing import (
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class MigrationRecorder:
|
||||
def __init__(
|
||||
self,
|
||||
connection: Optional[Union[DefaultConnectionProxy, backends.base.base.BaseDatabaseWrapper]]
|
||||
) -> None: ...
|
||||
def applied_migrations(self) -> Set[Tuple[str, str]]: ...
|
||||
def ensure_schema(self) -> None: ...
|
||||
def flush(self) -> None: ...
|
||||
def has_table(self) -> bool: ...
|
||||
@property
|
||||
def migration_qs(self) -> QuerySet: ...
|
||||
def record_applied(self, app: str, name: str) -> None: ...
|
||||
def record_unapplied(self, app: str, name: str) -> None: ...
|
||||
103
django/db/migrations/serializer.pyi
Normal file
103
django/db/migrations/serializer.pyi
Normal file
@@ -0,0 +1,103 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Dict,
|
||||
List,
|
||||
Set,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def serializer_factory(value: Any) -> BaseSerializer: ...
|
||||
|
||||
|
||||
class BaseSequenceSerializer:
|
||||
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
|
||||
|
||||
|
||||
class BaseSerializer:
|
||||
def __init__(self, value: Any) -> None: ...
|
||||
|
||||
|
||||
class BaseSimpleSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[Any]]: ...
|
||||
|
||||
|
||||
class DateSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class DatetimeSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class DeconstructableSerializer:
|
||||
@staticmethod
|
||||
def _serialize_path(path: str) -> Tuple[str, Set[str]]: ...
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
@staticmethod
|
||||
def serialize_deconstructed(
|
||||
path: str,
|
||||
args: Union[Tuple, List[str]],
|
||||
kwargs: Dict[str, Any]
|
||||
) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class DictionarySerializer:
|
||||
def serialize(self) -> Tuple[str, Set[Any]]: ...
|
||||
|
||||
|
||||
class EnumSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class FloatSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[Any]]: ...
|
||||
|
||||
|
||||
class FrozensetSerializer:
|
||||
def _format(self) -> str: ...
|
||||
|
||||
|
||||
class FunctionTypeSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class ModelFieldSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class ModelManagerSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class OperationSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class RegexSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class SequenceSerializer:
|
||||
def _format(self) -> str: ...
|
||||
|
||||
|
||||
class SetSerializer:
|
||||
def _format(self) -> str: ...
|
||||
|
||||
|
||||
class TimedeltaSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
|
||||
|
||||
class TupleSerializer:
|
||||
def _format(self) -> str: ...
|
||||
|
||||
|
||||
class TypeSerializer:
|
||||
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
|
||||
|
||||
|
||||
class UUIDSerializer:
|
||||
def serialize(self) -> Tuple[str, Set[str]]: ...
|
||||
35
django/db/migrations/state.pyi
Normal file
35
django/db/migrations/state.pyi
Normal file
@@ -0,0 +1,35 @@
|
||||
from django.apps.registry import Apps
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.indexes import Index
|
||||
from typing import (
|
||||
Any,
|
||||
Iterator,
|
||||
)
|
||||
|
||||
|
||||
class AppConfigStub:
|
||||
def __init__(self, label: str) -> None: ...
|
||||
def import_models(self) -> None: ...
|
||||
|
||||
|
||||
class ModelState:
|
||||
def __eq__(self, other: ModelState) -> bool: ...
|
||||
def __init__(
|
||||
self,
|
||||
app_label: str,
|
||||
name: str,
|
||||
fields: Any,
|
||||
options: Any = ...,
|
||||
bases: Any = ...,
|
||||
managers: Any = ...
|
||||
) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def clone(self) -> ModelState: ...
|
||||
def construct_managers(self) -> Iterator[Any]: ...
|
||||
@classmethod
|
||||
def from_model(cls, model: Any, exclude_rels: bool = ...) -> ModelState: ...
|
||||
def get_field_by_name(self, name: str) -> Field: ...
|
||||
def get_index_by_name(self, name: str) -> Index: ...
|
||||
@cached_property
|
||||
def name_lower(self) -> str: ...
|
||||
def render(self, apps: Apps): ...
|
||||
10
django/db/migrations/topological_sort.pyi
Normal file
10
django/db/migrations/topological_sort.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from typing import (
|
||||
Any,
|
||||
Iterator,
|
||||
)
|
||||
|
||||
|
||||
def stable_topological_sort(l: Any, dependency_graph: Any) -> Any: ...
|
||||
|
||||
|
||||
def topological_sort_as_sets(dependency_graph: Any) -> Iterator[Any]: ...
|
||||
9
django/db/migrations/utils.pyi
Normal file
9
django/db/migrations/utils.pyi
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
|
||||
|
||||
def get_migration_name_timestamp() -> str: ...
|
||||
|
||||
|
||||
class RegexObject:
|
||||
def __eq__(self, other: RegexObject) -> bool: ...
|
||||
def __init__(self, obj: SimpleLazyObject) -> None: ...
|
||||
41
django/db/migrations/writer.pyi
Normal file
41
django/db/migrations/writer.pyi
Normal file
@@ -0,0 +1,41 @@
|
||||
from django.db.migrations.migration import Migration
|
||||
from django.db.migrations.operations.base import Operation
|
||||
from typing import (
|
||||
Any,
|
||||
Set,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class MigrationWriter:
|
||||
def __init__(self, migration: Migration) -> None: ...
|
||||
def as_string(self) -> str: ...
|
||||
@property
|
||||
def basedir(self) -> str: ...
|
||||
@property
|
||||
def filename(self) -> str: ...
|
||||
@property
|
||||
def path(self) -> str: ...
|
||||
@classmethod
|
||||
def serialize(cls, value: Any) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
|
||||
|
||||
|
||||
class OperationWriter:
|
||||
def __init__(self, operation: Operation, indentation: int = ...) -> None: ...
|
||||
def feed(self, line: str) -> None: ...
|
||||
def indent(self) -> None: ...
|
||||
def render(self) -> str: ...
|
||||
def serialize(self) -> Union[Tuple[str, Set[Any]], Tuple[str, Set[str]]]: ...
|
||||
def unindent(self) -> None: ...
|
||||
|
||||
|
||||
class SettingsReference:
|
||||
def __init__(self, value: str, setting_name: str) -> None: ...
|
||||
@staticmethod
|
||||
def __new__(
|
||||
self: Type[SettingsReference],
|
||||
value: str,
|
||||
setting_name: str
|
||||
) -> SettingsReference: ...
|
||||
Reference in New Issue
Block a user