Compare commits

...

2 commits

3 changed files with 10 additions and 10 deletions

View file

@ -50,7 +50,7 @@ class WebDAVSettings(DAVSettings):
username: str = "ovd_user" username: str = "ovd_user"
password: str = "password" password: str = "password"
config_filename: str = "config.txt" config_filename: str = "config.toml"
disable_check: bool = False disable_check: bool = False
retries: int = 20 retries: int = 20

View file

@ -35,7 +35,7 @@ class WebDAV:
regex: re.Pattern[str] = re.compile(""), regex: re.Pattern[str] = re.compile(""),
) -> list[str]: ) -> list[str]:
""" """
Liste aller Dateien im Ordner `directory`, die zur RegEx `regex` passen List files in directory `directory` matching RegEx `regex`
""" """
_logger.debug(f"list_files {directory!r}") _logger.debug(f"list_files {directory!r}")
@ -49,9 +49,9 @@ class WebDAV:
maxsize=SETTINGS.webdav.cache_size, maxsize=SETTINGS.webdav.cache_size,
skip_args=1, skip_args=1,
) )
async def file_exists(cls, path: str) -> bool: async def exists(cls, path: str) -> bool:
""" """
`True`, wenn an Pfad `path` eine Datei existiert `True` iff there is a WebDAV resource at `path`
""" """
_logger.debug(f"file_exists {path!r}") _logger.debug(f"file_exists {path!r}")
@ -67,7 +67,7 @@ class WebDAV:
) )
async def read_bytes(cls, path: str) -> bytes: async def read_bytes(cls, path: str) -> bytes:
""" """
Datei aus Pfad `path` als bytes laden Load WebDAV file from `path` as bytes
""" """
_logger.debug(f"read_bytes {path!r}") _logger.debug(f"read_bytes {path!r}")
@ -79,7 +79,7 @@ class WebDAV:
@classmethod @classmethod
async def read_str(cls, path: str, encoding="utf-8") -> str: async def read_str(cls, path: str, encoding="utf-8") -> str:
""" """
Datei aus Pfad `path` als string laden Load WebDAV file from `path` as string
""" """
_logger.debug(f"read_str {path!r}") _logger.debug(f"read_str {path!r}")
@ -88,7 +88,7 @@ class WebDAV:
@classmethod @classmethod
async def write_bytes(cls, path: str, buffer: bytes) -> None: async def write_bytes(cls, path: str, buffer: bytes) -> None:
""" """
Bytes `buffer` in Datei in Pfad `path` schreiben Write bytes from `buffer` into WebDAV file at `path`
""" """
_logger.debug(f"write_bytes {path!r}") _logger.debug(f"write_bytes {path!r}")
@ -106,7 +106,7 @@ class WebDAV:
@classmethod @classmethod
async def write_str(cls, path: str, content: str, encoding="utf-8") -> None: async def write_str(cls, path: str, content: str, encoding="utf-8") -> None:
""" """
String `content` in Datei in Pfad `path` schreiben Write string from `content` into WebDAV file at `path`
""" """
_logger.debug(f"write_str {path!r}") _logger.debug(f"write_str {path!r}")

View file

@ -62,9 +62,9 @@ class FileNameLister:
async def __call__(self) -> Iterator[str]: async def __call__(self) -> Iterator[str]:
try: try:
file_names = await WebDAV.list_files(await self.remote_path) file_names = await WebDAV.list_files(await self.remote_path, regex=self.re)
return (name for name in file_names if self.re.search(name)) return iter(file_names)
except RemoteResourceNotFound: except RemoteResourceNotFound:
_logger.error( _logger.error(