Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions scmrepo/git/backend/dulwich/asyncssh_vendor.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
"""asyncssh SSH vendor for Dulwich."""
import asyncio
from typing import List, Optional
from typing import TYPE_CHECKING, List, Optional

from asyncssh.connection import SSHClientConnection, SSHConnection
from asyncssh.process import SSHClientProcess
from asyncssh.stream import SSHReader
from dulwich.client import SSHVendor

from scmrepo.asyn import BaseAsyncObject, sync_wrapper

if TYPE_CHECKING:
from asyncssh.connection import SSHClientConnection, SSHConnection
from asyncssh.process import SSHClientProcess
from asyncssh.stream import SSHReader


class _StderrWrapper:
def __init__(
self, stderr: SSHReader, loop: asyncio.AbstractEventLoop
self, stderr: "SSHReader", loop: asyncio.AbstractEventLoop
) -> None:
self.stderr = stderr
self.loop = loop
Expand All @@ -34,10 +36,12 @@ async def _read(self, n: Optional[int] = None) -> bytes:


class AsyncSSHWrapper(BaseAsyncObject):
def __init__(self, conn: SSHConnection, proc: SSHClientProcess, **kwargs):
def __init__(
self, conn: "SSHConnection", proc: "SSHClientProcess", **kwargs
):
super().__init__(**kwargs)
self.conn: SSHClientConnection = conn
self.proc: SSHClientProcess = proc
self.conn: "SSHClientConnection" = conn
self.proc: "SSHClientProcess" = proc
self.stderr = _StderrWrapper(proc.stderr, self.loop)

def can_read(self) -> bool:
Expand Down Expand Up @@ -142,7 +146,7 @@ async def _run_command(
MSG_USERAUTH_PK_OK
] = _process_public_key_ok_gh

conn: SSHClientConnection = await asyncssh.connect(
conn: "SSHClientConnection" = await asyncssh.connect(
host,
port=port if port is not None else (),
username=username if username is not None else (),
Expand All @@ -152,7 +156,7 @@ async def _run_command(
known_hosts=None,
encoding=None,
)
proc: SSHClientProcess = await conn.create_process(
proc: "SSHClientProcess" = await conn.create_process(
command, encoding=None
)
return AsyncSSHWrapper(conn, proc)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
description = SCM wrapper and fsspec filesystem for Git for use in DVC
name = scmrepo
version = 0.0.5
version = 0.0.6
long_description = file: README.md
long_description_content_type = text/markdown
license = Apache License 2.0
Expand Down