mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-15 08:41:24 -05:00
Run Black. (#5482)
This commit is contained in:
parent
7dcf984075
commit
32e7c9e7f2
376 changed files with 9142 additions and 10388 deletions
|
|
@ -40,9 +40,7 @@ def run_upgrade(cur, database_engine, config, *args, **kwargs):
|
|||
logger.warning("Could not get app_service_config_files from config")
|
||||
pass
|
||||
|
||||
appservices = load_appservices(
|
||||
config.server_name, config_files
|
||||
)
|
||||
appservices = load_appservices(config.server_name, config_files)
|
||||
|
||||
owned = {}
|
||||
|
||||
|
|
@ -53,20 +51,19 @@ def run_upgrade(cur, database_engine, config, *args, **kwargs):
|
|||
if user_id in owned.keys():
|
||||
logger.error(
|
||||
"user_id %s was owned by more than one application"
|
||||
" service (IDs %s and %s); assigning arbitrarily to %s" %
|
||||
(user_id, owned[user_id], appservice.id, owned[user_id])
|
||||
" service (IDs %s and %s); assigning arbitrarily to %s"
|
||||
% (user_id, owned[user_id], appservice.id, owned[user_id])
|
||||
)
|
||||
owned.setdefault(appservice.id, []).append(user_id)
|
||||
|
||||
for as_id, user_ids in owned.items():
|
||||
n = 100
|
||||
user_chunks = (user_ids[i:i + 100] for i in range(0, len(user_ids), n))
|
||||
user_chunks = (user_ids[i : i + 100] for i in range(0, len(user_ids), n))
|
||||
for chunk in user_chunks:
|
||||
cur.execute(
|
||||
database_engine.convert_param_style(
|
||||
"UPDATE users SET appservice_id = ? WHERE name IN (%s)" % (
|
||||
",".join("?" for _ in chunk),
|
||||
)
|
||||
"UPDATE users SET appservice_id = ? WHERE name IN (%s)"
|
||||
% (",".join("?" for _ in chunk),)
|
||||
),
|
||||
[as_id] + chunk
|
||||
[as_id] + chunk,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue