mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
lib.FileContext: Beautify NotImplementedErrors
Each wrapper method throws a NotImplementedError by default. Make that error a little more descriptive in case it really gets thrown. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
3360ec86cb
commit
6a3cf7a283
1 changed files with 7 additions and 7 deletions
|
|
@ -129,31 +129,31 @@ class FileContext(abc.ABC):
|
|||
title=title, owner=owner, group=group, mode=mode_str, atomic=atomic)
|
||||
|
||||
async def _unlink(self, path: str) -> None:
|
||||
raise NotImplementedError(f'{self.log_name}: unlink() is not implemented')
|
||||
raise NotImplementedError(f'{self.log_name}: unlink("{path}") is not implemented')
|
||||
|
||||
async def unlink(self, path: str) -> None:
|
||||
return await self._unlink(path)
|
||||
|
||||
async def _erase(self, path: str) -> None:
|
||||
raise NotImplementedError(f'{self.log_name}: erase() is not implemented')
|
||||
raise NotImplementedError(f'{self.log_name}: erase("{path}") is not implemented')
|
||||
|
||||
async def erase(self, path: str) -> None:
|
||||
return await self._erase(path)
|
||||
|
||||
async def _rename(self, src: str, dst: str) -> None:
|
||||
raise NotImplementedError(f'{self.log_name}: rename() is not implemented')
|
||||
raise NotImplementedError(f'{self.log_name}: rename("{path}") is not implemented')
|
||||
|
||||
async def rename(self, src: str, dst: str) -> None:
|
||||
return await self._rename(src, dst)
|
||||
|
||||
async def _mktemp(self, tmpl: str, directory: bool) -> None:
|
||||
raise NotImplementedError(f'{self.log_name}: mktemp() is not implemented')
|
||||
raise NotImplementedError(f'{self.log_name}: mktemp("{path}") is not implemented')
|
||||
|
||||
async def mktemp(self, tmpl: str, directory: bool=False) -> None:
|
||||
return await self._mktemp(tmpl, directory)
|
||||
|
||||
async def _chown(self, path: str, owner: str|None, group: str|None) -> None:
|
||||
raise NotImplementedError(f'{self.log_name}: chown() is not implemented')
|
||||
raise NotImplementedError(f'{self.log_name}: chown("{path}") is not implemented')
|
||||
|
||||
async def chown(self, path: str, owner: str|None=None, group: str|None=None) -> None:
|
||||
if owner is None and group is None:
|
||||
|
|
@ -161,13 +161,13 @@ class FileContext(abc.ABC):
|
|||
return await self._chown(path, owner, group)
|
||||
|
||||
async def _chmod(self, path: str, mode: int) -> None:
|
||||
raise NotImplementedError(f'{self.log_name}: chmod() is not implemented')
|
||||
raise NotImplementedError(f'{self.log_name}: chmod("{path}") is not implemented')
|
||||
|
||||
async def chmod(self, path: str, mode: int) -> None:
|
||||
return await self._chmod(path, mode)
|
||||
|
||||
async def _stat(self, path: str, follow_symlinks: bool) -> StatResult:
|
||||
raise NotImplementedError(f'{self.log_name}: lstat() is not implemented')
|
||||
raise NotImplementedError(f'{self.log_name}: lstat("{path}") is not implemented')
|
||||
|
||||
async def stat(self, path: str, follow_symlinks: bool=True) -> StatResult:
|
||||
if not isinstance(path, str):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue