library packages

This commit is contained in:
2024-09-28 22:56:00 -07:00
parent 64d9b78b3a
commit 1973934e95
4893 changed files with 1184173 additions and 31 deletions

View File

@@ -0,0 +1,31 @@
import array
cpdef bytes cstrencode(str pystr):
"""
Encode a string into bytes.
"""
try:
return pystr.encode("utf-8")
except UnicodeDecodeError:
return pystr.decode("utf-8").encode("utf-8")
cdef str cstrdecode(const char *instring):
if instring != NULL:
return instring
return None
IF CTE_PYTHON_IMPLEMENTATION == "CPython":
from cpython cimport array
cdef array.array _ARRAY_TEMPLATE = array.array("d", [])
cdef array.array empty_array(int npts):
return array.clone(_ARRAY_TEMPLATE, npts, zero=False)
ELSE:
# https://github.com/pyproj4/pyproj/issues/854
cdef empty_array(int npts):
return array.array("d", [float("NaN")] * npts)