Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9e5574c

Browse files
committed
Add final types to submodule.py
1 parent2fc8a46 commit9e5574c

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

‎git/objects/submodule/base.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
ifTYPE_CHECKING:
5858
fromgit.indeximportIndexFile
5959
fromgit.repoimportRepo
60+
fromgit.refsimportHead
6061

6162

6263
# -----------------------------------------------------------------------------
@@ -265,7 +266,7 @@ def _module_abspath(cls, parent_repo: 'Repo', path: PathLike, name: str) -> Path
265266
# end
266267

267268
@classmethod
268-
def_clone_repo(cls,repo,url,path,name,**kwargs):
269+
def_clone_repo(cls,repo:'Repo',url:str,path:PathLike,name:str,**kwargs:Any)->'Repo':
269270
""":return: Repo instance of newly cloned repository
270271
:param repo: our parent repository
271272
:param url: url to clone from
@@ -279,7 +280,7 @@ def _clone_repo(cls, repo, url, path, name, **kwargs):
279280
module_abspath_dir=osp.dirname(module_abspath)
280281
ifnotosp.isdir(module_abspath_dir):
281282
os.makedirs(module_abspath_dir)
282-
module_checkout_path=osp.join(repo.working_tree_dir,path)
283+
module_checkout_path=osp.join(str(repo.working_tree_dir),path)
283284
# end
284285

285286
clone=git.Repo.clone_from(url,module_checkout_path,**kwargs)
@@ -484,7 +485,7 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
484485
defupdate(self,recursive:bool=False,init:bool=True,to_latest_revision:bool=False,
485486
progress:Union['UpdateProgress',None]=None,dry_run:bool=False,
486487
force:bool=False,keep_going:bool=False,env:Union[Mapping[str,str],None]=None,
487-
clone_multi_options:Union[Sequence[TBD],None]=None):
488+
clone_multi_options:Union[Sequence[TBD],None]=None)->'Submodule':
488489
"""Update the repository of this submodule to point to the checkout
489490
we point at with the binsha of this instance.
490491
@@ -712,7 +713,7 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision:
712713
returnself
713714

714715
@unbare_repo
715-
defmove(self,module_path,configuration=True,module=True):
716+
defmove(self,module_path:PathLike,configuration:bool=True,module:bool=True)->'Submodule':
716717
"""Move the submodule to a another module path. This involves physically moving
717718
the repository at our current path, changing the configuration, as well as
718719
adjusting our index entry accordingly.
@@ -742,7 +743,7 @@ def move(self, module_path, configuration=True, module=True):
742743
returnself
743744
# END handle no change
744745

745-
module_checkout_abspath=join_path_native(self.repo.working_tree_dir,module_checkout_path)
746+
module_checkout_abspath=join_path_native(str(self.repo.working_tree_dir),module_checkout_path)
746747
ifosp.isfile(module_checkout_abspath):
747748
raiseValueError("Cannot move repository onto a file: %s"%module_checkout_abspath)
748749
# END handle target files
@@ -1160,7 +1161,7 @@ def exists(self) -> bool:
11601161
# END handle object state consistency
11611162

11621163
@property
1163-
defbranch(self):
1164+
defbranch(self)->'Head':
11641165
""":return: The branch instance that we are to checkout
11651166
:raise InvalidGitRepositoryError: if our module is not yet checked out"""
11661167
returnmkhead(self.module(),self._branch_path)

‎git/objects/util.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,20 @@ def __init__(self, secs_west_of_utc: float, name: Union[None, str] = None) -> No
144144
def__reduce__(self)->Tuple[Type['tzoffset'],Tuple[float,str]]:
145145
returntzoffset, (-self._offset.total_seconds(),self._name)
146146

147-
defutcoffset(self,dt)->timedelta:
147+
defutcoffset(self,dt:Union[datetime,None])->timedelta:
148148
returnself._offset
149149

150-
deftzname(self,dt)->str:
150+
deftzname(self,dt:Union[datetime,None])->str:
151151
returnself._name
152152

153-
defdst(self,dt)->timedelta:
153+
defdst(self,dt:Union[datetime,None])->timedelta:
154154
returnZERO
155155

156156

157157
utc=tzoffset(0,'UTC')
158158

159159

160-
deffrom_timestamp(timestamp,tz_offset:float)->datetime:
160+
deffrom_timestamp(timestamp:float,tz_offset:float)->datetime:
161161
"""Converts a timestamp + tz_offset into an aware datetime instance."""
162162
utc_dt=datetime.fromtimestamp(timestamp,utc)
163163
try:
@@ -305,7 +305,7 @@ class Traversable(Protocol):
305305

306306
@classmethod
307307
@abstractmethod
308-
def_get_intermediate_items(cls,item)->Sequence['Traversable']:
308+
def_get_intermediate_items(cls,item:Any)->Sequence['Traversable']:
309309
"""
310310
Returns:
311311
Tuple of items connected to the given item.
@@ -327,7 +327,7 @@ def list_traverse(self, *args: Any, **kwargs: Any) -> Any:
327327
stacklevel=2)
328328
returnself._list_traverse(*args,**kwargs)
329329

330-
def_list_traverse(self,as_edge=False,*args:Any,**kwargs:Any
330+
def_list_traverse(self,as_edge:bool=False,*args:Any,**kwargs:Any
331331
)->IterableList[Union['Commit','Submodule','Tree','Blob']]:
332332
"""
333333
:return: IterableList with the results of the traversal as produced by

‎pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ filterwarnings = 'ignore::DeprecationWarning'
1919
# filterwarnings ignore::WarningType # ignores those warnings
2020

2121
[tool.mypy]
22-
#disallow_untyped_defs = true
22+
disallow_untyped_defs =true
2323
no_implicit_optional =true
2424
warn_redundant_casts =true
2525
# warn_unused_ignores = True

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp