mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-06 20:24:31 +08:00
Refactors bad default values, now using Ellipsis (#132)
* Refactors bad default values, now using Ellipsis * Blacked
This commit is contained in:
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
||||
# Check http://editorconfig.org for more information
|
||||
# This is the main config file for this project:
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.py]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
@@ -13,7 +13,7 @@ class SearchVectorCombinable:
|
||||
ADD: str = ...
|
||||
|
||||
class SearchVector(SearchVectorCombinable, Func):
|
||||
config: Optional[Any] = None
|
||||
config: Optional[Any] = ...
|
||||
def __init__(self, *expressions: Union[str, Combinable], **extra: Any): ...
|
||||
|
||||
class CombinedSearchVector(SearchVectorCombinable, CombinedExpression):
|
||||
@@ -31,11 +31,11 @@ class SearchQueryCombinable:
|
||||
|
||||
class SearchQuery(SearchQueryCombinable, Value):
|
||||
SEARCH_TYPES: Dict[str, str] = {"plain": "plainto_tsquery", "phrase": "phraseto_tsquery", "raw": "to_tsquery"}
|
||||
def __init__(self, value, output_field=None, *, config=None, invert=False, search_type="plain"): ...
|
||||
def __init__(self, value, output_field=..., *, config=..., invert=False, search_type="plain"): ...
|
||||
def __invert__(self: _T) -> _T: ...
|
||||
|
||||
class CombinedSearchQuery(SearchQueryCombinable, CombinedExpression):
|
||||
def __init__(self, lhs, connector, rhs, config, output_field=None) -> None: ...
|
||||
def __init__(self, lhs, connector, rhs, config, output_field=...) -> None: ...
|
||||
|
||||
class SearchRank(Func):
|
||||
def __init__(self, vector, query, **extra: Any) -> None: ...
|
||||
|
||||
@@ -23,9 +23,14 @@ class FileUploadHandler:
|
||||
content_type_extra = ... # type: Optional[Dict[str, str]]
|
||||
request = ... # type: Optional[HttpRequest]
|
||||
field_name = ... # type: str
|
||||
def __init__(self, request: HttpRequest = None) -> None: ...
|
||||
def __init__(self, request: Optional[HttpRequest] = ...) -> None: ...
|
||||
def handle_raw_input(
|
||||
self, input_data: IO[bytes], META: Dict[str, str], content_length: int, boundary: str, encoding: str = None
|
||||
self,
|
||||
input_data: IO[bytes],
|
||||
META: Dict[str, str],
|
||||
content_length: int,
|
||||
boundary: str,
|
||||
encoding: Optional[str] = ...,
|
||||
) -> Optional[Tuple[QueryDict, MultiValueDict[str, UploadedFile]]]: ...
|
||||
def new_file(
|
||||
self,
|
||||
@@ -33,15 +38,15 @@ class FileUploadHandler:
|
||||
file_name: str,
|
||||
content_type: str,
|
||||
content_length: Optional[int],
|
||||
charset: str = None,
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
charset: Optional[str] = ...,
|
||||
content_type_extra: Optional[Dict[str, str]] = ...,
|
||||
) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> Optional[bytes]: ...
|
||||
def file_complete(self, file_size: int) -> Optional[UploadedFile]: ...
|
||||
def upload_complete(self) -> None: ...
|
||||
|
||||
class TemporaryFileUploadHandler(FileUploadHandler):
|
||||
def __init__(self, request: HttpRequest = None) -> None: ...
|
||||
def __init__(self, request: Optional[HttpRequest] = ...) -> None: ...
|
||||
file = ... # type: TemporaryUploadedFile
|
||||
def new_file(
|
||||
self,
|
||||
@@ -49,8 +54,8 @@ class TemporaryFileUploadHandler(FileUploadHandler):
|
||||
file_name: str,
|
||||
content_type: str,
|
||||
content_length: Optional[int],
|
||||
charset: str = None,
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
charset: Optional[str] = ...,
|
||||
content_type_extra: Optional[Dict[str, str]] = ...,
|
||||
) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> Optional[bytes]: ...
|
||||
def file_complete(self, file_size: int) -> Optional[UploadedFile]: ...
|
||||
@@ -59,7 +64,12 @@ class MemoryFileUploadHandler(FileUploadHandler):
|
||||
activated = ... # type: bool
|
||||
file = ... # type: IO[bytes]
|
||||
def handle_raw_input(
|
||||
self, input_data: IO[bytes], META: Dict[str, str], content_length: int, boundary: str, encoding: str = None
|
||||
self,
|
||||
input_data: IO[bytes],
|
||||
META: Dict[str, str],
|
||||
content_length: int,
|
||||
boundary: str,
|
||||
encoding: Optional[str] = ...,
|
||||
) -> Optional[Tuple[QueryDict, MultiValueDict[str, UploadedFile]]]: ...
|
||||
def new_file(
|
||||
self,
|
||||
@@ -67,8 +77,8 @@ class MemoryFileUploadHandler(FileUploadHandler):
|
||||
file_name: str,
|
||||
content_type: str,
|
||||
content_length: Optional[int],
|
||||
charset: str = None,
|
||||
content_type_extra: Dict[str, str] = None,
|
||||
charset: Optional[str] = ...,
|
||||
content_type_extra: Optional[Dict[str, str]] = ...,
|
||||
) -> None: ...
|
||||
def receive_data_chunk(self, raw_data: bytes, start: int) -> Optional[bytes]: ...
|
||||
def file_complete(self, file_size: int) -> Optional[UploadedFile]: ...
|
||||
|
||||
@@ -184,7 +184,7 @@ class RawQuerySet(Iterable[_T], Sized):
|
||||
def using(self, alias: Optional[str]) -> RawQuerySet[_T]: ...
|
||||
|
||||
class Prefetch(object):
|
||||
def __init__(self, lookup: str, queryset: Optional[QuerySet] = None, to_attr: Optional[str] = None) -> None: ...
|
||||
def __init__(self, lookup: str, queryset: Optional[QuerySet] = ..., to_attr: Optional[str] = ...) -> None: ...
|
||||
def __getstate__(self) -> Dict[str, Any]: ...
|
||||
def add_prefix(self, prefix: str) -> None: ...
|
||||
def get_current_prefetch_to(self, level: int) -> str: ...
|
||||
|
||||
@@ -38,5 +38,5 @@ def atomic(using: _C) -> _C: ...
|
||||
|
||||
# Decorator or context-manager with parameters
|
||||
@overload
|
||||
def atomic(using: Optional[str] = None, savepoint: bool = True) -> Atomic: ...
|
||||
def atomic(using: Optional[str] = ..., savepoint: bool = True) -> Atomic: ...
|
||||
def non_atomic_requests(using: Callable = ...) -> Callable: ...
|
||||
|
||||
@@ -49,7 +49,7 @@ class HttpResponseBase(Iterable[Any]):
|
||||
) -> None: ...
|
||||
def setdefault(self, key: str, value: str) -> None: ...
|
||||
def set_signed_cookie(self, key: str, value: str, salt: str = "", **kwargs: Any) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str = "", domain: str = None) -> None: ...
|
||||
def delete_cookie(self, key: str, path: str = "", domain: Optional[str] = ...) -> None: ...
|
||||
def make_bytes(self, value: object) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
def write(self, content: Union[str, bytes]) -> None: ...
|
||||
|
||||
@@ -39,7 +39,7 @@ class MultiValueDict(MutableMapping[_K, _V]):
|
||||
def __init__(self, key_to_list_mapping: Iterable[Tuple[_K, List[_V]]] = ...) -> None: ...
|
||||
def getlist(self, key: _K, default: Any = ...) -> List[_V]: ...
|
||||
def setlist(self, key: _K, list_: List[_V]) -> None: ...
|
||||
def setlistdefault(self, key: _K, default_list: List[_V] = None) -> List[_V]: ...
|
||||
def setlistdefault(self, key: _K, default_list: Optional[List[_V]] = ...) -> List[_V]: ...
|
||||
def appendlist(self, key: _K, value: _V) -> None: ...
|
||||
def lists(self) -> Iterable[Tuple[_K, List[_V]]]: ...
|
||||
def dict(self) -> Dict[_K, Union[_V, List[_V]]]: ...
|
||||
|
||||
@@ -17,7 +17,7 @@ class FormMixin(ContextMixin):
|
||||
def get_initial(self) -> Dict[str, Any]: ...
|
||||
def get_prefix(self) -> Optional[str]: ...
|
||||
def get_form_class(self) -> Type[BaseForm]: ...
|
||||
def get_form(self, form_class: Optional[Type[BaseForm]] = None) -> BaseForm: ...
|
||||
def get_form(self, form_class: Optional[Type[BaseForm]] = ...) -> BaseForm: ...
|
||||
def get_form_kwargs(self) -> Dict[str, Any]: ...
|
||||
def get_success_url(self) -> str: ...
|
||||
def form_valid(self, form: BaseForm) -> HttpResponse: ...
|
||||
|
||||
12
setup.cfg
12
setup.cfg
@@ -1,17 +1,17 @@
|
||||
[isort]
|
||||
skip =
|
||||
django-sources,
|
||||
django-stubs,
|
||||
test-data
|
||||
django-sources
|
||||
django-stubs
|
||||
test-data
|
||||
include_trailing_comma = true
|
||||
multi_line_output = 5
|
||||
wrap_length = 120
|
||||
|
||||
[flake8]
|
||||
exclude =
|
||||
django-sources,
|
||||
django-stubs,
|
||||
test-data
|
||||
django-sources
|
||||
django-stubs
|
||||
test-data
|
||||
max_line_length = 120
|
||||
|
||||
[metadata]
|
||||
|
||||
Reference in New Issue
Block a user