lib.FileContext.open(): Add method
Add an async open() method which should allow to do what __init__() couldn't, because it's not async, and to match the already existing .close(). It's called by __aenter__() __aexit__() if the FileContext is instantiated as context manager, or at will when the user finds it a good idea. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
432830a5c5
commit
58f7997bc6
3 changed files with 51 additions and 33 deletions
|
|
@ -35,6 +35,10 @@ class AsyncSSH(Base):
|
|||
self.__connect_timeout = connect_timeout
|
||||
self.__conn: asyncssh.SSHClientConnection|None = None
|
||||
|
||||
async def _open(self) -> None:
|
||||
await super()._open()
|
||||
await self._conn
|
||||
|
||||
async def _close(self) -> None:
|
||||
if self.__conn is not None:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue