Skip to content

Commit 9f4c18a

Browse files
committed
Run new prek hook
1 parent a4f5dba commit 9f4c18a

41 files changed

Lines changed: 157 additions & 227 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/ty_python_semantic/resources/mdtest/annotations/deferred.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
```pyi
88
def get_foo() -> Foo: ...
9+
910
class Foo: ...
1011
```
1112

@@ -256,7 +257,6 @@ Forward references in class keyword arguments are allowed in stub files.
256257

257258
```pyi
258259
class Foo(metaclass=SomeMeta): ...
259-
260260
class SomeMeta(type): ...
261261
```
262262

crates/ty_python_semantic/resources/mdtest/assignment/annotations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ reveal_type(x) # revealed: Foo
399399

400400
```pyi
401401
x: int = 1
402-
reveal_type(x) # revealed: Literal[1]
402+
reveal_type(x) # revealed: Literal[1]
403403
```
404404

405405
## Annotations influence generic call inference

crates/ty_python_semantic/resources/mdtest/assignment/augmented.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _(flag: bool):
6060
if flag:
6161
def __iadd__(self, other: int) -> str:
6262
return "Hello, world!"
63+
6364
else:
6465
def __iadd__(self, other: int) -> int:
6566
return 42

crates/ty_python_semantic/resources/mdtest/call/constructor.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def _(flag: bool) -> None:
9595
class Foo:
9696
if flag:
9797
def __new__(cls, x: int): ...
98+
9899
else:
99100
def __new__(cls, x: int, y: int = 1): ...
100101

@@ -228,6 +229,7 @@ def _(flag: bool) -> None:
228229
class Foo:
229230
if flag:
230231
def __init__(self, x: int): ...
232+
231233
else:
232234
def __init__(self, x: int, y: int = 1): ...
233235

crates/ty_python_semantic/resources/mdtest/call/dunder.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def _(flag: bool):
220220
if flag:
221221
def __getitem__(self, key: int) -> str:
222222
return str(key)
223+
223224
else:
224225
def __getitem__(self, key: int) -> bytes:
225226
return bytes()

crates/ty_python_semantic/resources/mdtest/call/overloads.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,6 @@ class SomeEnum(Enum):
428428
B = 2
429429
C = 3
430430

431-
432431
class A: ...
433432
class B: ...
434433
class C: ...
@@ -1467,19 +1466,16 @@ class B: ...
14671466
def f1(x: int) -> A: ...
14681467
@overload
14691468
def f1(x: Any, y: Any) -> A: ...
1470-
14711469
@overload
14721470
def f2(x: int) -> A: ...
14731471
@overload
14741472
def f2(x: Any, y: Any) -> B: ...
1475-
14761473
@overload
14771474
def f3(x: int) -> A: ...
14781475
@overload
14791476
def f3(x: Any, y: Any) -> A: ...
14801477
@overload
14811478
def f3(x: Any, y: Any, *, z: str) -> B: ...
1482-
14831479
@overload
14841480
def f4(x: int) -> A: ...
14851481
@overload
@@ -1523,14 +1519,12 @@ def f1(x1: T1, x2: T2, /) -> tuple[T1, T2]: ...
15231519
def f1(x1: T1, x2: T2, x3: T3, /) -> tuple[T1, T2, T3]: ...
15241520
@overload
15251521
def f1(*args: Any) -> tuple[Any, ...]: ...
1526-
15271522
@overload
15281523
def f2(x1: T1) -> tuple[T1]: ...
15291524
@overload
15301525
def f2(x1: T1, x2: T2) -> tuple[T1, T2]: ...
15311526
@overload
15321527
def f2(*args: Any, **kwargs: Any) -> tuple[Any, ...]: ...
1533-
15341528
@overload
15351529
def f3(x: T1) -> tuple[T1]: ...
15361530
@overload

crates/ty_python_semantic/resources/mdtest/call/union.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def _(flag: bool):
77
if flag:
88
def f() -> int:
99
return 1
10+
1011
else:
1112
def f() -> str:
1213
return "foo"
@@ -825,6 +826,7 @@ def _(flag: bool):
825826
if flag:
826827
def f(x: T) -> int:
827828
return 1
829+
828830
else:
829831
def f(x: dict[str, int]) -> int:
830832
return 1

