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

Function to_str

pygit2/utils.py:83–93  ·  view source on GitHub ↗
(s: str | bytes | os.PathLike[str] | os.PathLike[bytes])

Source from the content-addressed store, hash-verified

81
82
83def to_str(s: str | bytes | os.PathLike[str] | os.PathLike[bytes]) -> str:
84 if hasattr(s, '__fspath__'):
85 s = os.fspath(s)
86
87 if type(s) is str:
88 return s
89
90 if type(s) is bytes:
91 return s.decode()
92
93 raise TypeError(f'unexpected type "{repr(s)}"')
94
95
96def ptr_to_bytes(ptr_cdata) -> bytes:

Callers 4

optionFunction · 0.85
init_repositoryFunction · 0.85
_from_cMethod · 0.85
_from_cMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…