@@ 203-208 (lines=6) @@ | ||
200 | return ("==", key, value) |
|
201 | else: |
|
202 | return None |
|
203 | ||
204 | elif isinstance(clause, Grouping): |
|
205 | # Ungroup by simply taking the first element of the group |
|
206 | # This is not correct in general, but correct for all documented |
|
207 | # use cases. |
|
208 | return _where_to_tree(clause.get_children()[0], target) |
|
209 | ||
210 | else: |
|
211 | # We hit an unsupported type of clause |
|
@@ 196-201 (lines=6) @@ | ||
193 | elif clause.left.name == "value": |
|
194 | value = clause.right.value |
|
195 | ||
196 | # Check if we got only a key, a key and a value or neither |
|
197 | if key and not value: |
|
198 | return ("has", key, "") |
|
199 | elif key and value: |
|
200 | return ("==", key, value) |
|
201 | else: |
|
202 | return None |
|
203 | ||
204 | elif isinstance(clause, Grouping): |
|
@@ 189-194 (lines=6) @@ | ||
186 | ||
187 | key = "" |
|
188 | value = "" |
|
189 | ||
190 | for clause in conditionals: |
|
191 | if clause.left.name == "key": |
|
192 | key = clause.right.value |
|
193 | elif clause.left.name == "value": |
|
194 | value = clause.right.value |
|
195 | ||
196 | # Check if we got only a key, a key and a value or neither |
|
197 | if key and not value: |
|
@@ 182-187 (lines=6) @@ | ||
179 | try: |
|
180 | # Try to get the real conditionals from this weird statement |
|
181 | conditionals = (clause.get_children()[0]._whereclause.clauses[1]. |
|
182 | get_children()[0].get_children()[0]._whereclause.clauses[1].clauses) |
|
183 | except: |
|
184 | # Simply return None if we got something unexpected |
|
185 | return None |
|
186 | ||
187 | key = "" |
|
188 | value = "" |
|
189 | ||
190 | for clause in conditionals: |