mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 08:47:49 +08:00
new semanal wip 1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import collections
|
||||
import threading
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable, DefaultDict
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Callable, List, Optional, Tuple, Type, Union, Iterable, DefaultDict, Dict
|
||||
|
||||
from django.db.migrations.state import AppConfigStub
|
||||
from django.db.models.base import Model
|
||||
@@ -8,16 +8,16 @@ from django.db.models.base import Model
|
||||
from .config import AppConfig
|
||||
|
||||
class Apps:
|
||||
all_models: collections.defaultdict = ...
|
||||
app_configs: collections.OrderedDict = ...
|
||||
all_models: 'Dict[str, OrderedDict[str, Type[Model]]]' = ...
|
||||
app_configs: 'OrderedDict[str, AppConfig]' = ...
|
||||
stored_app_configs: List[Any] = ...
|
||||
apps_ready: bool = ...
|
||||
ready_event: threading.Event = ...
|
||||
loading: bool = ...
|
||||
_pending_operations: DefaultDict[Tuple[str, str], List]
|
||||
def __init__(self, installed_apps: Optional[Union[List[AppConfigStub], List[str], Tuple]] = ...) -> None: ...
|
||||
models_ready: bool = ...
|
||||
ready: bool = ...
|
||||
def __init__(self, installed_apps: Optional[Union[List[AppConfigStub], List[str], Tuple]] = ...) -> None: ...
|
||||
def populate(self, installed_apps: Union[List[AppConfigStub], List[str], Tuple] = ...) -> None: ...
|
||||
def check_apps_ready(self) -> None: ...
|
||||
def check_models_ready(self) -> None: ...
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, TypeVar, Union
|
||||
from typing import Any, Dict, List, Optional, Sequence, Set, Tuple, TypeVar, Union, ClassVar
|
||||
|
||||
from django.db.models.manager import Manager
|
||||
|
||||
from django.core.checks.messages import CheckMessage
|
||||
|
||||
from django.db.models.options import Options
|
||||
|
||||
|
||||
class ModelBase(type): ...
|
||||
|
||||
_Self = TypeVar("_Self", bound="Model")
|
||||
@@ -12,7 +15,7 @@ class Model(metaclass=ModelBase):
|
||||
class DoesNotExist(Exception): ...
|
||||
class MultipleObjectsReturned(Exception): ...
|
||||
class Meta: ...
|
||||
_meta: Any
|
||||
_meta: Options
|
||||
_default_manager: Manager[Model]
|
||||
pk: Any = ...
|
||||
def __init__(self: _Self, *args, **kwargs) -> None: ...
|
||||
|
||||
@@ -30,6 +30,9 @@ class Field(RegisterLookupMixin, Generic[_ST, _GT]):
|
||||
widget: Widget
|
||||
help_text: str
|
||||
db_table: str
|
||||
attname: str
|
||||
auto_created: bool
|
||||
primary_key: bool
|
||||
remote_field: Field
|
||||
max_length: Optional[int]
|
||||
model: Type[Model]
|
||||
|
||||
@@ -59,6 +59,7 @@ class RelatedField(FieldCacheMixin, Field[_ST, _GT]):
|
||||
one_to_one: bool = ...
|
||||
many_to_many: bool = ...
|
||||
many_to_one: bool = ...
|
||||
@property
|
||||
def related_model(self) -> Union[Type[Model], str]: ...
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
opts: Any = ...
|
||||
|
||||
@@ -9,9 +9,9 @@ class BaseManager(QuerySet[_T, _T]):
|
||||
creation_counter: int = ...
|
||||
auto_created: bool = ...
|
||||
use_in_migrations: bool = ...
|
||||
def __new__(cls: Type[BaseManager], *args: Any, **kwargs: Any) -> BaseManager: ...
|
||||
model: Optional[Any] = ...
|
||||
name: Optional[Any] = ...
|
||||
def __new__(cls: Type[BaseManager], *args: Any, **kwargs: Any) -> BaseManager: ...
|
||||
def __init__(self) -> None: ...
|
||||
def deconstruct(self) -> Tuple[bool, str, None, Tuple, Dict[str, int]]: ...
|
||||
def check(self, **kwargs: Any) -> List[Any]: ...
|
||||
|
||||
@@ -108,4 +108,4 @@ class Options:
|
||||
def get_ancestor_link(self, ancestor: Type[Model]) -> Optional[OneToOneField]: ...
|
||||
def get_path_to_parent(self, parent: Type[Model]) -> List[PathInfo]: ...
|
||||
def get_path_from_parent(self, parent: Type[Model]) -> List[PathInfo]: ...
|
||||
def get_fields(self, include_parents: bool = ..., include_hidden: bool = ...) -> ImmutableList: ...
|
||||
def get_fields(self, include_parents: bool = ..., include_hidden: bool = ...) -> List[Union[Field, ForeignObjectRel]]: ...
|
||||
|
||||
Reference in New Issue
Block a user