mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-30 16:14:24 +08:00
Fix shapely SupportsRead protocol (#12038)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from _typeshed import SupportsRead, SupportsWrite
|
||||
|
||||
from ._typing import SupportsRead, SupportsWrite
|
||||
from .geometry.base import BaseGeometry
|
||||
from .lib import Geometry
|
||||
|
||||
|
||||
Reference in New Issue
Block a user