Skip to content

Disable mypy ignore_missing_imports option #2058

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 6 commits into from
Apr 18, 2024
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
2 changes: 1 addition & 1 deletion django-stubs/contrib/postgres/fields/ranges.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from typing import Any, ClassVar, Literal

from django.db import models
from django.db.models.lookups import PostgresOperatorLookup
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange, Range
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange, Range # type: ignore [import-untyped]

class RangeBoundary(models.Expression):
lower: str
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/contrib/postgres/forms/ranges.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from typing import Any
from django import forms
from django.db.models.fields import _ErrorMessagesDict
from django.forms.widgets import MultiWidget, _OptAttrs
from psycopg2.extras import Range
from psycopg2.extras import Range # type: ignore [import-untyped]

class RangeWidget(MultiWidget):
def __init__(self, base_widget: forms.Widget | type[forms.Widget], attrs: _OptAttrs | None = ...) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/core/paginator.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections.abc import Iterable, Iterator, Sequence, Sized
from typing import ClassVar, Generic, Protocol, TypeVar, overload, type_check_only

from django.db.fields import _ErrorMessagesDict
from django.db.models.fields import _ErrorMessagesDict
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, looks like this already found some bugs.

from django.utils.functional import _StrPromise, cached_property

class UnorderedObjectListWarning(RuntimeWarning): ...
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/core/serializers/xml_serializer.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import IO, Any
from xml.sax.expatreader import ExpatParser as _ExpatParser
from xml.sax.expatreader import ExpatParser as _ExpatParser # type: ignore[import-not-found]

from django.core.serializers import base

Expand Down
2 changes: 1 addition & 1 deletion django-stubs/db/models/lookups.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from collections.abc import Iterable, Mapping
from typing import Any, Generic, Literal, TypeVar

from db.models import BooleanField
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models.expressions import Expression, Func
from django.db.models.fields import BooleanField
from django.db.models.query_utils import RegisterLookupMixin
from django.db.models.sql.compiler import SQLCompiler, _AsSqlType, _ParamT
from django.utils.datastructures import OrderedSet
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/db/models/sql/where.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from collections.abc import Sequence
from typing import Any

from db.models import BooleanField
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models.expressions import Expression
from django.db.models.fields import BooleanField
from django.db.models.sql.compiler import SQLCompiler, _AsSqlType
from django.db.models.sql.query import Query
from django.utils import tree
Expand Down
2 changes: 1 addition & 1 deletion django-stubs/utils/timezone.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from datetime import date, datetime, time, timedelta, timezone, tzinfo
from types import TracebackType
from typing import Literal, overload

import zoneinfo
import zoneinfo # type: ignore[import-not-found,unused-ignore]

def get_fixed_timezone(offset: timedelta | int) -> timezone: ...
def get_default_timezone() -> zoneinfo.ZoneInfo: ...
Expand Down
4 changes: 1 addition & 3 deletions ext/setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python
from distutils.core import setup

from setuptools import find_packages
from setuptools import find_packages, setup # type: ignore[import-untyped]

with open("README.md") as f:
readme = f.read()
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[mypy]
allow_redefinition = true
check_untyped_defs = true
ignore_missing_imports = true
ignore_missing_imports = false
incremental = true
strict_optional = true
show_traceback = true
Expand Down
4 changes: 4 additions & 0 deletions scripts/stubtest/allowlist_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ django.contrib.gis.db.models.JSONField.formfield
django.contrib.gis.db.models.JSONField.get_transform
django.contrib.gis.db.models.Lookup.get_prep_lhs
django.contrib.gis.db.models.Lookup.lookup_name
django.contrib.gis.db.models.Lookup.output_field
django.contrib.gis.db.models.Lookup.relabeled_clone
django.contrib.gis.db.models.Lookup.resolve_expression
django.contrib.gis.db.models.Lookup.select_format
Expand Down Expand Up @@ -884,6 +885,7 @@ django.db.models.JSONField.formfield
django.db.models.JSONField.get_transform
django.db.models.Lookup.get_prep_lhs
django.db.models.Lookup.lookup_name
django.db.models.Lookup.output_field
django.db.models.Lookup.relabeled_clone
django.db.models.Lookup.resolve_expression
django.db.models.Lookup.select_format
Expand Down Expand Up @@ -1221,6 +1223,7 @@ django.db.models.lookups.FieldGetDbPrepValueIterableMixin.process_rhs
django.db.models.lookups.IExact.process_rhs
django.db.models.lookups.Lookup.get_prep_lhs
django.db.models.lookups.Lookup.lookup_name
django.db.models.lookups.Lookup.output_field
django.db.models.lookups.Lookup.relabeled_clone
django.db.models.lookups.Lookup.resolve_expression
django.db.models.lookups.Lookup.select_format
Expand Down Expand Up @@ -1398,6 +1401,7 @@ django.db.models.sql.where.WhereNode.get_lookup
django.db.models.sql.where.WhereNode.get_refs
django.db.models.sql.where.WhereNode.get_source_expressions
django.db.models.sql.where.WhereNode.leaves
django.db.models.sql.where.WhereNode.output_field
django.db.models.sql.where.WhereNode.replace_expressions
django.db.models.sql.where.WhereNode.select_format
django.db.models.sql.where.WhereNode.set_source_expressions
Expand Down
2 changes: 1 addition & 1 deletion tests/typecheck/db/test_connection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- case: raw_connection_psycopg2_composable
main: |
from django.db import connection
from psycopg2.sql import SQL, Identifier
from psycopg2.sql import SQL, Identifier # type: ignore [import-untyped]
with connection.cursor() as cursor:
cursor.execute(SQL("INSERT INTO {} VALUES (%s)").format(Identifier("my_table")), [123])

Expand Down
2 changes: 2 additions & 0 deletions tests/typecheck/test_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@
content: |
def extra_fn() -> None:
pass
env:
- MYPYPATH=./extras
Loading
Loading