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

Commitf96eb0c

Browse files
committed
Change aliases to work around mypy issue.
Fixes#1934Note this should also gives better LSP support to these property aliases.
1 parent4c21e51 commitf96eb0c

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

‎git/remote.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,15 @@ def remove(cls, repo: "Repo", name: str) -> str:
828828
name._clear_cache()
829829
returnname
830830

831-
# `rm` is an alias.
832-
rm=remove
831+
@classmethod
832+
defrm(cls,repo:"Repo",name:str)->str:
833+
"""Alias of remove.
834+
Remove the remote with the given name.
835+
836+
:return:
837+
The passed remote name to remove
838+
"""
839+
returncls.remove(repo,name)
833840

834841
defrename(self,new_name:str)->"Remote":
835842
"""Rename self to the given `new_name`.

‎git/repo/base.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,17 @@ def heads(self) -> "IterableList[Head]":
402402
"""
403403
returnHead.list_items(self)
404404

405+
@property
406+
defbranches(self)->"IterableList[Head]":
407+
"""Alias for heads.
408+
A list of :class:`~git.refs.head.Head` objects representing the branch heads
409+
in this repo.
410+
411+
:return:
412+
``git.IterableList(Head, ...)``
413+
"""
414+
returnself.heads
415+
405416
@property
406417
defreferences(self)->"IterableList[Reference]":
407418
"""A list of :class:`~git.refs.reference.Reference` objects representing tags,
@@ -412,11 +423,16 @@ def references(self) -> "IterableList[Reference]":
412423
"""
413424
returnReference.list_items(self)
414425

415-
# Alias for references.
416-
refs=references
426+
@property
427+
defrefs(self)->"IterableList[Reference]":
428+
"""Alias for references.
429+
A list of :class:`~git.refs.reference.Reference` objects representing tags,
430+
heads and remote references.
417431
418-
# Alias for heads.
419-
branches=heads
432+
:return:
433+
``git.IterableList(Reference, ...)``
434+
"""
435+
returnself.references
420436

421437
@property
422438
defindex(self)->"IndexFile":

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp