git: fix mypy errors (#5073)

This commit is contained in:
Peter Rowlands (변기호)
2020-12-10 18:51:26 +09:00
committed by GitHub
parent e0884df99c
commit 9967d52885
3 changed files with 6 additions and 8 deletions
+4 -4
View File
@@ -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):
+1 -1
View File
@@ -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
+1 -3
View File
@@ -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