> ## 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.

# Missing Dict Items

#### Sourcery refactoring id: `missing-dict-items`

#### Description

Add missing `.items()` call when unpacking a dictionary

#### Before

```python
data = {"a": 1, "b": 2}
for key, value in data:
    process(key, value)
```

```python
data = {"x": 1, "y": 2, "z": 3}
filtered = {k: v for k, v in data if k == "x"}
```

#### After

```python
data = {"a": 1, "b": 2}
for key, value in data.items():
    process(key, value)
```

```python
data = {"x": 1, "y": 2, "z": 3}
filtered = {k: v for k, v in data.items() if k == "x"}
```

#### Explanation

When writing a loop to unpack a dictionary it is easy to forget to call
`.items()`. This suggestion adds in the missing call.
