<s> """<STR_LIT>""" <EOL> from gate . utils import v <EOL> from fnmatch import fnmatch as _fnmatch <EOL> def fnmatch ( fname , patterns ) : <EOL> """<STR_LIT>""" <EOL> if isinstance ( patterns , list ) : <EOL> return any ( _fnmatch ( fname , patt ) for patt in patterns ) <EOL> if isinstance ( patterns , basestring ) : <EOL> return _fnmatch ( fname , patterns ) <EOL> def as_byte_indexes ( indexes , s ) : <EOL> """<STR_LIT>""" <EOL> idx = <NUM_LIT:0> <EOL> byte_indexes = [ ] <EOL> for i , c in enumerate ( s ) : <EOL> if i in indexes : <EOL> byte_indexes . append ( idx ) <EOL> idx += len ( v . encode ( c ) ) <EOL> return byte_indexes </s>
