python: Use trailing commas consistently.

Automatically generated by the following script, based on the output
of lint with flake8-comma:

import re
import sys

last_filename = None
last_row = None
lines = []

for msg in sys.stdin:
    m = re.match(
        r"\x1b\[35mflake8    \|\x1b\[0m \x1b\[1;31m(.+):(\d+):(\d+): (\w+)", msg
    )
    if m:
        filename, row_str, col_str, err = m.groups()
        row, col = int(row_str), int(col_str)

        if filename == last_filename:
            assert last_row != row
        else:
            if last_filename is not None:
                with open(last_filename, "w") as f:
                    f.writelines(lines)

            with open(filename) as f:
                lines = f.readlines()
            last_filename = filename
        last_row = row

        line = lines[row - 1]
        if err in ["C812", "C815"]:
            lines[row - 1] = line[: col - 1] + "," + line[col - 1 :]
        elif err in ["C819"]:
            assert line[col - 2] == ","
            lines[row - 1] = line[: col - 2] + line[col - 1 :].lstrip(" ")

if last_filename is not None:
    with open(last_filename, "w") as f:
        f.writelines(lines)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-04-09 20:23:40 -07:00
committed by Tim Abbott
parent b114eb2f10
commit 69730a78cc
310 changed files with 1789 additions and 1789 deletions

View File

@@ -463,7 +463,7 @@ def export_from_config(response: TableData, config: Config, seed_object: Optiona
config.custom_fetch(
response=response,
config=config,
context=context
context=context,
)
if config.custom_tables:
for t in config.custom_tables:
@@ -533,7 +533,7 @@ def export_from_config(response: TableData, config: Config, seed_object: Optiona
config.post_process_data(
response=response,
config=config,
context=context
context=context,
)
# Now walk our children. It's extremely important to respect
@@ -551,7 +551,7 @@ def get_realm_config() -> Config:
realm_config = Config(
table='zerver_realm',
is_seeded=True
is_seeded=True,
)
Config(
@@ -593,7 +593,7 @@ def get_realm_config() -> Config:
table='zerver_client',
model=Client,
virtual_parent=realm_config,
use_all=True
use_all=True,
)
user_profile_config = Config(
@@ -740,7 +740,7 @@ def get_realm_config() -> Config:
id_source=('_stream_recipient', 'type_id'),
source_filter=lambda r: r['type'] == Recipient.STREAM,
exclude=['email_token'],
post_process_data=sanity_check_stream_data
post_process_data=sanity_check_stream_data,
)
#
@@ -773,7 +773,7 @@ def get_realm_config() -> Config:
'_user_subscription',
'_stream_subscription',
'_huddle_subscription',
]
],
)
return realm_config
@@ -999,7 +999,7 @@ def export_partial_message_files(realm: Realm,
# were specified as being allowed to be exported. "Them"
# refers to other users.
user_ids_for_us = get_ids(
response['zerver_userprofile']
response['zerver_userprofile'],
)
ids_of_our_possible_senders = get_ids(
response['zerver_userprofile'] +
@@ -1408,7 +1408,7 @@ def export_emoji_from_local(realm: Realm, local_dir: Path, output_dir: Path) ->
for realm_emoji in RealmEmoji.objects.filter(realm_id=realm.id):
emoji_path = RealmEmoji.PATH_ID_TEMPLATE.format(
realm_id=realm.id,
emoji_file_name=realm_emoji.file_name
emoji_file_name=realm_emoji.file_name,
)
# Use 'mark_sanitized' to work around false positive caused by Pysa
@@ -1490,7 +1490,7 @@ def do_export_realm(realm: Realm, output_dir: Path, threads: int,
response=response,
config=realm_config,
seed_object=realm,
context=dict(realm=realm, exportable_user_ids=exportable_user_ids)
context=dict(realm=realm, exportable_user_ids=exportable_user_ids),
)
logging.info('...DONE with get_realm_config() data')
@@ -1584,7 +1584,7 @@ def launch_user_message_subprocesses(threads: int, output_dir: Path,
os.path.join(settings.DEPLOY_ROOT, "manage.py"),
'export_usermessage_batch',
'--path', str(output_dir),
'--thread', str(shard_id)
'--thread', str(shard_id),
]
if consent_message_id is not None:
arguments.extend(['--consent-message-id', str(consent_message_id)])