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

Method _transform

pygit2/refspec.py:77–85  ·  view source on GitHub ↗
(self, ref: str, fn: Callable)

Source from the content-addressed store, hash-verified

75 return bool(C.git_refspec_dst_matches(self._refspec, to_bytes(ref)))
76
77 def _transform(self, ref: str, fn: Callable) -> str:
78 buf = ffi.new('git_buf *', (ffi.NULL, 0))
79 err = fn(buf, self._refspec, to_bytes(ref))
80 check_error(err)
81
82 try:
83 return ffi.string(buf.ptr).decode('utf-8')
84 finally:
85 C.git_buf_dispose(buf)
86
87 def transform(self, ref: str) -> str:
88 """Transform a reference name according to this refspec from the lhs to

Callers 2

transformMethod · 0.95
rtransformMethod · 0.95

Calls 3

to_bytesFunction · 0.85
check_errorFunction · 0.85
stringMethod · 0.80

Tested by

no test coverage detected