diff options
| author | Yobmod <yobmod@gmail.com> | 2021-08-02 17:56:06 +0100 |
|---|---|---|
| committer | Yobmod <yobmod@gmail.com> | 2021-08-02 17:56:06 +0100 |
| commit | 481f672baab666d6e2f81e9288a5f3c42c884a8e (patch) | |
| tree | c88f064fcdfa463c96ebdd0e0d694294b1cfe393 /git/repo | |
| parent | 6470ad4a413fb7fbd9f2d3b9da1720c13ffc92bb (diff) | |
| download | gitpython-481f672baab666d6e2f81e9288a5f3c42c884a8e.tar.gz | |
Add __future__.annotations to repo/base.py
Diffstat (limited to 'git/repo')
| -rw-r--r-- | git/repo/__init__.py | 2 | ||||
| -rw-r--r-- | git/repo/base.py | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/git/repo/__init__.py b/git/repo/__init__.py index 712df60d..23c18db8 100644 --- a/git/repo/__init__.py +++ b/git/repo/__init__.py @@ -1,3 +1,3 @@ """Initialize the Repo package""" # flake8: noqa -from .base import * +from .base import Repo as Repo diff --git a/git/repo/base.py b/git/repo/base.py index 2609bf55..6708872e 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -3,6 +3,7 @@ # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php +from __future__ import annotations import logging import os import re @@ -384,13 +385,13 @@ class Repo(object): :return: created submodules""" return Submodule.add(self, *args, **kwargs) - def iter_submodules(self, *args: Any, **kwargs: Any) -> Iterator: + def iter_submodules(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]: """An iterator yielding Submodule instances, see Traversable interface for a description of args and kwargs :return: Iterator""" return RootModule(self).traverse(*args, **kwargs) - def submodule_update(self, *args: Any, **kwargs: Any) -> Iterator: + def submodule_update(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]: """Update the submodules, keeping the repository consistent as it will take the previous state into consideration. For more information, please see the documentation of RootModule.update""" @@ -774,7 +775,7 @@ class Repo(object): finalize_process(proc) return untracked_files - def ignored(self, *paths: PathLike) -> List[PathLike]: + def ignored(self, *paths: PathLike) -> List[str]: """Checks if paths are ignored via .gitignore Doing so using the "git check-ignore" method. @@ -782,7 +783,7 @@ class Repo(object): :return: subset of those paths which are ignored """ try: - proc = self.git.check_ignore(*paths) + proc: str = self.git.check_ignore(*paths) except GitCommandError: return [] return proc.replace("\\\\", "\\").replace('"', "").split("\n") |
