(self, lst: None | Sequence[str | os.PathLike[str]])
| 148 | __arr: 'ArrayC[char_pointer]' |
| 149 | |
| 150 | def __init__(self, lst: None | Sequence[str | os.PathLike[str]]): |
| 151 | # Allow passing in None as lg2 typically considers them the same as empty |
| 152 | if lst is None: |
| 153 | self.__array = ffi.NULL |
| 154 | return |
| 155 | |
| 156 | if not isinstance(lst, (list, tuple)): |
| 157 | raise TypeError('Value must be a list') |
| 158 | |
| 159 | strings: list[None | 'ArrayC[char]'] = [None] * len(lst) |
| 160 | for i in range(len(lst)): |
| 161 | li = lst[i] |
| 162 | if not isinstance(li, str) and not hasattr(li, '__fspath__'): |
| 163 | raise TypeError('Value must be a string or PathLike object') |
| 164 | |
| 165 | strings[i] = ffi.new('char []', to_bytes(li)) |
| 166 | |
| 167 | self.__arr = ffi.new('char *[]', strings) |
| 168 | self.__strings = strings |
| 169 | self.__array = ffi.new('git_strarray *', [self.__arr, len(strings)]) # type: ignore[call-overload] |
| 170 | |
| 171 | def __enter__(self) -> 'StrArray': |
| 172 | return self |
nothing calls this directly
no test coverage detected