diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-06 14:55:44 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-06 14:55:44 +0100 |
commit | 35783557c418921641be47f95e12c80d50b20d22 (patch) | |
tree | b86275722e9079594c68ebd8481e5b89dd6b5110 | |
parent | 2a6a2e2e44b6220f4cbc7d1672e0cfb1c13926c2 (diff) | |
download | gitpython-35783557c418921641be47f95e12c80d50b20d22.tar.gz |
Add cast(Repo, mrepo) in try block
-rw-r--r-- | git/objects/submodule/base.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 401ef54e..2ace1f03 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -47,15 +47,15 @@ from .util import ( find_first_remote_branch ) -from git.repo import Repo # typing ---------------------------------------------------------------------- -from typing import Callable, Dict, Mapping, Sequence, TYPE_CHECKING +from typing import Callable, Dict, Mapping, Sequence, TYPE_CHECKING, cast from typing import Any, Iterator, Union from git.types import Commit_ish, PathLike, TBD if TYPE_CHECKING: + from git.repo import Repo from git.index import IndexFile @@ -589,7 +589,8 @@ class Submodule(IndexObject, TraversableIterableObj): if not dry_run: # see whether we have a valid branch to checkout try: - assert isinstance(mrepo, Repo) + # assert isinstance(mrepo, Repo) # cant do this cos of circular import + mrepo = cast('Repo', mrepo) # Try TypeGuard wirh hasattr? # find a remote which has our branch - we try to be flexible remote_branch = find_first_remote_branch(mrepo.remotes, self.branch_name) local_branch = mkhead(mrepo, self.branch_path) |