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

Commit9de7310

Browse files
committed
Minor type fixes
1 parent481f672 commit9de7310

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

‎git/refs/symbolic.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def set_object(self, object: Union[Commit_ish, 'SymbolicReference', str], logmsg
285285
commit=property(_get_commit,set_commit,doc="Query or set commits directly")# type: ignore
286286
object=property(_get_object,set_object,doc="Return the object our ref currently refers to")# type: ignore
287287

288-
def_get_reference(self)->'Reference':
288+
def_get_reference(self)->'SymbolicReference':
289289
""":return: Reference Object we point to
290290
:raise TypeError: If this symbolic reference is detached, hence it doesn't point
291291
to a reference, but to a commit"""
@@ -683,7 +683,7 @@ def iter_items(cls: Type[T_References], repo: 'Repo', common_path: Union[PathLik
683683
return (rforrincls._iter_items(repo,common_path)ifr.__class__==SymbolicReferenceornotr.is_detached)
684684

685685
@classmethod
686-
deffrom_path(cls,repo:'Repo',path:PathLike)->Union['Head','TagReference','Reference']:
686+
deffrom_path(cls:Type[T_References],repo:'Repo',path:PathLike)->T_References:
687687
"""
688688
:param path: full .git-directory-relative path name to the Reference to instantiate
689689
:note: use to_full_path() if you only have a partial path of a known Reference Type
@@ -698,12 +698,13 @@ def from_path(cls, repo: 'Repo', path: PathLike) -> Union['Head', 'TagReference'
698698
from .importHEAD,Head,RemoteReference,TagReference,Reference
699699
forref_typein (HEAD,Head,RemoteReference,TagReference,Reference,SymbolicReference):
700700
try:
701+
instance:T_References
701702
instance=ref_type(repo,path)
702703
ifinstance.__class__==SymbolicReferenceandinstance.is_detached:
703704
raiseValueError("SymbolRef was detached, we drop it")
704705
else:
705-
assertisinstance(instance,Reference),"instance should be Reference or subtype"
706706
returninstance
707+
707708
exceptValueError:
708709
pass
709710
# END exception handling

‎git/remote.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ def stale_refs(self) -> IterableList[Reference]:
632632
as well. This is a fix for the issue described here:
633633
https://github.com/gitpython-developers/GitPython/issues/260
634634
"""
635-
out_refs:IterableList[RemoteReference]=IterableList(RemoteReference._id_attribute_,"%s/"%self.name)
635+
out_refs:IterableList[Reference]=IterableList(RemoteReference._id_attribute_,"%s/"%self.name)
636636
forlineinself.repo.git.remote("prune","--dry-run",self).splitlines()[2:]:
637637
# expecting
638638
# * [would prune] origin/new_branch
@@ -642,7 +642,7 @@ def stale_refs(self) -> IterableList[Reference]:
642642
ref_name=line.replace(token,"")
643643
# sometimes, paths start with a full ref name, like refs/tags/foo, see #260
644644
ifref_name.startswith(Reference._common_path_default+'/'):
645-
out_refs.append(SymbolicReference.from_path(self.repo,ref_name))
645+
out_refs.append(Reference.from_path(self.repo,ref_name))
646646
else:
647647
fqhn="%s/%s"% (RemoteReference._common_path_default,ref_name)
648648
out_refs.append(RemoteReference(self.repo,fqhn))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp