Skip to content
Merged
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
24 changes: 0 additions & 24 deletions deebot_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from dataclasses import dataclass
from enum import IntEnum, unique
from pathlib import Path
from typing import TYPE_CHECKING, Required, TypedDict

from deebot_client.util.enum import StrEnumWithXml
Expand Down Expand Up @@ -91,26 +90,3 @@ class Credentials:
token: str
user_id: str
expires_at: int = 0


def _str_to_bool_or_cert(value: bool | str) -> bool | str:
"""Convert string to bool or certificate."""
if isinstance(value, bool):
return value

if value is not None:
value = value.lower()
if value in ("y", "yes", "t", "true", "on", "1"):
return True
if value in ("n", "no", "f", "false", "off", "0"):
return False
path = Path(str(value))
if path.exists():
# User could provide a path to a CA Cert as well, which is useful for Bumper
if path.is_file():
return value
msg = f"Certificate path provided is not a file: {value}"
raise ValueError(msg)

msg = f'Cannot convert "{value}" to a bool or certificate path'
raise ValueError(msg)