jpayne@68: # cython: language_level=3 jpayne@68: ######################################################################### jpayne@68: # Utility functions used across pysam jpayne@68: ######################################################################### jpayne@68: cimport cython jpayne@68: from cpython cimport array as c_array jpayne@68: jpayne@68: cpdef parse_region(contig=*, start=*, stop=*, region=*, reference=*, end=*) jpayne@68: jpayne@68: cdef int libc_whence_from_io(int whence) jpayne@68: jpayne@68: ######################################################################### jpayne@68: # Utility functions for quality string conversions jpayne@68: jpayne@68: cpdef c_array.array qualitystring_to_array(input_str, int offset=*) jpayne@68: cpdef array_to_qualitystring(c_array.array arr, int offset=*) jpayne@68: cpdef qualities_to_qualitystring(qualities, int offset=*) jpayne@68: jpayne@68: ######################################################################## jpayne@68: ## String encoding configuration facilities jpayne@68: ######################################################################## jpayne@68: jpayne@68: cpdef get_encoding_error_handler() jpayne@68: cpdef set_encoding_error_handler(name) jpayne@68: jpayne@68: ######################################################################## jpayne@68: ## Python 3 compatibility functions jpayne@68: ######################################################################## jpayne@68: cdef charptr_to_str(const char *s, encoding=*, errors=*) jpayne@68: cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*) jpayne@68: cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*) jpayne@68: cdef force_str(object s, encoding=*, errors=*) jpayne@68: cdef bytes force_bytes(object s, encoding=*, errors=*) jpayne@68: cdef decode_bytes(bytes s, encoding=*, errors=*) jpayne@68: cdef bytes encode_filename(object filename) jpayne@68: cdef from_string_and_size(const char *s, size_t length) jpayne@68: