MCPcopy Create free account
hub / github.com/libgit2/pygit2 / __getitem__

Method __getitem__

pygit2/remotes.py:425–433  ·  view source on GitHub ↗
(self, name: str | int)

Source from the content-addressed store, hash-verified

423 yield Remote(self._repo, cremote[0])
424
425 def __getitem__(self, name: str | int) -> Remote:
426 if isinstance(name, int):
427 return list(self)[name]
428
429 cremote = ffi.new('git_remote **')
430 err = C.git_remote_lookup(cremote, self._repo._repo, to_bytes(name))
431 check_error(err)
432
433 return Remote(self._repo, cremote[0])
434
435 def _ffi_names(self) -> Generator['char_pointer', None, None]:
436 with utils.new_git_strarray() as names:

Callers

nothing calls this directly

Calls 3

to_bytesFunction · 0.85
check_errorFunction · 0.85
RemoteClass · 0.85

Tested by

no test coverage detected