From 17f56cf2f635d79620a7da0d537191ac8c644290 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 15 Jun 2024 20:54:40 +0545 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#364) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.4 → v0.4.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.4...v0.4.8) - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.3.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update pyproject.toml --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: skshetry <18718008+skshetry@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 1 + src/scmrepo/git/backend/dulwich/asyncssh_vendor.py | 8 ++++---- src/scmrepo/git/backend/dulwich/client.py | 2 +- src/scmrepo/git/backend/gitpython.py | 2 +- src/scmrepo/git/backend/pygit2/__init__.py | 8 ++++---- src/scmrepo/git/backend/pygit2/callbacks.py | 2 +- src/scmrepo/git/credentials.py | 4 ++-- src/scmrepo/git/lfs/fetch.py | 4 ++-- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b17dc238..c873c5e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,13 +20,13 @@ repos: - id: sort-simple-yaml - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.4.4' + rev: 'v0.4.8' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell additional_dependencies: ["tomli"] diff --git a/pyproject.toml b/pyproject.toml index 9f75ea54..32d509a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -123,6 +123,7 @@ ignore_missing_imports = true [tool.codespell] ignore-words-list = "cachable, keypair" +skip = "CODE_OF_CONDUCT.rst" [tool.ruff] output-format = "full" diff --git a/src/scmrepo/git/backend/dulwich/asyncssh_vendor.py b/src/scmrepo/git/backend/dulwich/asyncssh_vendor.py index 6dea1360..93360441 100644 --- a/src/scmrepo/git/backend/dulwich/asyncssh_vendor.py +++ b/src/scmrepo/git/backend/dulwich/asyncssh_vendor.py @@ -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: @@ -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 ( @@ -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 diff --git a/src/scmrepo/git/backend/dulwich/client.py b/src/scmrepo/git/backend/dulwich/client.py index d0cfc046..16b2cb33 100644 --- a/src/scmrepo/git/backend/dulwich/client.py +++ b/src/scmrepo/git/backend/dulwich/client.py @@ -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, diff --git a/src/scmrepo/git/backend/gitpython.py b/src/scmrepo/git/backend/gitpython.py index 97dd7444..f059b4dd 100644 --- a/src/scmrepo/git/backend/gitpython.py +++ b/src/scmrepo/git/backend/gitpython.py @@ -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": diff --git a/src/scmrepo/git/backend/pygit2/__init__.py b/src/scmrepo/git/backend/pygit2/__init__.py index 06ac2e7e..a3a3faea 100644 --- a/src/scmrepo/git/backend/pygit2/__init__.py +++ b/src/scmrepo/git/backend/pygit2/__init__.py @@ -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) @@ -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("*"): @@ -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, @@ -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: diff --git a/src/scmrepo/git/backend/pygit2/callbacks.py b/src/scmrepo/git/backend/pygit2/callbacks.py index 9f0df78f..b4f38239 100644 --- a/src/scmrepo/git/backend/pygit2/callbacks.py +++ b/src/scmrepo/git/backend/pygit2/callbacks.py @@ -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] = {} diff --git a/src/scmrepo/git/credentials.py b/src/scmrepo/git/credentials.py index c217efcc..72e7cb71 100644 --- a/src/scmrepo/git/credentials.py +++ b/src/scmrepo/git/credentials.py @@ -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] @@ -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): diff --git a/src/scmrepo/git/lfs/fetch.py b/src/scmrepo/git/lfs/fetch.py index bc21a987..cb3aef79 100644 --- a/src/scmrepo/git/lfs/fetch.py +++ b/src/scmrepo/git/lfs/fetch.py @@ -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() @@ -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: