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

Commiteb15123

Browse files
committed
Use cast to allow silent getattrs
1 parentb5c834a commiteb15123

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

‎git/util.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,9 +1214,7 @@ def __getitem__(self, index: Union[SupportsIndex, int, slice, str]) -> T_Iterabl
12141214
raiseValueError("Index should be an int or str")
12151215
else:
12161216
try:
1217-
ifnotisinstance(index,str):
1218-
raiseAttributeError(f"{index} is not a valid attribute")
1219-
returngetattr(self,index)
1217+
returngetattr(self,cast(str,index))
12201218
exceptAttributeErrorase:
12211219
raiseIndexError(f"No item found with id{self._prefix}{index}")frome
12221220
# END handle getattr

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp