proteindf_bridge.str_processing module

class proteindf_bridge.str_processing.StrUtils[source]

Bases: object

classmethod add_spaces(s, num_add)[source]

Prepend num_add spaces to the start of each line.

classmethod check_pickled(data, level=0)[source]
classmethod del_spaces(s, num_del)[source]
classmethod get_common_str(str1, str2)[source]

Return the common string (from the beginning).

>>> a = 'abcdef'
>>> b = 'abcdefg'
>>> Utils.get_common_str(a, b)
'abcdef'
classmethod num_spaces(s)[source]

Return the number of leading spaces on each line.

classmethod sort_nicely(given_list)[source]

Sort the given list in the way that humans expect. ref: http://www.codinghorror.com/blog/2007/12/sorting-for-humans-natural-sort-order.html

classmethod str_to_bool(input_str)[source]
classmethod to_bytes(unicode_or_str)[source]

Convert str to bytes (utf-8).

classmethod to_unicode(unicode_or_str)[source]

Convert bytes to str (utf-8).

classmethod to_unicode_dict(d)[source]

Convert a dict whose keys are stored as bytes into a dict keyed by str (utf-8).

classmethod to_unicode_list(l)[source]
classmethod unindent_block(s)[source]