Fix shapely SupportsRead protocol (#12038)

This commit is contained in:
Ali Hamdan
2024-05-26 13:29:02 +02:00
committed by GitHub
parent a9a52a0e10
commit 47aeda444b
3 changed files with 9 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
import sys
from _typeshed import SupportsWrite as SupportsWrite
from collections.abc import Sequence
from typing import Any, Protocol, TypeVar, type_check_only
from typing_extensions import TypeAlias
@@ -12,6 +13,7 @@ if sys.version_info >= (3, 12):
from collections.abc import Buffer
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_DType = TypeVar("_DType", bound=np.dtype[Any])
_DType_co = TypeVar("_DType_co", covariant=True, bound=np.dtype[Any])
@@ -49,3 +51,8 @@ GeoArray: TypeAlias = NDArray[np.object_]
class SupportsGeoInterface(Protocol):
@property
def __geo_interface__(self) -> dict[str, Any]: ...
# Unlike _typeshed.SupportsRead, this protocol does not require a length parameter
@type_check_only
class SupportsRead(Protocol[_T_co]):
def read(self) -> _T_co: ...

View File

@@ -1,6 +1,6 @@
from _typeshed import SupportsRead, SupportsWrite
from typing import Literal, overload
from ._typing import SupportsRead, SupportsWrite
from .geometry.base import BaseGeometry
from .lib import Geometry

View File

@@ -1,5 +1,4 @@
from _typeshed import SupportsRead, SupportsWrite
from ._typing import SupportsRead, SupportsWrite
from .geometry.base import BaseGeometry
from .lib import Geometry