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

Method __getitem__

pygit2/branches.py:62–73  ·  view source on GitHub ↗
(self, name: str)

Source from the content-addressed store, hash-verified

60 self.remote = Branches(repository, flag=BranchType.REMOTE, commit=commit)
61
62 def __getitem__(self, name: str) -> Branch:
63 branch = None
64 if self._flag & BranchType.LOCAL:
65 branch = self._repository.lookup_branch(name, BranchType.LOCAL)
66
67 if branch is None and self._flag & BranchType.REMOTE:
68 branch = self._repository.lookup_branch(name, BranchType.REMOTE)
69
70 if branch is None or not self._valid(branch):
71 raise KeyError(f'Branch not found: {name}')
72
73 return branch
74
75 def get(self, key: str) -> Branch:
76 try:

Callers

nothing calls this directly

Calls 1

_validMethod · 0.95

Tested by

no test coverage detected