diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-06-03 09:50:04 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-06-03 11:36:37 -0400 |
commit | 7f0cb933f2b1979a8d781855618b7fd3bf280037 (patch) | |
tree | 22957c23cdd906a929cd7e3daecacef5e0675513 /lib/sqlalchemy/sql/elements.py | |
parent | 58ea81121877330e4bacd5aa4934c2742fc11693 (diff) | |
download | sqlalchemy-7f0cb933f2b1979a8d781855618b7fd3bf280037.tar.gz |
Inline a few ORM arguments, others
small changes
Change-Id: Id89a0651196c431d0aaf6935f5a4e7b12dd70c6c
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r-- | lib/sqlalchemy/sql/elements.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index fa2888a23..986bf134c 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -2189,6 +2189,10 @@ class BooleanClauseList(ClauseList, ColumnElement): has_continue_on = None convert_clauses = [] + + against = operators._asbool + lcc = 0 + for clause in clauses: if clause is continue_on: # instance of continue_on, like and_(x, y, True, z), store it @@ -2199,24 +2203,26 @@ class BooleanClauseList(ClauseList, ColumnElement): # instance of skip_on, e.g. and_(x, y, False, z), cancels # the rest out convert_clauses = [clause] + lcc = 1 break else: + if not lcc: + lcc = 1 + else: + against = operator + # techincally this would be len(convert_clauses) + 1 + # however this only needs to indicate "greater than one" + lcc = 2 convert_clauses.append(clause) if not convert_clauses and has_continue_on is not None: convert_clauses = [has_continue_on] + lcc = 1 - lcc = len(convert_clauses) - - if lcc > 1: - against = operator - else: - against = operators._asbool return lcc, [c.self_group(against=against) for c in convert_clauses] @classmethod def _construct(cls, operator, continue_on, skip_on, *clauses, **kw): - lcc, convert_clauses = cls._process_clauses_for_boolean( operator, continue_on, |