Skip to content

Commit efb6fd4

Browse files
committed
Merge pull request andialbrecht#235 from vmuriart/refactor
Refactor
2 parents 9ab1464 + 955996e commit efb6fd4

13 files changed

Lines changed: 416 additions & 506 deletions

File tree

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# http://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
end_of_line = crlf
9+
charset = utf-8
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.{py,ini,yaml,yml,rst}]
14+
indent_style = space
15+
indent_size = 4
16+
continuation_indent_size = 4
17+
trim_trailing_whitespace = true
18+
19+
[{Makefile,*.bat}]
20+
indent_style = tab
21+
22+
[*.md]
23+
trim_trailing_whitespace = false

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# PyCharm
2+
.idea/
3+
14
*.pyc
25
docs/build
36
dist

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Alphabetical list of contributors:
3333
* spigwitmer <itgpmc@gmail.com>
3434
* Tim Graham <timograham@gmail.com>
3535
* Victor Hahn <info@victor-hahn.de>
36+
* Victor Uriarte <vmuriart@gmail.com>
3637
* vthriller <farreva232@yandex.ru>
3738
* wayne.wuw <wayne.wuw@alibaba-inc.com>
3839
* Yago Riveiro <yago.riveiro@gmail.com>
File renamed without changes.
File renamed without changes.

examples/column_defs_lowlevel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
parsed = sqlparse.parse(SQL)[0]
1616

1717
# extract the parenthesis which holds column definitions
18-
par = parsed.token_next_by_instance(0, sqlparse.sql.Parenthesis)
18+
par = parsed.token_next_by(i=sqlparse.sql.Parenthesis)
1919

2020

2121
def extract_definitions(token_list):

sqlparse/compat.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,40 @@
1414
PY3 = sys.version_info[0] == 3
1515

1616
if PY3:
17+
def u(s):
18+
return str(s)
19+
20+
21+
range = range
1722
text_type = str
1823
string_types = (str,)
1924
from io import StringIO
2025

21-
def u(s):
22-
return str(s)
2326

2427
elif PY2:
28+
def u(s, encoding=None):
29+
encoding = encoding or 'unicode-escape'
30+
try:
31+
return unicode(s)
32+
except UnicodeDecodeError:
33+
return unicode(s, encoding)
34+
35+
36+
range = xrange
2537
text_type = unicode
2638
string_types = (basestring,)
27-
from StringIO import StringIO # flake8: noqa
28-
29-
def u(s):
30-
return unicode(s)
39+
from StringIO import StringIO
3140

3241

3342
# Directly copied from six:
3443
def with_metaclass(meta, *bases):
3544
"""Create a base class with a metaclass."""
45+
3646
# This requires a bit of explanation: the basic idea is to make a dummy
3747
# metaclass for one level of class instantiation that replaces itself with
3848
# the actual metaclass.
3949
class metaclass(meta):
4050
def __new__(cls, name, this_bases, d):
4151
return meta(name, bases, d)
52+
4253
return type.__new__(metaclass, 'temporary_class', (), {})

0 commit comments

Comments
 (0)