mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
git: fix mypy errors (#5073)
This commit is contained in:
@@ -6,7 +6,7 @@ import shlex
|
||||
from collections import OrderedDict
|
||||
from contextlib import contextmanager
|
||||
from functools import partialmethod
|
||||
from typing import Iterable, Optional
|
||||
from typing import Iterable, List, Optional, Set
|
||||
|
||||
from funcy import cached_property, first
|
||||
from pathspec.patterns import GitWildMatchPattern
|
||||
@@ -38,8 +38,8 @@ class Git(Base):
|
||||
def __init__(
|
||||
self, *args, backends: Optional[Iterable[str]] = None, **kwargs
|
||||
):
|
||||
self.ignored_paths = []
|
||||
self.files_to_track = set()
|
||||
self.ignored_paths: List[str] = []
|
||||
self.files_to_track: Set[str] = set()
|
||||
|
||||
selected = backends if backends else self.DEFAULT_BACKENDS.keys()
|
||||
self.backends = OrderedDict(
|
||||
@@ -248,7 +248,7 @@ class Git(Base):
|
||||
|
||||
self.add(self.files_to_track)
|
||||
|
||||
def track_file(self, path):
|
||||
def track_file(self, path: str):
|
||||
self.files_to_track.add(path)
|
||||
|
||||
def belongs_to_scm(self, path):
|
||||
|
||||
@@ -334,7 +334,7 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
|
||||
raise SCMError("Git failed to push '{src}' to '{url}'") from exc
|
||||
|
||||
def _push_dest_refs(
|
||||
self, src: str, dest: str
|
||||
self, src: Optional[str], dest: str
|
||||
) -> Tuple[Iterable[bytes], Iterable[bytes]]:
|
||||
from dulwich.objects import ZERO_SHA
|
||||
|
||||
|
||||
@@ -408,9 +408,7 @@ class GitPythonBackend(BaseGitBackend): # pylint:disable=abstract-method
|
||||
from git import Reference
|
||||
|
||||
for ref in Reference.iter_items(self.repo, common_path=base):
|
||||
if base and base.endswith("/"):
|
||||
base = base[:-1]
|
||||
yield "/".join([base, ref.name])
|
||||
yield ref.path
|
||||
|
||||
def iter_remote_refs(self, url: str, base: Optional[str] = None):
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user