Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate quotes for strings inside f-strings in preview #13860

Merged
merged 3 commits into from
Oct 23, 2024

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Oct 21, 2024

Summary

This PR changes how quotes are selected for f-strings and nested string literals when preview mode is on.

For the outer f-string: The logic is the same as for any other strings, except that we only count the quotes inside literal parts. This is different from before where choose_quotes analyzed the entire f-string, including expressions.

The rules for inner f-strings are:

  • If the outer f-string is a triple quoted string: Prefer the configured quote style
  • If the outer f-string is single quoted: Prefer the opposite quote style (alternate the quote styles).
f"{'inner'}"

# Before
f"{"inner"}"

The only exception to the above rule is when targeting <Py312 and the f-string contains a debug-expression that itself contains quotes:

f'{a + "b"=}' # Can't change the quotes here

In this case, changing the quotes is unsafe because the debug expression will retain its existing quotes. That's why the implementation must preserve the outer quotes as is. Changing the outer quotes is fine when targeting Py312+.

f"{a + "b"=}"

The advantage of limiting the pre-312 behavior to only debug expressions is that an upgrade of the target version to 312 should result in a very small diff considering that debug expressions containing quotes should be rare.

Fixes #13237
Fixes #11056

Considerations

This new style no longer optimizes for the fewest "foreign" quotes in total. E.g. it changes

return f'#{data["node"]["number"]} {component_str}{data["node"]["title"]}'

to

return f"#{data['node']['number']} {component_str}{data['node']['title']}"

where the total preferred quotes count is 2, but it uses 8 single quotes.

Test Plan

  • Added tests
  • Reviewed the snapshot changes
  • Reviewed the ecosystem changes

Review

The most useful for review is if you can think of more cursed f-string examples where the above approach might produce invalid f-strings or weird looking quote selections.

