summaryrefslogtreecommitdiff
path: root/git/objects/submodule/util.py
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2022-05-18 08:17:32 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2022-05-18 08:17:32 +0800
commit38e9a18b976b2b7e3b3cd0fcd5b037573823d7c2 (patch)
tree8ac0bc1540650cf3befff11735e1421de372fa92 /git/objects/submodule/util.py
parentb30720ee4d9762a03eae4fa7cfa4b0190d81784d (diff)
parent43c00af7e542911cce638cfab49c6a6dc9349e55 (diff)
downloadgitpython-38e9a18b976b2b7e3b3cd0fcd5b037573823d7c2.tar.gz
Merge branch 'black-fmt'
Diffstat (limited to 'git/objects/submodule/util.py')
-rw-r--r--git/objects/submodule/util.py34
1 files changed, 21 insertions, 13 deletions
diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py
index cc1cd60a..56ce1489 100644
--- a/git/objects/submodule/util.py
+++ b/git/objects/submodule/util.py
@@ -20,10 +20,15 @@ if TYPE_CHECKING:
from git.refs import RemoteReference
-__all__ = ('sm_section', 'sm_name', 'mkhead', 'find_first_remote_branch',
- 'SubmoduleConfigParser')
+__all__ = (
+ "sm_section",
+ "sm_name",
+ "mkhead",
+ "find_first_remote_branch",
+ "SubmoduleConfigParser",
+)
-#{ Utilities
+# { Utilities
def sm_section(name: str) -> str:
@@ -37,12 +42,12 @@ def sm_name(section: str) -> str:
return section[11:-1]
-def mkhead(repo: 'Repo', path: PathLike) -> 'Head':
+def mkhead(repo: "Repo", path: PathLike) -> "Head":
""":return: New branch/head instance"""
return git.Head(repo, git.Head.to_full_path(path))
-def find_first_remote_branch(remotes: Sequence['Remote'], branch_name: str) -> 'RemoteReference':
+def find_first_remote_branch(remotes: Sequence["Remote"], branch_name: str) -> "RemoteReference":
"""Find the remote branch matching the name of the given branch or raise InvalidGitRepositoryError"""
for remote in remotes:
try:
@@ -53,10 +58,12 @@ def find_first_remote_branch(remotes: Sequence['Remote'], branch_name: str) -> '
# END for remote
raise InvalidGitRepositoryError("Didn't find remote branch '%r' in any of the given remotes" % branch_name)
-#} END utilities
+# } END utilities
+
+
+# { Classes
-#{ Classes
class SubmoduleConfigParser(GitConfigParser):
@@ -70,13 +77,13 @@ class SubmoduleConfigParser(GitConfigParser):
"""
def __init__(self, *args: Any, **kwargs: Any) -> None:
- self._smref: Union['ReferenceType[Submodule]', None] = None
+ self._smref: Union["ReferenceType[Submodule]", None] = None
self._index = None
self._auto_write = True
super(SubmoduleConfigParser, self).__init__(*args, **kwargs)
- #{ Interface
- def set_submodule(self, submodule: 'Submodule') -> None:
+ # { Interface
+ def set_submodule(self, submodule: "Submodule") -> None:
"""Set this instance's submodule. It must be called before
the first write operation begins"""
self._smref = weakref.ref(submodule)
@@ -97,14 +104,15 @@ class SubmoduleConfigParser(GitConfigParser):
sm._clear_cache()
# END handle weakref
- #} END interface
+ # } END interface
- #{ Overridden Methods
+ # { Overridden Methods
def write(self) -> None: # type: ignore[override]
rval: None = super(SubmoduleConfigParser, self).write()
self.flush_to_index()
return rval
+
# END overridden methods
-#} END classes
+# } END classes