Skip to content

Commit a5e8115

Browse files
committed
fix: set default arugments to store/load value functions
1 parent d45fe69 commit a5e8115

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

roborock/devices/file_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def flush(self) -> None:
5757
await store_value(self._file_path, self._cache_data, self._serialize_fn)
5858

5959

60-
async def store_value(file_path: pathlib.Path, value: Any, serialize_fn: Callable[[Any], bytes]) -> None:
60+
async def store_value(file_path: pathlib.Path, value: Any, serialize_fn: Callable[[Any], bytes] = pickle.dumps) -> None:
6161
"""Store a value to the given file path."""
6262

6363
def _store_to_disk(file_path: pathlib.Path, value: Any) -> None:
@@ -70,7 +70,7 @@ def _store_to_disk(file_path: pathlib.Path, value: Any) -> None:
7070
await asyncio.to_thread(_store_to_disk, file_path, value)
7171

7272

73-
async def load_value(file_path: pathlib.Path, deserialize_fn: Callable[[bytes], Any]) -> Any | None:
73+
async def load_value(file_path: pathlib.Path, deserialize_fn: Callable[[bytes], Any] = pickle.loads) -> Any | None:
7474
"""Load a value from the given file path."""
7575

7676
def _load_from_disk(file_path: pathlib.Path) -> Any | None:

0 commit comments

Comments
 (0)