Skip to content

Refactors bad default values, now using Ellipsis #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions django-stubs/contrib/postgres/search.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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: ...
Expand Down
30 changes: 20 additions & 10 deletions django-stubs/core/files/uploadhandler.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,39 @@ 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,
field_name: str,
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,
field_name: str,
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]: ...
Expand All @@ -59,16 +64,21 @@ 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,
field_name: str,
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]: ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/db/models/query.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/db/transaction.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
2 changes: 1 addition & 1 deletion django-stubs/http/response.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/utils/datastructures.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]]]: ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/views/generic/edit.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
12 changes: 6 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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]
Expand Down