| 1 |
# cython: language_level=3 |
| 2 |
######################################################################### |
| 3 |
# Utility functions used across pysam |
| 4 |
######################################################################### |
| 5 |
cimport cython |
| 6 |
from cpython cimport array as c_array |
| 7 |
|
| 8 |
cpdef parse_region(contig=*, start=*, stop=*, region=*, reference=*, end=*) |
| 9 |
|
| 10 |
cdef int libc_whence_from_io(int whence) |
| 11 |
|
| 12 |
cdef OSError_from_errno(message, filename=*) |
| 13 |
|
| 14 |
######################################################################### |
| 15 |
# Utility functions for quality string conversions |
| 16 |
|
| 17 |
cpdef c_array.array qualitystring_to_array(input_str, int offset=*) |
| 18 |
cpdef array_to_qualitystring(c_array.array arr, int offset=*) |
| 19 |
cpdef qualities_to_qualitystring(qualities, int offset=*) |
| 20 |
|
| 21 |
######################################################################## |
| 22 |
## String encoding configuration facilities |
| 23 |
######################################################################## |
| 24 |
|
| 25 |
cpdef get_encoding_error_handler() |
| 26 |
cpdef set_encoding_error_handler(name) |
| 27 |
|
| 28 |
######################################################################## |
| 29 |
## Python 3 compatibility functions |
| 30 |
######################################################################## |
| 31 |
cdef charptr_to_str(const char *s, encoding=*, errors=*) |
| 32 |
cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*) |
| 33 |
cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*) |
| 34 |
cdef force_str(object s, encoding=*, errors=*) |
| 35 |
cdef bytes force_bytes(object s, encoding=*, errors=*) |
| 36 |
cdef decode_bytes(bytes s, encoding=*, errors=*) |
| 37 |
cdef bytes encode_filename(object filename) |
| 38 |
cdef from_string_and_size(const char *s, size_t length) |
| 39 |
|