File tree 1 file changed +13
-3
lines changed
src/graphql_relay/connection
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
import binascii
2
2
import 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
4
8
5
9
from ..utils .base64 import base64 , unbase64
6
10
from .connectiontypes import (
25
29
]
26
30
27
31
32
+ class SizedSliceable (Protocol ):
33
+ def __getitem__ (self , index : slice ) -> Any : ...
34
+ def __iter__ (self ) -> Iterator : ...
35
+ def __len__ (self ) -> int : ...
36
+
37
+
28
38
def connection_from_array (
29
- data : Sequence ,
39
+ data : SizedSliceable ,
30
40
args : ConnectionArguments = None ,
31
41
connection_type : ConnectionConstructor = Connection ,
32
42
edge_type : EdgeConstructor = Edge ,
@@ -83,7 +93,7 @@ def connection_from_list(
83
93
84
94
85
95
def connection_from_array_slice (
86
- array_slice : Sequence ,
96
+ array_slice : SizedSliceable ,
87
97
args : ConnectionArguments = None ,
88
98
slice_start : int = 0 ,
89
99
array_length : int = None ,
You can’t perform that action at this time.
0 commit comments