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

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

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

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

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

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

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


