From 6a73006723beaf5ac37a3feb14a2e7d8349ee527 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sun, 30 Jun 2024 14:27:42 -0400 Subject: [PATCH] ruff: Fix FURB105 Unnecessary empty string passed to `print`. Signed-off-by: Anders Kaseorg --- tools/run-mypy | 2 +- tools/test-js-with-puppeteer | 4 ++-- zerver/management/commands/create_default_stream_groups.py | 2 +- zerver/management/commands/deactivate_user.py | 2 +- .../management/commands/delete_old_unclaimed_attachments.py | 6 +++--- zerver/management/commands/register_server.py | 2 +- zerver/migrations/0371_invalid_characters_in_topics.py | 2 +- .../migrations/0375_invalid_characters_in_stream_names.py | 2 +- .../0383_revoke_invitations_from_deactivated_users.py | 2 +- .../migrations/0423_fix_email_gateway_attachment_owner.py | 2 +- zerver/migrations/0501_delete_dangling_usermessages.py | 4 ++-- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tools/run-mypy b/tools/run-mypy index 88d4991867..2a90b69004 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -82,7 +82,7 @@ mypy_args += ["--", *python_files, *pyi_files] rc = subprocess.call([mypy_command, *mypy_args]) if rc != 0: - print("") + print() print("See https://zulip.readthedocs.io/en/latest/testing/mypy.html for debugging tips.") sys.exit(rc) diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteer index e81df9135b..0ac53d9485 100755 --- a/tools/test-js-with-puppeteer +++ b/tools/test-js-with-puppeteer @@ -140,7 +140,7 @@ or report and ask for help in chat.zulip.org""", file=sys.stderr, ) if os.environ.get("GITHUB_ACTIONS"): - print("", file=sys.stderr) + print(file=sys.stderr) print( """ Screenshots generated on failure are extremely helpful for understanding @@ -150,7 +150,7 @@ below to download and view the generated screenshots. """, file=sys.stderr, ) - print("", file=sys.stderr) + print(file=sys.stderr) else: print( "It's also worthy to see screenshots generated on failure stored under var/puppeteer/*.png" diff --git a/zerver/management/commands/create_default_stream_groups.py b/zerver/management/commands/create_default_stream_groups.py index 8565d5cb3f..00d92d0586 100644 --- a/zerver/management/commands/create_default_stream_groups.py +++ b/zerver/management/commands/create_default_stream_groups.py @@ -64,4 +64,4 @@ Create default stream groups which the users can choose during sign up. print(default_stream_group.description) for stream in default_stream_group.streams.all(): print(stream.name) - print("") + print() diff --git a/zerver/management/commands/deactivate_user.py b/zerver/management/commands/deactivate_user.py index 63f0f42ee8..af9f4bbaf1 100644 --- a/zerver/management/commands/deactivate_user.py +++ b/zerver/management/commands/deactivate_user.py @@ -35,7 +35,7 @@ class Command(ZulipBaseCommand): print(f"{user_profile.delivery_email} has the following active sessions:") for session in user_sessions(user_profile): print(session.expire_date, session.get_decoded()) - print("") + print() print( f"{user_profile.delivery_email} has {get_active_bots_owned_by_user(user_profile).count()} active bots that will also be deactivated." ) diff --git a/zerver/management/commands/delete_old_unclaimed_attachments.py b/zerver/management/commands/delete_old_unclaimed_attachments.py index a83e81a7c3..00a9f2317a 100644 --- a/zerver/management/commands/delete_old_unclaimed_attachments.py +++ b/zerver/management/commands/delete_old_unclaimed_attachments.py @@ -61,15 +61,15 @@ class Command(ZulipBaseCommand): if options["for_real"]: do_delete_old_unclaimed_attachments(delta_weeks) - print("") + print() print("Unclaimed files deleted.") if options["clean_up_storage"]: - print("") + print() self.clean_attachment_upload_backend(dry_run=not options["for_real"]) if not options["for_real"]: - print("") + print() raise CommandError("This was a dry run. Pass -f to actually delete.") def clean_attachment_upload_backend(self, dry_run: bool = True) -> None: diff --git a/zerver/management/commands/register_server.py b/zerver/management/commands/register_server.py index 8772ebbf68..edb8ae629a 100644 --- a/zerver/management/commands/register_server.py +++ b/zerver/management/commands/register_server.py @@ -100,7 +100,7 @@ class Command(ZulipBaseCommand): tos_prompt = input( "Do you want to agree to the Zulip Terms of Service and proceed? [Y/n] " ) - print("") + print() if not ( tos_prompt.lower() == "y" or tos_prompt.lower() == "" or tos_prompt.lower() == "yes" ): diff --git a/zerver/migrations/0371_invalid_characters_in_topics.py b/zerver/migrations/0371_invalid_characters_in_topics.py index 90dbb5c812..4cade25f5d 100644 --- a/zerver/migrations/0371_invalid_characters_in_topics.py +++ b/zerver/migrations/0371_invalid_characters_in_topics.py @@ -32,7 +32,7 @@ def fix_topics(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None # Nothing to do if there are no messages. return - print("") + print() while lower_bound < max_id: print(f"Processed {lower_bound} / {max_id}") with connection.cursor() as cursor: diff --git a/zerver/migrations/0375_invalid_characters_in_stream_names.py b/zerver/migrations/0375_invalid_characters_in_stream_names.py index ac497755a1..9769df97f5 100644 --- a/zerver/migrations/0375_invalid_characters_in_stream_names.py +++ b/zerver/migrations/0375_invalid_characters_in_stream_names.py @@ -30,7 +30,7 @@ def fix_stream_names(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) - if len(realm_ids) == 0: return - print("") + print() for realm_id in realm_ids: print(f"Processing realm {realm_id}") realm_stream_dicts = Stream.objects.filter(realm_id=realm_id).values("id", "name") diff --git a/zerver/migrations/0383_revoke_invitations_from_deactivated_users.py b/zerver/migrations/0383_revoke_invitations_from_deactivated_users.py index f2d9def5cc..e57d2ba9fa 100644 --- a/zerver/migrations/0383_revoke_invitations_from_deactivated_users.py +++ b/zerver/migrations/0383_revoke_invitations_from_deactivated_users.py @@ -44,7 +44,7 @@ def revoke_invitations(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) return confirmation_ids - print("") + print() for realm_id in Realm.objects.values_list("id", flat=True): deactivated_user_ids = UserProfile.objects.filter( is_active=False, realm_id=realm_id diff --git a/zerver/migrations/0423_fix_email_gateway_attachment_owner.py b/zerver/migrations/0423_fix_email_gateway_attachment_owner.py index 53333c3b5c..e91a9b9e5e 100644 --- a/zerver/migrations/0423_fix_email_gateway_attachment_owner.py +++ b/zerver/migrations/0423_fix_email_gateway_attachment_owner.py @@ -37,7 +37,7 @@ def fix_email_gateway_attachment_owner( if len(orphan_attachments) == 0: return - print("") + print() print(f"Found {len(orphan_attachments)} email gateway attachments to reattach") for attachment in orphan_attachments: # We look for the message posted by "Internal" at the same diff --git a/zerver/migrations/0501_delete_dangling_usermessages.py b/zerver/migrations/0501_delete_dangling_usermessages.py index 56e1995964..f7c9ebc7e5 100644 --- a/zerver/migrations/0501_delete_dangling_usermessages.py +++ b/zerver/migrations/0501_delete_dangling_usermessages.py @@ -152,7 +152,7 @@ def log_extra_usermessage_rows(apps: StateApps, schema_editor: BaseDatabaseSchem ) else: log_file = sys.stderr - print("", file=log_file) + print(file=log_file) stack.enter_context(redirect_stdout(log_file)) for message in messages: @@ -189,7 +189,7 @@ def log_extra_usermessage_rows(apps: StateApps, schema_editor: BaseDatabaseSchem for um in ums: read = "(read)" if um.flags & 1 else "(unread)" print(f" {um.user_profile.delivery_email} {read}") - print("") + print() class Migration(migrations.Migration):