mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-07 04:34:29 +08:00
fix compatibility with 0.730 (#189)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
black
|
black
|
||||||
pytest-mypy-plugins==1.0.3
|
pytest-mypy-plugins==1.1.0
|
||||||
psycopg2
|
psycopg2
|
||||||
flake8==3.7.8
|
flake8==3.7.8
|
||||||
flake8-pyi==19.3.0
|
flake8-pyi==19.3.0
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ from django.forms.utils import ErrorDict, ErrorList
|
|||||||
from django.forms.widgets import Media, MediaDefiningClass
|
from django.forms.widgets import Media, MediaDefiningClass
|
||||||
from django.utils.safestring import SafeText
|
from django.utils.safestring import SafeText
|
||||||
|
|
||||||
class DeclarativeFieldsMetaclass(MediaDefiningClass):
|
class DeclarativeFieldsMetaclass(MediaDefiningClass): ...
|
||||||
def __new__(mcs, name: str, bases: Sequence[Type[BaseForm]], attrs: Dict[str, Any]) -> Type[BaseForm]: ...
|
|
||||||
|
|
||||||
class BaseForm:
|
class BaseForm:
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ class ModelFormOptions:
|
|||||||
field_classes: Optional[Dict[str, Type[Field]]] = ...
|
field_classes: Optional[Dict[str, Type[Field]]] = ...
|
||||||
def __init__(self, options: Optional[type] = ...) -> None: ...
|
def __init__(self, options: Optional[type] = ...) -> None: ...
|
||||||
|
|
||||||
class ModelFormMetaclass(DeclarativeFieldsMetaclass):
|
class ModelFormMetaclass(DeclarativeFieldsMetaclass): ...
|
||||||
def __new__(mcs, name: str, bases: Sequence[Type[Any]], attrs: Dict[str, Any]) -> Type[ModelForm]: ...
|
|
||||||
|
|
||||||
class BaseModelForm(BaseForm):
|
class BaseModelForm(BaseForm):
|
||||||
instance: Any = ...
|
instance: Any = ...
|
||||||
@@ -73,7 +72,6 @@ class BaseModelForm(BaseForm):
|
|||||||
use_required_attribute: Optional[bool] = ...,
|
use_required_attribute: Optional[bool] = ...,
|
||||||
renderer: Any = ...,
|
renderer: Any = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def clean(self) -> Dict[str, Any]: ...
|
|
||||||
def validate_unique(self) -> None: ...
|
def validate_unique(self) -> None: ...
|
||||||
save_m2m: Any = ...
|
save_m2m: Any = ...
|
||||||
def save(self, commit: bool = ...) -> Any: ...
|
def save(self, commit: bool = ...) -> Any: ...
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ class Media:
|
|||||||
def merge(list_1: Iterable[Any], list_2: Iterable[Any]) -> Iterable[Any]: ...
|
def merge(list_1: Iterable[Any], list_2: Iterable[Any]) -> Iterable[Any]: ...
|
||||||
def __add__(self, other: Media) -> Media: ...
|
def __add__(self, other: Media) -> Media: ...
|
||||||
|
|
||||||
class MediaDefiningClass(type):
|
class MediaDefiningClass(type): ...
|
||||||
def __new__(mcs, name: str, bases: Sequence[Any], attrs: Dict[str, Any]) -> type: ...
|
|
||||||
|
|
||||||
class Widget:
|
class Widget:
|
||||||
needs_multipart_form: bool = ...
|
needs_multipart_form: bool = ...
|
||||||
@@ -70,9 +69,7 @@ class HiddenInput(Input):
|
|||||||
choices: Iterable[Tuple[str, str]]
|
choices: Iterable[Tuple[str, str]]
|
||||||
|
|
||||||
class MultipleHiddenInput(HiddenInput): ...
|
class MultipleHiddenInput(HiddenInput): ...
|
||||||
|
class FileInput(Input): ...
|
||||||
class FileInput(Input):
|
|
||||||
needs_multipart_form: bool = ...
|
|
||||||
|
|
||||||
class ClearableFileInput(FileInput):
|
class ClearableFileInput(FileInput):
|
||||||
clear_checkbox_label: Any = ...
|
clear_checkbox_label: Any = ...
|
||||||
@@ -102,7 +99,7 @@ class ChoiceWidget(Widget):
|
|||||||
allow_multiple_selected: bool = ...
|
allow_multiple_selected: bool = ...
|
||||||
input_type: Optional[str] = ...
|
input_type: Optional[str] = ...
|
||||||
template_name: Optional[str] = ...
|
template_name: Optional[str] = ...
|
||||||
option_template_name: Any = ...
|
option_template_name: str = ...
|
||||||
add_id_index: bool = ...
|
add_id_index: bool = ...
|
||||||
checked_attribute: Any = ...
|
checked_attribute: Any = ...
|
||||||
option_inherits_attrs: bool = ...
|
option_inherits_attrs: bool = ...
|
||||||
@@ -130,10 +127,8 @@ class SelectMultiple(Select):
|
|||||||
|
|
||||||
class RadioSelect(ChoiceWidget):
|
class RadioSelect(ChoiceWidget):
|
||||||
can_add_related: bool
|
can_add_related: bool
|
||||||
option_template_name: str = ...
|
|
||||||
|
|
||||||
class CheckboxSelectMultiple(ChoiceWidget):
|
class CheckboxSelectMultiple(ChoiceWidget): ...
|
||||||
def id_for_label(self, id_: str, index: Optional[str] = ...) -> str: ...
|
|
||||||
|
|
||||||
class MultiWidget(Widget):
|
class MultiWidget(Widget):
|
||||||
template_name: str = ...
|
template_name: str = ...
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ IGNORED_ERRORS = {
|
|||||||
'SimpleLazyObject'
|
'SimpleLazyObject'
|
||||||
],
|
],
|
||||||
'aggregation': [
|
'aggregation': [
|
||||||
re.compile(r'got "Optional\[(Author|Publisher)\]", expected "Union\[(Author|Publisher), Combinable\]"')
|
re.compile(r'got "Optional\[(Author|Publisher)\]", expected "Union\[(Author|Publisher), Combinable\]"'),
|
||||||
|
'Argument 2 for "super" not an instance of argument 1',
|
||||||
],
|
],
|
||||||
'annotations': [
|
'annotations': [
|
||||||
'Incompatible type for "store" of "Employee" (got "Optional[Store]", expected "Union[Store, Combinable]")'
|
'Incompatible type for "store" of "Employee" (got "Optional[Store]", expected "Union[Store, Combinable]")'
|
||||||
@@ -151,7 +152,8 @@ IGNORED_ERRORS = {
|
|||||||
],
|
],
|
||||||
'file_uploads': [
|
'file_uploads': [
|
||||||
'"Iterable[Any]" has no attribute',
|
'"Iterable[Any]" has no attribute',
|
||||||
'"IO[Any]" has no attribute'
|
'"IO[Any]" has no attribute',
|
||||||
|
'has no attribute "content_type"',
|
||||||
],
|
],
|
||||||
'file_storage': [
|
'file_storage': [
|
||||||
'Incompatible types in assignment (expression has type "Callable"'
|
'Incompatible types in assignment (expression has type "Callable"'
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ if __name__ == '__main__':
|
|||||||
mypy_options = ['--cache-dir', str(mypy_config_file.parent / '.mypy_cache'),
|
mypy_options = ['--cache-dir', str(mypy_config_file.parent / '.mypy_cache'),
|
||||||
'--config-file', str(mypy_config_file),
|
'--config-file', str(mypy_config_file),
|
||||||
'--show-traceback',
|
'--show-traceback',
|
||||||
# '--no-error-summary',
|
'--no-error-summary',
|
||||||
# '--no-pretty',
|
|
||||||
'--hide-error-context'
|
'--hide-error-context'
|
||||||
]
|
]
|
||||||
mypy_options += [str(tests_root)]
|
mypy_options += [str(tests_root)]
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -21,7 +21,7 @@ with open('README.md', 'r') as f:
|
|||||||
readme = f.read()
|
readme = f.read()
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
'mypy>=0.720,<0.730',
|
'mypy>=0.730,<0.740',
|
||||||
'typing-extensions',
|
'typing-extensions',
|
||||||
'django',
|
'django',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# standard settings
|
# standard settings
|
||||||
reveal_type(settings.AUTH_USER_MODEL) # N: Revealed type is 'builtins.str'
|
reveal_type(settings.AUTH_USER_MODEL) # N: Revealed type is 'builtins.str'
|
||||||
reveal_type(settings.ROOT_DIR) # N: Revealed type is 'builtins.str'
|
reveal_type(settings.ROOT_DIR) # N: Revealed type is 'builtins.str'
|
||||||
reveal_type(settings.APPS_DIR) # N: Revealed type is 'pathlib.Path'
|
reveal_type(settings.APPS_DIR) # N: Revealed type is 'pathlib.Path*'
|
||||||
reveal_type(settings.NUMBERS) # N: Revealed type is 'builtins.list[builtins.str*]'
|
reveal_type(settings.NUMBERS) # N: Revealed type is 'builtins.list[builtins.str*]'
|
||||||
reveal_type(settings.DICT) # N: Revealed type is 'builtins.dict[Any, Any]'
|
reveal_type(settings.DICT) # N: Revealed type is 'builtins.dict[Any, Any]'
|
||||||
custom_settings: |
|
custom_settings: |
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
from settings.basic_settings import *
|
from settings.basic_settings import *
|
||||||
main: |
|
main: |
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
reveal_type(settings.MEDIA_ROOT) # N: Revealed type is 'pathlib.Path'
|
reveal_type(settings.MEDIA_ROOT) # N: Revealed type is 'pathlib.Path*'
|
||||||
reveal_type(settings.MEDIA_ROOT / 'part') # N: Revealed type is 'pathlib.Path*'
|
reveal_type(settings.MEDIA_ROOT / 'part') # N: Revealed type is 'pathlib.Path*'
|
||||||
files:
|
files:
|
||||||
- path: settings/__init__.py
|
- path: settings/__init__.py
|
||||||
|
|||||||
Reference in New Issue
Block a user