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