-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dcreager/class-match
* main: Use uv consistently throughout the documentation (#15302) [red-knot] Eagerly normalize `type[]` types (#15272) [`pyupgrade`] Split `UP007` to two individual rules for `Union` and `Optional` (`UP007`, `UP045`) (#15313) [red-knot] Improve symbol-lookup tracing (#14907) [red-knot] improve type shrinking coverage in red-knot property tests (#15297) [`flake8-return`] Recognize functions returning `Never` as non-returning (`RET503`) (#15298) [`flake8-bugbear`] Implement `class-as-data-structure` (`B903`) (#9601) Avoid treating newline-separated sections as sub-sections (#15311) Remove call when removing final argument from `format` (#15309) Don't enforce `object-without-hash-method` in stubs (#15310) Don't special-case class instances in binary expression inference (#15161) Upgrade zizmor to the latest version in CI (#15300)
- Loading branch information
Showing
59 changed files
with
2,135 additions
and
926 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
# Configuration for the zizmor static analysis tool, run via pre-commit in CI | ||
# https://woodruffw.github.io/zizmor/configuration/ | ||
# | ||
# TODO: can we remove the ignores here so that our workflows are more secure? | ||
rules: | ||
dangerous-triggers: | ||
ignore: | ||
- pr-comment.yaml | ||
cache-poisoning: | ||
ignore: | ||
- build-docker.yml | ||
- publish-playground.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
crates/red_knot_python_semantic/resources/mdtest/binary/classes.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Binary operations on classes | ||
|
||
## Union of two classes | ||
|
||
Unioning two classes via the `|` operator is only available in Python 3.10 and later. | ||
|
||
```toml | ||
[environment] | ||
python-version = "3.10" | ||
``` | ||
|
||
```py | ||
class A: ... | ||
class B: ... | ||
|
||
reveal_type(A | B) # revealed: UnionType | ||
``` | ||
|
||
## Union of two classes (prior to 3.10) | ||
|
||
```py | ||
class A: ... | ||
class B: ... | ||
|
||
# error: "Operator `|` is unsupported between objects of type `Literal[A]` and `Literal[B]`" | ||
reveal_type(A | B) # revealed: Unknown | ||
``` |
Oops, something went wrong.