Skip to content

Commit fe9fb9a

Browse files
committed
Merge branch 'main' into return_in_async_generator
2 parents abc6971 + 4488e9d commit fe9fb9a

26 files changed

Lines changed: 128 additions & 71 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
environment:
1919
name: release
2020
permissions:
21-
id-token: write # For PyPI's trusted publishing + PEP 740 attestations
21+
# For PyPI's trusted publishing.
22+
id-token: write
2223
steps:
2324
- name: "Install uv"
2425
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
@@ -27,8 +28,5 @@ jobs:
2728
pattern: wheels-*
2829
path: wheels
2930
merge-multiple: true
30-
- uses: astral-sh/attest-action@2c727738cea36d6c97dd85eb133ea0e0e8fe754b # v0.0.4
31-
with:
32-
paths: wheels/*
3331
- name: Publish to PyPi
3432
run: uv publish -v wheels/*

crates/ty_ide/src/goto_type_definition.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ mod tests {
145145

146146
assert_snapshot!(test.goto_type_definition(), @r"
147147
info[goto-type-definition]: Type definition
148-
--> stdlib/typing.pyi:770:1
148+
--> stdlib/typing.pyi:781:1
149149
|
150-
768 | def __class_getitem__(cls, args: TypeVar | tuple[TypeVar, ...]) -> _Final: ...
151-
769 |
152-
770 | Generic: type[_Generic]
150+
779 | def __class_getitem__(cls, args: TypeVar | tuple[TypeVar, ...]) -> _Final: ...
151+
780 |
152+
781 | Generic: type[_Generic]
153153
| ^^^^^^^
154-
771 |
155-
772 | class _ProtocolMeta(ABCMeta):
154+
782 |
155+
783 | class _ProtocolMeta(ABCMeta):
156156
|
157157
info: Source
158158
--> main.py:4:1

crates/ty_python_semantic/resources/mdtest/import/star.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ reveal_type(Y) # revealed: Unknown
715715

716716
# The `*` import is not considered a redefinition
717717
# of the global variable `Z` in this module, as the symbol in
718-
# the `a` module is in a branch that is statically known
718+
# the `exporter` module is in a branch that is statically known
719719
# to be dead code given the `python-version` configuration.
720720
# Thus this still reveals `Literal[True]`.
721721
reveal_type(Z) # revealed: Literal[True]

crates/ty_python_semantic/resources/mdtest/snapshots/deprecated.md_-_Tests_for_the_`@depr…_-_Syntax_(142fa2948c3c6cf1).snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ error[missing-argument]: No argument provided for required parameter `arg` of bo
9191
7 | from typing_extensions import deprecated
9292
|
9393
info: Parameter declared here
94-
--> stdlib/typing_extensions.pyi:1000:28
94+
--> stdlib/typing_extensions.pyi:1001:28
9595
|
96-
998 | stacklevel: int
97-
999 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
98-
1000 | def __call__(self, arg: _T, /) -> _T: ...
96+
999 | stacklevel: int
97+
1000 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
98+
1001 | def __call__(self, arg: _T, /) -> _T: ...
9999
| ^^^^^^^
100-
1001 |
101-
1002 | @final
100+
1002 |
101+
1003 | @final
102102
|
103103
info: rule `missing-argument` is enabled by default
104104

crates/ty_python_semantic/src/semantic_index/predicate.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ impl<'db> PatternPredicate<'db> {
166166
}
167167
}
168168

169-
/// A "placeholder predicate" that is used to model the fact that the boundness of a
170-
/// (possible) definition or declaration caused by a `*` import cannot be fully determined
171-
/// until type-inference time. This is essentially the same as a standard reachability constraint,
172-
/// so we reuse the [`Predicate`] infrastructure to model it.
169+
/// A "placeholder predicate" that is used to model the fact that the boundness of a (possible)
170+
/// definition or declaration caused by a `*` import cannot be fully determined until type-
171+
/// inference time. This is essentially the same as a standard reachability constraint, so we reuse
172+
/// the [`Predicate`] infrastructure to model it.
173173
///
174174
/// To illustrate, say we have a module `exporter.py` like so:
175175
///
@@ -183,14 +183,14 @@ impl<'db> PatternPredicate<'db> {
183183
/// ```py
184184
/// A = 1
185185
///
186-
/// from importer import *
186+
/// from exporter import *
187187
/// ```
188188
///
189-
/// Since we cannot know whether or not <condition> is true at semantic-index time,
190-
/// we record a definition for `A` in `b.py` as a result of the `from a import *`
191-
/// statement, but place a predicate on it to record the fact that we don't yet
192-
/// know whether this definition will be visible from all control-flow paths or not.
193-
/// Essentially, we model `b.py` as something similar to this:
189+
/// Since we cannot know whether or not <condition> is true at semantic-index time, we record
190+
/// a definition for `A` in `importer.py` as a result of the `from exporter import *` statement,
191+
/// but place a predicate on it to record the fact that we don't yet know whether this definition
192+
/// will be visible from all control-flow paths or not. Essentially, we model `importer.py` as
193+
/// something similar to this:
194194
///
195195
/// ```py
196196
/// A = 1
@@ -199,8 +199,8 @@ impl<'db> PatternPredicate<'db> {
199199
/// from a import A
200200
/// ```
201201
///
202-
/// At type-check time, the placeholder predicate for the `A` definition is evaluated by
203-
/// attempting to resolve the `A` symbol in `a.py`'s global namespace:
202+
/// At type-check time, the placeholder predicate for the `A` definition is evaluated by attempting
203+
/// to resolve the `A` symbol in `exporter.py`'s global namespace:
204204
/// - If it resolves to a definitely bound symbol, then the predicate resolves to [`Truthiness::AlwaysTrue`]
205205
/// - If it resolves to an unbound symbol, then the predicate resolves to [`Truthiness::AlwaysFalse`]
206206
/// - If it resolves to a possibly bound symbol, then the predicate resolves to [`Truthiness::Ambiguous`]

crates/ty_python_semantic/src/semantic_index/reachability_constraints.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! During semantic index building, we record so-called reachability constraints that keep track
44
//! of a set of conditions that need to apply in order for a certain statement or expression to
55
//! be reachable from the start of the scope. As an example, consider the following situation where
6-
//! we have just processed two `if`-statements:
6+
//! we have just processed an `if`-statement:
77
//! ```py
88
//! if test:
99
//! <is this reachable?>
@@ -101,13 +101,13 @@
101101
//! <is this reachable?>
102102
//! ```
103103
//! If we would not record any constraints at the branching point, we would have an `always-true`
104-
//! reachability for the no-loop branch, and a `always-false` reachability for the branch which enters
105-
//! the loop. Merging those would lead to a reachability of `always-true OR always-false = always-true`,
104+
//! reachability for the no-loop branch, and a `always-true` reachability for the branch which enters
105+
//! the loop. Merging those would lead to a reachability of `always-true OR always-true = always-true`,
106106
//! i.e. we would consider the end of the scope to be unconditionally reachable, which is not correct.
107107
//!
108108
//! Recording an ambiguous constraint at the branching point modifies the constraints in both branches to
109-
//! `always-true AND ambiguous = ambiguous` and `always-false AND ambiguous = always-false`, respectively.
110-
//! Merging these two using OR correctly leads to `ambiguous` for the end-of-scope reachability.
109+
//! `always-true AND ambiguous = ambiguous`. Merging these two using OR correctly leads to `ambiguous` for
110+
//! the end-of-scope reachability.
111111
//!
112112
//!
113113
//! ## Reachability constraints and bindings
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f8cdc0bd526301e873cd952eb0d457bdf2554e57
1+
ef2b90c67e5c668b91b3ae121baf00ee5165c30b

crates/ty_vendored/vendor/typeshed/stdlib/asyncio/runners.pyi

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from _typeshed import Unused
3-
from collections.abc import Callable, Coroutine
3+
from collections.abc import Awaitable, Callable, Coroutine
44
from contextvars import Context
55
from typing import Any, TypeVar, final
66
from typing_extensions import Self
@@ -50,9 +50,12 @@ if sys.version_info >= (3, 11):
5050

5151
def get_loop(self) -> AbstractEventLoop:
5252
"""Return embedded event loop."""
53-
54-
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T:
55-
"""Run code in the embedded event loop."""
53+
if sys.version_info >= (3, 14):
54+
def run(self, coro: Awaitable[_T], *, context: Context | None = None) -> _T:
55+
"""Run code in the embedded event loop."""
56+
else:
57+
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T:
58+
"""Run a coroutine inside the embedded event loop."""
5659

5760
if sys.version_info >= (3, 12):
5861
def run(

crates/ty_vendored/vendor/typeshed/stdlib/asyncio/trsock.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class TransportSocket:
6969
def listen(self, backlog: int = ..., /) -> None: ...
7070
@deprecated("Removed in Python 3.11")
7171
def makefile(self) -> BinaryIO: ...
72-
@deprecated("Rmoved in Python 3.11")
72+
@deprecated("Removed in Python 3.11")
7373
def sendfile(self, file: BinaryIO, offset: int = 0, count: int | None = None) -> int: ...
7474
@deprecated("Removed in Python 3.11")
7575
def close(self) -> None: ...

crates/ty_vendored/vendor/typeshed/stdlib/calendar.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,12 @@ if sys.version_info >= (3, 12):
6464

6565
_LocaleType: TypeAlias = tuple[str | None, str | None]
6666

67-
class IllegalMonthError(ValueError):
67+
class IllegalMonthError(ValueError, IndexError):
68+
month: int
6869
def __init__(self, month: int) -> None: ...
6970

7071
class IllegalWeekdayError(ValueError):
72+
weekday: int
7173
def __init__(self, weekday: int) -> None: ...
7274

7375
def isleap(year: int) -> bool:

0 commit comments

Comments
 (0)