ruff: Fix SIM118 Use `k in d` instead of `k in d.keys()`.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-01-04 22:26:31 -08:00 committed by Tim Abbott
parent 6303ebfc2f
commit 25346bde98
3 changed files with 6 additions and 8 deletions

View File

@ -268,9 +268,7 @@ def normalize_fixture_data(
f'"{timestamp_field}": 1[5-9][0-9]{{8}}(?![0-9-])'
] = f'"{timestamp_field}": 1{i+1:02}%07d'
normalized_values: Dict[str, Dict[str, str]] = {
pattern: {} for pattern in pattern_translations.keys()
}
normalized_values: Dict[str, Dict[str, str]] = {pattern: {} for pattern in pattern_translations}
for fixture_file in fixture_files_for_function(decorated_function):
with open(fixture_file) as f:
file_content = f.read()

View File

@ -263,7 +263,7 @@ class HomeTest(ZulipTestCase):
page_params = self._get_page_params(result)
actual_keys = sorted(str(k) for k in page_params.keys())
actual_keys = sorted(str(k) for k in page_params)
self.assertEqual(actual_keys, self.expected_page_params_keys)
@ -284,7 +284,7 @@ class HomeTest(ZulipTestCase):
"user_id",
]
realm_bots_actual_keys = sorted(str(key) for key in page_params["realm_bots"][0].keys())
realm_bots_actual_keys = sorted(str(key) for key in page_params["realm_bots"][0])
self.assertEqual(realm_bots_actual_keys, realm_bots_expected_keys)
def test_home_demo_organization(self) -> None:
@ -307,7 +307,7 @@ class HomeTest(ZulipTestCase):
self.check_rendered_logged_in_app(result)
page_params = self._get_page_params(result)
actual_keys = sorted(str(k) for k in page_params.keys())
actual_keys = sorted(str(k) for k in page_params)
expected_keys = self.expected_page_params_keys + [
"demo_organization_scheduled_deletion_date"
]
@ -331,7 +331,7 @@ class HomeTest(ZulipTestCase):
# Check no unnecessary params are passed to spectators.
page_params = self._get_page_params(result)
self.assertEqual(page_params["is_spectator"], True)
actual_keys = sorted(str(k) for k in page_params.keys())
actual_keys = sorted(str(k) for k in page_params)
expected_keys = [
"apps_page_url",
"bot_types",

View File

@ -169,7 +169,7 @@ def get_active_worker_queues(only_test_queues: bool = False) -> List[str]:
"""Returns all (either test, or real) worker queues."""
return [
queue_name
for queue_name in worker_classes.keys()
for queue_name in worker_classes
if bool(queue_name in test_queues) == only_test_queues
]