diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-19 19:10:45 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-19 19:10:45 +0100 |
commit | 9e5e969479ec6018e1ba06b95bcdefca5b0082a4 (patch) | |
tree | 574e03c6c4acd1067e3b285974651ec9e9529a49 /git | |
parent | 9a587e14d509cc77bf47b9591d1def3e5a1df570 (diff) | |
download | gitpython-9e5e969479ec6018e1ba06b95bcdefca5b0082a4.tar.gz |
Change remaining type comments to py3.6+ types
Diffstat (limited to 'git')
-rw-r--r-- | git/cmd.py | 16 | ||||
-rw-r--r-- | git/compat.py | 2 | ||||
-rw-r--r-- | git/config.py | 18 | ||||
-rw-r--r-- | git/diff.py | 6 | ||||
-rw-r--r-- | git/index/base.py | 24 | ||||
-rw-r--r-- | git/index/fun.py | 10 | ||||
-rw-r--r-- | git/objects/submodule/base.py | 3 | ||||
-rw-r--r-- | git/objects/tag.py | 4 | ||||
-rw-r--r-- | git/objects/tree.py | 2 | ||||
-rw-r--r-- | git/objects/util.py | 6 | ||||
-rw-r--r-- | git/refs/tag.py | 2 | ||||
-rw-r--r-- | git/remote.py | 12 | ||||
-rw-r--r-- | git/repo/base.py | 20 | ||||
-rw-r--r-- | git/repo/fun.py | 9 | ||||
-rw-r--r-- | git/util.py | 14 |
15 files changed, 76 insertions, 72 deletions
@@ -565,11 +565,11 @@ class Git(LazyMixin): .git directory in case of bare repositories.""" super(Git, self).__init__() self._working_dir = expand_path(working_dir) - self._git_options = () # type: Union[List[str], Tuple[str, ...]] - self._persistent_git_options = [] # type: List[str] + self._git_options: Union[List[str], Tuple[str, ...]] = () + self._persistent_git_options: List[str] = [] # Extra environment variables to pass to git commands - self._environment = {} # type: Dict[str, str] + self._environment: Dict[str, str] = {} # cached command slots self.cat_file_header = None @@ -603,9 +603,9 @@ class Git(LazyMixin): process_version = self._call_process('version') # should be as default *args and **kwargs used version_numbers = process_version.split(' ')[2] - self._version_info = tuple( + self._version_info: Tuple[int, int, int, int] = tuple( int(n) for n in version_numbers.split('.')[:4] if n.isdigit() - ) # type: Tuple[int, int, int, int] # type: ignore + ) # type: ignore # use typeguard here else: super(Git, self)._set_cache_(attr) # END handle version info @@ -868,8 +868,8 @@ class Git(LazyMixin): # Wait for the process to return status = 0 - stdout_value = b'' # type: Union[str, bytes] - stderr_value = b'' # type: Union[str, bytes] + stdout_value: Union[str, bytes] = b'' + stderr_value: Union[str, bytes] = b'' newline = "\n" if universal_newlines else b"\n" try: if output_stream is None: @@ -1145,7 +1145,7 @@ class Git(LazyMixin): # required for command to separate refs on stdin, as bytes if isinstance(ref, bytes): # Assume 40 bytes hexsha - bin-to-ascii for some reason returns bytes, not text - refstr = ref.decode('ascii') # type: str + refstr: str = ref.decode('ascii') elif not isinstance(ref, str): refstr = str(ref) # could be ref-object else: diff --git a/git/compat.py b/git/compat.py index 187618a2..7a0a15d2 100644 --- a/git/compat.py +++ b/git/compat.py @@ -34,7 +34,7 @@ from git.types import TBD # --------------------------------------------------------------------------- -is_win = (os.name == 'nt') # type: bool +is_win: bool = (os.name == 'nt') is_posix = (os.name == 'posix') is_darwin = (os.name == 'darwin') defenc = sys.getfilesystemencoding() diff --git a/git/config.py b/git/config.py index e0a18ec8..345cb40e 100644 --- a/git/config.py +++ b/git/config.py @@ -208,7 +208,7 @@ class _OMD(OrderedDict): def getall(self, key: str) -> Any: return super(_OMD, self).__getitem__(key) - def items(self) -> List[Tuple[str, Any]]: # type: ignore ## mypy doesn't like overwriting supertype signitures + def items(self) -> List[Tuple[str, Any]]: # type: ignore[override] """List of (key, last value for key).""" return [(k, self[k]) for k in self] @@ -322,7 +322,7 @@ class GitConfigParser(with_metaclass(MetaParserBuilder, cp.RawConfigParser)): # self._is_initialized = False self._merge_includes = merge_includes self._repo = repo - self._lock = None # type: Union['LockFile', None] + self._lock: Union['LockFile', None] = None self._acquire_lock() def _acquire_lock(self) -> None: @@ -545,13 +545,15 @@ class GitConfigParser(with_metaclass(MetaParserBuilder, cp.RawConfigParser)): # return None self._is_initialized = True - files_to_read = [""] # type: List[Union[PathLike, IO]] ## just for types until 3.5 dropped - if isinstance(self._file_or_files, (str)): # replace with PathLike once 3.5 dropped - files_to_read = [self._file_or_files] # for str, as str is a type of Sequence + files_to_read: List[Union[PathLike, IO]] = [""] + if isinstance(self._file_or_files, (str, os.PathLike)): + # for str or Path, as str is a type of Sequence + files_to_read = [self._file_or_files] elif not isinstance(self._file_or_files, (tuple, list, Sequence)): - files_to_read = [self._file_or_files] # for IO or Path - else: - files_to_read = list(self._file_or_files) # for lists or tuples + # could merge with above isinstance once runtime type known + files_to_read = [self._file_or_files] + else: # for lists or tuples + files_to_read = list(self._file_or_files) # end assure we have a copy of the paths to handle seen = set(files_to_read) diff --git a/git/diff.py b/git/diff.py index f8c0c25f..98a5cfd9 100644 --- a/git/diff.py +++ b/git/diff.py @@ -351,13 +351,13 @@ class Diff(object): return hash(tuple(getattr(self, n) for n in self.__slots__)) def __str__(self) -> str: - h = "%s" # type: str + h: str = "%s" if self.a_blob: h %= self.a_blob.path elif self.b_blob: h %= self.b_blob.path - msg = '' # type: str + msg: str = '' line = None # temp line line_length = 0 # line length for b, n in zip((self.a_blob, self.b_blob), ('lhs', 'rhs')): @@ -449,7 +449,7 @@ class Diff(object): :return: git.DiffIndex """ ## FIXME: Here SLURPING raw, need to re-phrase header-regexes linewise. - text_list = [] # type: List[bytes] + text_list: List[bytes] = [] handle_process_output(proc, text_list.append, None, finalize_process, decode_streams=False) # for now, we have to bake the stream diff --git a/git/index/base.py b/git/index/base.py index 220bdc85..6452419c 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -123,7 +123,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): self.repo = repo self.version = self._VERSION self._extension_data = b'' - self._file_path = file_path or self._index_path() # type: PathLike + self._file_path: PathLike = file_path or self._index_path() def _set_cache_(self, attr: str) -> None: if attr == "entries": @@ -136,7 +136,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): ok = True except OSError: # in new repositories, there may be no index, which means we are empty - self.entries = {} # type: Dict[Tuple[PathLike, StageType], IndexEntry] + self.entries: Dict[Tuple[PathLike, StageType], IndexEntry] = {} return None finally: if not ok: @@ -266,7 +266,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): # -i : ignore working tree status # --aggressive : handle more merge cases # -m : do an actual merge - args = ["--aggressive", "-i", "-m"] # type: List[Union[Treeish, str]] + args: List[Union[Treeish, str]] = ["--aggressive", "-i", "-m"] if base is not None: args.append(base) args.append(rhs) @@ -288,14 +288,14 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): New IndexFile instance. Its path will be undefined. If you intend to write such a merged Index, supply an alternate file_path to its 'write' method.""" - tree_sha_bytes = [to_bin_sha(str(t)) for t in tree_sha] # List[bytes] + tree_sha_bytes: List[bytes] = [to_bin_sha(str(t)) for t in tree_sha] base_entries = aggressive_tree_merge(repo.odb, tree_sha_bytes) inst = cls(repo) # convert to entries dict - entries = dict(zip( + entries: Dict[Tuple[PathLike, int], IndexEntry] = dict(zip( ((e.path, e.stage) for e in base_entries), - (IndexEntry.from_base(e) for e in base_entries))) # type: Dict[Tuple[PathLike, int], IndexEntry] + (IndexEntry.from_base(e) for e in base_entries))) inst.entries = entries return inst @@ -338,7 +338,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): if len(treeish) == 0 or len(treeish) > 3: raise ValueError("Please specify between 1 and 3 treeish, got %i" % len(treeish)) - arg_list = [] # type: List[Union[Treeish, str]] + arg_list: List[Union[Treeish, str]] = [] # ignore that working tree and index possibly are out of date if len(treeish) > 1: # drop unmerged entries when reading our index and merging @@ -445,7 +445,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): we will close stdin to break the pipe.""" fprogress(filepath, False, item) - rval = None # type: Union[None, str] + rval: Union[None, str] = None if proc.stdin is not None: try: @@ -492,7 +492,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): are at stage 3 will not have a stage 3 entry. """ is_unmerged_blob = lambda t: t[0] != 0 - path_map = {} # type: Dict[PathLike, List[Tuple[TBD, Blob]]] + path_map: Dict[PathLike, List[Tuple[TBD, Blob]]] = {} for stage, blob in self.iter_blobs(is_unmerged_blob): path_map.setdefault(blob.path, []).append((stage, blob)) # END for each unmerged blob @@ -624,8 +624,8 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): st = os.lstat(filepath) # handles non-symlinks as well if S_ISLNK(st.st_mode): # in PY3, readlink is string, but we need bytes. In PY2, it's just OS encoded bytes, we assume UTF-8 - open_stream = lambda: BytesIO(force_bytes(os.readlink(filepath), - encoding=defenc)) # type: Callable[[], BinaryIO] + open_stream: Callable[[], BinaryIO] = lambda: BytesIO(force_bytes(os.readlink(filepath), + encoding=defenc)) else: open_stream = lambda: open(filepath, 'rb') with open_stream() as stream: @@ -1160,7 +1160,7 @@ class IndexFile(LazyMixin, git_diff.Diffable, Serializable): proc = self.repo.git.checkout_index(args, **kwargs) # FIXME: Reading from GIL! make_exc = lambda: GitCommandError(("git-checkout-index",) + tuple(args), 128, proc.stderr.read()) - checked_out_files = [] # type: List[PathLike] + checked_out_files: List[PathLike] = [] for path in paths: co_path = to_native_path_linux(self._to_relative_path(path)) diff --git a/git/index/fun.py b/git/index/fun.py index e5e566a0..e071e15c 100644 --- a/git/index/fun.py +++ b/git/index/fun.py @@ -99,8 +99,8 @@ def run_commit_hook(name: str, index: 'IndexFile', *args: str) -> None: except Exception as ex: raise HookExecutionError(hp, ex) from ex else: - stdout_list = [] # type: List[str] - stderr_list = [] # type: List[str] + stdout_list: List[str] = [] + stderr_list: List[str] = [] handle_process_output(cmd, stdout_list.append, stderr_list.append, finalize_process) stdout = ''.join(stdout_list) stderr = ''.join(stderr_list) @@ -151,8 +151,8 @@ def write_cache(entries: Sequence[Union[BaseIndexEntry, 'IndexEntry']], stream: beginoffset = tell() write(entry[4]) # ctime write(entry[5]) # mtime - path_str = entry[3] # type: str - path = force_bytes(path_str, encoding=defenc) + path_str: str = entry[3] + path: bytes = force_bytes(path_str, encoding=defenc) plen = len(path) & CE_NAMEMASK # path length assert plen == len(path), "Path %s too long to fit into index" % entry[3] flags = plen | (entry[2] & CE_NAMEMASK_INV) # clear possible previous values @@ -210,7 +210,7 @@ def read_cache(stream: IO[bytes]) -> Tuple[int, Dict[Tuple[PathLike, int], 'Inde * content_sha is a 20 byte sha on all cache file contents""" version, num_entries = read_header(stream) count = 0 - entries = {} # type: Dict[Tuple[PathLike, int], 'IndexEntry'] + entries: Dict[Tuple[PathLike, int], 'IndexEntry'] = {} read = stream.read tell = stream.tell diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 21cfcd5a..d5ba118f 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -475,7 +475,8 @@ class Submodule(IndexObject, TraversableIterableObj): sm._branch_path = br.path # we deliberately assume that our head matches our index ! - sm.binsha = mrepo.head.commit.binsha # type: ignore + if mrepo: + sm.binsha = mrepo.head.commit.binsha index.add([sm], write=True) return sm diff --git a/git/objects/tag.py b/git/objects/tag.py index 4a2fcb0d..7048eb40 100644 --- a/git/objects/tag.py +++ b/git/objects/tag.py @@ -51,7 +51,7 @@ class TagObject(base.Object): authored_date is in, in a format similar to time.altzone""" super(TagObject, self).__init__(repo, binsha) if object is not None: - self.object = object # type: Union['Commit', 'Blob', 'Tree', 'TagObject'] + self.object: Union['Commit', 'Blob', 'Tree', 'TagObject'] = object if tag is not None: self.tag = tag if tagger is not None: @@ -67,7 +67,7 @@ class TagObject(base.Object): """Cache all our attributes at once""" if attr in TagObject.__slots__: ostream = self.repo.odb.stream(self.binsha) - lines = ostream.read().decode(defenc, 'replace').splitlines() # type: List[str] + lines: List[str] = ostream.read().decode(defenc, 'replace').splitlines() _obj, hexsha = lines[0].split(" ") _type_token, type_name = lines[1].split(" ") diff --git a/git/objects/tree.py b/git/objects/tree.py index 0e3f44b9..dd1fe783 100644 --- a/git/objects/tree.py +++ b/git/objects/tree.py @@ -298,7 +298,7 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable): See the ``TreeModifier`` for more information on how to alter the cache""" return TreeModifier(self._cache) - def traverse(self, # type: ignore # overrides super() + def traverse(self, # type: ignore[override] predicate: Callable[[Union[IndexObjUnion, TraversedTreeTup], int], bool] = lambda i, d: True, prune: Callable[[Union[IndexObjUnion, TraversedTreeTup], int], bool] = lambda i, d: False, depth: int = -1, diff --git a/git/objects/util.py b/git/objects/util.py index 04af3b83..ef1ae77b 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -285,7 +285,7 @@ class ProcessStreamAdapter(object): def __init__(self, process: 'Popen', stream_name: str) -> None: self._proc = process - self._stream = getattr(process, stream_name) # type: StringIO ## guess + self._stream: StringIO = getattr(process, stream_name) # guessed type def __getattr__(self, attr: str) -> Any: return getattr(self._stream, attr) @@ -356,7 +356,7 @@ class Traversable(Protocol): return out_list @ abstractmethod - def traverse(self, *args: Any, **kwargs) -> Any: + def traverse(self, *args: Any, **kwargs: Any) -> Any: """ """ warnings.warn("traverse() method should only be called from subclasses." "Calling from Traversable abstract class will raise NotImplementedError in 3.1.20" @@ -414,7 +414,7 @@ class Traversable(Protocol): ignore_self=False is_edge=False -> Iterator[Tuple[src, item]]""" visited = set() - stack = deque() # type: Deque[TraverseNT] + stack: Deque[TraverseNT] = deque() stack.append(TraverseNT(0, self, None)) # self is always depth level 0 def addToStack(stack: Deque[TraverseNT], diff --git a/git/refs/tag.py b/git/refs/tag.py index aa3b82a2..281ce09a 100644 --- a/git/refs/tag.py +++ b/git/refs/tag.py @@ -35,7 +35,7 @@ class TagReference(Reference): _common_path_default = Reference._common_path_default + "/" + _common_default @property - def commit(self) -> 'Commit': # type: ignore[override] # LazyMixin has unrelated + def commit(self) -> 'Commit': # type: ignore[override] # LazyMixin has unrelated comit method """:return: Commit object the tag ref points to :raise ValueError: if the tag points to a tree or blob""" diff --git a/git/remote.py b/git/remote.py index 0fcd49b5..d903552f 100644 --- a/git/remote.py +++ b/git/remote.py @@ -193,7 +193,7 @@ class PushInfo(IterableObj, object): # from_to handling from_ref_string, to_ref_string = from_to.split(':') if flags & cls.DELETED: - from_ref = None # type: Union[SymbolicReference, None] + from_ref: Union[SymbolicReference, None] = None else: if from_ref_string == "(delete)": from_ref = None @@ -201,7 +201,7 @@ class PushInfo(IterableObj, object): from_ref = Reference.from_path(remote.repo, from_ref_string) # commit handling, could be message or commit info - old_commit = None # type: Optional[str] + old_commit: Optional[str] = None if summary.startswith('['): if "[rejected]" in summary: flags |= cls.REJECTED @@ -259,14 +259,14 @@ class FetchInfo(IterableObj, object): _re_fetch_result = re.compile(r'^\s*(.) (\[?[\w\s\.$@]+\]?)\s+(.+) -> ([^\s]+)( \(.*\)?$)?') - _flag_map = { + _flag_map: Dict[flagKeyLiteral, int] = { '!': ERROR, '+': FORCED_UPDATE, '*': 0, '=': HEAD_UPTODATE, ' ': FAST_FORWARD, '-': TAG_UPDATE, - } # type: Dict[flagKeyLiteral, int] + } @ classmethod def refresh(cls) -> Literal[True]: @@ -359,7 +359,7 @@ class FetchInfo(IterableObj, object): # END control char exception handling # parse operation string for more info - makes no sense for symbolic refs, but we parse it anyway - old_commit = None # type: Union[Commit_ish, None] + old_commit: Union[Commit_ish, None] = None is_tag_operation = False if 'rejected' in operation: flags |= cls.REJECTED @@ -846,7 +846,7 @@ class Remote(LazyMixin, IterableObj): kwargs = add_progress(kwargs, self.repo.git, progress) if isinstance(refspec, list): - args = refspec # type: Sequence[Optional[str]] # should need this - check logic for passing None through + args: Sequence[Optional[str]] = refspec else: args = [refspec] diff --git a/git/repo/base.py b/git/repo/base.py index 29d08502..64f32bd3 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -83,10 +83,10 @@ class Repo(object): DAEMON_EXPORT_FILE = 'git-daemon-export-ok' git = cast('Git', None) # Must exist, or __del__ will fail in case we raise on `__init__()` - working_dir = None # type: Optional[PathLike] - _working_tree_dir = None # type: Optional[PathLike] - git_dir = "" # type: PathLike - _common_dir = "" # type: PathLike + working_dir: Optional[PathLike] = None + _working_tree_dir: Optional[PathLike] = None + git_dir: PathLike = "" + _common_dir: PathLike = "" # precompiled regex re_whitespace = re.compile(r'\s+') @@ -221,7 +221,7 @@ class Repo(object): self._working_tree_dir = None # END working dir handling - self.working_dir = self._working_tree_dir or self.common_dir # type: Optional[PathLike] + self.working_dir: Optional[PathLike] = self._working_tree_dir or self.common_dir self.git = self.GitCommandWrapperType(self.working_dir) # special handling, in special times @@ -591,7 +591,7 @@ class Repo(object): raise ValueError("Please specify at least two revs, got only %i" % len(rev)) # end handle input - res = [] # type: List[Union[Commit_ish, None]] + res: List[Union[Commit_ish, None]] = [] try: lines = self.git.merge_base(*rev, **kwargs).splitlines() # List[str] except GitCommandError as err: @@ -813,7 +813,7 @@ class Repo(object): line = next(stream) # when exhausted, causes a StopIteration, terminating this function except StopIteration: return - split_line = line.split() # type: Tuple[str, str, str, str] + split_line: Tuple[str, str, str, str] = line.split() hexsha, orig_lineno_str, lineno_str, num_lines_str = split_line lineno = int(lineno_str) num_lines = int(num_lines_str) @@ -879,10 +879,10 @@ class Repo(object): return self.blame_incremental(rev, file, **kwargs) data = self.git.blame(rev, '--', file, p=True, stdout_as_string=False, **kwargs) - commits = {} # type: Dict[str, Any] - blames = [] # type: List[List[Union[Optional['Commit'], List[str]]]] + commits: Dict[str, TBD] = {} + blames: List[List[Union[Optional['Commit'], List[str]]]] = [] - info = {} # type: Dict[str, Any] # use Any until TypedDict available + info: Dict[str, TBD] = {} # use Any until TypedDict available keepends = True for line in data.splitlines(keepends): diff --git a/git/repo/fun.py b/git/repo/fun.py index e96b62e0..a20e2ecb 100644 --- a/git/repo/fun.py +++ b/git/repo/fun.py @@ -1,5 +1,4 @@ """Package with general repository related functions""" -from git.refs.tag import Tag import os import stat from string import digits @@ -19,11 +18,13 @@ from git.cmd import Git # Typing ---------------------------------------------------------------------- from typing import Union, Optional, cast, TYPE_CHECKING -from git.types import PathLike + if TYPE_CHECKING: + from git.types import PathLike from .base import Repo from git.db import GitCmdObjectDB from git.objects import Commit, TagObject, Blob, Tree + from git.refs.tag import Tag # ---------------------------------------------------------------------------- @@ -122,7 +123,7 @@ def name_to_object(repo: 'Repo', name: str, return_ref: bool = False :param return_ref: if name specifies a reference, we will return the reference instead of the object. Otherwise it will raise BadObject or BadName """ - hexsha = None # type: Union[None, str, bytes] + hexsha: Union[None, str, bytes] = None # is it a hexsha ? Try the most common ones, which is 7 to 40 if repo.re_hexsha_shortened.match(name): @@ -162,7 +163,7 @@ def name_to_object(repo: 'Repo', name: str, return_ref: bool = False return Object.new_from_sha(repo, hex_to_bin(hexsha)) -def deref_tag(tag: Tag) -> 'TagObject': +def deref_tag(tag: 'Tag') -> 'TagObject': """Recursively dereference a tag and return the resulting object""" while True: try: diff --git a/git/util.py b/git/util.py index c04e2927..c0c0ecb7 100644 --- a/git/util.py +++ b/git/util.py @@ -267,7 +267,7 @@ def _cygexpath(drive: Optional[str], path: str) -> str: return p_str.replace('\\', '/') -_cygpath_parsers = ( +_cygpath_parsers: Tuple[Tuple[Pattern[str], Callable, bool], ...] = ( # See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx # and: https://www.cygwin.com/cygwin-ug-net/using.html#unc-paths (re.compile(r"\\\\\?\\UNC\\([^\\]+)\\([^\\]+)(?:\\(.*))?"), @@ -294,7 +294,7 @@ _cygpath_parsers = ( (lambda url: url), False ), -) # type: Tuple[Tuple[Pattern[str], Callable, bool], ...] +) def cygpath(path: str) -> str: @@ -330,7 +330,7 @@ def decygpath(path: PathLike) -> str: #: Store boolean flags denoting if a specific Git executable #: is from a Cygwin installation (since `cache_lru()` unsupported on PY2). -_is_cygwin_cache = {} # type: Dict[str, Optional[bool]] +_is_cygwin_cache: Dict[str, Optional[bool]] = {} @overload @@ -462,10 +462,10 @@ class RemoteProgress(object): re_op_relative = re.compile(r"(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)") def __init__(self) -> None: - self._seen_ops = [] # type: List[int] - self._cur_line = None # type: Optional[str] - self.error_lines = [] # type: List[str] - self.other_lines = [] # type: List[str] + self._seen_ops: List[int] = [] + self._cur_line: Optional[str] = None + self.error_lines: List[str] = [] + self.other_lines: List[str] = [] def _parse_progress_line(self, line: AnyStr) -> None: """Parse progress information from the given line as retrieved by git-push |