Skip to content

Commit 9c9f0c4

Browse files
committed
Misc code cleanup.
1 parent 4b686c4 commit 9c9f0c4

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

examples/column_defs_lowlevel.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def extract_definitions(token_list):
2929
idx = token_list.token_index(token)
3030
# grab the next token, this times including whitespace
3131
token = token_list.token_next(idx, skip_ws=False)
32-
# split on ","
33-
if (token is not None # = end of statement
34-
and token.match(sqlparse.tokens.Punctuation, ',')):
32+
# split on ",", except when on end of statement
33+
if token is not None \
34+
and token.match(sqlparse.tokens.Punctuation, ','):
3535
definitions.append(tmp)
3636
tmp = []
3737
idx = token_list.token_index(token)
@@ -44,5 +44,5 @@ def extract_definitions(token_list):
4444
columns = extract_definitions(par)
4545

4646
for column in columns:
47-
print 'NAME: %-12s DEFINITION: %s' % (column[0],
48-
''.join(str(t) for t in column[1:]))
47+
print('NAME: %-12s DEFINITION: %s' % (column[0],
48+
''.join(str(t) for t in column[1:])))

examples/extract_table_names.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ def extract_tables():
5757

5858

5959
if __name__ == '__main__':
60-
print 'Tables: %s' % ', '.join(extract_tables())
60+
print('Tables: %s' % ', '.join(extract_tables()))

setup.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717

1818

1919
def get_version():
20-
"""parse __init__.py for version number instead of importing the file
21-
22-
see http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package
23-
"""
24-
VERSIONFILE='sqlparse/__init__.py'
20+
"""Parse __init__.py for version number instead of importing the file."""
21+
VERSIONFILE = 'sqlparse/__init__.py'
2522
verstrline = open(VERSIONFILE, "rt").read()
2623
VSRE = r'^__version__ = [\'"]([^\'"]*)[\'"]'
2724
mo = re.search(VSRE, verstrline, re.M)

0 commit comments

Comments
 (0)