Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 10, 2024
1 parent 56576d3 commit 7ec75c8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/scmrepo/git/backend/dulwich/asyncssh_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ async def _read(self, n: Optional[int] = None) -> bytes:
class AsyncSSHWrapper(BaseAsyncObject):
def __init__(self, conn: "SSHClientConnection", 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 @@ -152,7 +152,7 @@ def connection_made(self, conn: "SSHClientConnection") -> None:
def connection_lost(self, exc: Optional[Exception]) -> None:
self._conn = None

async def public_key_auth_requested( # noqa: C901, PLR0912
async def public_key_auth_requested( # noqa: C901
self,
) -> Optional["KeyPairListArg"]:
from asyncssh.public_key import (
Expand Down Expand Up @@ -320,7 +320,7 @@ def get_unsupported_opts(config_paths: "ConfigPaths") -> Iterator[str]:

if config_paths:
if isinstance(config_paths, (str, PurePath)):
paths: Sequence["FilePath"] = [config_paths]
paths: Sequence[FilePath] = [config_paths]
else:
paths = config_paths

Expand Down
2 changes: 1 addition & 1 deletion src/scmrepo/git/backend/dulwich/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(
config=config,
**kwargs,
)
self._store_credentials: Optional["Credential"] = None
self._store_credentials: Optional[Credential] = None

def _http_request(
self,
Expand Down
2 changes: 1 addition & 1 deletion src/scmrepo/git/backend/gitpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def set_ref(
except GitCommandError as exc:
raise SCMError(f"Failed to set ref '{name}'") from exc

def get_ref(self, name: str, follow: bool = True) -> Optional[str]: # noqa: C901, PLR0911, PLR0912
def get_ref(self, name: str, follow: bool = True) -> Optional[str]: # noqa: C901, PLR0911
from git.exc import GitCommandError

if name == "HEAD":
Expand Down
8 changes: 4 additions & 4 deletions src/scmrepo/git/backend/pygit2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def _default_status(
SCMError(f"Git failed to fetch ref from '{url}'"),
):
with RemoteCallbacks(progress=progress) as cb:
remote_refs: dict[str, "Oid"] = (
remote_refs: dict[str, Oid] = (
{
head["name"]: head["oid"]
for head in remote.ls_remotes(callbacks=cb)
Expand All @@ -712,7 +712,7 @@ def _default_status(
message="fetch",
)

result: dict[str, "SyncStatus"] = {}
result: dict[str, SyncStatus] = {}
for refspec in refspecs:
lh, rh = refspec.split(":")
if lh.endswith("*"):
Expand Down Expand Up @@ -951,7 +951,7 @@ def status(
def iter_remote_refs(self, url: str, base: Optional[str] = None, **kwargs):
raise NotImplementedError

def merge( # noqa: C901, PLR0912
def merge( # noqa: C901
self,
rev: str,
commit: bool = True,
Expand Down Expand Up @@ -1089,7 +1089,7 @@ def check_attr(
from pygit2 import GitError
from pygit2.enums import AttrCheck

commit: Optional["Commit"] = None
commit: Optional[Commit] = None
flags = AttrCheck.FILE_THEN_INDEX
if source:
try:
Expand Down
2 changes: 1 addition & 1 deletion src/scmrepo/git/backend/pygit2/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(
):
super().__init__(*args, **kwargs)
self.progress = GitProgressReporter(progress) if progress else None
self._store_credentials: Optional["Credential"] = None
self._store_credentials: Optional[Credential] = None
self._tried_credentials = False
self.result: dict[str, SyncStatus] = {}

Expand Down
4 changes: 2 additions & 2 deletions src/scmrepo/git/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def get_matching_commands(
) -> Iterator[tuple[str, bool]]:
config = config or StackedConfig.default()
if isinstance(config, StackedConfig):
backends: Iterable["ConfigDict"] = config.backends
backends: Iterable[ConfigDict] = config.backends
else:
backends = [config]

Expand Down Expand Up @@ -324,7 +324,7 @@ class MemoryCredentialHelper(CredentialHelper):

def __init__(self):
super().__init__()
self._credentials: dict["_CredentialKey", "Credential"] = {}
self._credentials: dict[_CredentialKey, Credential] = {}

def __getitem__(self, key: object) -> "Credential":
if isinstance(key, _CredentialKey):
Expand Down
4 changes: 2 additions & 2 deletions src/scmrepo/git/lfs/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def fetch(
scm.lfs_storage.fetch(url, objects, progress=progress)


def get_fetch_url(scm: "Git", remote: Optional[str] = None): # noqa: C901,PLR0912
def get_fetch_url(scm: "Git", remote: Optional[str] = None): # noqa: C901
"""Return LFS fetch URL for the specified repository."""
git_config = scm.get_config()

Expand All @@ -56,7 +56,7 @@ def get_fetch_url(scm: "Git", remote: Optional[str] = None): # noqa: C901,PLR09
except KeyError:
pass
try:
lfs_config: Optional["Config"] = scm.get_config(
lfs_config: Optional[Config] = scm.get_config(
os.path.join(scm.root_dir, ".lfsconfig")
)
except FileNotFoundError:
Expand Down

0 comments on commit 7ec75c8

Please sign in to comment.