@MichaReiser MichaReiser added formatter Related to the formatter preview Related to preview mode features labels Oct 21, 2024
@MichaReiser MichaReiser changed the base branch from main to micha/refactor-normalize October 21, 2024 14:28
@MichaReiser MichaReiser force-pushed the micha/f-string-alternate-quotes branch from 802352c to 4c283f1 Compare October 21, 2024 14:48
@@ -235,6 +261,52 @@ pub(crate) struct QuoteMetadata {
/// Tracks information about the used quotes in a string which is used
/// to choose the quotes for a part.
impl QuoteMetadata {
pub(crate) fn from_part(
Copy link
Member Author

@MichaReiser MichaReiser Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both from_part and merge are also needed for implicit string formatting. We get good reuse :)

@MichaReiser MichaReiser force-pushed the micha/f-string-alternate-quotes branch from 4c283f1 to 5071965 Compare October 21, 2024 14:57
Copy link
Contributor

github-actions bot commented Oct 21, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

ℹ️ ecosystem check detected format changes. (+338 -338 lines in 178 files in 30 projects; 24 projects unchanged)

DisnakeDev/disnake (+2 -2 lines across 1 file)

ruff format --preview

disnake/opus.py~L371

     def set_bandwidth(self, req: BAND_CTL) -> None:
         if req not in band_ctl:
             raise KeyError(
-                f'{req!r} is not a valid bandwidth setting. Try one of: {",".join(band_ctl)}'
+                f"{req!r} is not a valid bandwidth setting. Try one of: {','.join(band_ctl)}"
             )
 
         k = band_ctl[req]

disnake/opus.py~L380

     def set_signal_type(self, req: SIGNAL_CTL) -> None:
         if req not in signal_ctl:
             raise KeyError(
-                f'{req!r} is not a valid bandwidth setting. Try one of: {",".join(signal_ctl)}'
+                f"{req!r} is not a valid bandwidth setting. Try one of: {','.join(signal_ctl)}"
             )
 
         k = signal_ctl[req]

RasaHQ/rasa (+2 -2 lines across 1 file)

ruff format --preview

rasa/core/training/interactive.py~L346

     choices = []
     for p in sorted_intents:
         name_with_confidence = (
-            f'{p.get("confidence"):03.2f} {p.get(INTENT_NAME_KEY):40}'
+            f"{p.get('confidence'):03.2f} {p.get(INTENT_NAME_KEY):40}"
         )
         choice = {
             INTENT_NAME_KEY: name_with_confidence,

rasa/core/training/interactive.py~L674

     await _print_history(conversation_id, endpoint)
 
     choices = [
-        {"name": f'{a["score"]:03.2f} {a["action"]:40}', "value": a["action"]}
+        {"name": f"{a['score']:03.2f} {a['action']:40}", "value": a["action"]}
         for a in predictions
     ]
 

Snowflake-Labs/snowcli (+1 -1 lines across 1 file)

ruff format --preview

tests/test_connection.py~L1268

             ["connection", "generate-jwt", "-c", "jwt"],
         )
         assert (
-            f'{attribute.capitalize().replace("_", " ")} is not set in the connection context'
+            f"{attribute.capitalize().replace('_', ' ')} is not set in the connection context"
             in result.output
         )

apache/airflow (+8 -8 lines across 5 files)

ruff format --preview

dev/breeze/src/airflow_breeze/commands/release_management_commands.py~L2035

     """Check if package has been prepared in dist folder."""
     return any(
         file.startswith((
-            f'apache_airflow_providers_{package.replace(".", "_")}',
-            f'apache-airflow-providers-{package.replace(".", "-")}',
+            f"apache_airflow_providers_{package.replace('.', '_')}",
+            f"apache-airflow-providers-{package.replace('.', '-')}",
         ))
         for file in dist_files
     )

dev/breeze/src/airflow_breeze/commands/release_management_commands.py~L2048

 def get_suffix_from_package_in_dist(dist_files: list[str], package: str) -> str | None:
     """Get suffix from package prepared in dist folder."""
     for file in dist_files:
-        if file.startswith(f'apache_airflow_providers_{package.replace(".", "_")}') and file.endswith(
+        if file.startswith(f"apache_airflow_providers_{package.replace('.', '_')}") and file.endswith(
             ".tar.gz"
         ):
             file = file[: -len(".tar.gz")]

dev/breeze/src/airflow_breeze/utils/packages.py~L714

             f"[error]Error {e}[/]\n"
             f"[error]When fetching tags from remote. Your tags might not be refreshed.[/]\n\n"
             f'[warning]Please refresh the tags manually via:[/]\n\n"'
-            f'{" ".join(fetch_command)}\n\n'
+            f"{' '.join(fetch_command)}\n\n"
         )
         sys.exit(1)
 

providers/src/airflow/providers/docker/decorators/docker.py~L161

             f"""bash -cx  '{
                 _generate_decode_command("__PYTHON_SCRIPT", "/tmp/script.py", self.python_command)
             } &&"""
-            f'{_generate_decode_command("__PYTHON_INPUT", "/tmp/script.in", self.python_command)} &&'
+            f"{_generate_decode_command('__PYTHON_INPUT', '/tmp/script.in', self.python_command)} &&"
             f"{self.python_command} /tmp/script.py /tmp/script.in /tmp/script.out none /tmp/script.out'"
         )
 

providers/tests/system/amazon/aws/example_sagemaker_endpoint.py~L211

     upload_data = S3CreateObjectOperator(
         task_id="upload_data",
         s3_bucket=test_setup["bucket_name"],
-        s3_key=f'{test_setup["input_data_s3_key"]}/train.csv',
+        s3_key=f"{test_setup['input_data_s3_key']}/train.csv",
         data=TRAIN_DATA,
     )
 

tests/models/test_dagbag.py~L498

         dag_id = expected_dag.dag_id
         actual_dagbag.log.info("validating %s", dag_id)
         assert (dag_id in actual_found_dag_ids) == should_be_found, (
-            f"dag \"{dag_id}\" should {'' if should_be_found else 'not '}"
+            f'dag "{dag_id}" should {"" if should_be_found else "not "}'
             f'have been found after processing dag "{expected_dag.dag_id}"'
         )
         assert (dag_id in actual_dagbag.dags) == should_be_found, (
-            f"dag \"{dag_id}\" should {'' if should_be_found else 'not '}"
+            f'dag "{dag_id}" should {"" if should_be_found else "not "}'
             f'be in dagbag.dags after processing dag "{expected_dag.dag_id}"'
         )
 

apache/superset (+7 -7 lines across 5 files)

ruff format --preview

superset/db_engine_specs/snowflake.py~L334

         if missing := sorted(required - present):
             errors.append(
                 SupersetError(
-                    message=f'One or more parameters are missing: {", ".join(missing)}',
+                    message=f"One or more parameters are missing: {', '.join(missing)}",
                     error_type=SupersetErrorType.CONNECTION_MISSING_PARAMETERS_ERROR,
                     level=ErrorLevel.WARNING,
                     extra={"missing": missing},

superset/sql_lab.py~L267

         if not query.tmp_table_name:
             start_dttm = datetime.fromtimestamp(query.start_time)
             query.tmp_table_name = (
-                f'tmp_{query.user_id}_table_{start_dttm.strftime("%Y_%m_%d_%H_%M_%S")}'
+                f"tmp_{query.user_id}_table_{start_dttm.strftime('%Y_%m_%d_%H_%M_%S')}"
             )
         sql = parsed_query.as_create_table(
             query.tmp_table_name,

superset/tags/api.py~L143

         """Deterministic string representation of the API instance for etag_cache."""
         return (
             "Superset.tags.api.TagRestApi@v"
-            f'{self.appbuilder.app.config["VERSION_STRING"]}'
-            f'{self.appbuilder.app.config["VERSION_SHA"]}'
+            f"{self.appbuilder.app.config['VERSION_STRING']}"
+            f"{self.appbuilder.app.config['VERSION_SHA']}"
         )
 
     @expose("/", methods=("POST",))

tests/integration_tests/datasets/api_tests.py~L723

 
         # cleanup
         data = json.loads(rv.data.decode("utf-8"))
-        uri = f'api/v1/dataset/{data.get("id")}'
+        uri = f"api/v1/dataset/{data.get('id')}"
         rv = self.client.delete(uri)
         assert rv.status_code == 200
         with example_db.get_sqla_engine() as engine:

tests/integration_tests/datasets/api_tests.py~L808

 
             # cleanup
             data = json.loads(rv.data.decode("utf-8"))
-            uri = f'api/v1/dataset/{data.get("id")}'
+            uri = f"api/v1/dataset/{data.get('id')}"
             rv = self.client.delete(uri)
             assert rv.status_code == 200
 

tests/integration_tests/datasource_tests.py~L541

 
     sql = (
         f"select * from ({virtual_dataset.sql}) as tbl "
-        f'limit {app.config["SAMPLES_ROW_LIMIT"]}'
+        f"limit {app.config['SAMPLES_ROW_LIMIT']}"
     )
     eager_samples = virtual_dataset.database.get_df(sql)
 

aws/aws-sam-cli (+2 -2 lines across 2 files)

ruff format --preview

tests/integration/testdata/remote_invoke/lambda-fns/main.py~L9

     print("value2 = " + event["key2"])
     print("value3 = " + event["key3"])
 
-    return {"message": f'{event["key1"]} {event["key3"]}'}
+    return {"message": f"{event['key1']} {event['key3']}"}
 
 
 def custom_env_var_echo_handler(event, context):

tests/unit/commands/pipeline/init/test_initeractive_init_flow.py~L188

             str(["2", "pipeline_execution_role"]): "arn:aws:iam::123456789012:role/execution-role",
             str(["default", "pipeline_execution_role"]): "arn:aws:iam::123456789012:role/execution-role",
             str(["stage_names_message"]): "Here are the stage configuration names detected "
-            f'in {os.path.join(".aws-sam", "pipeline", "pipelineconfig.toml")}:\n\t1 - testing\n\t2 - prod',
+            f"in {os.path.join('.aws-sam', 'pipeline', 'pipelineconfig.toml')}:\n\t1 - testing\n\t2 - prod",
             "shared_values": "default",
         })
         cookiecutter_mock.assert_called_once_with(

binary-husky/gpt_academic (+12 -12 lines across 8 files)

ruff format --preview

crazy_functions/Conversation_To_File.py~L246

         local_history = "<br/>".join([
             "`" + hide_cwd(f) + f" ({gen_file_preview(f)})" + "`"
             for f in glob.glob(
-                f'{get_log_folder(get_user(chatbot), plugin_name="chat_history")}/**/{f_prefix}*.html',
+                f"{get_log_folder(get_user(chatbot), plugin_name='chat_history')}/**/{f_prefix}*.html",
                 recursive=True,
             )
         ])

crazy_functions/Conversation_To_File.py~L285

     local_history = "<br/>".join([
         "`" + hide_cwd(f) + "`"
         for f in glob.glob(
-            f'{get_log_folder(get_user(chatbot), plugin_name="chat_history")}/**/{f_prefix}*.html',
+            f"{get_log_folder(get_user(chatbot), plugin_name='chat_history')}/**/{f_prefix}*.html",
             recursive=True,
         )
     ])
     for f in glob.glob(
-        f'{get_log_folder(get_user(chatbot), plugin_name="chat_history")}/**/{f_prefix}*.html',
+        f"{get_log_folder(get_user(chatbot), plugin_name='chat_history')}/**/{f_prefix}*.html",
         recursive=True,
     ):
         os.remove(f)

crazy_functions/Markdown_Translate.py~L193

                 txt = txt.replace("/blob/", "/")
 
         r = requests.get(txt, proxies=proxies)
-        download_local = f'{get_log_folder(plugin_name="批量Markdown翻译")}/raw-readme-{gen_time_str()}.md'
-        project_folder = f'{get_log_folder(plugin_name="批量Markdown翻译")}'
+        download_local = f"{get_log_folder(plugin_name='批量Markdown翻译')}/raw-readme-{gen_time_str()}.md"
+        project_folder = f"{get_log_folder(plugin_name='批量Markdown翻译')}"
         with open(download_local, "wb+") as f:
             f.write(r.content)
         file_manifest = [download_local]

crazy_functions/Social_Helper.py~L182

 
         try:
             Explaination = "\n".join([
-                f'{k}: {v["explain_to_llm"]}' for k, v in self.tools_to_select.items()
+                f"{k}: {v['explain_to_llm']}" for k, v in self.tools_to_select.items()
             ])
 
             class UserSociaIntention(BaseModel):

crazy_functions/gen_fns/gen_fns_shared.py~L22

 
 def try_make_module(code, chatbot):
     module_file = "gpt_fn_" + gen_time_str().replace("-", "_")
-    fn_path = f'{get_log_folder(plugin_name="gen_plugin_verify")}/{module_file}.py'
+    fn_path = f"{get_log_folder(plugin_name='gen_plugin_verify')}/{module_file}.py"
     with open(fn_path, "w", encoding="utf8") as f:
         f.write(code)
     promote_file_to_downloadzone(fn_path, chatbot=chatbot)

crazy_functions/gen_fns/gen_fns_shared.py~L70

     return_dict["traceback"] = ""
     try:
         module_file = "gpt_fn_" + gen_time_str().replace("-", "_")
-        fn_path = f'{get_log_folder(plugin_name="gen_plugin_run")}/{module_file}.py'
+        fn_path = f"{get_log_folder(plugin_name='gen_plugin_run')}/{module_file}.py"
         with open(fn_path, "w", encoding="utf8") as f:
             f.write(code)
         class_name = get_class_name(code)

crazy_functions/vt_fns/vt_call_plugin.py~L187

     # ⭐ ⭐ ⭐ 执行插件
     fn = plugin["Function"]
     fn_name = fn.__name__
-    msg = f'{llm_kwargs["llm_model"]}为您选择了插件: `{fn_name}`\n\n插件说明:{plugin["Info"]}\n\n插件参数:{plugin_sel.plugin_arg}\n\n假如偏离了您的要求,按停止键终止。'
+    msg = f"{llm_kwargs['llm_model']}为您选择了插件: `{fn_name}`\n\n插件说明:{plugin['Info']}\n\n插件参数:{plugin_sel.plugin_arg}\n\n假如偏离了您的要求,按停止键终止。"
     yield from update_ui_lastest_msg(
         lastmsg=msg, chatbot=chatbot, history=history, delay=2
     )

request_llms/bridge_all.py~L1170

             raise ValueError("AZURE_CFG_ARRAY中配置的模型必须以azure开头")
         endpoint_ = (
             azure_cfg_dict["AZURE_ENDPOINT"]
-            + f'openai/deployments/{azure_cfg_dict["AZURE_ENGINE"]}/chat/completions?api-version=2023-05-15'
+            + f"openai/deployments/{azure_cfg_dict['AZURE_ENGINE']}/chat/completions?api-version=2023-05-15"
         )
         model_info.update({
             azure_model_name: {

request_llms/com_google.py~L101

 def html_local_file(file):
     base_path = os.path.dirname(__file__)  # 项目目录
     if os.path.exists(str(file)):
-        file = f'file={file.replace(base_path, ".")}'
+        file = f"file={file.replace(base_path, '.')}"
     return file
 
 

shared_utils/handle_upload.py~L14

 def html_local_file(file):
     base_path = os.path.dirname(__file__)  # 项目目录
     if os.path.exists(str(file)):
-        file = f'file={file.replace(base_path, ".")}'
+        file = f"file={file.replace(base_path, '.')}"
     return file
 
 

bokeh/bokeh (+1 -1 lines across 1 file)

ruff format --preview

scripts/milestone.py~L67

     """Returns a humanized description of the given issue or PR data."""
     component = get_label_component(data)
     component_str = "" if not component else f"[component: {component}] "
-    return f'#{data["node"]["number"]} {component_str}{data["node"]["title"]}'
+    return f"#{data['node']['number']} {component_str}{data['node']['title']}"
 
 
 def get_milestone_number(title, token, allow_closed):

fronzbot/blinkpy (+3 -3 lines across 2 files)

ruff format --preview

blinksync/blinksync.py~L65

             await my_sync.refresh()
             if my_sync.local_storage and my_sync.local_storage_manifest_ready:
                 print("Manifest is ready")
-                print(f"Manifest {my_sync._local_storage["manifest"]}")
+                print(f"Manifest {my_sync._local_storage['manifest']}")
             else:
                 print("Manifest not ready")
             for name, camera in blink.cameras.items():

blinksync/blinksync.py~L91

                         await item.prepare_download(blink)
                         await item.download_video(
                             blink,
-                            f"{path}/{item.name}_{item.created_at.astimezone().isoformat().replace(":", "_")}.mp4",
+                            f"{path}/{item.name}_{item.created_at.astimezone().isoformat().replace(':', '_')}.mp4",
                         )
                     if button == DELETE:
                         await item.delete_video(blink)

tests/test_camera_functions.py~L119

                     f"temperature response {mock_resp.return_value}."
                 ),
                 (
-                    f"WARNING:blinkpy.camera:for network_id ({config["network_id"]}) "
+                    f"WARNING:blinkpy.camera:for network_id ({config['network_id']}) "
                     f"and camera_id ({self.camera.camera_id})"
                 ),
                 ("WARNING:blinkpy.camera:Could not find thumbnail for camera new."),

ibis-project/ibis (+1 -1 lines across 1 file)

ruff format --preview

ibis/backends/clickhouse/tests/test_client.py~L362

 
 
 def test_password_with_bracket():
-    password = f'{os.environ.get("IBIS_TEST_CLICKHOUSE_PASSWORD", "")}[]'
+    password = f"{os.environ.get('IBIS_TEST_CLICKHOUSE_PASSWORD', '')}[]"
     quoted_pass = quote_plus(password)
     host = os.environ.get("IBIS_TEST_CLICKHOUSE_HOST", "localhost")
     user = os.environ.get("IBIS_TEST_CLICKHOUSE_USER", "default")

langchain-ai/langchain (+16 -16 lines across 6 files)

ruff format --preview

docs/docs/how_to/chat_token_usage_tracking.ipynb~L138

     }
    ],
    "source": [
-    "print(f'OpenAI: {openai_response.response_metadata[\"token_usage\"]}\\n')\n",
-    "print(f'Anthropic: {anthropic_response.response_metadata[\"usage\"]}')"
+    "print(f\"OpenAI: {openai_response.response_metadata['token_usage']}\\n\")\n",
+    "print(f\"Anthropic: {anthropic_response.response_metadata['usage']}\")"
    ]
   },
   {

docs/docs/how_to/chat_token_usage_tracking.ipynb~L307

     "\n",
     "async for event in structured_llm.astream_events(\"Tell me a joke\", version=\"v2\"):\n",
     "    if event[\"event\"] == \"on_chat_model_end\":\n",
-    "        print(f'Token usage: {event[\"data\"][\"output\"].usage_metadata}\\n')\n",
+    "        print(f\"Token usage: {event['data']['output'].usage_metadata}\\n\")\n",
     "    elif event[\"event\"] == \"on_chain_end\":\n",
     "        print(event[\"data\"][\"output\"])\n",
     "    else:\n",

docs/docs/how_to/message_history.ipynb~L376

    "source": [
     "state = app.get_state(config).values\n",
     "\n",
-    "print(f'Language: {state[\"language\"]}')\n",
+    "print(f\"Language: {state['language']}\")\n",
     "for message in state[\"messages\"]:\n",
     "    message.pretty_print()"
    ]

docs/docs/how_to/message_history.ipynb~L427

    "source": [
     "state = app.get_state(config).values\n",
     "\n",
-    "print(f'Language: {state[\"language\"]}')\n",
+    "print(f\"Language: {state['language']}\")\n",
     "for message in state[\"messages\"]:\n",
     "    message.pretty_print()"
    ]

libs/cli/langchain_cli/namespaces/app.py~L249

 
     chain_names = []
     for e in installed_exports:
-        original_candidate = f'{e["package_name"].replace("-", "_")}_chain'
+        original_candidate = f"{e['package_name'].replace('-', '_')}_chain"
         candidate = original_candidate
         i = 2
         while candidate in chain_names:

libs/community/langchain_community/graphs/neo4j_graph.py~L178

                         example = (
                             (
                                 "Available options: "
-                                f'{[clean_string_values(el) for el in prop["values"]]}'
+                                f"{[clean_string_values(el) for el in prop['values']]}"
                             )
                             if prop["values"]
                             else ""

libs/community/langchain_community/graphs/neo4j_graph.py~L192

                     "LOCAL_DATE_TIME",
                 ]:
                     if prop.get("min") is not None:
-                        example = f'Min: {prop["min"]}, Max: {prop["max"]}'
+                        example = f"Min: {prop['min']}, Max: {prop['max']}"
                     else:
                         example = (
                             f'Example: "{prop["values"][0]}"'

libs/community/langchain_community/graphs/neo4j_graph.py~L204

                     if not prop.get("min_size") or prop["min_size"] > LIST_LIMIT:
                         continue
                     example = (
-                        f'Min Size: {prop["min_size"]}, Max Size: {prop["max_size"]}'
+                        f"Min Size: {prop['min_size']}, Max Size: {prop['max_size']}"
                     )
                 formatted_node_props.append(
                     f"  - `{prop['property']}`: {prop['type']} {example}"

libs/community/langchain_community/graphs/neo4j_graph.py~L226

                         example = (
                             (
                                 "Available options: "
-                                f'{[clean_string_values(el) for el in prop["values"]]}'
+                                f"{[clean_string_values(el) for el in prop['values']]}"
                             )
                             if prop["values"]
                             else ""

libs/community/langchain_community/graphs/neo4j_graph.py~L239

                     "LOCAL_DATE_TIME",
                 ]:
                     if prop.get("min"):  # If we have min/max
-                        example = f'Min: {prop["min"]}, Max:  {prop["max"]}'
+                        example = f"Min: {prop['min']}, Max:  {prop['max']}"
                     else:  # return a single value
                         example = (
                             f'Example: "{prop["values"][0]}"' if prop["values"] else ""

libs/community/langchain_community/graphs/neo4j_graph.py~L249

                     if not prop.get("min_size") or prop["min_size"] > LIST_LIMIT:
                         continue
                     example = (
-                        f'Min Size: {prop["min_size"]}, Max Size: {prop["max_size"]}'
+                        f"Min Size: {prop['min_size']}, Max Size: {prop['max_size']}"
                     )
                 formatted_rel_props.append(
                     f"  - `{prop['property']}: {prop['type']}` {example}"

libs/community/langchain_community/vectorstores/typesense.py~L159

         embedded_query = [str(x) for x in self._embedding.embed_query(query)]
         query_obj = {
             "q": "*",
-            "vector_query": f'vec:([{",".join(embedded_query)}], k:{k})',
+            "vector_query": f"vec:([{','.join(embedded_query)}], k:{k})",
             "filter_by": filter,
             "collection": self._typesense_collection_name,
         }

templates/neo4j-semantic-ollama/neo4j_semantic_ollama/recommendation_tool.py~L78

         try:
             return (
                 "Recommended movies are: "
-                f'{f"###Movie {nl}".join([el["movie"] for el in response])}'
+                f"{f'###Movie {nl}'.join([el['movie'] for el in response])}"
             )
         except Exception:
             return "Can you tell us about some of the movies you liked?"

templates/neo4j-semantic-ollama/neo4j_semantic_ollama/recommendation_tool.py~L88

         try:
             return (
                 "Recommended movies are: "
-                f'{f"###Movie {nl}".join([el["movie"] for el in response])}'
+                f"{f'###Movie {nl}'.join([el['movie'] for el in response])}"
             )
         except Exception:
             return "Something went wrong"

templates/neo4j-semantic-ollama/neo4j_semantic_ollama/recommendation_tool.py~L102

     try:
         return (
             "Recommended movies are: "
-            f'{f"###Movie {nl}".join([el["movie"] for el in response])}'
+            f"{f'###Movie {nl}'.join([el['movie'] for el in response])}"
         )
     except Exception:
         return "Something went wrong"

latchbio/latch (+1 -1 lines across 1 file)

ruff format --preview

latch_cli/services/move.py~L156

                 raise e
 
     if len(srcs) == 1:
-        src_str = f'{click.style("Source: ", fg="blue")}{srcs[0]}'
+        src_str = f"{click.style('Source: ', fg='blue')}{srcs[0]}"
     else:
         src_str = "\n".join([
             click.style("Sources: ", fg="blue"),

lnbits/lnbits (+7 -7 lines across 2 files)

ruff format --preview

lnbits/wallets/phoenixd.py~L232

                             and message_json.get("type") == "payment_received"
                         ):
                             logger.info(
-                                f'payment-received: {message_json["paymentHash"]}'
+                                f"payment-received: {message_json['paymentHash']}"
                             )
                             yield message_json["paymentHash"]
 

tests/regtest/test_real_invoice.py~L45

 
     # check the payment status
     response = await client.get(
-        f'/api/v1/payments/{invoice["payment_hash"]}', headers=inkey_headers_from
+        f"/api/v1/payments/{invoice['payment_hash']}", headers=inkey_headers_from
     )
     assert response.status_code < 300
     payment_status = response.json()

tests/regtest/test_real_invoice.py~L74

     invoice = response.json()
 
     response = await client.get(
-        f'/api/v1/payments/{invoice["payment_hash"]}', headers=inkey_headers_from
+        f"/api/v1/payments/{invoice['payment_hash']}", headers=inkey_headers_from
     )
     assert response.status_code < 300
     payment_status = response.json()

tests/regtest/test_real_invoice.py~L84

         assert payment.checking_id == invoice["payment_hash"]
 
         response = await client.get(
-            f'/api/v1/payments/{invoice["payment_hash"]}', headers=inkey_headers_from
+            f"/api/v1/payments/{invoice['payment_hash']}", headers=inkey_headers_from
         )
         assert response.status_code < 300
         payment_status = response.json()

tests/regtest/test_real_invoice.py~L128

 
     # check the payment status
     response = await client.get(
-        f'/api/v1/payments/{invoice["payment_hash"]}', headers=inkey_headers_from
+        f"/api/v1/payments/{invoice['payment_hash']}", headers=inkey_headers_from
     )
     payment_status = response.json()
     assert payment_status["paid"]

tests/regtest/test_real_invoice.py~L290

     assert response.status_code < 300
     invoice = response.json()
     response = await client.get(
-        f'/api/v1/payments/{invoice["payment_hash"]}', headers=inkey_headers_from
+        f"/api/v1/payments/{invoice['payment_hash']}", headers=inkey_headers_from
     )
     payment_status = response.json()
     assert not payment_status["paid"]

tests/regtest/test_real_invoice.py~L299

         assert payment.checking_id == invoice["payment_hash"]
 
         response = await client.get(
-            f'/api/v1/payments/{invoice["payment_hash"]}', headers=inkey_headers_from
+            f"/api/v1/payments/{invoice['payment_hash']}", headers=inkey_headers_from
         )
         assert response.status_code < 300
         payment_status = response.json()

milvus-io/pymilvus (+2 -2 lines across 2 files)

ruff format --preview

examples/hello_hybrid_bm25.py~L157

         print(f"text: {hit.text} distance {hit.score}")
 else:
     for hit in res:
-        print(f'text: {hit.fields["text"]} distance {hit.distance}')
+        print(f"text: {hit.fields['text']} distance {hit.distance}")
 
 # If you used both BGE-M3 and the reranker, you should see the following:
 # text: Alan Turing was the first person to conduct substantial research in AI. distance 0.9306981017573297

examples/hello_hybrid_sparse_dense.py~L151

         print(f"text: {hit.text} distance {hit.score}")
 else:
     for hit in res:
-        print(f'text: {hit.fields["text"]} distance {hit.distance}')
+        print(f"text: {hit.fields['text']} distance {hit.distance}")
 
 # If you used both BGE-M3 and the reranker, you should see the following:
 # text: Alan Turing was the first person to conduct substantial research in AI. distance 0.9306981017573297

mlflow/mlflow (+3 -3 lines across 2 files)

ruff format --preview

tests/recipes/test_ingest_step.py~L103

     pandas_df_part2 = pandas_df[1:]
     pandas_df_part1.to_csv(dataset_path / "df1.csv")
     pandas_df_part2.to_csv(dataset_path / "df2.csv")
-    dataset_path = [f'{dataset_path / "df1.csv"}', f'{dataset_path / "df2.csv"}']
+    dataset_path = [f"{dataset_path / 'df1.csv'}", f"{dataset_path / 'df2.csv'}"]
 
     recipe_yaml = tmp_recipe_root_path.joinpath(_RECIPE_CONFIG_FILE_NAME)
     recipe_yaml.write_text(

tests/recipes/test_ingest_step.py~L158

         dataset_path = pathlib.Path(os.path.relpath(dataset_path))
 
     if explicit_file_list and multiple_files:
-        dataset_path = [f'{dataset_path / "df1.csv"}', f'{dataset_path / "df2.csv"}']
+        dataset_path = [f"{dataset_path / 'df1.csv'}", f"{dataset_path / 'df2.csv'}"]
     else:
         dataset_path = str(dataset_path)
 

tests/server/auth/test_auth.py~L114

 
     # authenticate with the newly created user
     headers = {
-        "Authorization": f'Bearer {jwt.encode({"username": username}, "secret", algorithm="HS256")}'
+        "Authorization": f"Bearer {jwt.encode({'username': username}, 'secret', algorithm='HS256')}"
     }
     _mlflow_search_experiments_rest(client.tracking_uri, headers)
 

pandas-dev/pandas (+6 -6 lines across 3 files)

ruff format --preview

pandas/io/formats/xml.py~L404

                         f"{self.prefix} is not included in namespaces"
                     ) from err
             elif "" in self.namespaces:
-                uri = f'{{{self.namespaces[""]}}}'
+                uri = f"{{{self.namespaces['']}}}"
             else:
                 uri = ""
 

pandas/io/formats/xml.py~L502

                         f"{self.prefix} is not included in namespaces"
                     ) from err
             elif "" in self.namespaces:
-                uri = f'{{{self.namespaces[""]}}}'
+                uri = f"{{{self.namespaces['']}}}"
             else:
                 uri = ""
 

pandas/tests/io/json/test_pandas.py~L1776

     )
     def test_read_json_with_very_long_file_path(self, compression):
         # GH 46718
-        long_json_path = f'{"a" * 1000}.json{compression}'
+        long_json_path = f"{'a' * 1000}.json{compression}"
         with pytest.raises(
             FileNotFoundError, match=f"File {long_json_path} does not exist"
         ):

scripts/validate_docstrings.py~L368

         )
         for err_code in actual_failures - expected_failures:
             sys.stdout.write(
-                f'{prefix}{res["file"]}:{res["file_line"]}:'
+                f"{prefix}{res['file']}:{res['file_line']}:"
                 f"{err_code}:{func_name}:{error_messages[err_code]}\n"
             )
             exit_status += 1
         for err_code in ignore_errors.get(func_name, set()) - actual_failures:
             sys.stdout.write(
-                f'{prefix}{res["file"]}:{res["file_line"]}:'
+                f"{prefix}{res['file']}:{res['file_line']}:"
                 f"{err_code}:{func_name}:"
                 "EXPECTED TO FAIL, BUT NOT FAILING\n"
             )

scripts/validate_docstrings.py~L407

 
     sys.stderr.write(header("Validation"))
     if result["errors"]:
-        sys.stderr.write(f'{len(result["errors"])} Errors found for `{func_name}`:\n')
+        sys.stderr.write(f"{len(result['errors'])} Errors found for `{func_name}`:\n")
         for err_code, err_desc in result["errors"]:
             sys.stderr.write(f"\t{err_code}\t{err_desc}\n")
     else:

prefecthq/prefect (+1 -1 lines across 1 file)

ruff format --preview

src/prefect/blocks/core.py~L623

         qualified_name = to_qualified_name(cls)
         module_str = ".".join(qualified_name.split(".")[:-1])
         class_name = cls.__name__
-        block_variable_name = f'{cls.get_block_type_slug().replace("-", "_")}_block'
+        block_variable_name = f"{cls.get_block_type_slug().replace('-', '_')}_block"
 
         return dedent(
             f"""\

pypa/build (+1 -1 lines across 1 file)

ruff format --preview

src/build/main.py~L323

         '--version',
         '-V',
         action='version',
-        version=f"build {build.__version__} ({','.join(build.__path__)})",
+        version=f'build {build.__version__} ({",".join(build.__path__)})',
     )
     parser.add_argument(
         '--verbose',

pypa/cibuildwheel (+3 -3 lines across 1 file)

ruff format --preview

test/utils.py~L293

 
             if machine_arch == "arm64":
                 arm64_macosx = _floor_macosx(min_macosx, "11.0")
-                platform_tags = [f'macosx_{arm64_macosx.replace(".", "_")}_arm64']
+                platform_tags = [f"macosx_{arm64_macosx.replace('.', '_')}_arm64"]
             else:
-                platform_tags = [f'macosx_{min_macosx.replace(".", "_")}_x86_64']
+                platform_tags = [f"macosx_{min_macosx.replace('.', '_')}_x86_64"]
 
             if include_universal2:
-                platform_tags.append(f'macosx_{min_macosx.replace(".", "_")}_universal2')
+                platform_tags.append(f"macosx_{min_macosx.replace('.', '_')}_universal2")
         else:
             msg = f"Unsupported platform {platform!r}"
             raise Exception(msg)

python/mypy (+2 -2 lines across 2 files)

ruff format --preview

mypy/errors.py~L898

                     a.append(" " * DEFAULT_SOURCE_OFFSET + source_line_expanded)
                     marker = "^"
                     if end_line == line and end_column > column:
-                        marker = f'^{"~" * (end_column - column - 1)}'
+                        marker = f"^{'~' * (end_column - column - 1)}"
                     a.append(" " * (DEFAULT_SOURCE_OFFSET + column) + marker)
         return a
 

mypy/stubtest.py~L1554

 
 
 def describe_runtime_callable(signature: inspect.Signature, *, is_async: bool) -> str:
-    return f'{"async " if is_async else ""}def {signature}'
+    return f"{'async ' if is_async else ''}def {signature}"
 
 
 def is_subtype_helper(left: mypy.types.Type, right: mypy.types.Type) -> bool:

python/typeshed (+1 -1 lines across 1 file)

ruff format --preview

scripts/stubsabot.py~L533

     output = subprocess.check_output(["git", "remote", "get-url", "origin"], text=True).strip()
     match = re.match(r"(git@github.com:|https://github.com/)(?P<owner>[^/]+)/(?P<repo>[^/\s]+)", output)
     assert match is not None, f"Couldn't identify origin's owner: {output!r}"
-    assert match.group("repo").removesuffix(".git") == "typeshed", f'Unexpected repo: {match.group("repo")!r}'
+    assert match.group("repo").removesuffix(".git") == "typeshed", f"Unexpected repo: {match.group('repo')!r}"
     return match.group("owner")
 
 

reflex-dev/reflex (+3 -3 lines across 2 files)

ruff format --preview

reflex/custom_components/custom_components.py~L770

     pyproject_toml = _get_package_config()
     project = pyproject_toml["project"]
     console.print(
-        f'Double check the information before publishing: {project["name"]} version {project["version"]}'
+        f"Double check the information before publishing: {project['name']} version {project['version']}"
     )
 
     console.print("Update or enter to keep the current information.")

reflex/custom_components/custom_components.py~L782

     author["name"] = console.ask(f"Author Name", default=author.get("name", ""))
     author["email"] = console.ask(f"Author Email", default=author.get("email", ""))
 
-    console.print(f'Current keywords are: {project.get("keywords") or []}')
+    console.print(f"Current keywords are: {project.get('keywords') or []}")
     keyword_action = console.ask(
         "Keep, replace or append?", choices=["k", "r", "a"], default="k"
     )

reflex/vars/base.py~L364

 
                 _default_var_type: ClassVar[GenericType] = python_types[0]
 
-            ToVarOperation.__name__ = f'To{cls.__name__.removesuffix("Var")}Operation'
+            ToVarOperation.__name__ = f"To{cls.__name__.removesuffix('Var')}Operation"
 
             _var_subclasses.append(VarSubclassEntry(cls, ToVarOperation, python_types))
 

rotki/rotki (+187 -187 lines across 83 files)

ruff format --preview

rotkehlchen/api/rest.py~L447

             f"{task_str} dies with exception: {greenlet.exception}.\n"
             f"Exception Name: {greenlet.exc_info[0]}\n"
             f"Exception Info: {greenlet.exc_info[1]}\n"
-            f'Traceback:\n {"".join(traceback.format_tb(greenlet.exc_info[2]))}',
+            f"Traceback:\n {''.join(traceback.format_tb(greenlet.exc_info[2]))}",
         )
         # also write an error for the task result if it's not the main greenlet
         if task_id is not None:

rotkehlchen/api/rest.py~L1479

             return api_response(
                 result=wrap_in_fail_result(
                     f"Failed to add {asset.asset_type!s} {asset.name} "
-                    f'since it already exists. Existing ids: {",".join(identifiers)}'
+                    f"since it already exists. Existing ids: {','.join(identifiers)}"
                 ),
                 status_code=HTTPStatus.CONFLICT,
             )

rotkehlchen/api/rest.py~L1716

                     message=msg,
                     status_code=HTTPStatus.CONFLICT,
                 )
-            log.debug(f'extracted {len(data["events"])} events from {filepath}')
+            log.debug(f"extracted {len(data['events'])} events from {filepath}")
             self.rotkehlchen.accountant.process_history(
                 start_ts=Timestamp(data["pnl_settings"]["from_timestamp"]),
                 end_ts=Timestamp(data["pnl_settings"]["to_timestamp"]),

rotkehlchen/api/rest.py~L3269

         """Return the current price of the assets in the target asset currency."""
         log.debug(
             f"Querying the current {target_asset.identifier} price of these assets: "
-            f'{", ".join([asset.identifier for asset in assets])}',
+            f"{', '.join([asset.identifier for asset in assets])}",
         )
         # Type is list instead of tuple here because you can't serialize a tuple
         assets_price: dict[Asset, list[Price | (int | None | bool)]] = {}

rotkehlchen/api/rest.py~L3376

         """
         log.debug(
             f"Querying the historical {target_asset.identifier} price of these assets: "
-            f'{", ".join(f"{asset.identifier} at {ts}" for asset, ts in assets_timestamp)}',
+            f"{', '.join(f'{asset.identifier} at {ts}' for asset, ts in assets_timestamp)}",
             assets_timestamp=assets_timestamp,
         )
         assets_price: defaultdict[Asset, defaultdict] = defaultdict(

rotkehlchen/api/v1/fields.py~L533

         if self.limit_to is not None and chain_id not in self.limit_to:
             raise ValidationError(
                 f"Given chain_id {value} is not one of "
-                f'{",".join([str(x) for x in self.limit_to])} as needed by the endpoint',
+                f"{','.join([str(x) for x in self.limit_to])} as needed by the endpoint",
             )
 
         return chain_id

rotkehlchen/api/v1/fields.py~L573

         if self.limit_to is not None and chain not in self.limit_to:
             raise ValidationError(
                 f"Given chain {value} is not one of "
-                f'{",".join([str(x) for x in self.limit_to])} as needed by the endpoint',
+                f"{','.join([str(x) for x in self.limit_to])} as needed by the endpoint",
             )
 
         return chain

rotkehlchen/api/v1/fields.py~L808

         if self.limit_to is not None and location not in self.limit_to:
             raise ValidationError(
                 f"Given location {value} is not one of "
-                f'{",".join([str(x) for x in self.limit_to])} as needed by the endpoint',
+                f"{','.join([str(x) for x in self.limit_to])} as needed by the endpoint",
             )
 
         return location

rotkehlchen/api/v1/fields.py~L930

             ):  # noqa: E501
                 raise ValidationError(
                     f"Given file {value.filename} does not end in any of "
-                    f'{",".join(self.allowed_extensions)}',
+                    f"{','.join(self.allowed_extensions)}",
                 )
 
             return value

rotkehlchen/api/v1/fields.py~L950

         ):  # noqa: E501
             raise ValidationError(
                 f"Given file {path} does not end in any of "
-                f'{",".join(self.allowed_extensions)}',
+                f"{','.join(self.allowed_extensions)}",
             )
 
         return path

rotkehlchen/api/v1/schemas.py~L342

             SUPPORTED_CHAIN_IDS
         ):
             raise ValidationError(
-                message=f'rotki does not support evm transactions for {data["evm_chain"]}',
+                message=f"rotki does not support evm transactions for {data['evm_chain']}",
                 field_name="evm_chain",
             )
 

rotkehlchen/api/v1/schemas.py~L482

         ).issubset(valid_ordering_attr):
             error_msg = (
                 f"order_by_attributes for trades can not be "
-                f'{",".join(set(data["order_by_attributes"]) - valid_ordering_attr)}'
+                f"{','.join(set(data['order_by_attributes']) - valid_ordering_attr)}"
             )
             raise ValidationError(
                 message=error_msg,

rotkehlchen/api/v1/schemas.py~L711

         ).issubset(valid_ordering_attr):
             error_msg = (
                 f"order_by_attributes for history event data can not be "
-                f'{",".join(set(data["order_by_attributes"]) - valid_ordering_attr)}'
+                f"{','.join(set(data['order_by_attributes']) - valid_ordering_attr)}"
             )
             raise ValidationError(
                 message=error_msg,

rotkehlchen/api/v1/schemas.py~L1001

         ).issubset(valid_ordering_attr):
             error_msg = (
                 f"order_by_attributes for asset movements can not be "
-                f'{",".join(set(data["order_by_attributes"]) - valid_ordering_attr)}'
+                f"{','.join(set(data['order_by_attributes']) - valid_ordering_attr)}"
             )
             raise ValidationError(
                 message=error_msg,

rotkehlchen/api/v1/schemas.py~L1195

 
     if (invalid_oracles := given_set - SETTABLE_CURRENT_PRICE_ORACLES) != set():
         raise ValidationError(
-            f'Invalid current price oracles given: {", ".join([str(x) for x in invalid_oracles])}. ',  # noqa: E501
+            f"Invalid current price oracles given: {', '.join([str(x) for x in invalid_oracles])}. ",  # noqa: E501
         )
 
 

rotkehlchen/api/v1/schemas.py~L1209

         oracle_names = [str(oracle) for oracle in historical_price_oracles]
         supported_oracle_names = [str(oracle) for oracle in HistoricalPriceOracle]
         raise ValidationError(
-            f'Invalid historical price oracles in: {", ".join(oracle_names)}. '
-            f'Supported oracles are: {", ".join(supported_oracle_names)}. '
+            f"Invalid historical price oracles in: {', '.join(oracle_names)}. "
+            f"Supported oracles are: {', '.join(supported_oracle_names)}. "
             f"Check there are no repeated ones.",
         )
 

rotkehlchen/api/v1/schemas.py~L1508

         if data.get("api_key") is None:
             if data["name"] != ExternalService.MONERIUM:
                 raise ValidationError(
-                    message=f'an api key is needed for {data["name"].name.lower()}',
+                    message=f"an api key is needed for {data['name'].name.lower()}",
                     field_name="api_key",
                 )
 

rotkehlchen/api/v1/schemas.py~L1702

         ).issubset(valid_ordering_attr):
             error_msg = (
                 f"order_by_attributes for accounting report data can not be "
-                f'{",".join(set(data["order_by_attributes"]) - valid_ordering_attr)}'
+                f"{','.join(set(data['order_by_attributes']) - valid_ordering_attr)}"
             )
             raise ValidationError(
                 message=error_msg,

rotkehlchen/api/v1/schemas.py~L2775

         ).issubset(valid_ordering_attr):
             error_msg = (
                 f"order_by_attributes for eth2 daily stats can not be "
-                f'{",".join(set(data["order_by_attributes"]) - valid_ordering_attr)}'
+                f"{','.join(set(data['order_by_attributes']) - valid_ordering_attr)}"
             )
             raise ValidationError(
                 message=error_msg,

rotkehlchen/api/v1/schemas.py~L2888

                 address = to_checksum_address(data["address"])
             except ValueError as e:
                 raise ValidationError(
-                    f'Given value {data["address"]} is not a valid {data["blockchain"]} address',
+                    f"Given value {data['address']} is not a valid {data['blockchain']} address",
                     field_name="address",
                 ) from e
         else:

rotkehlchen/api/v1/schemas.py~L2929

             )
         ):
             raise ValidationError(
-                f'Given value {data["address"]} is not a {blockchain} address',
+                f"Given value {data['address']} is not a {blockchain} address",
                 field_name="address",
             )
 

rotkehlchen/api/v1/schemas.py~L3096

             == data["location_data_snapshot"][0].time
         ):  # noqa: E501
             raise ValidationError(
-                f'timestamp provided {data["timestamp"]} is not the same as the '
+                f"timestamp provided {data['timestamp']} is not the same as the "
                 f"one for the entries provided.",
             )
 

rotkehlchen/api/v1/schemas.py~L3357

             ).fetchone()[0]
             if tx_count > 0:
                 raise ValidationError(
-                    message=f'tx_hash {data["tx_hash"].hex()} for {data["evm_chain"]} already present in the database',  # noqa: E501
+                    message=f"tx_hash {data['tx_hash'].hex()} for {data['evm_chain']} already present in the database",  # noqa: E501
                     field_name="tx_hash",
                 )
 

