summaryrefslogtreecommitdiff
path: root/git/repo/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2021-06-26 10:09:53 +0800
committerGitHub <noreply@github.com>2021-06-26 10:09:53 +0800
commit2d2ff037f9f7a9ae33e5f4f6bdb75b669a1af19a (patch)
tree5f4fd00ad13fa5455dc876ab9cb9cc4f9b66bdfc /git/repo/base.py
parent703280b8c3df6f9b1a5cbe0997b717edbcaa8979 (diff)
parent5d7b8ba9f2e9298496232e4ae66bd904a1d71001 (diff)
downloadgitpython-2d2ff037f9f7a9ae33e5f4f6bdb75b669a1af19a.tar.gz
Merge pull request #1279 from Yobmod/main
Finish typing object, improve verious other types.
Diffstat (limited to 'git/repo/base.py')
-rw-r--r--git/repo/base.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/git/repo/base.py b/git/repo/base.py
index 5abd4961..52727504 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -7,6 +7,7 @@ import logging
import os
import re
import warnings
+from gitdb.db.loose import LooseObjectDB
from gitdb.exc import BadObject
@@ -100,7 +101,7 @@ class Repo(object):
# Subclasses may easily bring in their own custom types by placing a constructor or type here
GitCommandWrapperType = Git
- def __init__(self, path: Optional[PathLike] = None, odbt: Type[GitCmdObjectDB] = GitCmdObjectDB,
+ def __init__(self, path: Optional[PathLike] = None, odbt: Type[LooseObjectDB] = GitCmdObjectDB,
search_parent_directories: bool = False, expand_vars: bool = True) -> None:
"""Create a new Repo instance
@@ -308,7 +309,7 @@ class Repo(object):
return self._bare
@property
- def heads(self) -> 'IterableList':
+ def heads(self) -> 'IterableList[Head]':
"""A list of ``Head`` objects representing the branch heads in
this repo
@@ -316,7 +317,7 @@ class Repo(object):
return Head.list_items(self)
@property
- def references(self) -> 'IterableList':
+ def references(self) -> 'IterableList[Reference]':
"""A list of Reference objects representing tags, heads and remote references.
:return: IterableList(Reference, ...)"""
@@ -341,7 +342,7 @@ class Repo(object):
return HEAD(self, 'HEAD')
@property
- def remotes(self) -> 'IterableList':
+ def remotes(self) -> 'IterableList[Remote]':
"""A list of Remote objects allowing to access and manipulate remotes
:return: ``git.IterableList(Remote, ...)``"""
return Remote.list_items(self)
@@ -357,13 +358,13 @@ class Repo(object):
#{ Submodules
@property
- def submodules(self) -> 'IterableList':
+ def submodules(self) -> 'IterableList[Submodule]':
"""
:return: git.IterableList(Submodule, ...) of direct submodules
available from the current head"""
return Submodule.list_items(self)
- def submodule(self, name: str) -> 'IterableList':
+ def submodule(self, name: str) -> 'Submodule':
""" :return: Submodule with the given name
:raise ValueError: If no such submodule exists"""
try:
@@ -395,7 +396,7 @@ class Repo(object):
#}END submodules
@property
- def tags(self) -> 'IterableList':
+ def tags(self) -> 'IterableList[TagReference]':
"""A list of ``Tag`` objects that are available in this repo
:return: ``git.IterableList(TagReference, ...)`` """
return TagReference.list_items(self)