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

Commit627deff

Browse files
committed
Change List to MutableSequence in fun.py _find_by_name()
1 parent4f13b4e commit627deff

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

‎git/index/fun.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,9 @@ def aggressive_tree_merge(odb, tree_shas: Sequence[bytes]) -> List[BaseIndexEntr
388388
# all three can't be None
389389
ifoursisNone:
390390
# added in their branch
391-
out.append(_tree_entry_to_baseindexentry(theirs,0))# type: ignore
392-
eliftheirsisNone:# ours is not None, theirs is None
391+
asserttheirsisnotNone
392+
out.append(_tree_entry_to_baseindexentry(theirs,0))
393+
eliftheirsisNone:
393394
# added in our branch
394395
out.append(_tree_entry_to_baseindexentry(ours,0))
395396
else:

‎git/objects/fun.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# typing ----------------------------------------------
1111

12-
fromtypingimportCallable,List,Sequence,Tuple,TYPE_CHECKING,Union,overload
12+
fromtypingimportCallable,List,MutableSequence,Sequence,Tuple,TYPE_CHECKING,Union,overload
1313

1414
ifTYPE_CHECKING:
1515
from_typeshedimportReadableBuffer
@@ -102,24 +102,24 @@ def tree_entries_from_data(data: bytes) -> List[EntryTup]:
102102
returnout
103103

104104

105-
def_find_by_name(tree_data:List[EntryTupOrNone],name:str,is_dir:bool,start_at:int
105+
def_find_by_name(tree_data:MutableSequence[EntryTupOrNone],name:str,is_dir:bool,start_at:int
106106
)->EntryTupOrNone:
107107
"""return data entry matching the given name and tree mode
108108
or None.
109109
Before the item is returned, the respective data item is set
110110
None in the tree_data list to mark it done"""
111-
tree_data_list:List[EntryTupOrNone]=tree_data
111+
112112
try:
113-
item=tree_data_list[start_at]
113+
item=tree_data[start_at]
114114
ifitemanditem[2]==nameandS_ISDIR(item[1])==is_dir:
115-
tree_data_list[start_at]=None
115+
tree_data[start_at]=None
116116
returnitem
117117
exceptIndexError:
118118
pass
119119
# END exception handling
120-
forindex,iteminenumerate(tree_data_list):
120+
forindex,iteminenumerate(tree_data):
121121
ifitemanditem[2]==nameandS_ISDIR(item[1])==is_dir:
122-
tree_data_list[index]=None
122+
tree_data[index]=None
123123
returnitem
124124
# END if item matches
125125
# END for each item

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp