diff options
| author | Jesús Leganés Combarro "Piranna" <piranna@gmail.com> | 2012-02-03 15:22:05 +0100 |
|---|---|---|
| committer | Jesús Leganés Combarro "Piranna" <piranna@gmail.com> | 2012-02-03 15:22:05 +0100 |
| commit | 4e8ae03682d346b2a57dc9d4760d838ec9674804 (patch) | |
| tree | 056c49cb7c8c6ca14a299748a3692dc6ee488e21 /sqlparse | |
| parent | c1b05d502b715558076e0d54008b846e27299d41 (diff) | |
| download | sqlparse-4e8ae03682d346b2a57dc9d4760d838ec9674804.tar.gz | |
Changed get_identifiers() to be a generator
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters.py | 2 | ||||
| -rw-r--r-- | sqlparse/sql.py | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py index 9aa3f6d..23d06e1 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -298,7 +298,7 @@ class ReindentFilter(Filter): self.offset -= num_offset def _process_identifierlist(self, tlist): - identifiers = tlist.get_identifiers() + identifiers = list(tlist.get_identifiers()) if len(identifiers) > 1 and not tlist.within(sql.Function): first = list(identifiers[0].flatten())[0] num_offset = self._get_offset(first) - len(first.value) diff --git a/sqlparse/sql.py b/sqlparse/sql.py index ddb85a1..1bc6b08 100644 --- a/sqlparse/sql.py +++ b/sqlparse/sql.py @@ -437,10 +437,11 @@ class IdentifierList(TokenList): def get_identifiers(self): """Returns the identifiers. - Whitespaces and punctuations are not included in this list. + Whitespaces and punctuations are not included in this generator. """ - return [x for x in self.tokens - if not x.is_whitespace() and not x.match(T.Punctuation, ',')] + for x in self.tokens: + if not x.is_whitespace() and not x.match(T.Punctuation, ','): + yield x class Parenthesis(TokenList): |
