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

@@ -1,6 +1,5 @@
from collections import OrderedDict
from typing import (Any, Callable, Dict, Iterator, List, Optional, Tuple, Type,
Union)
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
@@ -16,26 +15,16 @@ class BadSerializer:
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 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
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 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]]]]
]
app_list: Union[List[Tuple[AppConfig, None]], List[Tuple[str, List[Type[Model]]]]]
) -> List[Type[Model]]: ...

View File

@@ -10,35 +10,26 @@ 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]],
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: ...
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 __init__(self, output: Optional[Union[StringIO, OutputWrapper]], total_count: int) -> None: ...
def update(self, count: int) -> None: ...
class Serializer:
@@ -75,36 +66,18 @@ class Serializer:
class Deserializer:
options: Any = ...
stream: Any = ...
def __init__(
self,
stream_or_string: Union[BufferedReader, TextIOWrapper, str],
**options: Any
) -> None: ...
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 __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 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,
field: ForeignKey, field_value: Optional[Union[List[str], Tuple[str], int, str]], using: str
) -> Optional[Union[int, str, UUID]]: ...

View File

@@ -7,11 +7,8 @@ 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]]
]
json_kwargs: Dict[str, Optional[Type[django.core.serializers.json.DjangoJSONEncoder]]]
options: Dict[str, None]
selected_fields: None
stream: _io.StringIO

View File

@@ -7,7 +7,6 @@ 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

View File

@@ -9,7 +9,6 @@ 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
@@ -33,24 +32,11 @@ class DjangoSafeDumper(SafeDumper):
last_anchor_id: int
line: int
mapping_context: bool
object_keeper: List[
Union[
List[collections.OrderedDict],
collections.OrderedDict,
datetime.datetime,
]
]
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,
],
]
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

View File

@@ -9,7 +9,6 @@ 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
@@ -46,25 +45,12 @@ 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 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
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): ...
@@ -82,21 +68,11 @@ class EntitiesForbidden(DefusedXmlException):
sysid: Any = ...
pubid: Any = ...
notation_name: Any = ...
def __init__(
self,
name: Any,
value: Any,
base: Any,
sysid: Any,
pubid: Any,
notation_name: Any,
) -> None: ...
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: ...
def __init__(self, context: Any, base: Any, sysid: Any, pubid: Any) -> None: ...