diff options
| author | David Cramer | 2012-01-12 19:13:47 -0800 |
|---|---|---|
| committer | David Cramer | 2012-01-12 19:13:47 -0800 |
| commit | 01cd08518ded622d3308dd539b00ebbf7012894e (patch) | |
| tree | a9cca14ff92d4602a51d4999430574587a733d1d /debug_toolbar/utils/sqlparse | |
| parent | c4eeef24faa81e7bc64ebfbd72c046f25c7b3381 (diff) | |
| download | django-debug-toolbar-01cd08518ded622d3308dd539b00ebbf7012894e.tar.bz2 | |
pep8
Diffstat (limited to 'debug_toolbar/utils/sqlparse')
| -rw-r--r-- | debug_toolbar/utils/sqlparse/engine/filter.py | 2 | ||||
| -rw-r--r-- | debug_toolbar/utils/sqlparse/filters.py | 5 | ||||
| -rw-r--r-- | debug_toolbar/utils/sqlparse/sql.py | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/debug_toolbar/utils/sqlparse/engine/filter.py b/debug_toolbar/utils/sqlparse/engine/filter.py index c1c0d6a..a31c5de 100644 --- a/debug_toolbar/utils/sqlparse/engine/filter.py +++ b/debug_toolbar/utils/sqlparse/engine/filter.py @@ -61,7 +61,7 @@ class StatementFilter(TokenFilter): if unified == 'END': # Should this respect a preceeding BEGIN? # In CASE ... WHEN ... END this results in a split level -1. - self._begin_depth = max(0, self._begin_depth-1) + self._begin_depth = max(0, self._begin_depth - 1) return -1 if ttype is T.Keyword.DDL and unified.startswith('CREATE'): diff --git a/debug_toolbar/utils/sqlparse/filters.py b/debug_toolbar/utils/sqlparse/filters.py index 2d247e7..897cc90 100644 --- a/debug_toolbar/utils/sqlparse/filters.py +++ b/debug_toolbar/utils/sqlparse/filters.py @@ -146,13 +146,14 @@ class ReindentFilter(Filter): split_words = ('FROM', 'JOIN$', 'AND', 'OR', 'GROUP', 'ORDER', 'UNION', 'VALUES', 'SET', 'BETWEEN') + def _next_token(i): t = tlist.token_next_match(i, T.Keyword, split_words, regex=True) if t and t.value.upper() == 'BETWEEN': - t = _next_token(tlist.token_index(t)+1) + t = _next_token(tlist.token_index(t) + 1) if t and t.value.upper() == 'AND': - t = _next_token(tlist.token_index(t)+1) + t = _next_token(tlist.token_index(t) + 1) return t idx = 0 diff --git a/debug_toolbar/utils/sqlparse/sql.py b/debug_toolbar/utils/sqlparse/sql.py index 55bf804..2f9f538 100644 --- a/debug_toolbar/utils/sqlparse/sql.py +++ b/debug_toolbar/utils/sqlparse/sql.py @@ -146,7 +146,7 @@ class TokenList(Token): def _pprint_tree(self, max_depth=None, depth=0): """Pretty-print the object tree.""" - indent = ' '*(depth*2) + indent = ' ' * (depth * 2) for idx, token in enumerate(self.tokens): if token.is_group(): pre = ' +-' @@ -156,7 +156,7 @@ class TokenList(Token): token._get_repr_name(), token._get_repr_value()) if (token.is_group() and (max_depth is None or depth < max_depth)): - token._pprint_tree(max_depth, depth+1) + token._pprint_tree(max_depth, depth + 1) def flatten(self): """Generator yielding ungrouped tokens. |
