diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2022-11-17 14:35:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2022-11-17 14:35:10 +0000 |
commit | 60cc662861232ac40bcfd0461b1b1845b643464a (patch) | |
tree | 97b8ca4a8e98aa1210bccc6051c60df13585d7c5 /lib/sqlalchemy/sql/util.py | |
parent | 200e70b9745f1f344be4a35bb8f2b5f01b40d467 (diff) | |
parent | 4eb4ceca36c7ce931ea65ac06d6ed08bf459fc66 (diff) | |
download | sqlalchemy-60cc662861232ac40bcfd0461b1b1845b643464a.tar.gz |
Merge "Try running pyupgrade on the code" into main
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r-- | lib/sqlalchemy/sql/util.py | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index ec8ea757f..14cbe2456 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -316,8 +316,7 @@ def visit_binary_product( if isinstance(element, ColumnClause): yield element for elem in element.get_children(): - for e in visit(elem): - yield e + yield from visit(elem) list(visit(expr)) visit = None # type: ignore # remove gc cycles @@ -433,12 +432,10 @@ def expand_column_list_from_order_by(collist, order_by): in the collist. """ - cols_already_present = set( - [ - col.element if col._order_by_label_element is not None else col - for col in collist - ] - ) + cols_already_present = { + col.element if col._order_by_label_element is not None else col + for col in collist + } to_look_for = list(chain(*[unwrap_order_by(o) for o in order_by])) @@ -463,13 +460,10 @@ def clause_is_present(clause, search): def tables_from_leftmost(clause: FromClause) -> Iterator[FromClause]: if isinstance(clause, Join): - for t in tables_from_leftmost(clause.left): - yield t - for t in tables_from_leftmost(clause.right): - yield t + yield from tables_from_leftmost(clause.left) + yield from tables_from_leftmost(clause.right) elif isinstance(clause, FromGrouping): - for t in tables_from_leftmost(clause.element): - yield t + yield from tables_from_leftmost(clause.element) else: yield clause @@ -592,7 +586,7 @@ class _repr_row(_repr_base): __slots__ = ("row",) - def __init__(self, row: "Row[Any]", max_chars: int = 300): + def __init__(self, row: Row[Any], max_chars: int = 300): self.row = row self.max_chars = max_chars @@ -775,7 +769,7 @@ class _repr_params(_repr_base): ) return text - def _repr_param_tuple(self, params: "Sequence[Any]") -> str: + def _repr_param_tuple(self, params: Sequence[Any]) -> str: trunc = self.trunc ( |