summaryrefslogtreecommitdiff
path: root/git/index/util.py
diff options
context:
space:
mode:
authorYobmod <yobmod@gmail.com>2021-07-06 17:56:24 +0100
committerYobmod <yobmod@gmail.com>2021-07-06 17:56:24 +0100
commit873ebe61431c50bb39afd5cafff498b3e1879342 (patch)
treecda938bf81da0a1dc62bbb2bea0c31067f6b5bc0 /git/index/util.py
parente9858513addf8a4ee69890d46f58c5ef2528a6ab (diff)
downloadgitpython-873ebe61431c50bb39afd5cafff498b3e1879342.tar.gz
Make diff.DiffIndex generic List['Diff']
Diffstat (limited to 'git/index/util.py')
-rw-r--r--git/index/util.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/git/index/util.py b/git/index/util.py
index e0daef0c..3b3d6489 100644
--- a/git/index/util.py
+++ b/git/index/util.py
@@ -52,7 +52,7 @@ class TemporaryFileSwap(object):
#{ Decorators
-def post_clear_cache(func: Callable[..., Any]) -> Callable[..., Any]:
+def post_clear_cache(func: Callable[..., _T]) -> Callable[..., _T]:
"""Decorator for functions that alter the index using the git command. This would
invalidate our possibly existing entries dictionary which is why it must be
deleted to allow it to be lazily reread later.
@@ -63,7 +63,7 @@ def post_clear_cache(func: Callable[..., Any]) -> Callable[..., Any]:
"""
@wraps(func)
- def post_clear_cache_if_not_raised(self, *args: Any, **kwargs: Any) -> Any:
+ def post_clear_cache_if_not_raised(self, *args: Any, **kwargs: Any) -> _T:
rval = func(self, *args, **kwargs)
self._delete_entries_cache()
return rval
@@ -72,13 +72,13 @@ def post_clear_cache(func: Callable[..., Any]) -> Callable[..., Any]:
return post_clear_cache_if_not_raised
-def default_index(func: Callable[..., Any]) -> Callable[..., Any]:
+def default_index(func: Callable[..., _T]) -> Callable[..., _T]:
"""Decorator assuring the wrapped method may only run if we are the default
repository index. This is as we rely on git commands that operate
on that index only. """
@wraps(func)
- def check_default_index(self, *args: Any, **kwargs: Any) -> Any:
+ def check_default_index(self, *args: Any, **kwargs: Any) -> _T:
if self._file_path != self._index_path():
raise AssertionError(
"Cannot call %r on indices that do not represent the default git index" % func.__name__)