summaryrefslogtreecommitdiff
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
parent4b686c4d7fd0d645fbd8f219794d4b2e6edd48a5 (diff)
downloadsqlparse-9c9f0c480971415a5a124896fa9d5f74bd60000a.tar.gz
Misc code cleanup.
-rw-r--r--examples/column_defs_lowlevel.py10
-rw-r--r--examples/extract_table_names.py2
-rw-r--r--setup.py7
3 files changed, 8 insertions, 11 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()))
diff --git a/setup.py b/setup.py
index 83e3b8c..e6f9284 100644
--- a/setup.py
+++ b/setup.py
@@ -17,11 +17,8 @@ except ImportError:
def get_version():
- """parse __init__.py for version number instead of importing the file
-
- see http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package
- """
- VERSIONFILE='sqlparse/__init__.py'
+ """Parse __init__.py for version number instead of importing the file."""
+ VERSIONFILE = 'sqlparse/__init__.py'
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r'^__version__ = [\'"]([^\'"]*)[\'"]'
mo = re.search(VSRE, verstrline, re.M)