mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
[ty] Allow classes to inherit from type[Any]
or type[Unknown]
(#18060)
This commit is contained in:
parent
41fa082414
commit
7e9b0df18a
5 changed files with 68 additions and 48 deletions
|
@ -140,6 +140,43 @@ info[revealed-type]: Revealed type
|
|||
|
||||
```
|
||||
|
||||
```
|
||||
error[duplicate-base]: Duplicate base class `Eggs`
|
||||
--> src/mdtest_snippet.py:16:7
|
||||
|
|
||||
14 | # error: [duplicate-base] "Duplicate base class `Spam`"
|
||||
15 | # error: [duplicate-base] "Duplicate base class `Eggs`"
|
||||
16 | class Ham(
|
||||
| _______^
|
||||
17 | | Spam,
|
||||
18 | | Eggs,
|
||||
19 | | Bar,
|
||||
20 | | Baz,
|
||||
21 | | Spam,
|
||||
22 | | Eggs,
|
||||
23 | | ): ...
|
||||
| |_^
|
||||
24 |
|
||||
25 | # fmt: on
|
||||
|
|
||||
info: The definition of class `Ham` will raise `TypeError` at runtime
|
||||
--> src/mdtest_snippet.py:18:5
|
||||
|
|
||||
16 | class Ham(
|
||||
17 | Spam,
|
||||
18 | Eggs,
|
||||
| ---- Class `Eggs` first included in bases list here
|
||||
19 | Bar,
|
||||
20 | Baz,
|
||||
21 | Spam,
|
||||
22 | Eggs,
|
||||
| ^^^^ Class `Eggs` later repeated here
|
||||
23 | ): ...
|
||||
|
|
||||
info: rule `duplicate-base` is enabled by default
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
error[duplicate-base]: Duplicate base class `Spam`
|
||||
--> src/mdtest_snippet.py:16:7
|
||||
|
@ -178,43 +215,6 @@ info: rule `duplicate-base` is enabled by default
|
|||
|
||||
```
|
||||
|
||||
```
|
||||
error[duplicate-base]: Duplicate base class `Eggs`
|
||||
--> src/mdtest_snippet.py:16:7
|
||||
|
|
||||
14 | # error: [duplicate-base] "Duplicate base class `Spam`"
|
||||
15 | # error: [duplicate-base] "Duplicate base class `Eggs`"
|
||||
16 | class Ham(
|
||||
| _______^
|
||||
17 | | Spam,
|
||||
18 | | Eggs,
|
||||
19 | | Bar,
|
||||
20 | | Baz,
|
||||
21 | | Spam,
|
||||
22 | | Eggs,
|
||||
23 | | ): ...
|
||||
| |_^
|
||||
24 |
|
||||
25 | # fmt: on
|
||||
|
|
||||
info: The definition of class `Ham` will raise `TypeError` at runtime
|
||||
--> src/mdtest_snippet.py:18:5
|
||||
|
|
||||
16 | class Ham(
|
||||
17 | Spam,
|
||||
18 | Eggs,
|
||||
| ---- Class `Eggs` first included in bases list here
|
||||
19 | Bar,
|
||||
20 | Baz,
|
||||
21 | Spam,
|
||||
22 | Eggs,
|
||||
| ^^^^ Class `Eggs` later repeated here
|
||||
23 | ): ...
|
||||
|
|
||||
info: rule `duplicate-base` is enabled by default
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
info[revealed-type]: Revealed type
|
||||
--> src/mdtest_snippet.py:27:13
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue