Skip to content

Commit 2e059e0

Browse files
committed
[py]: minor types, avoid import names for variables, simplify int or float checks in keys_to_typing
1 parent bef96e6 commit 2e059e0

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

py/selenium/webdriver/common/utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ def is_url_connectable(port: Union[int, str]) -> bool:
136136

137137
def keys_to_typing(value: Iterable[AnyKey]) -> List[str]:
138138
"""Processes the values that will be typed in the element."""
139-
typing: List[str] = []
139+
_typing: List[str] = []
140140
for val in value:
141141
if isinstance(val, Keys):
142-
typing.append(val)
143-
elif isinstance(val, int) or isinstance(val, float):
142+
# Todo: Does this even work?
143+
_typing.append(val)
144+
elif isinstance(val, (int, float)):
144145
val = str(val)
145146
for i in range(len(val)):
146-
typing.append(val[i])
147+
_typing.append(val[i])
147148
else:
148149
for i in range(len(val)):
149-
typing.append(val[i])
150-
return typing
150+
_typing.append(val[i])
151+
return _typing

py/selenium/webdriver/remote/webelement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def find_elements(self, by=By.ID, value=None) -> list[WebElement]:
443443
return self._execute(Command.FIND_CHILD_ELEMENTS,
444444
{"using": by, "value": value})['value']
445445

446-
def __hash__(self):
446+
def __hash__(self) -> int:
447447
return int(md5_hash(self._id.encode('utf-8')).hexdigest(), 16)
448448

449449
def _upload(self, filename):

0 commit comments

Comments
 (0)