Skip to content

Commit

Permalink
clean up forms
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurnikov committed Feb 20, 2019
1 parent 5d8cdbc commit 116aa2c
Show file tree
Hide file tree
Showing 10 changed files with 344 additions and 308 deletions.
14 changes: 3 additions & 11 deletions django-stubs/core/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
from typing import Any, Dict, Iterator, List, Mapping, Optional, Tuple, Union

from django.db.models.base import Model
from django.forms.utils import ErrorDict

class FieldDoesNotExist(Exception): ...
Expand Down Expand Up @@ -31,20 +30,13 @@ class ValidationError(Exception):
message: Any = ...
code: Any = ...
params: Any = ...
def __init__(
self,
message: Any,
code: Optional[str] = ...,
params: Optional[
Union[Dict[str, Union[Tuple[str], Type[Model], Model, str]], Dict[str, Union[int, str]]]
] = ...,
) -> None: ...
def __init__(self, message: Any, code: Optional[str] = ..., params: Optional[Mapping[str, Any]] = ...) -> None: ...
@property
def message_dict(self) -> Dict[str, List[str]]: ...
@property
def messages(self) -> List[str]: ...
def update_error_dict(
self, error_dict: Union[Dict[str, List[ValidationError]], ErrorDict]
self, error_dict: Mapping[str, Any]
) -> Union[Dict[str, List[ValidationError]], ErrorDict]: ...
def __iter__(self) -> Iterator[Union[Tuple[str, List[str]], str]]: ...

Expand Down
6 changes: 3 additions & 3 deletions django-stubs/core/files/uploadedfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class InMemoryUploadedFile(UploadedFile):
charset: Optional[str],
content_type_extra: Dict[str, str] = ...,
) -> None: ...
def chunks(self, chunk_size: int = None) -> Iterator[bytes]: ...
def multiple_chunks(self, chunk_size: int = None) -> bool: ...
def chunks(self, chunk_size: Optional[int] = ...) -> Iterator[bytes]: ...
def multiple_chunks(self, chunk_size: Optional[int] = ...) -> bool: ...

class SimpleUploadedFile(InMemoryUploadedFile):
def __init__(self, name: str, content: bytes, content_type: str = "") -> None: ...
def __init__(self, name: str, content: Optional[Union[bytes, str]], content_type: str = ...) -> None: ...
@classmethod
def from_dict(cls: Any, file_dict: Dict[str, Union[str, bytes]]) -> None: ...
Loading

0 comments on commit 116aa2c

Please sign in to comment.