Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ruff: Fix E226 Missing whitespace around arithmetic operator.

Anders Kaseorg82a9fd927bfc
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index 8f6998f7d42..9ee1839ca62 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -268,7 +268,7 @@ def normalize_fixture_data(
for i, timestamp_field in enumerate(tested_timestamp_fields):
# Don't use (..) notation, since the matched timestamp can easily appear in other fields
pattern_translations[f'"{timestamp_field}": 1[5-9][0-9]{{8}}(?![0-9-])'] = (
- f'"{timestamp_field}": 1{i+1:02}%07d'
+ f'"{timestamp_field}": 1{i + 1:02}%07d'
)
normalized_values: Dict[str, Dict[str, str]] = {pattern: {} for pattern in pattern_translations}
diff --git a/scripts/log-search b/scripts/log-search
index f9c900d9c34..2e52a8c4be0 100755
--- a/scripts/log-search
+++ b/scripts/log-search
@@ -49,7 +49,7 @@ def parser() -> argparse.ArgumentParser:
"-n",
help="Number of log files to search",
choices=range(1, access_log_retention_days + 2),
- metavar=f"[1-{access_log_retention_days+1}]",
+ metavar=f"[1-{access_log_retention_days + 1}]",
type=int,
)
log_selection_options.add_argument(
@@ -503,7 +503,7 @@ def print_line(
gap_ms = int((logline_start - last_match_end) / timedelta(milliseconds=1))
if gap_ms > 5000:
print()
- print(f"========== {int(gap_ms/1000):>4} second gap ==========")
+ print(f"========== {int(gap_ms / 1000):>4} second gap ==========")
print()
elif gap_ms > 1000:
print(f"============ {gap_ms:>5}ms gap ============")
diff --git a/zerver/tests/test_validators.py b/zerver/tests/test_validators.py
index 117ae07db9b..6729d34ddea 100644
--- a/zerver/tests/test_validators.py
+++ b/zerver/tests/test_validators.py
@@ -124,7 +124,9 @@ class ValidatorTestCase(ZulipTestCase):
to_non_negative_int("x", "-1")
with self.assertRaisesRegex(ValueError, re.escape("5 is too large (max 4)")):
to_non_negative_int("x", "5", max_int_size=4)
- with self.assertRaisesRegex(ValueError, re.escape(f"{2**32} is too large (max {2**32-1})")):
+ with self.assertRaisesRegex(
+ ValueError, re.escape(f"{2**32} is too large (max {2**32 - 1})")
+ ):
to_non_negative_int("x", str(2**32))
def test_check_float(self) -> None:
diff --git a/zerver/webhooks/bitbucket2/tests.py b/zerver/webhooks/bitbucket2/tests.py
index 577fdc221b8..b7c70567902 100644
--- a/zerver/webhooks/bitbucket2/tests.py
+++ b/zerver/webhooks/bitbucket2/tests.py
@@ -25,12 +25,12 @@ class Bitbucket2HookTests(WebhookTestCase):
def test_bitbucket2_on_push_commits_multiple_committers(self) -> None:
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))\n"
- expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 3 commits to branch master. Commits by Ben (2) and Tomasz (1).\n\n{commit_info*2}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
+ expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 3 commits to branch master. Commits by Ben (2) and Tomasz (1).\n\n{commit_info * 2}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
self.check_webhook("push_multiple_committers", TOPIC_BRANCH_EVENTS, expected_message)
def test_bitbucket2_on_push_commits_multiple_committers_with_others(self) -> None:
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))\n"
- expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 10 commits to branch master. Commits by Tomasz (4), James (3), Brendon (2) and others (1).\n\n{commit_info*9}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
+ expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 10 commits to branch master. Commits by Tomasz (4), James (3), Brendon (2) and others (1).\n\n{commit_info * 9}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
self.check_webhook(
"push_multiple_committers_with_others", TOPIC_BRANCH_EVENTS, expected_message
)
@@ -38,7 +38,7 @@ class Bitbucket2HookTests(WebhookTestCase):
def test_bitbucket2_on_push_commits_multiple_committers_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url(branches="master,development")
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))\n"
- expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 3 commits to branch master. Commits by Ben (2) and Tomasz (1).\n\n{commit_info*2}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
+ expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 3 commits to branch master. Commits by Ben (2) and Tomasz (1).\n\n{commit_info * 2}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
self.check_webhook("push_multiple_committers", TOPIC_BRANCH_EVENTS, expected_message)
def test_bitbucket2_on_push_commits_multiple_committers_with_others_filtered_by_branches(
@@ -46,7 +46,7 @@ class Bitbucket2HookTests(WebhookTestCase):
) -> None:
self.url = self.build_webhook_url(branches="master,development")
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))\n"
- expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 10 commits to branch master. Commits by Tomasz (4), James (3), Brendon (2) and others (1).\n\n{commit_info*9}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
+ expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 10 commits to branch master. Commits by Tomasz (4), James (3), Brendon (2) and others (1).\n\n{commit_info * 9}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
self.check_webhook(
"push_multiple_committers_with_others", TOPIC_BRANCH_EVENTS, expected_message
)