From 1868100bd9bbb775adffd38f6f02f2324a376f7c Mon Sep 17 00:00:00 2001 From: Maxim Kurnikov Date: Wed, 30 Jan 2019 16:12:19 +0300 Subject: [PATCH] enable more folders --- django-stubs/core/checks/__init__.pyi | 2 +- django-stubs/db/models/fields/__init__.pyi | 1 + django-stubs/db/models/fields/related.pyi | 3 +-- django-stubs/middleware/csrf.pyi | 2 ++ scripts/typecheck_tests.py | 21 ++++++++++++++++----- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/django-stubs/core/checks/__init__.pyi b/django-stubs/core/checks/__init__.pyi index c1ac36c..f3d5ba2 100644 --- a/django-stubs/core/checks/__init__.pyi +++ b/django-stubs/core/checks/__init__.pyi @@ -1,3 +1,3 @@ from .messages import Warning as Warning, Info as Info, Debug as Debug, Error as Error, Critical as Critical -from .registry import run_checks as run_checks +from .registry import run_checks as run_checks, Tags as Tags, register as register diff --git a/django-stubs/db/models/fields/__init__.pyi b/django-stubs/db/models/fields/__init__.pyi index 941e341..8c4ab91 100644 --- a/django-stubs/db/models/fields/__init__.pyi +++ b/django-stubs/db/models/fields/__init__.pyi @@ -14,6 +14,7 @@ _ErrorMessagesToOverride = Dict[str, Any] class Field(RegisterLookupMixin): widget: Widget help_text: str + db_table: str def __init__( self, verbose_name: Optional[str] = ..., diff --git a/django-stubs/db/models/fields/related.pyi b/django-stubs/db/models/fields/related.pyi index f656648..5cf5efa 100644 --- a/django-stubs/db/models/fields/related.pyi +++ b/django-stubs/db/models/fields/related.pyi @@ -52,7 +52,6 @@ class ManyToManyField(RelatedField, Generic[_T]): rel_class: Any = ... description: Any = ... has_null_arg: Any = ... - db_table: Any = ... swappable: Any = ... def __init__( self, @@ -64,7 +63,7 @@ class ManyToManyField(RelatedField, Generic[_T]): through: Optional[Union[str, Type[Model]]] = ..., through_fields: Optional[Tuple[str, str]] = ..., db_constraint: bool = ..., - db_table: None = ..., + db_table: Optional[str] = ..., swappable: bool = ..., **kwargs: Any ) -> None: ... diff --git a/django-stubs/middleware/csrf.pyi b/django-stubs/middleware/csrf.pyi index c2d55ad..eb13f65 100644 --- a/django-stubs/middleware/csrf.pyi +++ b/django-stubs/middleware/csrf.pyi @@ -25,3 +25,5 @@ class CsrfViewMiddleware(MiddlewareMixin): self, request: HttpRequest, callback: Callable, callback_args: Tuple, callback_kwargs: Dict[str, Any] ) -> Optional[HttpResponseForbidden]: ... def process_response(self, request: HttpRequest, response: HttpResponseBase) -> HttpResponseBase: ... + +def _compare_salted_tokens(request_csrf_token: str, csrf_token: str) -> bool: ... diff --git a/scripts/typecheck_tests.py b/scripts/typecheck_tests.py index c139365..6c98eae 100644 --- a/scripts/typecheck_tests.py +++ b/scripts/typecheck_tests.py @@ -40,12 +40,14 @@ IGNORED_ERROR_PATTERNS = [ 'Incompatible types in assignment (expression has type "RelatedFieldWidgetWrapper", variable has type "AdminRadioSelect")', 'has incompatible type "MockRequest"; expected "WSGIRequest"', '"NullTranslations" has no attribute "_catalog"', + 'Definition of "as_sql" in base class', + 'expression has type "property"', re.compile(r'"Callable\[\[(Any(, )?)+\], Any\]" has no attribute'), re.compile(r'"HttpResponseBase" has no attribute "[A-Za-z_]+"'), re.compile(r'Incompatible types in assignment \(expression has type "Tuple\[\]", ' r'variable has type "Tuple\[[A-Za-z, ]+\]"'), re.compile(r'"validate" of "[A-Za-z]+" does not return a value'), - re.compile(r'Module has no attribute "[A-Za-z]+"'), + re.compile(r'Module has no attribute "[A-Za-z_]+"'), re.compile(r'"[A-Za-z\[\]]+" has no attribute "getvalue"'), # TODO: remove when reassignment will be possible (in 0.670? ) re.compile(r'Incompatible types in assignment \(expression has type "(QuerySet|List){1}\[[A-Za-z, ]+\]", ' @@ -62,25 +64,34 @@ TESTS_DIRS = [ 'admin_custom_urls', 'admin_default_site', 'admin_docs', - # TODO: 'admin_filters', + # # TODO: 'admin_filters', 'admin_inlines', 'admin_ordering', 'admin_registration', 'admin_scripts', - # TODO: 'admin_utils', - # TODO: 'admin_views', + # # TODO: 'admin_utils', + # # TODO: 'admin_views', 'admin_widgets', 'aggregation', 'aggregation_regress', 'annotations', 'app_loading', 'apps', - # TODO: auth_tests + # # TODO: auth_tests 'base', 'bash_completion', 'basic', 'builtin_server', 'bulk_create', + # TODO: 'cache', + # TODO: 'check_framework', + 'choices', + 'conditional_processing', + # TODO: 'contenttypes_tests', + 'context_processors', + 'csrf_tests', + 'custom_columns', + # TODO: 'custom_lookups', ]