From 9b969b60247403925e46f90e65540d219afa7c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Sun, 4 Sep 2022 14:14:22 +0000 Subject: [PATCH] dav_file dataclass --- api/ovdashboard_api/dav_file.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/ovdashboard_api/dav_file.py b/api/ovdashboard_api/dav_file.py index 5a07fe7..c774a15 100644 --- a/api/ovdashboard_api/dav_file.py +++ b/api/ovdashboard_api/dav_file.py @@ -1,5 +1,6 @@ import logging import time +from dataclasses import dataclass from io import BytesIO from typing import Any, Optional @@ -38,14 +39,14 @@ async def _get_buffer( return await buffer_inner(resource) +@dataclass(frozen=True) class DavFile: - def __init__(self, remote_path: Any) -> None: - self.__remote_path = remote_path + remote_path: str @property async def __buffer(self) -> BytesIO: return await _get_buffer( - remote_path=self.__remote_path, + remote_path=self.remote_path, ttl_hash=_get_ttl_hash(20), )