summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2015-10-26 20:18:35 +0100
committerAndi Albrecht <albrecht.andi@gmail.com>2015-10-26 20:18:35 +0100
commit9c9f0c480971415a5a124896fa9d5f74bd60000a (patch)
treec4cc3f3b2b768e242a50bf59e613ac9178ce25f6 /examples
parent4b686c4d7fd0d645fbd8f219794d4b2e6edd48a5 (diff)
downloadsqlparse-9c9f0c480971415a5a124896fa9d5f74bd60000a.tar.gz
Misc code cleanup.
Diffstat (limited to 'examples')
-rw-r--r--examples/column_defs_lowlevel.py10
-rw-r--r--examples/extract_table_names.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/column_defs_lowlevel.py b/examples/column_defs_lowlevel.py
index 5ed8950..9e945d4 100644
--- a/examples/column_defs_lowlevel.py
+++ b/examples/column_defs_lowlevel.py
@@ -29,9 +29,9 @@ def extract_definitions(token_list):
idx = token_list.token_index(token)
# grab the next token, this times including whitespace
token = token_list.token_next(idx, skip_ws=False)
- # split on ","
- if (token is not None # = end of statement
- and token.match(sqlparse.tokens.Punctuation, ',')):
+ # split on ",", except when on end of statement
+ if token is not None \
+ and token.match(sqlparse.tokens.Punctuation, ','):
definitions.append(tmp)
tmp = []
idx = token_list.token_index(token)
@@ -44,5 +44,5 @@ def extract_definitions(token_list):
columns = extract_definitions(par)
for column in columns:
- print 'NAME: %-12s DEFINITION: %s' % (column[0],
- ''.join(str(t) for t in column[1:]))
+ print('NAME: %-12s DEFINITION: %s' % (column[0],
+ ''.join(str(t) for t in column[1:])))
diff --git a/examples/extract_table_names.py b/examples/extract_table_names.py
index d8d1698..3ab04a9 100644
--- a/examples/extract_table_names.py
+++ b/examples/extract_table_names.py
@@ -57,4 +57,4 @@ def extract_tables():
if __name__ == '__main__':
- print 'Tables: %s' % ', '.join(extract_tables())
+ print('Tables: %s' % ', '.join(extract_tables()))