Skip to content

Pyright update #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
language: node
pass_filenames: false
types: [python]
additional_dependencies: ["[email protected].323"]
additional_dependencies: ["[email protected].330"]
repo: local
- hooks:
- id: jb-to-sphinx
Expand Down
8 changes: 2 additions & 6 deletions expression/collections/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,7 @@ def starmap(
) -> Block[_TResult]:
...

def starmap(
self: Block[Tuple[Any, ...]], mapping: Callable[..., Any]
) -> Block[Any]:
def starmap(self: Block[Any], mapping: Callable[..., Any]) -> Block[Any]:
"""Starmap source sequence.

Unpack arguments grouped as tuple elements. Builds a new collection
Expand Down Expand Up @@ -811,9 +809,7 @@ def starmap(
...


def starmap(
mapper: Callable[..., Any]
) -> Callable[[Block[Tuple[Any, ...]]], Block[Any]]:
def starmap(mapper: Callable[..., Any]) -> Callable[[Block[Any]], Block[Any]]:
"""Starmap source sequence.

Unpack arguments grouped as tuple elements. Builds a new collection
Expand Down
6 changes: 2 additions & 4 deletions expression/collections/seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def starmap(
) -> Seq[_TResult]:
...

def starmap(self: Seq[Tuple[Any, ...]], mapping: Callable[..., Any]) -> Seq[Any]:
def starmap(self: Seq[Any], mapping: Callable[..., Any]) -> Seq[Any]:
"""Starmap source sequence.

Unpack arguments grouped as tuple elements. Builds a new collection
Expand Down Expand Up @@ -663,9 +663,7 @@ def starmap(
...


def starmap(
mapper: Callable[..., Any]
) -> Callable[[Iterable[Tuple[Any, ...]]], Iterable[Any]]:
def starmap(mapper: Callable[..., Any]) -> Callable[[Iterable[Any]], Iterable[Any]]:
"""Starmap source sequence.

Unpack arguments grouped as tuple elements. Builds a new collection
Expand Down
5 changes: 4 additions & 1 deletion expression/core/fn.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import functools
from typing import Awaitable, Callable, Generic, TypeVar, Union
from typing import Awaitable, Callable, Generic, TypeVar, Union, cast

from typing_extensions import ParamSpec

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

def trampoline(bouncer: TailCallResult[_TResult, _P]) -> _TResult:
while isinstance(bouncer, TailCall):
bouncer = cast(TailCall[_P], bouncer)

args, kw = bouncer.args, bouncer.kw
bouncer = fn(*args, **kw)

Expand All @@ -53,6 +55,7 @@ def tailrec_async(

async def trampoline(bouncer: TailCallResult[_TResult, _P]) -> _TResult:
while isinstance(bouncer, TailCall):
bouncer = cast(TailCall[_P], bouncer)
args, kw = bouncer.args, bouncer.kw
bouncer = await fn(*args, **kw)

Expand Down
6 changes: 2 additions & 4 deletions expression/extra/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ def starmap(
) -> Parser[_E]:
...

def starmap(
self: Parser[Tuple[Any, ...]], mapper: Callable[..., Any]
) -> Parser[Any]:
def starmap(self: Parser[Any], mapper: Callable[..., Any]) -> Parser[Any]:
return pipe(self, starmap(mapper))

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


@curry(1)
def starmap(mapper: Callable[..., Any], parser: Parser[Tuple[Any, ...]]) -> Parser[Any]:
def starmap(mapper: Callable[..., Any], parser: Parser[Any]) -> Parser[Any]:
def mapper_(values: Tuple[Any, ...]) -> Any:
return mapper(*values)

Expand Down
Loading