This commit is contained in:
Maxim Kurnikov
2019-02-11 01:12:59 +03:00
parent 643f852775
commit faefdcca5b
4 changed files with 10 additions and 4 deletions

View File

@@ -81,7 +81,7 @@ class BaseModelAdmin:
def get_sortable_by(self, request: WSGIRequest) -> Union[List[Callable], List[str], Tuple]: ...
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
def to_field_allowed(self, request: WSGIRequest, to_field: str) -> bool: ...
def has_add_permission(self, request: WSGIRequest) -> bool: ...
def has_add_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
def has_change_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
def has_delete_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...
def has_view_permission(self, request: WSGIRequest, obj: Optional[Model] = ...) -> bool: ...

View File

@@ -3,6 +3,8 @@ from datetime import date, time, datetime, timedelta
from typing import Any, Optional, Tuple, Iterable, Callable, Dict, Union, Type, TypeVar
import decimal
from typing_extensions import Literal
from django.db.models import Model
from django.db.models.query_utils import RegisterLookupMixin
@@ -62,7 +64,7 @@ class Field(RegisterLookupMixin):
def to_python(self, value: Any) -> Any: ...
class IntegerField(Field):
def __set__(self, instance, value: Union[int, Combinable]) -> None: ...
def __set__(self, instance, value: Union[int, Combinable, Literal['']]) -> None: ...
def __get__(self, instance, owner) -> int: ...
class PositiveIntegerRelDbTypeMixin:

View File

@@ -124,4 +124,4 @@ class Client:
def force_login(self, user: User, backend: Optional[str] = ...) -> None: ...
def logout(self) -> None: ...
def conditional_content_removal(request: HttpRequest, response: HttpResponse) -> HttpResponse: ...
def conditional_content_removal(request: HttpRequest, response: HttpResponseBase) -> HttpResponse: ...

View File

@@ -181,6 +181,9 @@ IGNORED_ERRORS = {
],
'modeladmin': [
'BandAdmin',
'base class "ModelAdmin" defined the type a',
'base class "InlineModelAdmin" defined the type a',
'List item 0 has incompatible type "Type[ValidationTestInline]"; expected "Type[BaseModelAdmin]"'
],
'migrate_signals': [
'Value of type "None" is not indexable',
@@ -237,6 +240,7 @@ IGNORED_ERRORS = {
],
'test_client': [
'Incompatible types in assignment (expression has type "StreamingHttpResponse", variable has type "HttpResponse")',
'Incompatible types in assignment (expression has type "HttpResponse", variable has type "StreamingHttpResponse")'
],
'test_client_regress': [
'Incompatible types in assignment (expression has type "Dict[<nothing>, <nothing>]", variable has type "SessionBase")'
@@ -541,7 +545,7 @@ def is_ignored(line: str, test_folder_name: str) -> bool:
def replace_with_clickable_location(error: str, abs_test_folder: Path) -> str:
raw_path, _, error_line = error.partition(': ')
fname, _,line_number = raw_path.partition(':')
fname, _, line_number = raw_path.partition(':')
try:
path = abs_test_folder.joinpath(fname).relative_to(PROJECT_DIRECTORY)