Skip to content

Commit 20214d1

Browse files
committed
Fix: Mypy type annotation errors in storage.py, options.py, and virtual_authenticator.py
1 parent f52bb20 commit 20214d1

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

py/selenium/webdriver/common/bidi/storage.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
from typing import Optional, Union
19-
18+
from typing import Optional, Union, Any
2019
from selenium.webdriver.common.bidi.common import command_builder
2120

2221

@@ -88,9 +87,9 @@ def from_dict(cls, data: dict) -> "Cookie":
8887
value = BytesValue(data.get("value", {}).get("type"), data.get("value", {}).get("value"))
8988

9089
return cls(
91-
name=data.get("name"),
90+
name = str(data.get("name") or ""),
9291
value=value,
93-
domain=data.get("domain"),
92+
domain = str(data.get("domain") or ""),
9493
path=data.get("path"),
9594
size=data.get("size"),
9695
http_only=data.get("httpOnly"),
@@ -125,14 +124,14 @@ def __init__(
125124
self.same_site = same_site
126125
self.expiry = expiry
127126

128-
def to_dict(self) -> dict:
127+
def to_dict(self) -> dict[str, Any]:
129128
"""Converts the CookieFilter to a dictionary.
130129
131130
Returns:
132131
-------
133132
Dict: A dictionary representation of the CookieFilter.
134133
"""
135-
result = {}
134+
result: dict[str, Any] = {}
136135
if self.name is not None:
137136
result["name"] = self.name
138137
if self.value is not None:
@@ -242,14 +241,14 @@ def __init__(
242241
self.same_site = same_site
243242
self.expiry = expiry
244243

245-
def to_dict(self) -> dict:
244+
def to_dict(self) -> dict[str, Any]:
246245
"""Converts the PartialCookie to a dictionary.
247246
248247
Returns:
249248
-------
250249
Dict: A dictionary representation of the PartialCookie.
251250
"""
252-
result = {
251+
result: dict[str, Any] = {
253252
"name": self.name,
254253
"value": self.value.to_dict(),
255254
"domain": self.domain,

py/selenium/webdriver/common/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def __init__(self) -> None:
422422
self._caps = self.default_capabilities
423423
self._proxy = None
424424
self.set_capability("pageLoadStrategy", PageLoadStrategy.normal)
425-
self.mobile_options = None
425+
self.mobile_options: dict[str, str] = {}
426426
self._ignore_local_proxy = False
427427

428428
@property

py/selenium/webdriver/common/virtual_authenticator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
class Protocol(str, Enum):
2525
"""Protocol to communicate with the authenticator."""
2626

27-
CTAP2: str = "ctap2"
28-
U2F: str = "ctap1/u2f"
27+
CTAP2 = "ctap2"
28+
U2F = "ctap1/u2f"
2929

3030

3131
class Transport(str, Enum):
3232
"""Transport method to communicate with the authenticator."""
3333

34-
BLE: str = "ble"
35-
USB: str = "usb"
36-
NFC: str = "nfc"
37-
INTERNAL: str = "internal"
34+
BLE = "ble"
35+
USB = "usb"
36+
NFC = "nfc"
37+
INTERNAL = "internal"
3838

3939

4040
class VirtualAuthenticatorOptions:

0 commit comments

Comments
 (0)