> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Simplify f-string Formatting

#### Sourcery refactoring id: `simplify-fstring-formatting`

#### Description

Simplify the formatting of replacements within an f-string.

#### Before

```python
name = "Tom"
celebration = "hurrah"
f"{name} is {5} years old, {f'{celebration.upper()}'}"
```

#### After

```python
name = "Tom"
celebration = "hurrah"
f"{name} is 5 years old, {celebration.upper()}"
```

#### Explanation

This refactoring simplifies f-string:

- Inline constants directly into the f-strings
- Remove unnecessary nested f-strings if they are not needed
