-
-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve GeoDjango type-hints (#1299)
- Provide more specific type-hints for GeoDjango modules. - Fixed some missing exports in `contrib/gis/**/__init__.py`. - Removed unintentional re-exports in many modules.
- Loading branch information
Showing
42 changed files
with
593 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
from typing import Any | ||
from django.apps import AppConfig | ||
|
||
from django.apps import AppConfig as AppConfig | ||
|
||
class GISConfig(AppConfig): | ||
name: str | ||
verbose_name: Any | ||
def ready(self) -> None: ... | ||
class GISConfig(AppConfig): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from django.contrib.gis.db.models.sql.conversion import AreaField as AreaField | ||
from django.contrib.gis.db.models.sql.conversion import DistanceField as DistanceField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
from collections.abc import Iterable, Sequence | ||
from typing import Any | ||
|
||
from django.contrib.syndication.views import Feed as BaseFeed | ||
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed | ||
from django.utils.xmlutils import SimplerXMLGenerator | ||
|
||
class GeoFeedMixin: | ||
def georss_coords(self, coords: Any) -> Any: ... | ||
def add_georss_point(self, handler: Any, coords: Any, w3c_geo: bool = ...) -> None: ... | ||
def add_georss_element(self, handler: Any, item: Any, w3c_geo: bool = ...) -> None: ... | ||
def georss_coords(self, coords: Iterable[Sequence[float]]) -> str: ... | ||
def add_georss_point(self, handler: SimplerXMLGenerator, coords: Sequence[float], w3c_geo: bool = ...) -> None: ... | ||
def add_georss_element(self, handler: SimplerXMLGenerator, item: dict[str, Any], w3c_geo: bool = ...) -> None: ... | ||
|
||
class GeoRSSFeed(Rss201rev2Feed, GeoFeedMixin): | ||
def rss_attributes(self) -> Any: ... | ||
def add_item_elements(self, handler: Any, item: Any) -> None: ... | ||
def add_root_elements(self, handler: Any) -> None: ... | ||
def rss_attributes(self) -> dict[str, str]: ... | ||
|
||
class GeoAtom1Feed(Atom1Feed, GeoFeedMixin): | ||
def root_attributes(self) -> Any: ... | ||
def add_item_elements(self, handler: Any, item: Any) -> None: ... | ||
def add_root_elements(self, handler: Any) -> None: ... | ||
class GeoAtom1Feed(Atom1Feed, GeoFeedMixin): ... | ||
|
||
class W3CGeoFeed(Rss201rev2Feed, GeoFeedMixin): | ||
def rss_attributes(self) -> Any: ... | ||
def add_item_elements(self, handler: Any, item: Any) -> None: ... | ||
def add_root_elements(self, handler: Any) -> None: ... | ||
def rss_attributes(self) -> dict[str, str]: ... | ||
|
||
class Feed(BaseFeed): | ||
feed_type: Any | ||
def feed_extra_kwargs(self, obj: Any) -> Any: ... | ||
def item_extra_kwargs(self, item: Any) -> Any: ... | ||
class Feed(BaseFeed): ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.forms import * | ||
|
||
from .fields import GeometryCollectionField as GeometryCollectionField | ||
from .fields import GeometryField as GeometryField | ||
from .fields import LineStringField as LineStringField | ||
from .fields import MultiLineStringField as MultiLineStringField | ||
from .fields import MultiPointField as MultiPointField | ||
from .fields import MultiPolygonField as MultiPolygonField | ||
from .fields import PointField as PointField | ||
from .fields import PolygonField as PolygonField | ||
from .widgets import BaseGeometryWidget as BaseGeometryWidget | ||
from .widgets import OpenLayersWidget as OpenLayersWidget | ||
from .widgets import OSMWidget as OSMWidget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
from typing import Any | ||
|
||
from django.contrib.gis.gdal.base import GDALBase as GDALBase | ||
from django.contrib.gis.gdal.base import GDALBase | ||
from django.contrib.gis.gdal.driver import Driver | ||
from django.contrib.gis.gdal.layer import Layer | ||
|
||
class DataSource(GDALBase): | ||
destructor: Any | ||
encoding: Any | ||
encoding: str | ||
ptr: Any | ||
driver: Any | ||
driver: Driver | ||
def __init__(self, ds_input: Any, ds_driver: bool = ..., write: bool = ..., encoding: str = ...) -> None: ... | ||
def __getitem__(self, index: Any) -> Any: ... | ||
def __getitem__(self, index: str | int) -> Layer: ... | ||
def __len__(self) -> int: ... | ||
@property | ||
def layer_count(self) -> Any: ... | ||
def layer_count(self) -> int: ... | ||
@property | ||
def name(self) -> Any: ... | ||
def name(self) -> str: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
from typing import Any | ||
|
||
from django.contrib.gis.gdal.base import GDALBase as GDALBase | ||
from django.contrib.gis.gdal.base import GDALBase | ||
|
||
class Driver(GDALBase): | ||
ptr: Any | ||
def __init__(self, dr_input: Any) -> None: ... | ||
@classmethod | ||
def ensure_registered(cls) -> None: ... | ||
@classmethod | ||
def driver_count(cls) -> Any: ... | ||
def driver_count(cls) -> int: ... | ||
@property | ||
def name(self) -> Any: ... | ||
def name(self) -> str: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
from typing import Any | ||
|
||
from django.contrib.gis.gdal.base import GDALBase as GDALBase | ||
from django.contrib.gis.gdal.base import GDALBase | ||
from django.contrib.gis.gdal.field import Field | ||
from django.contrib.gis.gdal.geometries import OGRGeometry | ||
from django.contrib.gis.gdal.geomtype import OGRGeomType | ||
|
||
class Feature(GDALBase): | ||
destructor: Any | ||
ptr: Any | ||
def __init__(self, feat: Any, layer: Any) -> None: ... | ||
def __getitem__(self, index: Any) -> Any: ... | ||
def __getitem__(self, index: str | int) -> Field: ... | ||
def __len__(self) -> int: ... | ||
def __eq__(self, other: object) -> bool: ... | ||
@property | ||
def encoding(self) -> Any: ... | ||
def encoding(self) -> str: ... | ||
@property | ||
def fid(self) -> Any: ... | ||
def fid(self) -> int: ... | ||
@property | ||
def layer_name(self) -> Any: ... | ||
def layer_name(self) -> str: ... | ||
@property | ||
def num_fields(self) -> Any: ... | ||
def num_fields(self) -> int: ... | ||
@property | ||
def fields(self) -> Any: ... | ||
def fields(self) -> list[str]: ... | ||
@property | ||
def geom(self) -> Any: ... | ||
def geom(self) -> OGRGeometry: ... | ||
@property | ||
def geom_type(self) -> Any: ... | ||
def get(self, field: Any) -> Any: ... | ||
def index(self, field_name: Any) -> Any: ... | ||
def geom_type(self) -> OGRGeomType: ... | ||
def get(self, field: str) -> Any: ... | ||
def index(self, field_name: str) -> Any: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.