mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[flake8-bugbear
] Exempt NewType
calls where the original type is immutable (B008
) (#15765)
## Summary Resolves #12717. This change incorporates the logic added in #15588. ## Test Plan `cargo nextest run` and `cargo insta test`. --------- Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
This commit is contained in:
parent
6090408f65
commit
4bec8ba731
5 changed files with 88 additions and 55 deletions
|
@ -35,3 +35,14 @@ def okay(obj=Class()):
|
|||
|
||||
def error(obj=OtherClass()):
|
||||
...
|
||||
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/12717
|
||||
|
||||
from typing import NewType
|
||||
|
||||
N = NewType("N", int)
|
||||
L = NewType("L", list[str])
|
||||
|
||||
def okay(obj = N()): ...
|
||||
def error(obj = L()): ...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue