Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions playwright/_impl/_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import asyncio
import datetime
import math
import os
import re
Expand Down Expand Up @@ -574,3 +575,13 @@ def is_file_payload(value: Optional[Any]) -> bool:

def is_textual_mime_type(mime_type: str) -> bool:
return bool(TEXTUAL_MIME_TYPE.match(mime_type))


def to_milliseconds(
value: Union[float, datetime.timedelta, None],
) -> Optional[float]:
if value is None:
return None
if isinstance(value, datetime.timedelta):
return value / datetime.timedelta(milliseconds=1)
return value
Loading
Loading