crates/ty_python_semantic/resources/mdtest/class/super.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,10 @@ def coinflip() -> bool:
639639
def f():
640640
if coinflip():
641641
class A: ...
642+
642643
else:
643644
class A: ...
645+
644646
super(A, A()) # error: [invalid-super-argument]
645647
```
646648

crates/ty_python_semantic/resources/mdtest/conditional/if_statement.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ class NotBoolable:
155155
__bool__: int = 3
156156

157157
# error: [unsupported-bool-conversion] "Boolean conversion is not supported for type `NotBoolable`"
158-
if NotBoolable():
159-
...
158+
if NotBoolable(): ...
160159
# error: [unsupported-bool-conversion] "Boolean conversion is not supported for type `NotBoolable`"
161-
elif NotBoolable():
162-
...
160+
elif NotBoolable(): ...
163161
```

crates/ty_python_semantic/resources/mdtest/dataclasses/dataclass_transform.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ from dataclasses import field
226226

227227
@dataclass_transform(kw_only_default=True)
228228
def create_model(*, kw_only: bool = True): ...
229+
229230
@create_model()
230231
class A:
231232
name: str
@@ -282,6 +283,7 @@ from typing import dataclass_transform
282283

283284
@dataclass_transform(frozen_default=True)
284285
def create_model(*, frozen: bool = True): ...
286+
285287
@create_model()
286288
class ImmutableModel:
287289
name: str
@@ -339,6 +341,7 @@ from typing import dataclass_transform
339341

340342
@dataclass_transform(eq_default=True, order_default=False, kw_only_default=True, frozen_default=True)
341343
def create_model(*, eq: bool = True, order: bool = False, kw_only: bool = True, frozen: bool = True): ...
344+
342345
@create_model(eq=False, order=True, kw_only=False, frozen=False)
343346
class OverridesAllParametersModel:
344347
name: str
@@ -367,6 +370,7 @@ from typing import dataclass_transform
367370

368371
@dataclass_transform(frozen_default=True)
369372
def default_frozen_model(*, frozen: bool = True, order: bool = False): ...
373+
370374
@default_frozen_model()
371375
class Frozen:
372376
name: str
@@ -466,6 +470,7 @@ from typing import dataclass_transform
466470

467471
@dataclass_transform(frozen_default=True)
468472
def frozen_model(*, frozen: bool = True): ...
473+
469474
@frozen_model()
470475
class FrozenWithOverrides:
471476
x: int
@@ -497,6 +502,7 @@ from typing import dataclass_transform
497502

498503
@dataclass_transform()
499504
def ordered_model(*, order: bool = False): ...
505+
500506
@ordered_model(order=True)
501507
class OrderedWithOverrides:
502508
x: int
@@ -652,6 +658,7 @@ reveal_type(alice.age) # revealed: int | None
652658
from typing_extensions import dataclass_transform, Any
653659

654660
def fancy_field(*, init: bool = True, kw_only: bool = False, alias: str | None = None) -> Any: ...
661+
655662
@dataclass_transform(field_specifiers=(fancy_field,))
656663
class FancyMeta(type):
657664
def __new__(cls, name, bases, namespace):
@@ -680,6 +687,7 @@ reveal_type(alice.age) # revealed: int | None
680687
from typing_extensions import dataclass_transform, Any
681688

682689
def fancy_field(*, init: bool = True, kw_only: bool = False, alias: str | None = None) -> Any: ...
690+
683691
@dataclass_transform(field_specifiers=(fancy_field,))
684692
class FancyBase:
685693
def __init_subclass__(cls):
@@ -763,6 +771,7 @@ from typing import Any
763771
from typing_extensions import dataclass_transform
764772

765773
def field(**kwargs: Any) -> Any: ...
774+
766775
@dataclass_transform(field_specifiers=(field,))
767776
class ModelMeta(type): ...
768777

@@ -790,6 +799,7 @@ from typing import Any
790799
from typing_extensions import dataclass_transform
791800

792801
def field(**kwargs: Any) -> Any: ...
802+
793803
@dataclass_transform(field_specifiers=(field,))
794804
class ModelBase: ...
795805

@@ -1094,6 +1104,7 @@ class InvalidKWOnlyDefaultModel:
10941104
from typing_extensions import Any, dataclass_transform
10951105

10961106
def field(*, init: bool = True, kw_only: bool = False, default: Any = ...) -> Any: ...
1107+
10971108
@dataclass_transform(field_specifiers=(field,))
10981109
class ModelMeta(type): ...
10991110

@@ -1140,6 +1151,7 @@ class InvalidKWOnlyDefaultModel(KWOnlyDefaultModelBase):
11401151
from typing_extensions import Any, dataclass_transform
11411152

11421153
def field(*, init: bool = True, kw_only: bool = False, default: Any = ...) -> Any: ...
1154+
11431155
@dataclass_transform(field_specifiers=(field,))
11441156
class ModelBase:
11451157
def __init_subclass__(cls):

0 commit comments

Comments
 (0)