diff options
author | Federico Caselli <cfederico87@gmail.com> | 2022-11-03 20:52:21 +0100 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2022-11-16 23:03:04 +0100 |
commit | 4eb4ceca36c7ce931ea65ac06d6ed08bf459fc66 (patch) | |
tree | 4970cff3f78489a4a0066cd27fd4bae682402957 /lib/sqlalchemy/orm/unitofwork.py | |
parent | 3fc6c40ea77c971d3067dab0fdf57a5b5313b69b (diff) | |
download | sqlalchemy-4eb4ceca36c7ce931ea65ac06d6ed08bf459fc66.tar.gz |
Try running pyupgrade on the code
command run is "pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format <files...>"
pyupgrade will change assert_ to assertTrue. That was reverted since assertTrue does not
exists in sqlalchemy fixtures
Change-Id: Ie1ed2675c7b11d893d78e028aad0d1576baebb55
Diffstat (limited to 'lib/sqlalchemy/orm/unitofwork.py')
-rw-r--r-- | lib/sqlalchemy/orm/unitofwork.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 5e66653a3..9a8c02b6b 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -411,9 +411,9 @@ class UOWTransaction: if cycles: # if yes, break the per-mapper actions into # per-state actions - convert = dict( - (rec, set(rec.per_state_flush_actions(self))) for rec in cycles - ) + convert = { + rec: set(rec.per_state_flush_actions(self)) for rec in cycles + } # rewrite the existing dependencies to point to # the per-state actions for those per-mapper actions @@ -435,9 +435,9 @@ class UOWTransaction: for dep in convert[edge[1]]: self.dependencies.add((edge[0], dep)) - return set( - [a for a in self.postsort_actions.values() if not a.disabled] - ).difference(cycles) + return { + a for a in self.postsort_actions.values() if not a.disabled + }.difference(cycles) def execute(self) -> None: postsort_actions = self._generate_actions() @@ -478,9 +478,9 @@ class UOWTransaction: return states = set(self.states) - isdel = set( + isdel = { s for (s, (isdelete, listonly)) in self.states.items() if isdelete - ) + } other = states.difference(isdel) if isdel: self.session._remove_newly_deleted(isdel) |