rotkehlchen/api/v1/schemas.py~L3367

             ).fetchone()[0]
             if accounts_count == 0:
                 raise ValidationError(
-                    message=f'address {data["associated_address"]} provided is not tracked by rotki for {data["evm_chain"]}',  # noqa: E501
+                    message=f"address {data['associated_address']} provided is not tracked by rotki for {data['evm_chain']}",  # noqa: E501
                     field_name="associated_address",
                 )
 

rotkehlchen/chain/aggregator.py~L535

         if len(bad_accounts) != 0:
             word = "already" if append_or_remove == "append" else "don't"
             raise InputError(
-                f'Blockchain account/s {",".join(bad_accounts)} {word} exist',
+                f"Blockchain account/s {','.join(bad_accounts)} {word} exist",
             )
 
     @protect_with_lock(arguments_matter=True)

rotkehlchen/chain/aggregator.py~L781

         if len(unknown_accounts) != 0:
             raise InputError(
                 f"Tried to remove unknown {blockchain.value} "
-                f'accounts {",".join(unknown_accounts)}',
+                f"accounts {','.join(unknown_accounts)}",
             )
 
         self.modify_blockchain_accounts(

rotkehlchen/chain/ethereum/airdrops.py~L41

 log = RotkehlchenLogsAdapter(logger)
 
 AIRDROPS_REPO_BASE: Final = (
-    f'https://github.com/raw/rotki/data/{"main" if is_production() else "develop"}'  # noqa: E501
+    f"https://github.com/raw/rotki/data/{'main' if is_production() else 'develop'}"  # noqa: E501
 )
 AIRDROPS_INDEX: Final = f"{AIRDROPS_REPO_BASE}/airdrops/index_v3.json"
 ETAG_CACHE_KEY: Final = "ETag"

rotkehlchen/chain/ethereum/modules/compound/v3/compound.py~L75

                 rates_calls[balance_type].append((
                     token_address,
                     token_contract.encode(
-                        method_name=f'get{"Supply" if balance_type == BalanceType.ASSET else "Borrow"}Rate',  # noqa: E501
+                        method_name=f"get{'Supply' if balance_type == BalanceType.ASSET else 'Borrow'}Rate",  ...*[Comment body truncated]*

Base automatically changed from micha/refactor-normalize to main October 21, 2024 19:23
@MichaReiser MichaReiser force-pushed the micha/f-string-alternate-quotes branch from 1793dc9 to 73f1d80 Compare October 22, 2024 07:58
@MichaReiser
Copy link
Member Author

This not only fixes the issue where Ruff failed to change the quotes in Py312+ but now also ensures that f-strings use the preferred quote styles if nested literals uses the other quotes

@MichaReiser MichaReiser changed the title Alternate quotes for strings inside f-strings when targeting Py312+ and preview mode is on Alternate quotes for strings inside f-strings in preview Oct 22, 2024
@MichaReiser MichaReiser force-pushed the micha/f-string-alternate-quotes branch from 73f1d80 to a5a6ef4 Compare October 22, 2024 09:43
@MichaReiser MichaReiser marked this pull request as ready for review October 22, 2024 10:03
Comment on lines 135 to 139
if fstring
.elements
.iter()
.filter_map(FStringElement::as_expression)
.any(|expression| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might make rustfmt mad so might want to do this locally

Suggested change
if fstring
.elements
.iter()
.filter_map(FStringElement::as_expression)
.any(|expression| {
if fstring
.elements
.expressions()
.any(|expression| {

Copy link
Member Author

@MichaReiser MichaReiser Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it's on elements. I always try to call it on the fstring

Comment on lines +565 to +566
# Not valid Pre 3.12
f"""test {f"inner {'''inner inner'''}"}"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's interesting that as a side effect we'll start fixing certain code that would raise a syntax error pre-3.12.

Comment on lines 713 to 717
_ = (
"This string should change its quotes to double quotes"
f'This string uses double quotes in an expression {"woah"}'
f"This string uses double quotes in an expression {"it's a quote"}"
f"This f-string does not use any quotes."
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? The outer single quotes got formatted to use double quotes even though the expression has a double quoted string, thus not using alternate quote style.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The idea is that we use the same quote selection criteria as everywhere else and we keep using double quotes to avoid unnecessary escaping the single quote

Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! I really like the ecosystem changes as well. I played around with random f-string with quotes but couldn't really find anything unexpected.

@MichaReiser MichaReiser force-pushed the micha/f-string-alternate-quotes branch from c4878ee to f9c3767 Compare October 22, 2024 16:07
@MichaReiser
Copy link
Member Author

I'll do another review of my own changes tomorrow and then plan to land this.

@MichaReiser MichaReiser merged commit 2f88f84 into main Oct 23, 2024
20 checks passed
@MichaReiser MichaReiser deleted the micha/f-string-alternate-quotes branch October 23, 2024 05:57
lmaotrigine added a commit to lmaotrigine/ruff that referenced this pull request Oct 26, 2024
* [red-knot] binary arithmetic on instances (#13800)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* [red-knot] Fix edge case for binary-expression inference where the lhs and rhs are the exact same type (#13823)

## Summary

This fixes an edge case that @carljm and I missed when implementing
https://github.com/astral-sh/ruff/pull/13800. Namely, if the left-hand
operand is the _exact same type_ as the right-hand operand, the
reflected dunder on the right-hand operand is never tried:

```pycon
>>> class Foo:
...     def __radd__(self, other):
...         return 42
...         
>>> Foo() + Foo()
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    Foo() + Foo()
    ~~~~~~^~~~~~~
TypeError: unsupported operand type(s) for +: 'Foo' and 'Foo'
```

This edge case _is_ covered in Brett's blog at
https://snarky.ca/unravelling-binary-arithmetic-operations-in-python/,
but I missed it amongst all the other subtleties of this algorithm. The
motivations and history behind it were discussed in
https://mail.python.org/archives/list/python-dev@python.org/thread/7NZUCODEAPQFMRFXYRMGJXDSIS3WJYIV/

## Test Plan

I added an mdtest for this cornercase.

* [red-knot] Enhancing Diagnostics for Compare Expression Inference (#13819)

## Summary

- Refactored comparison type inference functions in `infer.rs`: Changed
the return type from `Option` to `Result` to lay the groundwork for
providing more detailed diagnostics.
- Updated diagnostic messages.

This is a small step toward improving diagnostics in the future.

Please refer to #13787

## Test Plan

mdtest included!

---------

Co-authored-by: Carl Meyer <carl@astral.sh>

* [python_ast] Make the iter_mut functions public (#13542)

* [red-knot] Implement more types in binary and unary expressions (#13803)

Implemented some points from
https://github.com/astral-sh/ruff/issues/12701

- Handle Unknown and Any in Unary operation
- Handle Boolean in binary operations
- Handle instances in unary operation
- Consider division by False to be division by zero

---------

Co-authored-by: Carl Meyer <carl@astral.sh>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Update BREAKING_CHANGES.md for Ruff 0.7 (#13828)

* Bump MSRV to Rust 1.80 (#13826)

* Update Rust crate pep440_rs to 0.7.1 (#13654)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micha Reiser <micha@reiser.io>

* [red-knot] Cleanup generated names of mdtest tests (#13831)

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Co-authored-by: Micha Reiser <micha@reiser.io>

* Simplify iteration idioms (#13834)

Remove unnecessary uses of `.as_ref()`, `.iter()`, `&**` and similar, mostly in situations when iterating over variables. Many of these changes are only possible following #13826, when we bumped our MSRV to 1.80: several useful implementations on `&Box<[T]>` were only stabilised in Rust 1.80. Some of these changes we could have done earlier, however.

* Modernize build scripts (#13837)

Use the modern `cargo::KEY=VALUE` syntax that was stabilised in MSRV 1.77, rather than the deprecated `cargo:KEY=VALUE` syntax.

* Update dependency mdformat to v0.7.18 (#13843)

* Update dependency ruff to v0.7.0 (#13847)

* Update Rust crate libc to v0.2.161 (#13840)

* Update Rust crate anyhow to v1.0.90 (#13839)

* Update Rust crate proc-macro2 to v1.0.88 (#13841)

* Update Rust crate syn to v2.0.82 (#13842)

* Update Rust crate fern to 0.7.0 (#13844)

* Update Rust crate serde_json to v1.0.132 (#13848)

* Update Rust crate uuid to v1.11.0 (#13845)

* Update dependency tomli_w to v1.1.0 (#13849)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [tomli_w](https://redirect.github.com/hukkin/tomli-w)
([changelog](https://redirect.github.com/hukkin/tomli-w/blob/master/CHANGELOG.md))
| `==1.0.0` -> `==1.1.0` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/tomli_w/1.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/tomli_w/1.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/tomli_w/1.0.0/1.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/tomli_w/1.0.0/1.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>hukkin/tomli-w (tomli_w)</summary>

###
[`v1.1.0`](https://redirect.github.com/hukkin/tomli-w/blob/HEAD/CHANGELOG.md#110)

[Compare
Source](https://redirect.github.com/hukkin/tomli-w/compare/1.0.0...1.1.0)

-   Removed
    -   Support for Python 3.7 and 3.8
-   Added
- Accept generic `collections.abc.Mapping`, not just `dict`, as input.
Thank you [Watal M. Iwasaki](https://redirect.github.com/heavywatal) for
the
        [PR](https://redirect.github.com/hukkin/tomli-w/pull/46).
- `indent` keyword argument for customizing indent width of arrays.
Thank you [Wim Jeantine-Glenn](https://redirect.github.com/wimglenn) for
the
        [PR](https://redirect.github.com/hukkin/tomli-w/pull/49).
-   Type annotations
- Type annotate `dump` function's output stream object as
`typing.IO[bytes]` (previously `typing.BinaryIO`)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xMjAuMSIsInVwZGF0ZWRJblZlciI6IjM4LjEyMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update pre-commit dependencies (#13850)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[abravalheri/validate-pyproject](https://redirect.github.com/abravalheri/validate-pyproject)
| repository | minor | `v0.20.2` -> `v0.21` |
|
[astral-sh/ruff-pre-commit](https://redirect.github.com/astral-sh/ruff-pre-commit)
| repository | minor | `v0.6.9` -> `v0.7.0` |
| [crate-ci/typos](https://redirect.github.com/crate-ci/typos) |
repository | minor | `v1.25.0` -> `v1.26.0` |
|
[executablebooks/mdformat](https://redirect.github.com/executablebooks/mdformat)
| repository | patch | `0.7.17` -> `0.7.18` |

Note: The `pre-commit` manager in Renovate is not supported by the
`pre-commit` maintainers or community. Please do not report any problems
there, instead [create a Discussion in the Renovate
repository](https://redirect.github.com/renovatebot/renovate/discussions/new)
if you have any questions.

---

### Release Notes

<details>
<summary>abravalheri/validate-pyproject
(abravalheri/validate-pyproject)</summary>

###
[`v0.21`](https://redirect.github.com/abravalheri/validate-pyproject/releases/tag/v0.21)

[Compare
Source](https://redirect.github.com/abravalheri/validate-pyproject/compare/v0.20.2...v0.21)

#### What's Changed

- Added support PEP 735 by
[@&#8203;henryiii](https://redirect.github.com/henryiii) in
[https://github.com/abravalheri/validate-pyproject/pull/208](https://redirect.github.com/abravalheri/validate-pyproject/pull/208)
- Added support PEP 639 by
[@&#8203;henryiii](https://redirect.github.com/henryiii) in
[https://github.com/abravalheri/validate-pyproject/pull/210](https://redirect.github.com/abravalheri/validate-pyproject/pull/210)
- Renamed testing extra to test by
[@&#8203;henryiii](https://redirect.github.com/henryiii) in
[https://github.com/abravalheri/validate-pyproject/pull/212](https://redirect.github.com/abravalheri/validate-pyproject/pull/212)
-   General updates in CI setup

**Full Changelog**:
https://github.com/abravalheri/validate-pyproject/compare/v0.20.2...v0.21

</details>

<details>
<summary>astral-sh/ruff-pre-commit (astral-sh/ruff-pre-commit)</summary>

###
[`v0.7.0`](https://redirect.github.com/astral-sh/ruff-pre-commit/releases/tag/v0.7.0)

[Compare
Source](https://redirect.github.com/astral-sh/ruff-pre-commit/compare/v0.6.9...v0.7.0)

See: https://github.com/astral-sh/ruff/releases/tag/0.7.0

</details>

<details>
<summary>crate-ci/typos (crate-ci/typos)</summary>

###
[`v1.26.0`](https://redirect.github.com/crate-ci/typos/releases/tag/v1.26.0)

[Compare
Source](https://redirect.github.com/crate-ci/typos/compare/v1.25.0...v1.26.0)

#### \[1.26.0] - 2024-10-07

##### Compatibility

-   *(pre-commit)* Requires 3.2+

##### Fixes

- *(pre-commit)* Resolve deprecations in 4.0 about deprecated stage
names

</details>

<details>
<summary>executablebooks/mdformat (executablebooks/mdformat)</summary>

###
[`v0.7.18`](https://redirect.github.com/executablebooks/mdformat/compare/0.7.17...0.7.18)

[Compare
Source](https://redirect.github.com/executablebooks/mdformat/compare/0.7.17...0.7.18)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xMjAuMSIsInVwZGF0ZWRJblZlciI6IjM4LjEyMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update NPM Development dependencies (#13851)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[@cloudflare/workers-types](https://redirect.github.com/cloudflare/workerd)
| [`4.20241004.0` ->
`4.20241018.0`](https://renovatebot.com/diffs/npm/@cloudflare%2fworkers-types/4.20241004.0/4.20241018.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@cloudflare%2fworkers-types/4.20241018.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@cloudflare%2fworkers-types/4.20241018.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@cloudflare%2fworkers-types/4.20241004.0/4.20241018.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@cloudflare%2fworkers-types/4.20241004.0/4.20241018.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@types/react-dom](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom)
([source](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom))
| [`18.3.0` ->
`18.3.1`](https://renovatebot.com/diffs/npm/@types%2freact-dom/18.3.0/18.3.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2freact-dom/18.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2freact-dom/18.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2freact-dom/18.3.0/18.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2freact-dom/18.3.0/18.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin)
([source](https://redirect.github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin))
| [`8.8.0` ->
`8.10.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.8.0/8.10.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@typescript-eslint%2feslint-plugin/8.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@typescript-eslint%2feslint-plugin/8.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@typescript-eslint%2feslint-plugin/8.8.0/8.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@typescript-eslint%2feslint-plugin/8.8.0/8.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[@typescript-eslint/parser](https://typescript-eslint.io/packages/parser)
([source](https://redirect.github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser))
| [`8.8.0` ->
`8.10.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.8.0/8.10.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@typescript-eslint%2fparser/8.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@typescript-eslint%2fparser/8.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@typescript-eslint%2fparser/8.8.0/8.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@typescript-eslint%2fparser/8.8.0/8.10.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [eslint-plugin-react-hooks](https://react.dev/)
([source](https://redirect.github.com/facebook/react/tree/HEAD/packages/eslint-plugin-react-hooks))
| [`^4.6.0` ->
`^5.0.0`](https://renovatebot.com/diffs/npm/eslint-plugin-react-hooks/4.6.2/5.0.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/eslint-plugin-react-hooks/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/eslint-plugin-react-hooks/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/eslint-plugin-react-hooks/4.6.2/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint-plugin-react-hooks/4.6.2/5.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[miniflare](https://redirect.github.com/cloudflare/workers-sdk/tree/main/packages/miniflare#readme)
([source](https://redirect.github.com/cloudflare/workers-sdk/tree/HEAD/packages/miniflare))
| [`3.20240925.0` ->
`3.20241011.0`](https://renovatebot.com/diffs/npm/miniflare/3.20240925.0/3.20241011.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/miniflare/3.20241011.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/miniflare/3.20241011.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/miniflare/3.20240925.0/3.20241011.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/miniflare/3.20240925.0/3.20241011.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [tailwindcss](https://tailwindcss.com)
([source](https://redirect.github.com/tailwindlabs/tailwindcss)) |
[`3.4.13` ->
`3.4.14`](https://renovatebot.com/diffs/npm/tailwindcss/3.4.13/3.4.14) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/tailwindcss/3.4.14?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tailwindcss/3.4.14?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tailwindcss/3.4.13/3.4.14?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tailwindcss/3.4.13/3.4.14?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [typescript](https://www.typescriptlang.org/)
([source](https://redirect.github.com/microsoft/TypeScript)) | [`5.6.2`
-> `5.6.3`](https://renovatebot.com/diffs/npm/typescript/5.6.2/5.6.3) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/typescript/5.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/typescript/5.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/typescript/5.6.2/5.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/typescript/5.6.2/5.6.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [vite](https://vite.dev)
([source](https://redirect.github.com/vitejs/vite/tree/HEAD/packages/vite))
| [`5.4.8` ->
`5.4.9`](https://renovatebot.com/diffs/npm/vite/5.4.8/5.4.9) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/vite/5.4.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite/5.4.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite/5.4.8/5.4.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite/5.4.8/5.4.9?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [wrangler](https://redirect.github.com/cloudflare/workers-sdk)
([source](https://redirect.github.com/cloudflare/workers-sdk/tree/HEAD/packages/wrangler))
| [`3.80.0` ->
`3.81.0`](https://renovatebot.com/diffs/npm/wrangler/3.80.0/3.81.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/wrangler/3.81.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/wrangler/3.81.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/wrangler/3.80.0/3.81.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/wrangler/3.80.0/3.81.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>cloudflare/workerd (@&#8203;cloudflare/workers-types)</summary>

###
[`v4.20241018.0`](https://redirect.github.com/cloudflare/workerd/compare/caeb4e0d9e8a7ecbef208e8c54c27bae7e412f7b...fa7168988f89ec72e218a0112be4f6f0229c2d6b)

[Compare
Source](https://redirect.github.com/cloudflare/workerd/compare/caeb4e0d9e8a7ecbef208e8c54c27bae7e412f7b...fa7168988f89ec72e218a0112be4f6f0229c2d6b)

###
[`v4.20241011.0`](https://redirect.github.com/cloudflare/workerd/compare/76198481858fce538e4efa2783c3844e38149227...caeb4e0d9e8a7ecbef208e8c54c27bae7e412f7b)

[Compare
Source](https://redirect.github.com/cloudflare/workerd/compare/76198481858fce538e4efa2783c3844e38149227...caeb4e0d9e8a7ecbef208e8c54c27bae7e412f7b)

</details>

<details>
<summary>typescript-eslint/typescript-eslint
(@&#8203;typescript-eslint/eslint-plugin)</summary>

###
[`v8.10.0`](https://redirect.github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8100-2024-10-17)

[Compare
Source](https://redirect.github.com/typescript-eslint/typescript-eslint/compare/v8.9.0...v8.10.0)

##### 🚀 Features

- support TypeScript 5.6
([#&#8203;9972](https://redirect.github.com/typescript-eslint/typescript-eslint/pull/9972))

##### ❤️  Thank You

-   Josh Goldberg ✨

You can read about our [versioning
strategy](https://main--typescript-eslint.netlify.app/users/versioning)
and
[releases](https://main--typescript-eslint.netlify.app/users/releases)
on our website.

###
[`v8.9.0`](https://redirect.github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#890-2024-10-14)

[Compare
Source](https://redirect.github.com/typescript-eslint/typescript-eslint/compare/v8.8.1...v8.9.0)

##### 🩹 Fixes

- **eslint-plugin:** \[no-unnecessary-type-parameters] cannot assume
variables are either type or value

- **scope-manager:** \[no-use-before-define] do not treat nested
namespace aliases as variable references

- **eslint-plugin:** \[return-await] sync the behavior with
await-thenable

- **eslint-plugin:** \[prefer-literal-enum-member] report a different
error message when `allowBitwiseExpressions` is enabled

-   **eslint-plugin:** \[no-loop-func] sync from upstream base rule

- **eslint-plugin:** \[no-unused-vars] never report the naming of an
enum member

-   **eslint-plugin:** correct use-at-your-own-risk type definitions

-   **eslint-plugin:** handle unions in await...for

##### ❤️  Thank You

-   Abraham Guo
-   Anna Bocharova
-   Arya Emami
-   auvred
-   Joshua Chen
-   Kirk Waiblinger
-   Lotfi Meklati
-   mdm317
-   Ronen Amiel
-   Sukka
-   YeonJuan

You can read about our [versioning
strategy](https://main--typescript-eslint.netlify.app/users/versioning)
and
[releases](https://main--typescript-eslint.netlify.app/users/releases)
on our website.

###
[`v8.8.1`](https://redirect.github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#881-2024-10-07)

[Compare
Source](https://redirect.github.com/typescript-eslint/typescript-eslint/compare/v8.8.0...v8.8.1)

##### 🩹 Fixes

- **eslint-plugin:** stop warning on
[@&#8203;ts-nocheck](https://redirect.github.com/ts-nocheck) comments
which aren't at the beginning of the file

##### ❤️  Thank You

-   Brad Zacher
-   Ronen Amiel
-   WhitePiano

You can read about our [versioning
strategy](https://main--typescript-eslint.netlify.app/users/versioning)
and
[releases](https://main--typescript-eslint.netlify.app/users/releases)
on our website.

</details>

<details>
<summary>typescript-eslint/typescript-eslint
(@&#8203;typescript-eslint/parser)</summary>

###
[`v8.10.0`](https://redirect.github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8100-2024-10-17)

[Compare
Source](https://redirect.github.com/typescript-eslint/typescript-eslint/compare/v8.9.0...v8.10.0)

##### 🚀 Features

- support TypeScript 5.6
([#&#8203;9972](https://redirect.github.com/typescript-eslint/typescript-eslint/pull/9972))

##### ❤️  Thank You

-   Josh Goldberg ✨

You can read about our [versioning
strategy](https://main--typescript-eslint.netlify.app/users/versioning)
and
[releases](https://main--typescript-eslint.netlify.app/users/releases)
on our website.

###
[`v8.9.0`](https://redirect.github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#890-2024-10-14)

[Compare
Source](https://redirect.github.com/typescript-eslint/typescript-eslint/compare/v8.8.1...v8.9.0)

This was a version bump only for parser to align it with other projects,
there were no code changes.

You can read about our [versioning
strategy](https://main--typescript-eslint.netlify.app/users/versioning)
and
[releases](https://main--typescript-eslint.netlify.app/users/releases)
on our website.

###
[`v8.8.1`](https://redirect.github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#881-2024-10-07)

[Compare
Source](https://redirect.github.com/typescript-eslint/typescript-eslint/compare/v8.8.0...v8.8.1)

This was a version bump only for parser to align it with other projects,
there were no code changes.

You can read about our [versioning
strategy](https://main--typescript-eslint.netlify.app/users/versioning)
and
[releases](https://main--typescript-eslint.netlify.app/users/releases)
on our website.

</details>

<details>
<summary>facebook/react (eslint-plugin-react-hooks)</summary>

###
[`v5.0.0`](https://redirect.github.com/facebook/react/blob/HEAD/packages/eslint-plugin-react-hooks/CHANGELOG.md#500)

[Compare
Source](https://redirect.github.com/facebook/react/compare/a87edf62d7d69705ddbcec9a24f0780b3db7535f...eslint-plugin-react-hooks@5.0.0)

- **New Violations:** Component names now need to start with an
uppercase letter instead of a non-lowercase letter. This means `_Button`
or `_component` are no longer valid.
([@&#8203;kassens](https://redirect.github.com/kassens)) in
[#&#8203;25162](https://redirect.github.com/facebook/react/pull/25162)

<!---->

- Consider dispatch from `useActionState` stable.
([@&#8203;eps1lon](https://redirect.github.com/eps1lon) in
[#&#8203;29665](https://redirect.github.com/facebook/react/pull/29665))
- Add support for ESLint v9.
([@&#8203;eps1lon](https://redirect.github.com/eps1lon) in
[#&#8203;28773](https://redirect.github.com/facebook/react/pull/28773))
- Accept `as` expression in callback.
([@&#8203;StyleShit](https://redirect.github.com/StyleShit) in
[#&#8203;28202](https://redirect.github.com/facebook/react/pull/28202))
- Accept `as` expressions in deps array.
([@&#8203;StyleShit](https://redirect.github.com/StyleShit) in
[#&#8203;28189](https://redirect.github.com/facebook/react/pull/28189))
- Treat `React.use()` the same as `use()`.
([@&#8203;kassens](https://redirect.github.com/kassens) in
[#&#8203;27769](https://redirect.github.com/facebook/react/pull/27769))
- Move `use()` lint to non-experimental.
([@&#8203;kassens](https://redirect.github.com/kassens) in
[#&#8203;27768](https://redirect.github.com/facebook/react/pull/27768))
- Support Flow `as` expressions.
([@&#8203;cpojer](https://redirect.github.com/cpojer) in
[#&#8203;27590](https://redirect.github.com/facebook/react/pull/27590))
- Allow `useEffect(fn, undefined)`.
([@&#8203;kassens](https://redirect.github.com/kassens) in
[#&#8203;27525](https://redirect.github.com/facebook/react/pull/27525))
- Disallow hooks in async functions.
([@&#8203;acdlite](https://redirect.github.com/acdlite) in
[#&#8203;27045](https://redirect.github.com/facebook/react/pull/27045))
- Rename experimental `useEvent` to `useEffectEvent`.
([@&#8203;sebmarkbage](https://redirect.github.com/sebmarkbage) in
[#&#8203;25881](https://redirect.github.com/facebook/react/pull/25881))
- Lint for presence of `useEvent` functions in dependency lists.
([@&#8203;poteto](https://redirect.github.com/poteto) in
[#&#8203;25512](https://redirect.github.com/facebook/react/pull/25512))
- Check `useEvent` references instead.
([@&#8203;poteto](https://redirect.github.com/poteto) in
[#&#8203;25319](https://redirect.github.com/facebook/react/pull/25319))
- Update `RulesOfHooks` with `useEvent` rules.
([@&#8203;poteto](https://redirect.github.com/poteto) in
[#&#8203;25285](https://redirect.github.com/facebook/react/pull/25285))

</details>

<details>
<summary>cloudflare/workers-sdk (miniflare)</summary>

###
[`v3.20241011.0`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/miniflare/CHANGELOG.md#3202410110)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/miniflare@3.20241004.0...miniflare@3.20241011.0)

##### Patch Changes

-
[#&#8203;6961](https://redirect.github.com/cloudflare/workers-sdk/pull/6961)
[`5761020`](https://redirect.github.com/cloudflare/workers-sdk/commit/5761020cb41270ce872ad6c555b263597949c06d)
Thanks
[@&#8203;dependabot](https://redirect.github.com/apps/dependabot)! -
chore: update dependencies of "miniflare" package

    The following dependency versions have been updated:

    | Dependency                | From          | To            |
    | ------------------------- | ------------- | ------------- |
    | workerd                   | 1.20241004.0  | 1.20241011.1  |
|
[@&#8203;cloudflare/workers-types](https://redirect.github.com/cloudflare/workers-types)
| ^4.20241004.0 | ^4.20241011.0 |

-
[#&#8203;6943](https://redirect.github.com/cloudflare/workers-sdk/pull/6943)
[`7859a04`](https://redirect.github.com/cloudflare/workers-sdk/commit/7859a04bcd4b2f1cafe67c371bd236acaf7a2d91)
Thanks [@&#8203;sdnts](https://redirect.github.com/sdnts)! - fix: local
queues now respect consumer max delays and retry delays properly

###
[`v3.20241004.0`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/miniflare/CHANGELOG.md#3202410040)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/miniflare@3.20240925.1...miniflare@3.20241004.0)

##### Patch Changes

-
[#&#8203;6949](https://redirect.github.com/cloudflare/workers-sdk/pull/6949)
[`c863183`](https://redirect.github.com/cloudflare/workers-sdk/commit/c86318354f1a6c0f5c096d6b2a884de740552a19)
Thanks
[@&#8203;dependabot](https://redirect.github.com/apps/dependabot)! -
chore: update dependencies of "miniflare" package

    The following dependency versions have been updated:

    | Dependency                | From          | To            |
    | ------------------------- | ------------- | ------------- |
    | workerd                   | 1.20240925.0  | 1.20241004.0  |
|
[@&#8203;cloudflare/workers-types](https://redirect.github.com/cloudflare/workers-types)
| ^4.20240925.0 | ^4.20241004.0 |

###
[`v3.20240925.1`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/miniflare/CHANGELOG.md#3202409251)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/miniflare@3.20240925.0...miniflare@3.20240925.1)

##### Patch Changes

-
[#&#8203;6835](https://redirect.github.com/cloudflare/workers-sdk/pull/6835)
[`5c50949`](https://redirect.github.com/cloudflare/workers-sdk/commit/5c509494807a1c0418be83c47a459ec80126848e)
Thanks [@&#8203;emily-shen](https://redirect.github.com/emily-shen)! -
fix: rename asset plugin options slightly to match wrangler.toml better

    Renamed `path` -> `directory`, `bindingName` -> `binding`.

</details>

<details>
<summary>tailwindlabs/tailwindcss (tailwindcss)</summary>

###
[`v3.4.14`](https://redirect.github.com/tailwindlabs/tailwindcss/releases/tag/v3.4.14)

[Compare
Source](https://redirect.github.com/tailwindlabs/tailwindcss/compare/v3.4.13...v3.4.14)

##### Fixed

- Don't set `display: none` on elements that use `hidden="until-found"`
([#&#8203;14625](https://redirect.github.com/tailwindlabs/tailwindcss/pull/14625))

</details>

<details>
<summary>microsoft/TypeScript (typescript)</summary>

###
[`v5.6.3`](https://redirect.github.com/microsoft/TypeScript/compare/v5.6.2...d48a5cf89a62a62d6c6ed53ffa18f070d9458b85)

[Compare
Source](https://redirect.github.com/microsoft/TypeScript/compare/v5.6.2...v5.6.3)

</details>

<details>
<summary>vitejs/vite (vite)</summary>

###
[`v5.4.9`](https://redirect.github.com/vitejs/vite/releases/tag/v5.4.9)

[Compare
Source](https://redirect.github.com/vitejs/vite/compare/v5.4.8...v5.4.9)

Please refer to
[CHANGELOG.md](https://redirect.github.com/vitejs/vite/blob/v5.4.9/packages/vite/CHANGELOG.md)
for details.

</details>

<details>
<summary>cloudflare/workers-sdk (wrangler)</summary>

###
[`v3.81.0`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/wrangler/CHANGELOG.md#3810)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/wrangler@3.80.5...wrangler@3.81.0)

##### Minor Changes

-
[#&#8203;6990](https://redirect.github.com/cloudflare/workers-sdk/pull/6990)
[`586c253`](https://redirect.github.com/cloudflare/workers-sdk/commit/586c253f7de36360cab275cb1ebf9a2373fd4f4c)
Thanks
[@&#8203;courtney-sims](https://redirect.github.com/courtney-sims)! -
feat: Adds new detailed pages deployment output type

##### Patch Changes

-
[#&#8203;6963](https://redirect.github.com/cloudflare/workers-sdk/pull/6963)
[`a5ac45d`](https://redirect.github.com/cloudflare/workers-sdk/commit/a5ac45d7d5aa7a6b82de18a8cf14e6eabdd22e9e)
Thanks [@&#8203;RamIdeas](https://redirect.github.com/RamIdeas)! - fix:
make `wrangler dev --remote` respect wrangler.toml's `account_id`
property.

This was a regression in the `--x-dev-env` flow recently turned on by
default.

-
[#&#8203;6996](https://redirect.github.com/cloudflare/workers-sdk/pull/6996)
[`b8ab809`](https://redirect.github.com/cloudflare/workers-sdk/commit/b8ab8093b9011b5d7d47bcd31fa69cefa6c8fe2a)
Thanks [@&#8203;emily-shen](https://redirect.github.com/emily-shen)! -
fix: improve error messaging when accidentally using Workers commands in
Pages project

If we detect a Workers command used with a Pages project (i.e.
wrangler.toml contains `pages_output_build_dir`), error with Pages
version of command rather than "missing entry-point" etc.

###
[`v3.80.5`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/wrangler/CHANGELOG.md#3805)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/wrangler@3.80.4...wrangler@3.80.5)

##### Patch Changes

- Updated dependencies
\[[`5761020`](https://redirect.github.com/cloudflare/workers-sdk/commit/5761020cb41270ce872ad6c555b263597949c06d),
[`7859a04`](https://redirect.github.com/cloudflare/workers-sdk/commit/7859a04bcd4b2f1cafe67c371bd236acaf7a2d91)]:
    -   miniflare@3.20241011.0

###
[`v3.80.4`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/wrangler/CHANGELOG.md#3804)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/wrangler@3.80.3...wrangler@3.80.4)

##### Patch Changes

-
[#&#8203;6937](https://redirect.github.com/cloudflare/workers-sdk/pull/6937)
[`51aedd4`](https://redirect.github.com/cloudflare/workers-sdk/commit/51aedd4333cce9ffa4f6834cdf19e22148dab7e9)
Thanks [@&#8203;lrapoport-cf](https://redirect.github.com/lrapoport-cf)!
- fix: show help when kv commands are run without parameters

- Updated dependencies
\[[`c863183`](https://redirect.github.com/cloudflare/workers-sdk/commit/c86318354f1a6c0f5c096d6b2a884de740552a19),
[`fd43068`](https://redirect.github.com/cloudflare/workers-sdk/commit/fd430687ec1431be6c3af1b7420278b636c36e59)]:
    -   miniflare@3.20241004.0
-
[@&#8203;cloudflare/workers-shared](https://redirect.github.com/cloudflare/workers-shared)[@&#8203;0](https://redirect.github.com/0).6.0

###
[`v3.80.3`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/wrangler/CHANGELOG.md#3803)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/wrangler@3.80.2...wrangler@3.80.3)

##### Patch Changes

-
[#&#8203;6927](https://redirect.github.com/cloudflare/workers-sdk/pull/6927)
[`2af75ed`](https://redirect.github.com/cloudflare/workers-sdk/commit/2af75edb3c0722c04793c74f46aa099f4a3f27a9)
Thanks [@&#8203;emily-shen](https://redirect.github.com/emily-shen)! -
fix: respect `CLOUDFLARE_ACCOUNT_ID` with `wrangler pages project`
commands

Fixes
[#&#8203;4947](https://redirect.github.com/cloudflare/workers-sdk/issues/4947)

-
[#&#8203;6894](https://redirect.github.com/cloudflare/workers-sdk/pull/6894)
[`eaf71b8`](https://redirect.github.com/cloudflare/workers-sdk/commit/eaf71b86cc5650cffb54c942704ce3dd1b5ed6a7)
Thanks
[@&#8203;petebacondarwin](https://redirect.github.com/petebacondarwin)!
- fix: improve the rendering of build errors when bundling

-
[#&#8203;6920](https://redirect.github.com/cloudflare/workers-sdk/pull/6920)
[`2e64968`](https://redirect.github.com/cloudflare/workers-sdk/commit/2e649686c259c639701a62e754c53448cb694dfc)
Thanks [@&#8203;vicb](https://redirect.github.com/vicb)! - chore: update
unenv dependency version

Pulls in [feat(node/net): implement Server
mock](https://redirect.github.com/unjs/unenv/pull/316).

-
[#&#8203;6932](https://redirect.github.com/cloudflare/workers-sdk/pull/6932)
[`4c6aad0`](https://redirect.github.com/cloudflare/workers-sdk/commit/4c6aad05b919a56484d13e4a49b861dcafbc0a2c)
Thanks [@&#8203;vicb](https://redirect.github.com/vicb)! - fix: allow
`require`ing unenv aliased packages

    Before this PR `require`ing packages aliased in unenv would fail.
    That's because `require` would load the mjs file.

This PR adds wraps the mjs file in a virtual ES module to allow
`require`ing it.

###
[`v3.80.2`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/wrangler/CHANGELOG.md#3802)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/wrangler@3.80.1...wrangler@3.80.2)

##### Patch Changes

-
[#&#8203;6923](https://redirect.github.com/cloudflare/workers-sdk/pull/6923)
[`1320f20`](https://redirect.github.com/cloudflare/workers-sdk/commit/1320f20b38d7b4623fe21d38118bdc9fb8514a99)
Thanks [@&#8203;andyjessop](https://redirect.github.com/andyjessop)! -
chore: adds eslint-disable for ESLint error on empty typescript
interface in workers-configuration.d.ts

###
[`v3.80.1`](https://redirect.github.com/cloudflare/workers-sdk/blob/HEAD/packages/wrangler/CHANGELOG.md#3801)

[Compare
Source](https://redirect.github.com/cloudflare/workers-sdk/compare/wrangler@3.80.0...wrangler@3.80.1)

##### Patch Changes

-
[#&#8203;6908](https://redirect.github.com/cloudflare/workers-sdk/pull/6908)
[`d696850`](https://redirect.github.com/cloudflare/workers-sdk/commit/d6968507b7eab36abdc4d6c2ffe183788857d08c)
Thanks [@&#8203;penalosa](https://redirect.github.com/penalosa)! - fix:
debounce restarting worker on assets dir file changes when `--x-dev-env`
is enabled.

-
[#&#8203;6902](https://redirect.github.com/cloudflare/workers-sdk/pull/6902)
[`dc92af2`](https://redirect.github.com/cloudflare/workers-sdk/commit/dc92af28c572e3f7a03b84afd53f10a40ee2a5f8)
Thanks
[@&#8203;threepointone](https://redirect.github.com/threepointone)! -
fix: enable esbuild's keepNames: true to set .name on functions/classes

-
[#&#8203;6909](https://redirect.github.com/cloudflare/workers-sdk/pull/6909)
[`82180a7`](https://redirect.github.com/cloudflare/workers-sdk/commit/82180a7a7680028f2ea24ae8b1c8479d39627826)
Thanks [@&#8203;penalosa](https://redirect.github.com/penalosa)! - fix:
Various fixes for logging in `--x-dev-env`, primarily to ensure the
hotkeys don't wipe useful output and are cleaned up correctly

-
[#&#8203;6903](https://redirect.github.com/cloudflare/workers-sdk/pull/6903)
[`54924a4`](https://redirect.github.com/cloudflare/workers-sdk/commit/54924a430354c0e427770ee4289217660141c72e)
Thanks
[@&#8203;petebacondarwin](https://redirect.github.com/petebacondarwin)!
- fix: ensure that `alias` config gets passed through to the bundler
when using new `--x-dev-env`

Fixes
[#&#8203;6898](https://redirect.github.com/cloudflare/workers-sdk/issues/6898)

-
[#&#8203;6911](https://redirect.github.com/cloudflare/workers-sdk/pull/6911)
[`30b7328`](https://redirect.github.com/cloudflare/workers-sdk/commit/30b7328073c86ff9adebd594015bca6844da7163)
Thanks [@&#8203;emily-shen](https://redirect.github.com/emily-shen)! -
fix: infer experimentalJsonConfig from file extension

Fixes
[#&#8203;5768](https://redirect.github.com/cloudflare/workers-sdk/issues/5768)
- issue with vitest and Pages projects with wrangler.toml

- Updated dependencies
\[[`5c50949`](https://redirect.github.com/cloudflare/workers-sdk/commit/5c509494807a1c0418be83c47a459ec80126848e)]:
    -   miniflare@3.20240925.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/astral-sh/ruff).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xMjAuMSIsInVwZGF0ZWRJblZlciI6IjM4LjEyMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJpbnRlcm5hbCJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* [`pylint`] - restrict `iteration-over-set` to only work on sets of literals (`PLC0208`) (#13731)

* [red-knot] Consistently rename BoolLiteral => BooleanLiteral (#13856)

## Summary

- Consistent naming: `BoolLiteral` => `BooleanLiteral` (it's mainly the
`Ty::BoolLiteral` variant that was renamed)

  I tripped over this a few times now, so I thought I'll smooth it out.
- Add a new test case for `Literal[True] <: bool`, as suggested here:
https://github.com/astral-sh/ruff/pull/13781#discussion_r1804922827

* [red-knot] handle unions on the LHS of is_subtype_of (#13857)

## Summary

Just a drive-by change that occurred to me while I was looking at
`Type::is_subtype_of`: the existing pattern for unions on the *right
hand side*:
```rs
            (ty, Type::Union(union)) => union
                .elements(db)
                .iter()
                .any(|&elem_ty| ty.is_subtype_of(db, elem_ty)),
```
is not (generally) correct if the *left hand side* is a union.

## Test Plan

Added new test cases for `is_subtype_of` and `!is_subtype_of`

* Speed up mdtests (#13832)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* formatter: Introduce `QuoteMetadata` (#13858)

* [red-knot] Improve chained comparisons handling (#13825)

## Summary

A small fix for comparisons of multiple comparators.
Instead of comparing each comparator to the leftmost item, we should
compare it to the closest item on the left.

While implementing this, I noticed that we don’t yet narrow Yoda
comparisons (e.g., `True is x`), so I didn’t change that behavior in
this PR.

## Test Plan

Added some mdtests 🎉

* Speedup mdtest parser (#13835)

* Update cloudflare/wrangler-action action to v3.9.0 (#13846)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* [red-knot] Support for not-equal narrowing (#13749)

Add type narrowing for `!=` expression as stated in
#13694.

###  Test Plan

Add tests in new md format.

---------

Co-authored-by: David Peter <mail@david-peter.de>

* [red-knot] Report line numbers in mdtest relative to the markdown file, not the test snippet (#13804)

Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Carl Meyer <carl@oddbird.net>

* [red-knot] is_subtype_of: treat literals as subtype of 'object' (#13876)

Add the following subtype relations:
- `BooleanLiteral <: object`
- `IntLiteral <: object`
- `StringLiteral <: object`
- `LiteralString <: object`
- `BytesLiteral <: object`

Added a test case for `bool <: int`.

## Test Plan

New unit tests.

* ci(docker): incorporate docker release enhancements from uv (#13274)

## Summary

This PR updates `ruff` to match `uv` updated [docker releases
approach](https://github.com/astral-sh/uv/blob/main/.github/workflows/build-docker.yml).
It's a combined PR with changes from these PR's
* https://github.com/astral-sh/uv/pull/6053
* https://github.com/astral-sh/uv/pull/6556
* https://github.com/astral-sh/uv/pull/6734
* https://github.com/astral-sh/uv/pull/7568

Summary of changes / features

1. This change would publish an additional tags that includes only
`major.minor`.

    For a release with `x.y.z`, this would publish the tags:

    * ghcr.io/astral-sh/ruff:latest
    * ghcr.io/astral-sh/ruff:x.y.z
    * ghcr.io/astral-sh/ruff:x.y

2. Parallelizes multi-platform builds using multiple workers (hence the
new docker-build / docker-publish jobs), which cuts docker releases time
in half.

3. This PR introduces additional images with the ruff binaries from
scratch for both amd64/arm64 and makes the mapping easy to configure by
generating the Dockerfile on the fly. This approach focuses on
minimizing CI time by taking advantage of dedicating a worker per
mapping (20-30s~ per job). For example, on release `x.y.z`, this will
publish the following image tags with format
`ghcr.io/astral-sh/ruff:{tag}` with manifests for both amd64/arm64. This
also include `x.y` tags for each respective additional tag. Note, this
version does not include the python based images, unlike `uv`.

* From **scratch**: `latest`, `x.y.z`, `x.y` (currently being published)
* From **alpine:3.20**: `alpine`, `alpine3.20`, `x.y.z-alpine`,
`x.y.z-alpine3.20`
* From **debian:bookworm-slim**: `debian-slim`, `bookworm-slim`,
`x.y.z-debian-slim`, `x.y.z-bookworm-slim`
* From **buildpack-deps:bookworm**: `debian`, `bookworm`,
`x.y.z-debian`, `x.y.z-bookworm`

4. This PR also fixes `org.opencontainers.image.version` for all tags
(including the one from `scratch`) to contain the right release version
instead of branch name `main` (current behavior).

    ```
> docker inspect ghcr.io/astral-sh/ruff:0.6.4 | jq -r
'.[0].Config.Labels'
    {
      ...
      "org.opencontainers.image.version": "main"
    }
    ```

Closes https://github.com/astral-sh/ruff/issues/13481

## Test Plan

Approach mimics `uv` with almost no changes so risk is low but I still
tested the full workflow.

* I have a working CI release pipeline on my fork run
https://github.com/samypr100/ruff/actions/runs/10966657733
* The resulting images were published to
https://github.com/samypr100/ruff/pkgs/container/ruff

* Fix `D204`'s documentation to correctly mention the conventions when it is enabled (#13867)

* [red-knot] Treat empty intersection as 'object', fix intersection simplification (#13880)

## Summary

- Properly treat the empty intersection as being of type `object`.
- Consequently, change the simplification method to explicitly add
`Never` to the positive side of the intersection when collapsing a type
such as `int & str` to `Never`, as opposed to just clearing both the
positive and the negative side.
- Minor code improvement in `bindings_ty`: use `peekable()` to check
whether the iterator over constraints is empty, instead of handling
first and subsequent elements separately.

fixes #13870

## Test Plan

- New unit tests for `IntersectionBuilder` to make sure the empty
intersection represents `object`.
- Markdown-based regression test for the original issue in #13870

* [red-knot] rename {Class,Module,Function} => {Class,Module,Function}Literal (#13873)

## Summary

* Rename `Type::Class` => `Type::ClassLiteral`
* Rename `Type::Function` => `Type::FunctionLiteral`
* Do not rename `Type::Module`
* Remove `*Literal` suffixes in `display::LiteralTypeKind` variants, as
per clippy suggestion
* Get rid of `Type::is_class()` in favor of `is_subtype_of(…, 'type')`;
modifiy `is_subtype_of` to support this.
* Add new `Type::is_xyz()` methods and use them instead of matching on
`Type` variants.

closes #13863 

## Test Plan

New `is_subtype_of_class_literals` unit test.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Alternate quotes for strings inside f-strings in preview (#13860)

* [red-knot] Use track_caller for expect_ methods (#13884)

## Summary

A minor quality-of-life improvement: add
[`#[track_caller]`](https://doc.rust-lang.org/reference/attributes/codegen.html#the-track_caller-attribute)
attribute to `Type::expect_xyz()` methods and some `TypeInference` methods such that the panic-location
is reported one level higher up in the stack trace.

before: reports location inside the `Type::expect_class_literal()`
method. Not very useful.
```
thread 'types::infer::tests::deferred_annotation_builtin' panicked at crates/red_knot_python_semantic/src/types.rs:304:14:
Expected a Type::ClassLiteral variant
```

after: reports location at the `Type::expect_class_literal()` call site,
where the error was made.
```
thread 'types::infer::tests::deferred_annotation_builtin' panicked at crates/red_knot_python_semantic/src/types/infer.rs:4302:14:
Expected a Type::ClassLiteral variant
```

## Test Plan

Called `expect_class_literal()` on something that's not a
`Type::ClassLiteral` and saw that the error was reported at the call
site.

* [`flake8-type-checking`] Support auto-quoting when annotations contain quotes (#11811)

## Summary

This PR updates the fix generation logic for auto-quoting an annotation
to generate an edit even when there's a quote character present.

The logic uses the visitor pattern, maintaining it's state on where it
is and generating the string value one node at a time. This can be
considered as a specialized form of `Generator`. The state required to
maintain is whether we're currently inside a `typing.Literal` or
`typing.Annotated` because the string value in those types should not be
un-quoted i.e., `Generic[Literal["int"]]` should become
`"Generic[Literal['int']]`, the quotes inside the `Literal` should be
preserved.

Fixes: https://github.com/astral-sh/ruff/issues/9137

## Test Plan

Add various test cases to validate this change, validate the snapshots.
There are no ecosystem changes to go through.

---------

Signed-off-by: Shaygan <hey@glyphack.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>

* Fix stale syntax errors in playground (#13888)

* Fix E221 and E222 to flag missing or extra whitespace around `==` operator (#13890)

* [red-knot] Type narrowing for `isinstance` checks (#13894)

## Summary

Add type narrowing for `isinstance(object, classinfo)` [1] checks:
```py
x = 1 if flag else "a"

if isinstance(x, int):
    reveal_type(x)  # revealed: Literal[1]
```

closes #13893

[1] https://docs.python.org/3/library/functions.html#isinstance

## Test Plan

New Markdown-based tests in `narrow/isinstance.md`.

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Remove "default" remark from `ruff check` (#13900)

## Summary

`ruff check` has not been the default in a long time. However, the help
message and code comment still designate it as the default. The remark
should have been removed in the deprecation PR #10169.

## Test Plan

Not tested.

* Use referencial equality in `traversal` helper methods (#13895)

* Join implicit concatenated strings when they fit on a line (#13663)

* [red-knot] Infer subscript expression types for bytes literals (#13901)

## Summary

Infer subscript expression types for bytes literals:
```py
b = b"\x00abc\xff"

reveal_type(b[0])  # revealed: Literal[b"\x00"]
reveal_type(b[1])  # revealed: Literal[b"a"]
reveal_type(b[-1])  # revealed: Literal[b"\xff"]
reveal_type(b[-2])  # revealed: Literal[b"c"]

reveal_type(b[False])  # revealed: Literal[b"\x00"]
reveal_type(b[True])  # revealed: Literal[b"a"]
```


part of #13689
(https://github.com/astral-sh/ruff/issues/13689#issuecomment-2404285064)

## Test Plan

- New Markdown-based tests (see `mdtest/subscript/bytes.md`)
- Added missing test for `string_literal[bool_literal]`

* [red-knot] Format mdtest Python snippets more concisely (#13905)

* Fix preview style name in `can_omit_parentheses` to is_f_string_formatting_enabled (#13907)

* Fix `normalize` arguments when `fstring_formatting` is disabled (#13910)

* Bump version to 0.7.1 (#13913)

* Enable nursery rules: 'redundant_clone', 'debug_assert_with_mut_call', and 'unused_peekable' (#13920)

* [red-knot] knot benchmark: fix `--knot-path` arg (#13923)

## Summary

Previously, this would fail with

```
AttributeError: 'str' object has no attribute 'is_file'
```

if I tried to use the `--knot-path` option. I wish we had a type checker
for Python*.

## Test Plan

```sh
uv run benchmark --knot-path ~/.cargo-target/release/red_knot
```

\* to be fair, this would probably require special handling for
`argparse` in the typechecker.

* [red-knot] Infer `Todo`, not `Unknown`, for PEP-604 unions in annotations (#13908)

* [red-knot] Remove lint-phase (#13922)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Docs: Add GitLab CI/CD to integrations. (#13915)

* [red-knot] Type narrow in else clause (#13918)

## Summary

Add support for type narrowing in elif and else scopes as part of
#13694.

## Test Plan

- mdtest
- builder unit test for union negation.

---------

Co-authored-by: Carl Meyer <carl@astral.sh>

---------

Signed-off-by: Shaygan <hey@glyphack.com>
Co-authored-by: Carl Meyer <carl@astral.sh>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: cake-monotone <cake.monotone@gmail.com>
Co-authored-by: Neil Mitchell <ndmitchell@gmail.com>
Co-authored-by: Shaygan Hooshyari <sh.hooshyari@gmail.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Aditya Pratap Singh <adityapratapsjnhh7654@gmail.com>
Co-authored-by: Steve C <diceroll123@gmail.com>
Co-authored-by: David Peter <sharkdp@users.noreply.github.com>
Co-authored-by: TomerBin <tomerbin98@gmail.com>
Co-authored-by: Alex <83035922+Lexxxzy@users.noreply.github.com>
Co-authored-by: David Peter <mail@david-peter.de>
Co-authored-by: aditya pillai <29032680+pilleye@users.noreply.github.com>
Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: samypr100 <3933065+samypr100@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Mihai Capotă <mihai@mihaic.ro>
Co-authored-by: Jonas Vacek <jvacek@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter preview Related to preview mode features
Projects
None yet
2 participants