mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
use system hook for mypy; fix raised issues (#6851)
This commit is contained in:
+7
-12
@@ -1,5 +1,5 @@
|
||||
ci:
|
||||
skip: [pylint, dvc-pre-commit]
|
||||
skip: [mypy, pylint, dvc-pre-commit]
|
||||
|
||||
repos:
|
||||
- hooks:
|
||||
@@ -34,19 +34,14 @@ repos:
|
||||
- flake8-string-format
|
||||
repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.9.2
|
||||
- hooks:
|
||||
- id: mypy
|
||||
language_version: python3
|
||||
files: ^dvc/
|
||||
additional_dependencies:
|
||||
- types-requests
|
||||
- types-paramiko
|
||||
- types-tabulate
|
||||
- types-toml
|
||||
repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: 'v0.910-1'
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: mypy
|
||||
name: mypy
|
||||
entry: mypy
|
||||
files: ^dvc/
|
||||
language: system
|
||||
types: [python]
|
||||
- id: pylint
|
||||
name: pylint
|
||||
entry: pylint
|
||||
|
||||
@@ -85,8 +85,10 @@ def _prompts(keys: Iterable[str], defaults: Dict[str, OptStr]):
|
||||
else:
|
||||
prompt_cls = SkippablePrompt
|
||||
kwargs = {"default": defaults[key]} if key in defaults else {}
|
||||
prompt = PROMPTS.get(key)
|
||||
value = prompt_cls.ask(prompt, console=ui.error_console, **kwargs)
|
||||
prompt = PROMPTS[key]
|
||||
value = prompt_cls.ask( # type: ignore[call-overload]
|
||||
prompt, console=ui.error_console, **kwargs
|
||||
)
|
||||
yield key, value
|
||||
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
|
||||
from .asyncssh_vendor import AsyncSSHVendor
|
||||
|
||||
# monkeypatch dulwich client's default SSH vendor to use asyncssh
|
||||
client.get_ssh_vendor = AsyncSSHVendor
|
||||
client.get_ssh_vendor = AsyncSSHVendor # type: ignore[assignment]
|
||||
|
||||
# Dulwich progress will return messages equivalent to git CLI,
|
||||
# our pbars should just display the messages as formatted by dulwich
|
||||
|
||||
@@ -148,7 +148,8 @@ class GitPythonBackend(BaseGitBackend): # pylint:disable=abstract-method
|
||||
rev: Optional[str] = None,
|
||||
shallow_branch: Optional[str] = None,
|
||||
):
|
||||
import git
|
||||
from git import Repo
|
||||
from git.exc import GitCommandError
|
||||
|
||||
ld_key = "LD_LIBRARY_PATH"
|
||||
|
||||
@@ -170,7 +171,7 @@ class GitPythonBackend(BaseGitBackend): # pylint:disable=abstract-method
|
||||
url = f"file://{url}"
|
||||
with TqdmGit(desc="Cloning", unit="obj") as pbar:
|
||||
clone_from = partial(
|
||||
git.Repo.clone_from,
|
||||
Repo.clone_from,
|
||||
url,
|
||||
to_path,
|
||||
env=env, # needed before we can fix it in __init__
|
||||
@@ -182,7 +183,7 @@ class GitPythonBackend(BaseGitBackend): # pylint:disable=abstract-method
|
||||
else:
|
||||
tmp_repo = clone_from(branch=shallow_branch, depth=1)
|
||||
tmp_repo.close()
|
||||
except git.exc.GitCommandError as exc: # pylint: disable=no-member
|
||||
except GitCommandError as exc: # pylint: disable=no-member
|
||||
raise CloneError(url, to_path) from exc
|
||||
|
||||
# NOTE: using our wrapper to make sure that env is fixed in __init__
|
||||
@@ -191,7 +192,7 @@ class GitPythonBackend(BaseGitBackend): # pylint:disable=abstract-method
|
||||
if rev:
|
||||
try:
|
||||
repo.checkout(rev)
|
||||
except git.exc.GitCommandError as exc: # pylint: disable=no-member
|
||||
except GitCommandError as exc: # pylint: disable=no-member
|
||||
raise RevError(
|
||||
"failed to access revision '{}' for repo '{}'".format(
|
||||
rev, url
|
||||
|
||||
Reference in New Issue
Block a user