---
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
---
F521 `.format` call has invalid format string: Single '{' encountered in format string
 --> F521.py:1:1
  |
1 | "{".format(1)
  | ^^^^^^^^^^^^^
2 | "}".format(1)
3 | "{foo[}".format(foo=1)
  |

F521 `.format` call has invalid format string: Single '}' encountered in format string
 --> F521.py:2:1
  |
1 | "{".format(1)
2 | "}".format(1)
  | ^^^^^^^^^^^^^
3 | "{foo[}".format(foo=1)
4 | # too much string recursion (placeholder-in-placeholder)
  |

F521 `.format` call has invalid format string: Expected '}' before end of string
 --> F521.py:3:1
  |
1 | "{".format(1)
2 | "}".format(1)
3 | "{foo[}".format(foo=1)
  | ^^^^^^^^^^^^^^^^^^^^^^
4 | # too much string recursion (placeholder-in-placeholder)
5 | "{:{:{}}}".format(1, 2, 3)
  |

F521 `.format` call has invalid format string: Max format placeholder recursion exceeded
 --> F521.py:5:1
  |
3 | "{foo[}".format(foo=1)
4 | # too much string recursion (placeholder-in-placeholder)
5 | "{:{:{}}}".format(1, 2, 3)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^
6 | # ruff picks these issues up, but flake8 doesn't
7 | "{foo[]}".format(foo={"": 1})
  |

F521 `.format` call has invalid format string: Empty attribute in format string
 --> F521.py:7:1
  |
5 | "{:{:{}}}".format(1, 2, 3)
6 | # ruff picks these issues up, but flake8 doesn't
7 | "{foo[]}".format(foo={"": 1})
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8 | "{foo..}".format(foo=1)
9 | "{foo..bar}".format(foo=1)
  |

F521 `.format` call has invalid format string: Empty attribute in format string
 --> F521.py:8:1
  |
6 | # ruff picks these issues up, but flake8 doesn't
7 | "{foo[]}".format(foo={"": 1})
8 | "{foo..}".format(foo=1)
  | ^^^^^^^^^^^^^^^^^^^^^^^
9 | "{foo..bar}".format(foo=1)
  |

F521 `.format` call has invalid format string: Empty attribute in format string
  --> F521.py:9:1
   |
 7 | "{foo[]}".format(foo={"": 1})
 8 | "{foo..}".format(foo=1)
 9 | "{foo..bar}".format(foo=1)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | # The following are all "good" uses of .format
   |
