File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 46
46
47
47
# Need BaseRepository for type hints, but don't let it cause a circular dependency
48
48
if TYPE_CHECKING :
49
- from ._libgit2 .ffi import GitRemoteC
49
+ from ._libgit2 .ffi import GitRemoteC , char_pointer
50
50
from .repository import BaseRepository
51
51
52
52
@@ -367,12 +367,12 @@ def __getitem__(self, name: str | int) -> Remote:
367
367
368
368
return Remote (self ._repo , cremote [0 ])
369
369
370
- def _ffi_names (self ):
370
+ def _ffi_names (self ) -> Generator [ 'char_pointer' , None , None ] :
371
371
with utils .new_git_strarray () as names :
372
372
err = C .git_remote_list (names , self ._repo ._repo )
373
373
check_error (err )
374
374
for i in range (names .count ):
375
- yield names .strings [i ]
375
+ yield names .strings [i ] # type: ignore[index]
376
376
377
377
def names (self ) -> Generator [str | None , None , None ]:
378
378
"""An iterator over the names of the available remotes."""
Original file line number Diff line number Diff line change 29
29
from typing import (
30
30
TYPE_CHECKING ,
31
31
Generic ,
32
+ Generator ,
32
33
Iterator ,
33
34
Optional ,
34
35
Protocol ,
45
46
from ._libgit2 .ffi import ArrayC , GitStrrayC , char , char_pointer
46
47
47
48
48
- def maybe_string (ptr : 'char_pointer' ) -> str | None :
49
+ def maybe_string (ptr : 'char_pointer' | None ) -> str | None :
49
50
if not ptr :
50
51
return None
51
52
@@ -105,7 +106,7 @@ def ptr_to_bytes(ptr_cdata):
105
106
106
107
107
108
@contextlib .contextmanager
108
- def new_git_strarray ():
109
+ def new_git_strarray () -> Generator [ GitStrrayC , None , None ] :
109
110
strarray = ffi .new ('git_strarray *' )
110
111
yield strarray
111
112
C .git_strarray_dispose (strarray )
You can’t perform that action at this time.
0 commit comments