| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -410,7 +410,7 @@ def raise_exc(e): | |||
| 410 | 410 | # whose name contains wildcard characters. | |
| 411 | 411 | if abs_path not in resolved_paths: | |
| 412 | 412 | for f in self._iter_expand_paths(glob.glob(abs_path)): | |
| 413 | - yield f.replace(rs, '') | ||
| 413 | + yield str(f).replace(rs, '') | ||
| 414 | 414 | continue | |
| 415 | 415 | # END glob handling | |
| 416 | 416 | try: | |
@@ -635,7 +635,7 @@ def _store_path(self, filepath: PathLike, fprogress: Callable) -> BaseIndexEntry | |||
| 635 | 635 | @git_working_dir | |
| 636 | 636 | def _entries_for_paths(self, paths: List[str], path_rewriter: Callable, fprogress: Callable, | |
| 637 | 637 | entries: List[BaseIndexEntry]) -> List[BaseIndexEntry]: | |
| 638 | - entries_added = [] # type: List[BaseIndexEntry] | ||
| 638 | + entries_added: List[BaseIndexEntry] = [] | ||
| 639 | 639 | if path_rewriter: | |
| 640 | 640 | for path in paths: | |
| 641 | 641 | if osp.isabs(path): | |
@@ -769,7 +769,7 @@ def add(self, items: Sequence[Union[PathLike, Blob, BaseIndexEntry, Submodule]], | |||
| 769 | 769 | # automatically | |
| 770 | 770 | # paths can be git-added, for everything else we use git-update-index | |
| 771 | 771 | paths, entries = self._preprocess_add_items(items) | |
| 772 | - entries_added = [] | ||
| 772 | + entries_added: List[BaseIndexEntry] = [] | ||
| 773 | 773 | # This code needs a working tree, therefore we try not to run it unless required. | |
| 774 | 774 | # That way, we are OK on a bare repository as well. | |
| 775 | 775 | # If there are no paths, the rewriter has nothing to do either | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | 14 | from typing import (Any, Callable) | |
| 15 | 15 | ||
| 16 | - from git.types import PathLike | ||
| 16 | + from git.types import PathLike, _T | ||
| 17 | 17 | ||
| 18 | 18 | # --------------------------------------------------------------------------------- | |
| 19 | 19 | ||
@@ -88,12 +88,12 @@ def check_default_index(self, *args: Any, **kwargs: Any) -> Any: | |||
| 88 | 88 | return check_default_index | |
| 89 | 89 | ||
| 90 | 90 | ||
| 91 | - def git_working_dir(func: Callable[..., Any]) -> Callable[..., None]: | ||
| 91 | + def git_working_dir(func: Callable[..., _T]) -> Callable[..., _T]: | ||
| 92 | 92 | """Decorator which changes the current working dir to the one of the git | |
| 93 | 93 | repository in order to assure relative paths are handled correctly""" | |
| 94 | 94 | ||
| 95 | 95 | @wraps(func) | |
| 96 | - def set_git_working_dir(self, *args: Any, **kwargs: Any) -> None: | ||
| 96 | + def set_git_working_dir(self, *args: Any, **kwargs: Any) -> _T: | ||
| 97 | 97 | cur_wd = os.getcwd() | |
| 98 | 98 | os.chdir(self.repo.working_tree_dir) | |
| 99 | 99 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,7 @@ | |||
| 30 | 30 | # from git.refs import SymbolicReference | |
| 31 | 31 | ||
| 32 | 32 | TBD = Any | |
| 33 | + _T = TypeVar('_T') | ||
| 33 | 34 | ||
| 34 | 35 | Tree_ish = Union['Commit', 'Tree'] | |
| 35 | 36 | Commit_ish = Union['Commit', 'TagObject', 'Blob', 'Tree'] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments