---
source: crates/ruff_linter/src/rules/flake8_quotes/mod.rs
snapshot_kind: text
---
singles_escaped.py:1:26: Q003 [*] Change outer quotes to avoid escaping inner quotes
  |
1 | this_should_raise_Q003 = "This is a \"string\""
  |                          ^^^^^^^^^^^^^^^^^^^^^^ Q003
2 | this_is_fine = "'This' is a \"string\""
3 | this_is_fine = 'This is a "string"'
  |
  = help: Change outer quotes to avoid escaping inner quotes

ℹ Safe fix
1   |-this_should_raise_Q003 = "This is a \"string\""
  1 |+this_should_raise_Q003 = 'This is a "string"'
2 2 | this_is_fine = "'This' is a \"string\""
3 3 | this_is_fine = 'This is a "string"'
4 4 | this_is_fine = '\'This\' is a "string"'

singles_escaped.py:9:5: Q003 [*] Change outer quotes to avoid escaping inner quotes
   |
 7 | this_should_raise = (
 8 |     "This is a"
 9 |     "\"string\""
   |     ^^^^^^^^^^^^ Q003
10 | )
   |
   = help: Change outer quotes to avoid escaping inner quotes

ℹ Safe fix
6  6  | this_is_fine = R"This is a \"string\""
7  7  | this_should_raise = (
8  8  |     "This is a"
9     |-    "\"string\""
   9  |+    '"string"'
10 10 | )
11 11 | 
12 12 | # Same as above, but with f-strings

singles_escaped.py:13:1: Q003 [*] Change outer quotes to avoid escaping inner quotes
   |
12 | # Same as above, but with f-strings
13 | f"This is a \"string\""
   | ^^^^^^^^^^^^^^^^^^^^^^^ Q003
14 | f"'This' is a \"string\""
15 | f'This is a "string"'
   |
   = help: Change outer quotes to avoid escaping inner quotes

ℹ Safe fix
10 10 | )
11 11 | 
12 12 | # Same as above, but with f-strings
13    |-f"This is a \"string\""
   13 |+f'This is a "string"'
14 14 | f"'This' is a \"string\""
15 15 | f'This is a "string"'
16 16 | f'\'This\' is a "string"'

singles_escaped.py:21:5: Q003 [*] Change outer quotes to avoid escaping inner quotes
   |
19 | foo = (
20 |     f"This is a"
21 |     f"\"string\""
   |     ^^^^^^^^^^^^^ Q003
22 | )
   |
   = help: Change outer quotes to avoid escaping inner quotes

ℹ Safe fix
18 18 | fR"This is a \"string\""
19 19 | foo = (
20 20 |     f"This is a"
21    |-    f"\"string\""
   21 |+    f'"string"'
22 22 | )
23 23 | 
24 24 | # Nested f-strings (Python 3.12+)
