Skip to content

Commit eecf148

Browse files
committed
Rmv root.py types
1 parent ed58e2f commit eecf148

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

‎git/objects/submodule/base.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ def set_parent_commit(self, commit: Union[Commit_ish, None], check: bool = True)
10151015
# If check is False, we might see a parent-commit that doesn't even contain the submodule anymore.
10161016
# in that case, mark our sha as being NULL
10171017
try:
1018-
self.binsha=pctree[self.path].binsha# type: ignore # str()?
1018+
self.binsha=pctree[str(self.path)].binsha
10191019
exceptKeyError:
10201020
self.binsha=self.NULL_BIN_SHA
10211021
# end
@@ -1080,7 +1080,7 @@ def rename(self, new_name: str) -> 'Submodule':
10801080
destination_module_abspath=self._module_abspath(self.repo, self.path, new_name)
10811081
source_dir=mod.git_dir
10821082
# Let's be sure the submodule name is not so obviously tied to a directory
1083-
ifdestination_module_abspath.startswith(str(mod.git_dir)):# type: ignore # str()?
1083+
ifstr(destination_module_abspath).startswith(str(mod.git_dir)):
10841084
tmp_dir=self._module_abspath(self.repo, self.path, str(uuid.uuid4()))
10851085
os.renames(source_dir, tmp_dir)
10861086
source_dir=tmp_dir

‎git/objects/submodule/root.py‎

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@
1010

1111
importlogging
1212

13-
# typing -------------------------------------------------------------------
14-
15-
fromtypingimportTYPE_CHECKING, Union
16-
17-
fromgit.typesimportCommit_ish
18-
19-
ifTYPE_CHECKING:
20-
fromgit.repoimportRepo
21-
fromgit.utilimportIterableList
22-
23-
# ----------------------------------------------------------------------------
24-
2513
__all__= ["RootModule", "RootUpdateProgress"]
2614

2715
log=logging.getLogger('git.objects.submodule.root')
@@ -54,7 +42,7 @@ class RootModule(Submodule):
5442

5543
k_root_name='__ROOT__'
5644

57-
def__init__(self, repo: 'Repo'):
45+
def__init__(self, repo):
5846
# repo, binsha, mode=None, path=None, name = None, parent_commit=None, url=None, ref=None)
5947
super(RootModule, self).__init__(
6048
repo,
@@ -67,17 +55,15 @@ def __init__(self, repo: 'Repo'):
6755
branch_path=git.Head.to_full_path(self.k_head_default)
6856
)
6957

70-
def_clear_cache(self)->None:
58+
def_clear_cache(self):
7159
"""May not do anything"""
7260
pass
7361

7462
#{Interface
7563

76-
defupdate(self, previous_commit: Union[Commit_ish, None] =None, # type: ignore[override]
77-
recursive: bool=True, force_remove: bool=False, init: bool=True,
78-
to_latest_revision: bool=False, progress: Union[None, 'RootUpdateProgress'] =None,
79-
dry_run: bool=False, force_reset: bool=False, keep_going: bool=False
80-
) ->'RootModule':
64+
defupdate(self, previous_commit=None, recursive=True, force_remove=False, init=True,
65+
to_latest_revision=False, progress=None, dry_run=False, force_reset=False,
66+
keep_going=False):
8167
"""Update the submodules of this repository to the current HEAD commit.
8268
This method behaves smartly by determining changes of the path of a submodules
8369
repository, next to changes to the to-be-checked-out commit or the branch to be
@@ -142,8 +128,8 @@ def update(self, previous_commit: Union[Commit_ish, None] = None,
142128
previous_commit=repo.commit(previous_commit) # obtain commit object
143129
# END handle previous commit
144130

145-
psms: 'IterableList[Submodule]'=self.list_items(repo, parent_commit=previous_commit)
146-
sms: 'IterableList[Submodule]'=self.list_items(repo)
131+
psms=self.list_items(repo, parent_commit=previous_commit)
132+
sms=self.list_items(repo)
147133
spsms=set(psms)
148134
ssms=set(sms)
149135

@@ -176,8 +162,8 @@ def update(self, previous_commit: Union[Commit_ish, None] = None,
176162
csms= (spsms&ssms)
177163
len_csms=len(csms)
178164
fori, csminenumerate(csms):
179-
psm: 'Submodule'=psms[csm.name]
180-
sm: 'Submodule'=sms[csm.name]
165+
psm=psms[csm.name]
166+
sm=sms[csm.name]
181167

182168
# PATH CHANGES
183169
##############
@@ -357,7 +343,7 @@ def update(self, previous_commit: Union[Commit_ish, None] = None,
357343

358344
returnself
359345

360-
defmodule(self)->'Repo':
346+
defmodule(self):
361347
""":return: the actual repository containing the submodules"""
362348
returnself.repo
363349
#} END interface

0 commit comments

Comments
(0)