Skip to content

Commit 4737f0e

Browse files
committed
Run Pyright in strict mode
1 parent f8f7a2e commit 4737f0e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,7 @@ showcontent = true
302302
pretty = true
303303
disallow_untyped_defs = true
304304
check_untyped_defs = true
305+
306+
307+
[tool.pyright]
308+
include = ["typing-examples/baseline_examples.py"]

typing-examples/baseline_examples.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SPDX-License-Identifier: MIT
2+
# pyright: strict
23

34
"""
45
Baseline features that should be supported by all type checkers.
@@ -143,8 +144,8 @@ class OrderFlags:
143144

144145
# field_transformer
145146
def ft_hook2(
146-
cls: type, attribs: list[attrs.Attribute]
147-
) -> list[attrs.Attribute]:
147+
cls: type, attribs: list[attrs.Attribute[Any]]
148+
) -> list[attrs.Attribute[Any]]:
148149
return attribs
149150

150151

@@ -155,9 +156,12 @@ class TransformedAttrs2:
155156

156157
@attrs.define
157158
class FactoryTest:
158-
a: list[int] = attrs.field(default=attrs.Factory(list))
159-
b: list[Any] = attrs.field(default=attrs.Factory(list, False))
159+
a: list[int] = attrs.field(factory=list) # pyright:ignore[reportUnknownVariableType]
160+
b: list[str] = attrs.field( # pyright:ignore[reportUnknownVariableType]
161+
default=attrs.Factory(list, takes_self=False) # pyright:ignore[reportUnknownArgumentType]
162+
)
160163
c: list[int] = attrs.field(default=attrs.Factory((lambda s: s.a), True))
164+
d: list[int] = attrs.Factory(list) # pyright:ignore[reportUnknownVariableType]
161165

162166

163167
attrs.asdict(FactoryTest())

0 commit comments

Comments
 (0)