Skip to content

Commit b114ff6

Browse files
committed
Update init and misc files
1 parent c43fccf commit b114ff6

File tree

6 files changed

+35
-21
lines changed

6 files changed

+35
-21
lines changed

examples/column_defs_lowlevel.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/usr/bin/env python
2-
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (C) 2016 Andi Albrecht, [email protected]
5+
#
6+
# This example is part of python-sqlparse and is released under
7+
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
8+
#
39
# Example for retrieving column definitions from a CREATE statement
410
# using low-level functions.
511

@@ -21,17 +27,16 @@
2127
def extract_definitions(token_list):
2228
# assumes that token_list is a parenthesis
2329
definitions = []
30+
tmp = []
2431
# grab the first token, ignoring whitespace
2532
token = token_list.token_next(0)
26-
tmp = []
2733
while token and not token.match(sqlparse.tokens.Punctuation, ')'):
2834
tmp.append(token)
2935
idx = token_list.token_index(token)
3036
# grab the next token, this times including whitespace
3137
token = token_list.token_next(idx, skip_ws=False)
3238
# split on ",", except when on end of statement
33-
if token is not None \
34-
and token.match(sqlparse.tokens.Punctuation, ','):
39+
if token and token.match(sqlparse.tokens.Punctuation, ','):
3540
definitions.append(tmp)
3641
tmp = []
3742
idx = token_list.token_index(token)

examples/extract_table_names.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Copyright (C) 2016 Andi Albrecht, [email protected]
5+
#
6+
# This example is part of python-sqlparse and is released under
7+
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
8+
#
19
# This example illustrates how to extract table names from nested
210
# SELECT statements.
3-
11+
#
412
# See:
513
# http://groups.google.com/group/sqlparse/browse_thread/thread/b0bd9a022e9d4895
614

setup.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
[wheel]
22
universal = 1
3+
4+
[flake8]
5+
exclude =
6+
sqlparse/compat.py
7+
ignore =
8+
W503,
9+
E731

sqlparse/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77

88
"""Parse SQL statements."""
99

10-
11-
__version__ = '0.2.0.dev0'
12-
13-
1410
# Setup namespace
15-
from sqlparse import engine # noqa
16-
from sqlparse import filters # noqa
17-
from sqlparse import formatter # noqa
11+
from sqlparse import sql
12+
from sqlparse import engine
13+
from sqlparse import tokens
14+
from sqlparse import filters
15+
from sqlparse import formatter
16+
17+
from sqlparse.compat import u
1818

19-
from sqlparse.compat import u # noqa
19+
__version__ = '0.2.0.dev0'
20+
__all__ = ['engine', 'filters', 'formatter', 'sql', 'tokens']
2021

2122

2223
def parse(sql, encoding=None):

sqlparse/compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ def unicode_compatible(cls):
5050

5151

5252
text_type = unicode
53-
string_types = (basestring,)
53+
string_types = (str, unicode,)
5454
from StringIO import StringIO

tox.ini

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,3 @@ deps =
2626
flake8
2727
commands =
2828
flake8 sqlparse tests setup.py
29-
30-
[flake8]
31-
exclude =
32-
sqlparse/compat.py
33-
ignore =
34-
W503,
35-
E731

0 commit comments

Comments
 (0)