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

Commit2a6a2e2

Browse files
committed
Improve types of diff.py
1 parentfb09bfa commit2a6a2e2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

‎git/diff.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@
2626

2727
Lit_change_type=Literal['A','D','M','R','T']
2828

29+
30+
defis_change_type(inp:str)->TypeGuard[Lit_change_type]:
31+
returninpinLit_change_type.__args__# type: ignore
32+
2933
# ------------------------------------------------------------------------
3034

35+
3136
__all__= ('Diffable','DiffIndex','Diff','NULL_TREE')
3237

3338
# Special object to compare against the empty tree in diffs
@@ -503,13 +508,10 @@ def _handle_diff_line(lines_bytes: bytes, repo: 'Repo', index: DiffIndex) -> Non
503508
a_blob_id:Union[str,None]
504509
b_blob_id:Union[str,None]
505510
old_mode,new_mode,a_blob_id,b_blob_id,_change_type=meta.split(None,4)
506-
#Change type can be R100
511+
#_Change_type can be R100
507512
# R: status letter
508513
# 100: score (in case of copy and rename)
509514

510-
defis_change_type(inp:str)->TypeGuard[Lit_change_type]:
511-
returninpinLit_change_type.__args__# type: ignore
512-
513515
assertis_change_type(_change_type[0])
514516
change_type:Lit_change_type=_change_type[0]
515517
score_str=''.join(_change_type[1:])

‎git/objects/submodule/base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
find_first_remote_branch
4848
)
4949

50+
fromgit.repoimportRepo
5051

5152
# typing ----------------------------------------------------------------------
5253
fromtypingimportCallable,Dict,Mapping,Sequence,TYPE_CHECKING
@@ -55,7 +56,6 @@
5556
fromgit.typesimportCommit_ish,PathLike,TBD
5657

5758
ifTYPE_CHECKING:
58-
fromgit.repoimportRepo
5959
fromgit.indeximportIndexFile
6060

6161

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp