File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/graphql_relay/connection Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 11import binascii
22import warnings
3- from typing import Any , Optional , Sequence
3+ from typing import Any , Iterator , Optional , Sequence
4+ try :
5+ from typing import Protocol
6+ except ImportError :
7+ from typing_extensions import Protocol # type: ignore
48
59from ..utils .base64 import base64 , unbase64
610from .connectiontypes import (
2529]
2630
2731
32+ class SizedSliceable (Protocol ):
33+ def __getitem__ (self , index : slice ) -> Any : ...
34+ def __iter__ (self ) -> Iterator : ...
35+ def __len__ (self ) -> int : ...
36+
37+
2838def connection_from_array (
29- data : Sequence ,
39+ data : SizedSliceable ,
3040 args : ConnectionArguments = None ,
3141 connection_type : ConnectionConstructor = Connection ,
3242 edge_type : EdgeConstructor = Edge ,
@@ -83,7 +93,7 @@ def connection_from_list(
8393
8494
8595def connection_from_array_slice (
86- array_slice : Sequence ,
96+ array_slice : SizedSliceable ,
8797 args : ConnectionArguments = None ,
8898 slice_start : int = 0 ,
8999 array_length : int = None ,
You can’t perform that action at this time.
0 commit comments