Skip to content

Commit efd6d00

Browse files
authored
Upgrade pyright (#229)
1 parent 13c2d30 commit efd6d00

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.10", "3.11", "3.12"]
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1818

1919
steps:
2020
- uses: actions/checkout@v3

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ repos:
1414
language: node
1515
pass_filenames: false
1616
types: [python]
17-
additional_dependencies: ["[email protected].374"]
17+
additional_dependencies: ["[email protected].386"]
1818
repo: local

expression/core/option.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import builtins
1212
from collections.abc import Callable, Generator, Iterable
13-
from typing import TYPE_CHECKING, Any, Literal, TypeGuard, TypeVar, get_args, get_origin
13+
from typing import TYPE_CHECKING, Any, Literal, TypeGuard, TypeVar, cast, get_args, get_origin
1414

1515
from typing_extensions import TypeVarTuple, Unpack
1616

@@ -258,7 +258,7 @@ def dict(self) -> _TSourceOut | None:
258258
case Option(tag="some", some=value):
259259
attr = getattr(value, "model_dump", None) or getattr(value, "dict", None)
260260
if attr and callable(attr):
261-
value = attr()
261+
value = cast(_TSourceOut, attr())
262262

263263
return value
264264
case _:

expression/core/result.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Literal,
2121
TypeGuard,
2222
TypeVar,
23+
cast,
2324
get_args,
2425
get_origin,
2526
)
@@ -189,12 +190,12 @@ def dict(self) -> builtins.dict[str, _TSourceOut | _TError | Literal["ok", "erro
189190
case Result(tag="ok", ok=value):
190191
attr = getattr(value, "model_dump", None) or getattr(value, "dict", None)
191192
if attr and callable(attr):
192-
value = attr()
193+
value = cast(_TSourceOut, attr())
193194
return {"tag": "ok", "ok": value}
194195
case Result(error=error):
195196
attr = getattr(error, "model_dump", None) or getattr(error, "dict", None)
196197
if attr and callable(attr):
197-
error = attr()
198+
error = cast(_TError, attr())
198199
return {"tag": "error", "error": error}
199200

200201
def swap(self) -> Result[_TError, _TSourceOut]:

0 commit comments

Comments
 (0)