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

Commitf2012e5

Browse files
committed
Add type to symbolicreference.set_object()
1 parente8442ee commitf2012e5

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

‎git/refs/reference.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def __str__(self) -> str:
6363
#{ Interface
6464

6565
# @ReservedAssignment
66-
defset_object(self,object:Union[Commit_ish,'SymbolicReference'],logmsg:Union[str,None]=None
67-
)->'SymbolicReference':
66+
defset_object(self,object:Union[Commit_ish,'SymbolicReference',str],logmsg:Union[str,None]=None
67+
)->'Reference':
6868
"""Special version which checks if the head-log needs an update as well
6969
:return: self"""
7070
oldbinsha=None

‎git/refs/symbolic.py‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ def _get_commit(self):
221221
# END handle type
222222
returnobj
223223

224-
defset_commit(self,commit:Union[Commit,'SymbolicReference',str],logmsg=None):
224+
defset_commit(self,commit:Union[Commit,'SymbolicReference',str],logmsg:Union[str,None]=None
225+
)->'SymbolicReference':
225226
"""As set_object, but restricts the type of object to be a Commit
226227
227228
:raise ValueError: If commit is not a Commit object or doesn't point to
@@ -250,7 +251,8 @@ def set_commit(self, commit: Union[Commit, 'SymbolicReference', str], logmsg=Non
250251

251252
returnself
252253

253-
defset_object(self,object,logmsg=None):# @ReservedAssignment
254+
defset_object(self,object:Union[Commit_ish,'SymbolicReference',str],logmsg:Union[str,None]=None
255+
)->'SymbolicReference':
254256
"""Set the object we point to, possibly dereference our symbolic reference first.
255257
If the reference does not exist, it will be created
256258
@@ -277,10 +279,10 @@ def set_object(self, object, logmsg=None): # @ReservedAssignment
277279
# set the commit on our reference
278280
returnself._get_reference().set_object(object,logmsg)
279281

280-
commit=property(_get_commit,set_commit,doc="Query or set commits directly")
281-
object=property(_get_object,set_object,doc="Return the object our ref currently refers to")
282+
commit=property(_get_commit,set_commit,doc="Query or set commits directly")# type: ignore
283+
object=property(_get_object,set_object,doc="Return the object our ref currently refers to")# type: ignore
282284

283-
def_get_reference(self):
285+
def_get_reference(self)->'SymbolicReference':
284286
""":return: Reference Object we point to
285287
:raise TypeError: If this symbolic reference is detached, hence it doesn't point
286288
to a reference, but to a commit"""
@@ -290,7 +292,7 @@ def _get_reference(self):
290292
returnself.from_path(self.repo,target_ref_path)
291293

292294
defset_reference(self,ref:Union[Commit_ish,'SymbolicReference',str],
293-
logmsg:Union[str,None]=None)->Union[Commit_ish,'SymbolicReference']:
295+
logmsg:Union[str,None]=None)->'SymbolicReference':
294296
"""Set ourselves to the given ref. It will stay a symbol if the ref is a Reference.
295297
Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
296298
will be set which effectively detaches the refererence if it was a purely

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp