@@ -10,13 +10,13 @@ class BidiValue(ABC):
10
10
protocol_value : Dict [str , Any ]
11
11
type : str
12
12
13
- def __init__ (self , protocol_value ):
13
+ def __init__ (self , protocol_value : Dict [ str , Any ] ):
14
14
assert isinstance (protocol_value , dict )
15
15
assert isinstance (protocol_value ["type" ], str )
16
16
self .type = protocol_value ["type" ]
17
17
self .protocol_value = protocol_value
18
18
19
- def to_classic_protocol_value (self ) -> Dict :
19
+ def to_classic_protocol_value (self ) -> Dict [ str , Any ] :
20
20
"""Convert the BiDi value to the classic protocol value. Required for compatibility of the values sent over BiDi
21
21
transport with the classic actions."""
22
22
raise NotImplementedError ("No conversion to the classic protocol value is implemented." )
@@ -30,7 +30,7 @@ def __init__(self, protocol_value: Dict[str, Any]):
30
30
assert self .type == "node"
31
31
self .shared_id = self .protocol_value ["sharedId" ]
32
32
33
- def to_classic_protocol_value (self ) -> Dict :
33
+ def to_classic_protocol_value (self ) -> Dict [ str , Any ] :
34
34
return {WebElement .identifier : self .shared_id }
35
35
36
36
@@ -43,7 +43,7 @@ def __init__(self, protocol_value: Dict[str, Any]):
43
43
self .browsing_context = self .protocol_value ["value" ]["context" ]
44
44
45
45
46
- def bidi_deserialize (bidi_value : Union [str , int , Dict ]) :
46
+ def bidi_deserialize (bidi_value : Union [str , int , Dict [ str , Any ]]) -> Any :
47
47
"""
48
48
Deserialize the BiDi primitive values, lists and objects to the Python value, keeping non-common data types
49
49
in BiDi format.
@@ -82,15 +82,15 @@ def bidi_deserialize(bidi_value: Union[str, int, Dict]):
82
82
return int (bidi_value ["value" ])
83
83
# script.RemoteValue https://w3c.github.io/webdriver-bidi/#type-script-RemoteValue
84
84
if bidi_value ["type" ] == "array" :
85
- result = []
85
+ list_result = []
86
86
for item in bidi_value ["value" ]:
87
- result .append (bidi_deserialize (item ))
88
- return result
87
+ list_result .append (bidi_deserialize (item ))
88
+ return list_result
89
89
if bidi_value ["type" ] == "object" :
90
- result = {}
90
+ dict_result = {}
91
91
for item in bidi_value ["value" ]:
92
- result [bidi_deserialize (item [0 ])] = bidi_deserialize (item [1 ])
93
- return result
92
+ dict_result [bidi_deserialize (item [0 ])] = bidi_deserialize (item [1 ])
93
+ return dict_result
94
94
if bidi_value ["type" ] == "node" :
95
95
return BidiNode (bidi_value )
96
96
if bidi_value ["type" ] == "window" :
0 commit comments