diff options
| author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-18 07:43:53 +0800 |
|---|---|---|
| committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-18 07:43:53 +0800 |
| commit | 21ec529987d10e0010badd37f8da3274167d436f (patch) | |
| tree | a3394cfe902ce7edd07c89420c21c13274a2d295 /git/objects/submodule/util.py | |
| parent | b30720ee4d9762a03eae4fa7cfa4b0190d81784d (diff) | |
| download | gitpython-21ec529987d10e0010badd37f8da3274167d436f.tar.gz | |
Run everything through 'black'
That way people who use it won't be deterred, while it unifies style
everywhere.
Diffstat (limited to 'git/objects/submodule/util.py')
| -rw-r--r-- | git/objects/submodule/util.py | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/git/objects/submodule/util.py b/git/objects/submodule/util.py index cc1cd60a..456ae34b 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,14 @@ 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: @@ -51,12 +58,16 @@ def find_first_remote_branch(remotes: Sequence['Remote'], branch_name: str) -> ' continue # END exception handling # END for remote - raise InvalidGitRepositoryError("Didn't find remote branch '%r' in any of the given remotes" % branch_name) + 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 +81,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 +108,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 |
