| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,7 +68,7 @@ | |||
| 68 | 68 | # Documentation | |
| 69 | 69 | ## @{ | |
| 70 | 70 | ||
| 71 | - def handle_process_output(process: subprocess.Popen, | ||
| 71 | + def handle_process_output(process: Union[subprocess.Popen, 'Git.AutoInterrupt'], | ||
| 72 | 72 | stdout_handler: Union[None, | |
| 73 | 73 | Callable[[AnyStr], None], | |
| 74 | 74 | Callable[[List[AnyStr]], None], | |
@@ -77,7 +77,7 @@ def handle_process_output(process: subprocess.Popen, | |||
| 77 | 77 | Callable[[AnyStr], None], | |
| 78 | 78 | Callable[[List[AnyStr]], None]], | |
| 79 | 79 | finalizer: Union[None, | |
| 80 | - Callable[[subprocess.Popen], None]] = None, | ||
| 80 | + Callable[[Union[subprocess.Popen, 'Git.AutoInterrupt']], None]] = None, | ||
| 81 | 81 | decode_streams: bool = True) -> None: | |
| 82 | 82 | """Registers for notifications to learn that process output is ready to read, and dispatches lines to | |
| 83 | 83 | the respective line handlers. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,8 +29,6 @@ | |||
| 29 | 29 | Union, | |
| 30 | 30 | overload, | |
| 31 | 31 | ) | |
| 32 | - from git.types import TBD | ||
| 33 | - | ||
| 34 | 32 | # --------------------------------------------------------------------------- | |
| 35 | 33 | ||
| 36 | 34 | ||
@@ -97,19 +95,3 @@ def win_encode(s: Optional[AnyStr]) -> Optional[bytes]: | |||
| 97 | 95 | elif s is not None: | |
| 98 | 96 | raise TypeError('Expected bytes or text, but got %r' % (s,)) | |
| 99 | 97 | return None | |
| 100 | - | ||
| 101 | - | ||
| 102 | - # type: ignore ## mypy cannot understand dynamic class creation | ||
| 103 | - def with_metaclass(meta: Type[Any], *bases: Any) -> TBD: | ||
| 104 | - """copied from https://github.com/Byron/bcore/blob/master/src/python/butility/future.py#L15""" | ||
| 105 | - | ||
| 106 | - class metaclass(meta): # type: ignore | ||
| 107 | - __call__ = type.__call__ | ||
| 108 | - __init__ = type.__init__ # type: ignore | ||
| 109 | - | ||
| 110 | - def __new__(cls, name: str, nbases: Optional[Tuple[int, ...]], d: Dict[str, Any]) -> TBD: | ||
| 111 | - if nbases is None: | ||
| 112 | - return type.__new__(cls, name, (), d) | ||
| 113 | - return meta(name, bases, d) | ||
| 114 | - | ||
| 115 | - return metaclass(meta.__name__ + 'Helper', None, {}) # type: ignore | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,14 +16,15 @@ | |||
| 16 | 16 | # typing ------------------------------------------------------------------ | |
| 17 | 17 | ||
| 18 | 18 | from typing import Any, Iterator, List, Match, Optional, Tuple, Type, TypeVar, Union, TYPE_CHECKING, cast | |
| 19 | - from git.types import PathLike, TBD, Literal | ||
| 19 | + from git.types import PathLike, Literal | ||
| 20 | 20 | ||
| 21 | 21 | if TYPE_CHECKING: | |
| 22 | 22 | from .objects.tree import Tree | |
| 23 | 23 | from .objects import Commit | |
| 24 | 24 | from git.repo.base import Repo | |
| 25 | 25 | from git.objects.base import IndexObject | |
| 26 | 26 | from subprocess import Popen | |
| 27 | + from git import Git | ||
| 27 | 28 | ||
| 28 | 29 | Lit_change_type = Literal['A', 'D', 'C', 'M', 'R', 'T', 'U'] | |
| 29 | 30 | ||
@@ -442,7 +443,7 @@ def _pick_best_path(cls, path_match: bytes, rename_match: bytes, path_fallback_m | |||
| 442 | 443 | return None | |
| 443 | 444 | ||
| 444 | 445 | @ classmethod | |
| 445 | - def _index_from_patch_format(cls, repo: 'Repo', proc: TBD) -> DiffIndex: | ||
| 446 | + def _index_from_patch_format(cls, repo: 'Repo', proc: Union['Popen', 'Git.AutoInterrupt']) -> DiffIndex: | ||
| 446 | 447 | """Create a new DiffIndex from the given text which must be in patch format | |
| 447 | 448 | :param repo: is the repository we are operating on - it is required | |
| 448 | 449 | :param stream: result of 'git diff' as a stream (supporting file protocol) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,7 +70,7 @@ | |||
| 70 | 70 | from typing import (Any, BinaryIO, Callable, Dict, IO, Iterable, Iterator, List, NoReturn, | |
| 71 | 71 | Sequence, TYPE_CHECKING, Tuple, Type, Union) | |
| 72 | 72 | ||
| 73 | - from git.types import Commit_ish, PathLike, TBD | ||
| 73 | + from git.types import Commit_ish, PathLike | ||
| 74 | 74 | ||
| 75 | 75 | if TYPE_CHECKING: | |
| 76 | 76 | from subprocess import Popen | |
@@ -181,7 +181,7 @@ def _deserialize(self, stream: IO) -> 'IndexFile': | |||
| 181 | 181 | self.version, self.entries, self._extension_data, _conten_sha = read_cache(stream) | |
| 182 | 182 | return self | |
| 183 | 183 | ||
| 184 | - def _entries_sorted(self) -> List[TBD]: | ||
| 184 | + def _entries_sorted(self) -> List[IndexEntry]: | ||
| 185 | 185 | """:return: list of entries, in a sorted fashion, first by path, then by stage""" | |
| 186 | 186 | return sorted(self.entries.values(), key=lambda e: (e.path, e.stage)) | |
| 187 | 187 | ||
@@ -427,8 +427,8 @@ def raise_exc(e: Exception) -> NoReturn: | |||
| 427 | 427 | # END path exception handling | |
| 428 | 428 | # END for each path | |
| 429 | 429 | ||
| 430 | - def _write_path_to_stdin(self, proc: 'Popen', filepath: PathLike, item: TBD, fmakeexc: Callable[..., GitError], | ||
| 431 | - fprogress: Callable[[PathLike, bool, TBD], None], | ||
| 430 | + def _write_path_to_stdin(self, proc: 'Popen', filepath: PathLike, item: PathLike, fmakeexc: Callable[..., GitError], | ||
| 431 | + fprogress: Callable[[PathLike, bool, PathLike], None], | ||
| 432 | 432 | read_from_stdout: bool = True) -> Union[None, str]: | |
| 433 | 433 | """Write path to proc.stdin and make sure it processes the item, including progress. | |
| 434 | 434 | ||
@@ -492,12 +492,13 @@ def unmerged_blobs(self) -> Dict[PathLike, List[Tuple[StageType, Blob]]]: | |||
| 492 | 492 | are at stage 3 will not have a stage 3 entry. | |
| 493 | 493 | """ | |
| 494 | 494 | is_unmerged_blob = lambda t: t[0] != 0 | |
| 495 | - path_map: Dict[PathLike, List[Tuple[TBD, Blob]]] = {} | ||
| 495 | + path_map: Dict[PathLike, List[Tuple[StageType, Blob]]] = {} | ||
| 496 | 496 | for stage, blob in self.iter_blobs(is_unmerged_blob): | |
| 497 | 497 | path_map.setdefault(blob.path, []).append((stage, blob)) | |
| 498 | 498 | # END for each unmerged blob | |
| 499 | 499 | for line in path_map.values(): | |
| 500 | 500 | line.sort() | |
| 501 | + | ||
| 501 | 502 | return path_map | |
| 502 | 503 | ||
| 503 | 504 | @ classmethod | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -379,6 +379,7 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No | |||
| 379 | 379 | :return: The newly created submodule instance | |
| 380 | 380 | :note: works atomically, such that no change will be done if the repository | |
| 381 | 381 | update fails for instance""" | |
| 382 | + | ||
| 382 | 383 | if repo.bare: | |
| 383 | 384 | raise InvalidGitRepositoryError("Cannot add submodules to bare repositories") | |
| 384 | 385 | # END handle bare repos | |
@@ -434,7 +435,7 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No | |||
| 434 | 435 | url = urls[0] | |
| 435 | 436 | else: | |
| 436 | 437 | # clone new repo | |
| 437 | - kwargs: Dict[str, Union[bool, int, Sequence[TBD]]] = {'n': no_checkout} | ||
| 438 | + kwargs: Dict[str, Union[bool, int, str, Sequence[TBD]]] = {'n': no_checkout} | ||
| 438 | 439 | if not branch_is_default: | |
| 439 | 440 | kwargs['b'] = br.name | |
| 440 | 441 | # END setup checkout-branch | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ | |||
| 8 | 8 | # typing ------------------------------------------------------------------ | |
| 9 | 9 | ||
| 10 | 10 | from typing import Any, Callable, Iterator, Type, Union, TYPE_CHECKING # NOQA | |
| 11 | - from git.types import Commit_ish, PathLike, TBD, Literal, _T # NOQA | ||
| 11 | + from git.types import Commit_ish, PathLike, _T # NOQA | ||
| 12 | 12 | ||
| 13 | 13 | if TYPE_CHECKING: | |
| 14 | 14 | from git.repo import Repo | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,8 +21,8 @@ | |||
| 21 | 21 | ||
| 22 | 22 | # typing ------------------------------------------------------------------ | |
| 23 | 23 | ||
| 24 | - from typing import Any, Iterator, List, Match, Optional, Tuple, Type, TypeVar, Union, TYPE_CHECKING, cast # NOQA | ||
| 25 | - from git.types import Commit_ish, PathLike, TBD, Literal # NOQA | ||
| 24 | + from typing import Any, Iterator, List, Tuple, Type, TypeVar, Union, TYPE_CHECKING, cast # NOQA | ||
| 25 | + from git.types import Commit_ish, PathLike # NOQA | ||
| 26 | 26 | ||
| 27 | 27 | if TYPE_CHECKING: | |
| 28 | 28 | from git.repo import Repo | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,6 +38,7 @@ | |||
| 38 | 38 | from git.remote import Remote | |
| 39 | 39 | from git.repo.base import Repo | |
| 40 | 40 | from git.config import GitConfigParser, SectionConstraint | |
| 41 | + from git import Git | ||
| 41 | 42 | # from git.objects.base import IndexObject | |
| 42 | 43 | ||
| 43 | 44 | ||
@@ -379,7 +380,7 @@ def get_user_id() -> str: | |||
| 379 | 380 | return "%s@%s" % (getpass.getuser(), platform.node()) | |
| 380 | 381 | ||
| 381 | 382 | ||
| 382 | - def finalize_process(proc: subprocess.Popen, **kwargs: Any) -> None: | ||
| 383 | + def finalize_process(proc: Union[subprocess.Popen, 'Git.AutoInterrupt'], **kwargs: Any) -> None: | ||
| 383 | 384 | """Wait for the process (clone, fetch, pull or push) and handle its errors accordingly""" | |
| 384 | 385 | # TODO: No close proc-streams?? | |
| 385 | 386 | proc.wait(**kwargs) | |
@@ -1033,7 +1034,7 @@ def __delitem__(self, index: Union[SupportsIndex, int, slice, str]) -> None: | |||
| 1033 | 1034 | ||
| 1034 | 1035 | class IterableClassWatcher(type): | |
| 1035 | 1036 | """ Metaclass that watches """ | |
| 1036 | - def __init__(cls, name: str, bases: List, clsdict: Dict) -> None: | ||
| 1037 | + def __init__(cls, name: str, bases: Tuple, clsdict: Dict) -> None: | ||
| 1037 | 1038 | for base in bases: | |
| 1038 | 1039 | if type(base) == IterableClassWatcher: | |
| 1039 | 1040 | warnings.warn(f"GitPython Iterable subclassed by {name}. " | |
| Back | FazBrowse Home | New Git URL |
0 commit comments