diff --git a/django-stubs/contrib/auth/context_processors.pyi b/django-stubs/contrib/auth/context_processors.pyi index 51a063ca3..623e121cc 100644 --- a/django-stubs/contrib/auth/context_processors.pyi +++ b/django-stubs/contrib/auth/context_processors.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict +from typing import Any, Dict, Iterator from django.http.request import HttpRequest @@ -7,14 +7,14 @@ class PermLookupDict: user: Any def __init__(self, user: Any, app_label: str) -> None: ... def __getitem__(self, perm_name: str) -> bool: ... - def __iter__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... def __bool__(self) -> bool: ... class PermWrapper: user: Any = ... def __init__(self, user: Any) -> None: ... def __getitem__(self, app_label: str) -> PermLookupDict: ... - def __iter__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... def __contains__(self, perm_name: Any) -> bool: ... def auth(request: HttpRequest) -> Dict[str, Any]: ... diff --git a/django-stubs/contrib/gis/db/backends/base/adapter.pyi b/django-stubs/contrib/gis/db/backends/base/adapter.pyi index fbc212761..fd5ed0b3a 100644 --- a/django-stubs/contrib/gis/db/backends/base/adapter.pyi +++ b/django-stubs/contrib/gis/db/backends/base/adapter.pyi @@ -4,5 +4,5 @@ class WKTAdapter: wkt: Any = ... srid: Any = ... def __init__(self, geom: Any) -> None: ... - def __eq__(self, other: Any) -> Any: ... - def __hash__(self) -> Any: ... + def __eq__(self, other: Any) -> bool: ... + def __hash__(self) -> int: ... diff --git a/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi b/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi index df6bdc99d..3f7bcdc4c 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/adapter.pyi @@ -7,7 +7,7 @@ class PostGISAdapter: geography: Any = ... def __init__(self, obj: Any, geography: bool = ...) -> None: ... def __conform__(self, proto: Any) -> Any: ... - def __eq__(self, other: Any) -> Any: ... - def __hash__(self) -> Any: ... + def __eq__(self, other: Any) -> bool: ... + def __hash__(self) -> int: ... def prepare(self, conn: Any) -> None: ... def getquoted(self) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/datasource.pyi b/django-stubs/contrib/gis/gdal/datasource.pyi index fdc52dca9..1ed79da79 100644 --- a/django-stubs/contrib/gis/gdal/datasource.pyi +++ b/django-stubs/contrib/gis/gdal/datasource.pyi @@ -9,7 +9,7 @@ class DataSource(GDALBase): driver: Any = ... def __init__(self, ds_input: Any, ds_driver: bool = ..., write: bool = ..., encoding: str = ...) -> None: ... def __getitem__(self, index: Any) -> Any: ... - def __len__(self) -> Any: ... + def __len__(self) -> int: ... @property def layer_count(self) -> Any: ... @property diff --git a/django-stubs/contrib/gis/gdal/envelope.pyi b/django-stubs/contrib/gis/gdal/envelope.pyi index 965d511fc..5f2c1c630 100644 --- a/django-stubs/contrib/gis/gdal/envelope.pyi +++ b/django-stubs/contrib/gis/gdal/envelope.pyi @@ -5,7 +5,7 @@ class OGREnvelope(Structure): ... class Envelope: def __init__(self, *args: Any) -> None: ... - def __eq__(self, other: Any) -> Any: ... + def __eq__(self, other: Any) -> bool: ... def expand_to_include(self, *args: Any) -> Any: ... @property def min_x(self) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/feature.pyi b/django-stubs/contrib/gis/gdal/feature.pyi index 5d912fa66..7a4f512d1 100644 --- a/django-stubs/contrib/gis/gdal/feature.pyi +++ b/django-stubs/contrib/gis/gdal/feature.pyi @@ -7,8 +7,8 @@ class Feature(GDALBase): ptr: Any = ... def __init__(self, feat: Any, layer: Any) -> None: ... def __getitem__(self, index: Any) -> Any: ... - def __len__(self) -> Any: ... - def __eq__(self, other: Any) -> Any: ... + def __len__(self) -> int: ... + def __eq__(self, other: Any) -> bool: ... @property def encoding(self) -> Any: ... @property diff --git a/django-stubs/contrib/gis/gdal/field.pyi b/django-stubs/contrib/gis/gdal/field.pyi index 28a00b92a..cf1ba52fd 100644 --- a/django-stubs/contrib/gis/gdal/field.pyi +++ b/django-stubs/contrib/gis/gdal/field.pyi @@ -4,7 +4,6 @@ from django.contrib.gis.gdal.base import GDALBase as GDALBase class Field(GDALBase): ptr: Any = ... - __class__: Any = ... def __init__(self, feat: Any, index: Any) -> None: ... def as_double(self) -> Any: ... def as_int(self, is_64: bool = ...) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/geometries.pyi b/django-stubs/contrib/gis/gdal/geometries.pyi index 979d81062..66fe9d2ac 100644 --- a/django-stubs/contrib/gis/gdal/geometries.pyi +++ b/django-stubs/contrib/gis/gdal/geometries.pyi @@ -6,7 +6,6 @@ class OGRGeometry(GDALBase): destructor: Any = ... ptr: Any = ... srs: Any = ... - __class__: Any = ... def __init__(self, geom_input: Any, srs: Optional[Any] = ...) -> None: ... @classmethod def from_bbox(cls, bbox: Any) -> Any: ... @@ -18,7 +17,7 @@ class OGRGeometry(GDALBase): def __and__(self, other: Any) -> Any: ... def __sub__(self, other: Any) -> Any: ... def __xor__(self, other: Any) -> Any: ... - def __eq__(self, other: Any) -> Any: ... + def __eq__(self, other: Any) -> bool: ... @property def dimension(self) -> Any: ... coord_dim: Any = ... @@ -95,7 +94,7 @@ class Point(OGRGeometry): class LineString(OGRGeometry): def __getitem__(self, index: Any) -> Any: ... - def __len__(self) -> Any: ... + def __len__(self) -> int: ... @property def tuple(self) -> Any: ... coords: Any = ... @@ -109,7 +108,7 @@ class LineString(OGRGeometry): class LinearRing(LineString): ... class Polygon(OGRGeometry): - def __len__(self) -> Any: ... + def __len__(self) -> int: ... def __getitem__(self, index: Any) -> Any: ... @property def shell(self) -> Any: ... @@ -124,7 +123,7 @@ class Polygon(OGRGeometry): class GeometryCollection(OGRGeometry): def __getitem__(self, index: Any) -> Any: ... - def __len__(self) -> Any: ... + def __len__(self) -> int: ... def add(self, geom: Any) -> None: ... @property def point_count(self) -> Any: ... diff --git a/django-stubs/contrib/gis/gdal/geomtype.pyi b/django-stubs/contrib/gis/gdal/geomtype.pyi index 2c0797940..04ee0f0a0 100644 --- a/django-stubs/contrib/gis/gdal/geomtype.pyi +++ b/django-stubs/contrib/gis/gdal/geomtype.pyi @@ -4,7 +4,7 @@ class OGRGeomType: wkb25bit: int = ... num: Any = ... def __init__(self, type_input: Any) -> None: ... - def __eq__(self, other: Any) -> Any: ... + def __eq__(self, other: Any) -> bool: ... @property def name(self) -> Any: ... @property diff --git a/django-stubs/contrib/gis/gdal/layer.pyi b/django-stubs/contrib/gis/gdal/layer.pyi index d1a7cc1df..5671d9e72 100644 --- a/django-stubs/contrib/gis/gdal/layer.pyi +++ b/django-stubs/contrib/gis/gdal/layer.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, Iterator from django.contrib.gis.gdal.base import GDALBase as GDALBase @@ -6,8 +6,8 @@ class Layer(GDALBase): ptr: Any = ... def __init__(self, layer_ptr: Any, ds: Any) -> None: ... def __getitem__(self, index: Any) -> Any: ... - def __iter__(self) -> Any: ... - def __len__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... @property def extent(self) -> Any: ... @property diff --git a/django-stubs/contrib/gis/gdal/raster/band.pyi b/django-stubs/contrib/gis/gdal/raster/band.pyi index 9d1a8f491..ec9e471ff 100644 --- a/django-stubs/contrib/gis/gdal/raster/band.pyi +++ b/django-stubs/contrib/gis/gdal/raster/band.pyi @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any, Iterator, Optional from django.contrib.gis.gdal.raster.base import GDALRasterBase as GDALRasterBase @@ -40,6 +40,6 @@ class GDALBand(GDALRasterBase): class BandList(list): source: Any = ... def __init__(self, source: Any) -> None: ... - def __iter__(self) -> Any: ... - def __len__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... def __getitem__(self, index: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/collections.pyi b/django-stubs/contrib/gis/geos/collections.pyi index 578a23cfd..f1f3b18a1 100644 --- a/django-stubs/contrib/gis/geos/collections.pyi +++ b/django-stubs/contrib/gis/geos/collections.pyi @@ -1,12 +1,12 @@ -from typing import Any +from typing import Any, Iterator from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry from django.contrib.gis.geos.geometry import LinearGeometryMixin as LinearGeometryMixin class GeometryCollection(GEOSGeometry): def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __iter__(self) -> Any: ... - def __len__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... @property def kml(self) -> Any: ... @property diff --git a/django-stubs/contrib/gis/geos/coordseq.pyi b/django-stubs/contrib/gis/geos/coordseq.pyi index b44d0e61e..0a63ce4f5 100644 --- a/django-stubs/contrib/gis/geos/coordseq.pyi +++ b/django-stubs/contrib/gis/geos/coordseq.pyi @@ -1,12 +1,12 @@ -from typing import Any +from typing import Any, Iterator from django.contrib.gis.geos.base import GEOSBase as GEOSBase class GEOSCoordSeq(GEOSBase): ptr_type: Any = ... def __init__(self, ptr: Any, z: bool = ...) -> None: ... - def __iter__(self) -> Any: ... - def __len__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... def __getitem__(self, index: Any) -> Any: ... def __setitem__(self, index: Any, value: Any) -> None: ... def getOrdinate(self, dimension: Any, index: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/geometry.pyi b/django-stubs/contrib/gis/geos/geometry.pyi index 3640c4ad5..05d2d3a9a 100644 --- a/django-stubs/contrib/gis/geos/geometry.pyi +++ b/django-stubs/contrib/gis/geos/geometry.pyi @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any, Optional, TypeVar from django.contrib.gis.geometry import hex_regex as hex_regex # noqa: F401 from django.contrib.gis.geometry import json_regex as json_regex @@ -6,20 +6,21 @@ from django.contrib.gis.geometry import wkt_regex as wkt_regex from django.contrib.gis.geos.base import GEOSBase as GEOSBase from django.contrib.gis.geos.mutable_list import ListMixin as ListMixin +_T = TypeVar("_T") + class GEOSGeometryBase(GEOSBase): ptr_type: Any = ... destructor: Any = ... has_cs: bool = ... - __class__: Any = ... def __init__(self, ptr: Any, cls: Any) -> None: ... - def __copy__(self) -> Any: ... - def __deepcopy__(self, memodict: Any) -> Any: ... + def __copy__(self: _T) -> _T: ... + def __deepcopy__(self: _T, memodict: Any) -> _T: ... @staticmethod def from_ewkt(ewkt: Any) -> Any: ... @classmethod def from_gml(cls, gml_string: Any) -> Any: ... - def __eq__(self, other: Any) -> Any: ... - def __hash__(self) -> Any: ... + def __eq__(self, other: Any) -> bool: ... + def __hash__(self) -> int: ... def __or__(self, other: Any) -> Any: ... def __and__(self, other: Any) -> Any: ... def __sub__(self, other: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/linestring.pyi b/django-stubs/contrib/gis/geos/linestring.pyi index 68700c8ae..ab3ffb2c2 100644 --- a/django-stubs/contrib/gis/geos/linestring.pyi +++ b/django-stubs/contrib/gis/geos/linestring.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, Iterator from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry from django.contrib.gis.geos.geometry import LinearGeometryMixin as LinearGeometryMixin @@ -6,8 +6,8 @@ from django.contrib.gis.geos.geometry import LinearGeometryMixin as LinearGeomet class LineString(LinearGeometryMixin, GEOSGeometry): has_cs: bool = ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __iter__(self) -> Any: ... - def __len__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... @property def tuple(self) -> Any: ... coords: Any = ... diff --git a/django-stubs/contrib/gis/geos/mutable_list.pyi b/django-stubs/contrib/gis/geos/mutable_list.pyi index f5c3ed88d..dbb8b9a82 100644 --- a/django-stubs/contrib/gis/geos/mutable_list.pyi +++ b/django-stubs/contrib/gis/geos/mutable_list.pyi @@ -11,7 +11,7 @@ class ListMixin: def __mul__(self, n: Any) -> Any: ... def __rmul__(self, n: Any) -> Any: ... def __imul__(self, n: Any) -> Any: ... - def __eq__(self, other: Any) -> Any: ... + def __eq__(self, other: Any) -> bool: ... def __lt__(self, other: Any) -> Any: ... def count(self, val: Any) -> Any: ... def index(self, val: Any) -> Any: ... diff --git a/django-stubs/contrib/gis/geos/point.pyi b/django-stubs/contrib/gis/geos/point.pyi index 34af47a8a..bed91bdb1 100644 --- a/django-stubs/contrib/gis/geos/point.pyi +++ b/django-stubs/contrib/gis/geos/point.pyi @@ -1,4 +1,4 @@ -from typing import Any, Optional +from typing import Any, Iterator, Optional from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry @@ -7,8 +7,8 @@ class Point(GEOSGeometry): def __init__( self, x: Optional[Any] = ..., y: Optional[Any] = ..., z: Optional[Any] = ..., srid: Optional[Any] = ... ) -> None: ... - def __iter__(self) -> Any: ... - def __len__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... @property def x(self) -> Any: ... @x.setter diff --git a/django-stubs/contrib/gis/geos/polygon.pyi b/django-stubs/contrib/gis/geos/polygon.pyi index a1dc6a6da..e02d2b78f 100644 --- a/django-stubs/contrib/gis/geos/polygon.pyi +++ b/django-stubs/contrib/gis/geos/polygon.pyi @@ -1,11 +1,11 @@ -from typing import Any +from typing import Any, Iterator from django.contrib.gis.geos.geometry import GEOSGeometry as GEOSGeometry class Polygon(GEOSGeometry): def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __iter__(self) -> Any: ... - def __len__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... @classmethod def from_bbox(cls, bbox: Any) -> Any: ... @property diff --git a/django-stubs/contrib/gis/measure.pyi b/django-stubs/contrib/gis/measure.pyi index 2ee3201d6..d518c829f 100644 --- a/django-stubs/contrib/gis/measure.pyi +++ b/django-stubs/contrib/gis/measure.pyi @@ -8,7 +8,7 @@ class MeasureBase: def __init__(self, default_unit: Optional[Any] = ..., **kwargs: Any) -> None: ... standard: Any = ... def __getattr__(self, name: Any) -> Any: ... - def __eq__(self, other: Any) -> Any: ... + def __eq__(self, other: Any) -> bool: ... def __lt__(self, other: Any) -> Any: ... def __add__(self, other: Any) -> Any: ... def __iadd__(self, other: Any) -> Any: ... @@ -19,7 +19,7 @@ class MeasureBase: def __rmul__(self, other: Any) -> Any: ... def __truediv__(self, other: Any) -> Any: ... def __itruediv__(self, other: Any) -> Any: ... - def __bool__(self) -> Any: ... + def __bool__(self) -> bool: ... def default_units(self, kwargs: Any) -> Any: ... @classmethod def unit_attname(cls, unit_str: Any) -> Any: ... diff --git a/django-stubs/db/backends/oracle/base.pyi b/django-stubs/db/backends/oracle/base.pyi index e4a43b617..ea102547b 100644 --- a/django-stubs/db/backends/oracle/base.pyi +++ b/django-stubs/db/backends/oracle/base.pyi @@ -1,5 +1,5 @@ from contextlib import contextmanager -from typing import Any, Generator, Optional, Type +from typing import Any, Generator, Iterator, Optional, Type from django.db.backends.base.base import BaseDatabaseWrapper as BaseDatabaseWrapper @@ -74,4 +74,4 @@ class FormatStylePlaceholderCursor: def var(self, *args: Any) -> Any: ... def arrayvar(self, *args: Any) -> Any: ... def __getattr__(self, attr: Any) -> Any: ... - def __iter__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... diff --git a/django-stubs/template/response.pyi b/django-stubs/template/response.pyi index 4f4a87c8f..90d9e4d1c 100644 --- a/django-stubs/template/response.pyi +++ b/django-stubs/template/response.pyi @@ -1,6 +1,6 @@ import functools from http.cookies import SimpleCookie -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Tuple, Union from django.core.handlers.wsgi import WSGIRequest from django.http import HttpResponse @@ -41,7 +41,7 @@ class SimpleTemplateResponse(HttpResponse): def render(self) -> SimpleTemplateResponse: ... @property def is_rendered(self) -> bool: ... - def __iter__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... class TemplateResponse(SimpleTemplateResponse): client: Client diff --git a/django-stubs/template/utils.pyi b/django-stubs/template/utils.pyi index 926ba6a0c..cf23f12db 100644 --- a/django-stubs/template/utils.pyi +++ b/django-stubs/template/utils.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Tuple +from typing import Any, Dict, Iterator, List, Tuple from django.core.exceptions import ImproperlyConfigured from django.template.backends.base import BaseEngine @@ -10,7 +10,7 @@ class EngineHandler: @property def templates(self) -> Dict[str, Any]: ... def __getitem__(self, alias: str) -> BaseEngine: ... - def __iter__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... def all(self) -> List[BaseEngine]: ... def get_app_template_dirs(dirname: str) -> Tuple: ... diff --git a/django-stubs/urls/resolvers.pyi b/django-stubs/urls/resolvers.pyi index 1993fe388..52111e7b2 100644 --- a/django-stubs/urls/resolvers.pyi +++ b/django-stubs/urls/resolvers.pyi @@ -1,5 +1,5 @@ from types import ModuleType -from typing import Any, Callable, Dict, List, Optional, Pattern, Sequence, Tuple, Type, Union, overload +from typing import Any, Callable, Dict, Iterator, List, Optional, Pattern, Sequence, Tuple, Type, Union, overload from django.core.checks.messages import CheckMessage from django.urls import _AnyURL @@ -32,7 +32,7 @@ class ResolverMatch: ) -> None: ... def __getitem__(self, index: int) -> Any: ... # for tuple unpacking - def __iter__(self) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... def get_resolver(urlconf: Optional[str] = ...) -> URLResolver: ... def get_ns_resolver(ns_pattern: str, resolver: URLResolver, converters: Tuple) -> URLResolver: ... diff --git a/django-stubs/utils/functional.pyi b/django-stubs/utils/functional.pyi index 20473510f..56b3ef7ab 100644 --- a/django-stubs/utils/functional.pyi +++ b/django-stubs/utils/functional.pyi @@ -65,7 +65,6 @@ class LazyObject: __bytes__: Callable = ... __bool__: Callable = ... __dir__: Callable = ... - __class__: Any = ... __ne__: Callable = ... __hash__: Callable = ... __getitem__: Callable = ...