Skip to content

Commit a1bc5f6

Browse files
authored
Pyright update (#173)
1 parent 84ceed9 commit a1bc5f6

File tree

6 files changed

+1038
-997
lines changed

6 files changed

+1038
-997
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
language: node
2929
pass_filenames: false
3030
types: [python]
31-
additional_dependencies: ["[email protected].323"]
31+
additional_dependencies: ["[email protected].330"]
3232
repo: local
3333
- hooks:
3434
- id: jb-to-sphinx

expression/collections/block.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ def starmap(
292292
) -> Block[_TResult]:
293293
...
294294

295-
def starmap(
296-
self: Block[Tuple[Any, ...]], mapping: Callable[..., Any]
297-
) -> Block[Any]:
295+
def starmap(self: Block[Any], mapping: Callable[..., Any]) -> Block[Any]:
298296
"""Starmap source sequence.
299297
300298
Unpack arguments grouped as tuple elements. Builds a new collection
@@ -811,9 +809,7 @@ def starmap(
811809
...
812810

813811

814-
def starmap(
815-
mapper: Callable[..., Any]
816-
) -> Callable[[Block[Tuple[Any, ...]]], Block[Any]]:
812+
def starmap(mapper: Callable[..., Any]) -> Callable[[Block[Any]], Block[Any]]:
817813
"""Starmap source sequence.
818814
819815
Unpack arguments grouped as tuple elements. Builds a new collection

expression/collections/seq.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def starmap(
200200
) -> Seq[_TResult]:
201201
...
202202

203-
def starmap(self: Seq[Tuple[Any, ...]], mapping: Callable[..., Any]) -> Seq[Any]:
203+
def starmap(self: Seq[Any], mapping: Callable[..., Any]) -> Seq[Any]:
204204
"""Starmap source sequence.
205205
206206
Unpack arguments grouped as tuple elements. Builds a new collection
@@ -663,9 +663,7 @@ def starmap(
663663
...
664664

665665

666-
def starmap(
667-
mapper: Callable[..., Any]
668-
) -> Callable[[Iterable[Tuple[Any, ...]]], Iterable[Any]]:
666+
def starmap(mapper: Callable[..., Any]) -> Callable[[Iterable[Any]], Iterable[Any]]:
669667
"""Starmap source sequence.
670668
671669
Unpack arguments grouped as tuple elements. Builds a new collection

expression/core/fn.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import functools
4-
from typing import Awaitable, Callable, Generic, TypeVar, Union
4+
from typing import Awaitable, Callable, Generic, TypeVar, Union, cast
55

66
from typing_extensions import ParamSpec
77

@@ -34,6 +34,8 @@ def tailrec(fn: Callable[_P, TailCallResult[_TResult, _P]]) -> Callable[_P, _TRe
3434

3535
def trampoline(bouncer: TailCallResult[_TResult, _P]) -> _TResult:
3636
while isinstance(bouncer, TailCall):
37+
bouncer = cast(TailCall[_P], bouncer)
38+
3739
args, kw = bouncer.args, bouncer.kw
3840
bouncer = fn(*args, **kw)
3941

@@ -53,6 +55,7 @@ def tailrec_async(
5355

5456
async def trampoline(bouncer: TailCallResult[_TResult, _P]) -> _TResult:
5557
while isinstance(bouncer, TailCall):
58+
bouncer = cast(TailCall[_P], bouncer)
5659
args, kw = bouncer.args, bouncer.kw
5760
bouncer = await fn(*args, **kw)
5861

expression/extra/parser.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ def starmap(
7575
) -> Parser[_E]:
7676
...
7777

78-
def starmap(
79-
self: Parser[Tuple[Any, ...]], mapper: Callable[..., Any]
80-
) -> Parser[Any]:
78+
def starmap(self: Parser[Any], mapper: Callable[..., Any]) -> Parser[Any]:
8179
return pipe(self, starmap(mapper))
8280

8381
def opt(self) -> Parser[Option[_A]]:
@@ -217,7 +215,7 @@ def starmap(
217215

218216

219217
@curry(1)
220-
def starmap(mapper: Callable[..., Any], parser: Parser[Tuple[Any, ...]]) -> Parser[Any]:
218+
def starmap(mapper: Callable[..., Any], parser: Parser[Any]) -> Parser[Any]:
221219
def mapper_(values: Tuple[Any, ...]) -> Any:
222220
return mapper(*values)
223221

0 commit comments

Comments
 (0)