| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,7 @@ include README.md | |||
| 6 | 6 | include VERSION | |
| 7 | 7 | include requirements.txt | |
| 8 | 8 | include test-requirements.txt | |
| 9 | + include git/py.typed | ||
| 9 | 10 | ||
| 10 | 11 | recursive-include doc * | |
| 11 | 12 | recursive-exclude test * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -342,11 +342,11 @@ def polish_url(cls, url: str, is_cygwin: Literal[False] = ...) -> str: | |||
| 342 | 342 | ||
| 343 | 343 | @overload | |
| 344 | 344 | @classmethod | |
| 345 | - def polish_url(cls, url: PathLike, is_cygwin: Union[None, bool] = None) -> str: | ||
| 345 | + def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None) -> str: | ||
| 346 | 346 | ... | |
| 347 | 347 | ||
| 348 | 348 | @classmethod | |
| 349 | - def polish_url(cls, url: PathLike, is_cygwin: Union[None, bool] = None) -> PathLike: | ||
| 349 | + def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None) -> PathLike: | ||
| 350 | 350 | if is_cygwin is None: | |
| 351 | 351 | is_cygwin = cls.is_cygwin() | |
| 352 | 352 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,8 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | 30 | import configparser as cp | |
| 31 | 31 | ||
| 32 | - from pathlib import Path | ||
| 33 | - | ||
| 34 | 32 | # typing------------------------------------------------------- | |
| 35 | 33 | ||
| 36 | 34 | from typing import Any, Callable, IO, List, Dict, Sequence, TYPE_CHECKING, Tuple, Union, cast, overload | |
@@ -330,7 +328,7 @@ def _acquire_lock(self) -> None: | |||
| 330 | 328 | "Write-ConfigParsers can operate on a single file only, multiple files have been passed") | |
| 331 | 329 | # END single file check | |
| 332 | 330 | ||
| 333 | - if isinstance(self._file_or_files, (str, Path)): # cannot narrow by os._pathlike until 3.5 dropped | ||
| 331 | + if isinstance(self._file_or_files, (str, os.PathLike)): | ||
| 334 | 332 | file_or_files = self._file_or_files | |
| 335 | 333 | else: | |
| 336 | 334 | file_or_files = cast(IO, self._file_or_files).name | |
@@ -696,6 +694,16 @@ def read_only(self) -> bool: | |||
| 696 | 694 | """:return: True if this instance may change the configuration file""" | |
| 697 | 695 | return self._read_only | |
| 698 | 696 | ||
| 697 | + @overload | ||
| 698 | + def get_value(self, section: str, option: str, default: str | ||
| 699 | + ) -> str: | ||
| 700 | + ... | ||
| 701 | + | ||
| 702 | + @overload | ||
| 703 | + def get_value(self, section: str, option: str, default: float | ||
| 704 | + ) -> float: | ||
| 705 | + ... | ||
| 706 | + | ||
| 699 | 707 | def get_value(self, section: str, option: str, default: Union[int, float, str, bool, None] = None | |
| 700 | 708 | ) -> Union[int, float, str, bool]: | |
| 701 | 709 | # can default or return type include bool? | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | # | |
| 4 | 4 | # This module is part of GitPython and is released under | |
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | - from git.refs.reference import Reference | ||
| 6 | + | ||
| 7 | 7 | import glob | |
| 8 | 8 | from io import BytesIO | |
| 9 | 9 | import os | |
@@ -74,6 +74,8 @@ | |||
| 74 | 74 | if TYPE_CHECKING: | |
| 75 | 75 | from subprocess import Popen | |
| 76 | 76 | from git.repo import Repo | |
| 77 | + from git.refs.reference import Reference | ||
| 78 | + from git.util import Actor | ||
| 77 | 79 | ||
| 78 | 80 | ||
| 79 | 81 | StageType = int | |
@@ -966,8 +968,8 @@ def move(self, items: Sequence[Union[PathLike, Blob, BaseIndexEntry, Submodule]] | |||
| 966 | 968 | ||
| 967 | 969 | return out | |
| 968 | 970 | ||
| 969 | - def commit(self, message: str, parent_commits=None, head: bool = True, author: str = None, | ||
| 970 | - committer: str = None, author_date: str = None, commit_date: str = None, | ||
| 971 | + def commit(self, message: str, parent_commits=None, head: bool = True, author: Union[None, 'Actor'] = None, | ||
| 972 | + committer: Union[None, 'Actor'] = None, author_date: str = None, commit_date: str = None, | ||
| 971 | 973 | skip_hooks: bool = False) -> Commit: | |
| 972 | 974 | """Commit the current default index file, creating a commit object. | |
| 973 | 975 | For more information on the arguments, see tree.commit. | |
@@ -1191,7 +1193,7 @@ def handle_stderr(proc: 'Popen[bytes]', iter_checked_out_files: Iterable[PathLik | |||
| 1191 | 1193 | assert "Should not reach this point" | |
| 1192 | 1194 | ||
| 1193 | 1195 | @default_index | |
| 1194 | - def reset(self, commit: Union[Commit, Reference, str] = 'HEAD', working_tree: bool = False, | ||
| 1196 | + def reset(self, commit: Union[Commit, 'Reference', str] = 'HEAD', working_tree: bool = False, | ||
| 1195 | 1197 | paths: Union[None, Iterable[PathLike]] = None, | |
| 1196 | 1198 | head: bool = False, **kwargs: Any) -> 'IndexFile': | |
| 1197 | 1199 | """Reset the index to reflect the tree at the given commit. This will not | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,15 +17,16 @@ | |||
| 17 | 17 | ||
| 18 | 18 | from typing import Any, TYPE_CHECKING, Optional, Union | |
| 19 | 19 | ||
| 20 | - from git.types import PathLike | ||
| 20 | + from git.types import PathLike, Commit_ish | ||
| 21 | 21 | ||
| 22 | 22 | if TYPE_CHECKING: | |
| 23 | 23 | from git.repo import Repo | |
| 24 | 24 | from gitdb.base import OStream | |
| 25 | 25 | from .tree import Tree | |
| 26 | 26 | from .blob import Blob | |
| 27 | - from .tag import TagObject | ||
| 28 | - from .commit import Commit | ||
| 27 | + from .submodule.base import Submodule | ||
| 28 | + | ||
| 29 | + IndexObjUnion = Union['Tree', 'Blob', 'Submodule'] | ||
| 29 | 30 | ||
| 30 | 31 | # -------------------------------------------------------------------------- | |
| 31 | 32 | ||
@@ -71,7 +72,7 @@ def new(cls, repo: 'Repo', id): # @ReservedAssignment | |||
| 71 | 72 | return repo.rev_parse(str(id)) | |
| 72 | 73 | ||
| 73 | 74 | @classmethod | |
| 74 | - def new_from_sha(cls, repo: 'Repo', sha1: bytes) -> Union['Commit', 'TagObject', 'Tree', 'Blob']: | ||
| 75 | + def new_from_sha(cls, repo: 'Repo', sha1: bytes) -> Commit_ish: | ||
| 75 | 76 | """ | |
| 76 | 77 | :return: new object instance of a type appropriate to represent the given | |
| 77 | 78 | binary sha1 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments