mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 08:17:08 +08:00
Adds django@4.0 support (#786)
* Adds django@4.0 support * Fixes CI * Fixes CI * Ignore new error for django4.0 * Fixes
This commit is contained in:
@@ -111,6 +111,7 @@ IGNORED_ERRORS = {
|
||||
"Unsupported dynamic base class",
|
||||
'error: "HttpResponse" has no attribute "streaming_content"',
|
||||
'error: "HttpResponse" has no attribute "context_data"',
|
||||
'Duplicate module named "apps"',
|
||||
],
|
||||
"admin_checks": ['Argument 1 to "append" of "list" has incompatible type "str"; expected "CheckMessage"'],
|
||||
"admin_default_site": [
|
||||
@@ -514,7 +515,7 @@ IGNORED_ERRORS = {
|
||||
|
||||
|
||||
def check_if_custom_ignores_are_covered_by_common() -> None:
|
||||
from scripts.typecheck_tests import is_pattern_fits
|
||||
from scripts.typecheck_tests import does_pattern_fit
|
||||
|
||||
common_ignore_patterns = IGNORED_ERRORS["__common__"]
|
||||
for module_name, patterns in IGNORED_ERRORS.items():
|
||||
@@ -522,7 +523,7 @@ def check_if_custom_ignores_are_covered_by_common() -> None:
|
||||
continue
|
||||
for pattern in patterns:
|
||||
for common_pattern in common_ignore_patterns:
|
||||
if isinstance(pattern, str) and is_pattern_fits(common_pattern, pattern):
|
||||
if isinstance(pattern, str) and does_pattern_fit(common_pattern, pattern):
|
||||
print(f'pattern "{module_name}: {pattern!r}" is covered by pattern {common_pattern!r}')
|
||||
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ from scripts.enabled_test_modules import EXTERNAL_MODULES, IGNORED_ERRORS, IGNOR
|
||||
from scripts.git_helpers import checkout_django_branch
|
||||
from scripts.paths import DJANGO_SOURCE_DIRECTORY, PROJECT_DIRECTORY
|
||||
|
||||
DJANGO_COMMIT_REFS: Dict[str, str] = {
|
||||
DJANGO_COMMIT_REFS = {
|
||||
"2.2": "8093aaa8ff9dd7386a069c6eb49fcc1c5980c033",
|
||||
"3.0": "44da7abda848f05caaed74f6a749038c87dedfda",
|
||||
"3.2": "0153a63a674937e4a56d9d5e4ca2d629b011fbde",
|
||||
"4.0": "67d0c4644acfd7707be4a31e8976f865509b09ac",
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +29,7 @@ def get_unused_ignores(ignored_message_freq: Dict[str, Dict[Union[str, Pattern],
|
||||
return unused_ignores
|
||||
|
||||
|
||||
def is_pattern_fits(pattern: Union[Pattern, str], line: str):
|
||||
def does_pattern_fit(pattern: Union[Pattern, str], line: str):
|
||||
if isinstance(pattern, Pattern):
|
||||
if pattern.search(line):
|
||||
return True
|
||||
@@ -46,12 +47,12 @@ def is_ignored(line: str, test_folder_name: str, *, ignored_message_freqs: Dict[
|
||||
return True
|
||||
|
||||
for pattern in IGNORED_ERRORS.get(test_folder_name, []):
|
||||
if is_pattern_fits(pattern, line):
|
||||
if does_pattern_fit(pattern, line):
|
||||
ignored_message_freqs[test_folder_name][pattern] += 1
|
||||
return True
|
||||
|
||||
for pattern in IGNORED_ERRORS["__common__"]:
|
||||
if is_pattern_fits(pattern, line):
|
||||
if does_pattern_fit(pattern, line):
|
||||
ignored_message_freqs["__common__"][pattern] += 1
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user