---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
B006_B008.py:62:25: B006 Do not use mutable data structures for argument defaults
   |
62 | def this_is_wrong(value=[1, 2, 3]):
   |                         ^^^^^^^^^ B006
63 |     ...
   |

B006_B008.py:66:30: B006 Do not use mutable data structures for argument defaults
   |
66 | def this_is_also_wrong(value={}):
   |                              ^^ B006
67 |     ...
   |

B006_B008.py:70:20: B006 Do not use mutable data structures for argument defaults
   |
70 | def and_this(value=set()):
   |                    ^^^^^ B006
71 |     ...
   |

B006_B008.py:74:20: B006 Do not use mutable data structures for argument defaults
   |
74 | def this_too(value=collections.OrderedDict()):
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^ B006
75 |     ...
   |

B006_B008.py:78:32: B006 Do not use mutable data structures for argument defaults
   |
78 | async def async_this_too(value=collections.defaultdict()):
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^ B006
79 |     ...
   |

B006_B008.py:82:26: B006 Do not use mutable data structures for argument defaults
   |
82 | def dont_forget_me(value=collections.deque()):
   |                          ^^^^^^^^^^^^^^^^^^^ B006
83 |     ...
   |

B006_B008.py:87:46: B006 Do not use mutable data structures for argument defaults
   |
87 | # N.B. we're also flagging the function call in the comprehension
88 | def list_comprehension_also_not_okay(default=[i**2 for i in range(3)]):
   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^ B006
89 |     pass
   |

B006_B008.py:91:46: B006 Do not use mutable data structures for argument defaults
   |
91 | def dict_comprehension_also_not_okay(default={i: i**2 for i in range(3)}):
   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^ B006
92 |     pass
   |

B006_B008.py:95:45: B006 Do not use mutable data structures for argument defaults
   |
95 | def set_comprehension_also_not_okay(default={i**2 for i in range(3)}):
   |                                             ^^^^^^^^^^^^^^^^^^^^^^^^ B006
96 |     pass
   |

B006_B008.py:99:33: B006 Do not use mutable data structures for argument defaults
    |
 99 | def kwonlyargs_mutable(*, value=[]):
    |                                 ^^ B006
100 |     ...
    |

B006_B008.py:192:20: B006 Do not use mutable data structures for argument defaults
    |
192 | # B006 and B008
193 | # We should handle arbitrary nesting of these B008.
194 | def nested_combo(a=[float(3), dt.datetime.now()]):
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ B006
195 |     pass
    |

B006_B008.py:225:27: B006 Do not use mutable data structures for argument defaults
    |
225 | def mutable_annotations(
226 |     a: list[int] | None = [],
    |                           ^^ B006
227 |     b: Optional[Dict[int, int]] = {},
228 |     c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
    |

B006_B008.py:226:35: B006 Do not use mutable data structures for argument defaults
    |
226 | def mutable_annotations(
227 |     a: list[int] | None = [],
228 |     b: Optional[Dict[int, int]] = {},
    |                                   ^^ B006
229 |     c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
230 | ):
    |

B006_B008.py:227:62: B006 Do not use mutable data structures for argument defaults
    |
227 |     a: list[int] | None = [],
228 |     b: Optional[Dict[int, int]] = {},
229 |     c: Annotated[Union[Set[str], abc.Sized], "annotation"] = set(),
    |                                                              ^^^^^ B006
230 | ):
231 |     pass
    |


