move generated stubs to separate directory, too messty

This commit is contained in:
Maxim Kurnikov
2018-11-10 17:49:18 +03:00
parent 7436d641e3
commit 96cd3ddb27
446 changed files with 58 additions and 71 deletions

View File

@@ -0,0 +1,41 @@
from collections import OrderedDict
from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
Union)
from django.apps.config import AppConfig
from django.core.serializers.base import Serializer
from django.core.serializers.xml_serializer import Deserializer
from django.db.models.base import Model
from django.db.models.query import QuerySet
BUILTIN_SERIALIZERS: Any
class BadSerializer:
internal_use_only: bool = ...
exception: ModuleNotFoundError = ...
def __init__(self, exception: ImportError) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
def register_serializer(
format: str,
serializer_module: str,
serializers: Optional[Dict[str, Any]] = ...,
) -> None: ...
def unregister_serializer(format: str) -> None: ...
def get_serializer(format: str) -> Union[Type[Serializer], BadSerializer]: ...
def get_serializer_formats() -> List[str]: ...
def get_public_serializer_formats() -> List[str]: ...
def get_deserializer(format: str) -> Union[Callable, Type[Deserializer]]: ...
def serialize(
format: str,
queryset: Union[Iterator[Any], List[Model], QuerySet],
**options: Any
) -> Optional[Union[List[OrderedDict], bytes, str]]: ...
def deserialize(
format: str, stream_or_string: Any, **options: Any
) -> Union[Iterator[Any], Deserializer]: ...
def sort_dependencies(
app_list: Union[
List[Tuple[AppConfig, None]], List[Tuple[str, List[Type[Model]]]]
]
) -> List[Type[Model]]: ...

View File

@@ -0,0 +1,110 @@
from collections import OrderedDict
from datetime import date
from io import BufferedReader, StringIO, TextIOWrapper
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from uuid import UUID
from django.core.management.base import OutputWrapper
from django.core.serializers.xml_serializer import Deserializer
from django.db.models.base import Model
from django.db.models.fields.related import ForeignKey, ManyToManyField
from django.db.models.query import QuerySet
class SerializerDoesNotExist(KeyError): ...
class SerializationError(Exception): ...
class DeserializationError(Exception):
@classmethod
def WithData(
cls,
original_exc: Exception,
model: str,
fk: Union[int, str],
field_value: Optional[Union[List[str], str]],
) -> DeserializationError: ...
class M2MDeserializationError(Exception):
original_exc: django.core.exceptions.ObjectDoesNotExist = ...
pk: List[str] = ...
def __init__(
self, original_exc: Exception, pk: Union[List[str], str]
) -> None: ...
class ProgressBar:
progress_width: int = ...
output: None = ...
total_count: int = ...
prev_done: int = ...
def __init__(
self, output: Optional[Union[StringIO, OutputWrapper]], total_count: int
) -> None: ...
def update(self, count: int) -> None: ...
class Serializer:
internal_use_only: bool = ...
progress_class: Any = ...
stream_class: Any = ...
options: Any = ...
stream: Any = ...
selected_fields: Any = ...
use_natural_foreign_keys: Any = ...
use_natural_primary_keys: Any = ...
first: bool = ...
def serialize(
self,
queryset: Union[Iterator[Any], List[Model], QuerySet],
*,
stream: Optional[Any] = ...,
fields: Optional[Any] = ...,
use_natural_foreign_keys: bool = ...,
use_natural_primary_keys: bool = ...,
progress_output: Optional[Any] = ...,
object_count: int = ...,
**options: Any
) -> Optional[Union[List[OrderedDict], bytes, str]]: ...
def start_serialization(self) -> None: ...
def end_serialization(self) -> None: ...
def start_object(self, obj: Any) -> None: ...
def end_object(self, obj: Any) -> None: ...
def handle_field(self, obj: Any, field: Any) -> None: ...
def handle_fk_field(self, obj: Any, field: Any) -> None: ...
def handle_m2m_field(self, obj: Any, field: Any) -> None: ...
def getvalue(self) -> Optional[Union[bytes, str]]: ...
class Deserializer:
options: Any = ...
stream: Any = ...
def __init__(
self,
stream_or_string: Union[BufferedReader, TextIOWrapper, str],
**options: Any
) -> None: ...
def __iter__(self) -> Deserializer: ...
def __next__(self) -> None: ...
class DeserializedObject:
object: django.db.models.base.Model = ...
m2m_data: Dict[Any, Any] = ...
def __init__(
self, obj: Model, m2m_data: Optional[Dict[str, List[int]]] = ...
) -> None: ...
def save(
self, save_m2m: bool = ..., using: Optional[str] = ..., **kwargs: Any
) -> None: ...
def build_instance(
Model: Type[Model],
data: Dict[str, Optional[Union[date, int, str, UUID]]],
db: str,
) -> Model: ...
def deserialize_m2m_values(
field: ManyToManyField,
field_value: Union[List[List[str]], List[int]],
using: str,
) -> List[int]: ...
def deserialize_fk_value(
field: ForeignKey,
field_value: Optional[Union[List[str], Tuple[str], int, str]],
using: str,
) -> Optional[Union[int, str, UUID]]: ...

