Skip to content

Commit f7e1885

Browse files
fixed a bug in bidi/session.py by removing mutable object as default value for function argument
1 parent 004746e commit f7e1885

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

py/selenium/webdriver/common/bidi/session.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,30 @@
1616
# under the License.
1717

1818

19-
def session_subscribe(*events, browsing_contexts=[]):
19+
def session_subscribe(*events, browsing_contexts=None):
2020
cmd_dict = {
2121
"method": "session.subscribe",
2222
"params": {
2323
"events": events,
2424
},
2525
}
26+
if browsing_contexts is None:
27+
browsing_contexts = []
2628
if browsing_contexts:
2729
cmd_dict["params"]["browsingContexts"] = browsing_contexts
2830
_ = yield cmd_dict
2931
return None
3032

3133

32-
def session_unsubscribe(*events, browsing_contexts=[]):
34+
def session_unsubscribe(*events, browsing_contexts=None):
3335
cmd_dict = {
3436
"method": "session.unsubscribe",
3537
"params": {
3638
"events": events,
3739
},
3840
}
41+
if browsing_contexts is None:
42+
browsing_contexts = []
3943
if browsing_contexts:
4044
cmd_dict["params"]["browsingContexts"] = browsing_contexts
4145
_ = yield cmd_dict

py/selenium/webdriver/support/relative_locator.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ def __init__(self, root: Optional[Dict[ByType, str]] = None, filters: Optional[L
8888
self.filters = filters or []
8989

9090
@overload
91-
def above(self, element_or_locator: Union[WebElement, LocatorType]) -> "RelativeBy": ...
91+
def above(self, element_or_locator: Union[WebElement, LocatorType]) -> "RelativeBy":
92+
...
9293

9394
@overload
94-
def above(self, element_or_locator: None = None) -> "NoReturn": ...
95+
def above(self, element_or_locator: None = None) -> "NoReturn":
96+
...
9597

9698
def above(self, element_or_locator: Union[WebElement, LocatorType, None] = None) -> "RelativeBy":
9799
"""Add a filter to look for elements above.
@@ -106,10 +108,12 @@ def above(self, element_or_locator: Union[WebElement, LocatorType, None] = None)
106108
return self
107109

108110
@overload
109-
def below(self, element_or_locator: Union[WebElement, LocatorType]) -> "RelativeBy": ...
111+
def below(self, element_or_locator: Union[WebElement, LocatorType]) -> "RelativeBy":
112+
...
110113

111114
@overload
112-
def below(self, element_or_locator: None = None) -> "NoReturn": ...
115+
def below(self, element_or_locator: None = None) -> "NoReturn":
116+
...
113117

114118
def below(self, element_or_locator: Union[WebElement, Dict, None] = None) -> "RelativeBy":
115119
"""Add a filter to look for elements below.
@@ -124,10 +128,12 @@ def below(self, element_or_locator: Union[WebElement, Dict, None] = None) -> "Re
124128
return self
125129

126130
@overload
127-
def to_left_of(self, element_or_locator: Union[WebElement, LocatorType]) -> "RelativeBy": ...
131+
def to_left_of(self, element_or_locator: Union[WebElement, LocatorType]) -> "RelativeBy":
132+
...
128133

129134
@overload
130-
def to_left_of(self, element_or_locator: None = None) -> "NoReturn": ...
135+
def to_left_of(self, element_or_locator: None = None) -> "NoReturn":
136+
...
131137

132138
def to_left_of(self, element_or_locator: Union[WebElement, Dict, None] = None) -> "RelativeBy":
133139
"""Add a filter to look for elements to the left of.
@@ -142,10 +148,12 @@ def to_left_of(self, element_or_locator: Union[WebElement, Dict, None] = None) -
142148
return self
143149

144150
@overload
145-
def to_right_of(self, element_or_locator: Union[WebElement, LocatorType]) -> "RelativeBy": ...
151+
def to_right_of(self, element_or_locator: Union[WebElement, LocatorType]) -> "RelativeBy":
152+
...
146153

147154
@overload
148-
def to_right_of(self, element_or_locator: None = None) -> "NoReturn": ...
155+
def to_right_of(self, element_or_locator: None = None) -> "NoReturn":
156+
...
149157

150158
def to_right_of(self, element_or_locator: Union[WebElement, Dict, None] = None) -> "RelativeBy":
151159
"""Add a filter to look for elements right of.
@@ -160,10 +168,12 @@ def to_right_of(self, element_or_locator: Union[WebElement, Dict, None] = None)
160168
return self
161169

162170
@overload
163-
def near(self, element_or_locator: Union[WebElement, LocatorType], distance: int = 50) -> "RelativeBy": ...
171+
def near(self, element_or_locator: Union[WebElement, LocatorType], distance: int = 50) -> "RelativeBy":
172+
...
164173

165174
@overload
166-
def near(self, element_or_locator: None = None, distance: int = 50) -> "NoReturn": ...
175+
def near(self, element_or_locator: None = None, distance: int = 50) -> "NoReturn":
176+
...
167177

168178
def near(self, element_or_locator: Union[WebElement, LocatorType, None] = None, distance: int = 50) -> "RelativeBy":
169179
"""Add a filter to look for elements near.

0 commit comments

Comments
 (0)