#NEWLINE# def _chars_to_indices( self , chars ) : #NEWLINE# #INDENT# 'Helper for Sequence.frequencies.' #NEWLINE# if isinstance ( chars , ( str , bytes ) ) : #NEWLINE# #INDENT# chars = set ( [ chars ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( chars , set ) ) : #NEWLINE# #INDENT# raise TypeError ( ( '`chars` must be of type `set`, not %r' % type ( chars ) . __name__ ) ) #NEWLINE# #UNINDENT# #UNINDENT# chars = list ( chars ) #NEWLINE# indices = [ ] #NEWLINE# for char in chars : #NEWLINE# #INDENT# if ( not isinstance ( char , ( str , bytes ) ) ) : #NEWLINE# #INDENT# raise TypeError ( ( 'Each element of `chars` must be string-like, not %r' % type ( char ) . __name__ ) ) #NEWLINE# #UNINDENT# if ( len ( char ) != 1 ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Each element of `chars` must contain a single character (found %d characters)' % len ( char ) ) ) #NEWLINE# #UNINDENT# index = ord ( char ) #NEWLINE# if ( index >= self . _number_of_extended_ascii_codes ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Character %r in `chars` is outside the range of allowable characters in a `Sequence` object.' % char ) ) #NEWLINE# #UNINDENT# indices . append ( index ) #NEWLINE# #UNINDENT# return ( chars , indices )