View File

@@ -0,0 +1,35 @@
import json
from datetime import datetime
from decimal import Decimal
from typing import Any, Optional, Union
from uuid import UUID
from django.core.serializers.python import Serializer as PythonSerializer
from django.db.models.base import Model
class Serializer(PythonSerializer):
json_kwargs: Dict[
str, Optional[Type[django.core.serializers.json.DjangoJSONEncoder]]
]
options: Dict[str, None]
selected_fields: None
stream: _io.StringIO
use_natural_foreign_keys: bool
use_natural_primary_keys: bool
internal_use_only: bool = ...
def start_serialization(self) -> None: ...
def end_serialization(self) -> None: ...
def end_object(self, obj: Model) -> None: ...
def getvalue(self) -> Optional[Union[bytes, str]]: ...
def Deserializer(stream_or_string: Any, **options: Any) -> None: ...
class DjangoJSONEncoder(json.JSONEncoder):
allow_nan: bool
check_circular: bool
ensure_ascii: bool
indent: None
skipkeys: bool
sort_keys: bool
def default(self, o: Union[datetime, Decimal, UUID]) -> str: ...

View File

@@ -0,0 +1,39 @@
from collections import OrderedDict
from typing import Any, Dict, Iterator, List, Optional, Union
from django.core.serializers import base
from django.core.serializers.base import DeserializedObject
from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignKey, ManyToManyField
class Serializer(base.Serializer):
options: Dict[Any, Any]
selected_fields: None
stream: _io.StringIO
use_natural_foreign_keys: bool
use_natural_primary_keys: bool
internal_use_only: bool = ...
objects: List[Any] = ...
def start_serialization(self) -> None: ...
def end_serialization(self) -> None: ...
def start_object(self, obj: Model) -> None: ...
def end_object(self, obj: Model) -> None: ...
def get_dump_object(self, obj: Model) -> OrderedDict: ...
def handle_field(self, obj: Model, field: Field) -> None: ...
def handle_fk_field(self, obj: Model, field: ForeignKey) -> None: ...
def handle_m2m_field(self, obj: Model, field: ManyToManyField) -> None: ...
def getvalue(self) -> List[OrderedDict]: ...
def Deserializer(
object_list: Union[
List[Dict[str, Optional[Union[Dict[str, Optional[str]], str]]]],
List[Dict[str, Union[Dict[str, Union[List[int], int, str]], int, str]]],
List[OrderedDict],
],
*,
using: Any = ...,
ignorenonexistent: bool = ...,
**options: Any
) -> Iterator[DeserializedObject]: ...

View File

