[py] PEP 484 type hints for selenium.webdriver.remote.file_detector
from abc import ABCMeta, abstractmethod
import os
+from typing import Optional
from selenium.webdriver.common.utils import keys_to_typing
+from selenium.types import AnyKey
class FileDetector(metaclass=ABCMeta):
@@ -27,8 +29,8 @@ class FileDetector(metaclass=ABCMeta):
"""
@abstractmethod
- def is_local_file(self, *keys):
- return
+ def is_local_file(self, *keys: AnyKey) -> Optional[str]:
+ return None
class UselessFileDetector(FileDetector):
@@ -36,7 +38,7 @@ class UselessFileDetector(FileDetector):
A file detector that never finds anything.
"""
- def is_local_file(self, *keys):
+ def is_local_file(self, *keys: AnyKey) -> Optional[str]:
return None
@@ -45,7 +47,7 @@ class LocalFileDetector(FileDetector):
Detects files on the local disk.
"""
- def is_local_file(self, *keys):
+ def is_local_file(self, *keys: AnyKey) -> Optional[str]:
file_path = ''.join(keys_to_typing(keys))
if not file_path:
