dav_file dataclass

This commit is contained in:
Jörn-Michael Miehe 2022-09-04 14:14:22 +00:00
parent cf684ee5f9
commit 9b969b6024

View file

@ -1,5 +1,6 @@
import logging import logging
import time import time
from dataclasses import dataclass
from io import BytesIO from io import BytesIO
from typing import Any, Optional from typing import Any, Optional
@ -38,14 +39,14 @@ async def _get_buffer(
return await buffer_inner(resource) return await buffer_inner(resource)
@dataclass(frozen=True)
class DavFile: class DavFile:
def __init__(self, remote_path: Any) -> None: remote_path: str
self.__remote_path = remote_path
@property @property
async def __buffer(self) -> BytesIO: async def __buffer(self) -> BytesIO:
return await _get_buffer( return await _get_buffer(
remote_path=self.__remote_path, remote_path=self.remote_path,
ttl_hash=_get_ttl_hash(20), ttl_hash=_get_ttl_hash(20),
) )