]> git.phdru.name Git - sqlconvert.git/blob - mysql2sql/print_tokens.py
Version 0.0.2: Rename mysql-to-sql.py -> mysql2py
[sqlconvert.git] / mysql2sql / print_tokens.py
1
2 import sys
3
4
5 def print_tokens(token_list, outfile=sys.stdout, encoding=None):
6     if encoding:
7         outfile = getattr(outfile, 'buffer', outfile)
8     for token in token_list.flatten():
9         normalized = token.normalized
10         if encoding:
11             normalized = normalized.encode(encoding)
12         outfile.write(normalized)
13
14
15 def tlist2str(token_list):
16     return u''.join(token.normalized for token in token_list.flatten())