@@ -0,0 +1,86 @@
from collections import OrderedDict
from decimal import Decimal
from typing import Any, Optional, Union
from yaml import CSafeDumper as SafeDumper
from yaml.nodes import MappingNode, ScalarNode
from django.core.serializers.python import Serializer as PythonSerializer
from django.db.models.base import Model
from django.db.models.fields import Field
class DjangoSafeDumper(SafeDumper):
alias_key: int
allow_unicode: None
analysis: None
anchors: Dict[Any, Any]
best_indent: int
best_line_break: str
best_width: int
canonical: None
closed: bool
column: int
default_flow_style: None
default_style: None
encoding: None
event: None
events: List[Any]
flow_level: int
indent: None
indention: bool
indents: List[Any]
last_anchor_id: int
line: int
mapping_context: bool
object_keeper: List[
Union[
List[collections.OrderedDict],
collections.OrderedDict,
datetime.datetime,
]
]
open_ended: bool
prepared_anchor: None
prepared_tag: None
represented_objects: Dict[
int,
Union[
yaml.nodes.MappingNode,
yaml.nodes.ScalarNode,
yaml.nodes.SequenceNode,
],
]
resolver_exact_paths: List[Any]
resolver_prefix_paths: List[Any]
root_context: bool
sequence_context: bool
serialized_nodes: Dict[Any, Any]
simple_key_context: bool
state: Callable
states: List[Any]
stream: _io.StringIO
style: None
tag_prefixes: None
use_encoding: None
use_explicit_end: None
use_explicit_start: None
use_tags: None
use_version: None
whitespace: bool
def represent_decimal(self, data: Decimal) -> ScalarNode: ...
def represent_ordered_dict(self, data: OrderedDict) -> MappingNode: ...
class Serializer(PythonSerializer):
objects: List[Any]
options: Dict[Any, Any]
selected_fields: None
stream: _io.StringIO
use_natural_foreign_keys: bool
use_natural_primary_keys: bool
internal_use_only: bool = ...
def handle_field(self, obj: Model, field: Field) -> None: ...
def end_serialization(self) -> None: ...
def getvalue(self) -> Union[bytes, str]: ...
def Deserializer(stream_or_string: str, **options: Any) -> None: ...

View File

@@ -0,0 +1,102 @@
from io import BufferedReader, TextIOWrapper
from typing import Any, Optional, Union
from xml.dom.minidom import Element
from xml.sax.expatreader import ExpatParser as _ExpatParser
from django.core.serializers import base
from django.core.serializers.base import DeserializedObject
from django.db.models.base import Model
from django.db.models.fields import Field
from django.db.models.fields.related import ForeignKey, ManyToManyField
class Serializer(base.Serializer):
options: Dict[str, None]
selected_fields: None
stream: django.core.management.base.OutputWrapper
use_natural_foreign_keys: bool
use_natural_primary_keys: bool
def indent(self, level: int) -> None: ...
xml: django.utils.xmlutils.SimplerXMLGenerator = ...
def start_serialization(self) -> None: ...
def end_serialization(self) -> None: ...
def start_object(self, obj: Model) -> None: ...
def end_object(self, obj: Model) -> None: ...
def handle_field(self, obj: Model, field: Field) -> None: ...
def handle_fk_field(self, obj: Model, field: ForeignKey) -> None: ...
def handle_m2m_field(self, obj: Model, field: ManyToManyField) -> None: ...
class Deserializer(base.Deserializer):
options: Dict[Any, Any]
stream: _io.BufferedReader
event_stream: Any = ...
db: Any = ...
ignore: Any = ...
def __init__(
self,
stream_or_string: Union[BufferedReader, TextIOWrapper, str],
*,
using: Any = ...,
ignorenonexistent: bool = ...,
**options: Any
) -> None: ...
def __next__(self) -> DeserializedObject: ...
def getInnerText(node: Element) -> str: ...
class DefusedExpatParser(_ExpatParser):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def start_doctype_decl(
self, name: str, sysid: str, pubid: None, has_internal_subset: int
) -> Any: ...
def entity_decl(
self,
name: Any,
is_parameter_entity: Any,
value: Any,
base: Any,
sysid: Any,
pubid: Any,
notation_name: Any,
) -> None: ...
def unparsed_entity_decl(
self, name: Any, base: Any, sysid: Any, pubid: Any, notation_name: Any
) -> None: ...
def external_entity_ref_handler(
self, context: Any, base: Any, sysid: Any, pubid: Any
) -> None: ...
def reset(self) -> None: ...
class DefusedXmlException(ValueError): ...
class DTDForbidden(DefusedXmlException):
name: str = ...
sysid: str = ...
pubid: None = ...
def __init__(self, name: str, sysid: str, pubid: None) -> None: ...
class EntitiesForbidden(DefusedXmlException):
name: Any = ...
value: Any = ...
base: Any = ...
sysid: Any = ...
pubid: Any = ...
notation_name: Any = ...
def __init__(
self,
name: Any,
value: Any,
base: Any,
sysid: Any,
pubid: Any,
notation_name: Any,
) -> None: ...
class ExternalReferenceForbidden(DefusedXmlException):
context: Any = ...
base: Any = ...
sysid: Any = ...
pubid: Any = ...
def __init__(
self, context: Any, base: Any, sysid: Any, pubid: Any
) -> None: ...