Skip to content

Commit 610939a

Browse files
authored
update NoReturn to Never mypy 1.11.0 (#1889)
1 parent e6fc70b commit 610939a

File tree

24 files changed

+109
-108
lines changed

24 files changed

+109
-108
lines changed

docs/pages/interfaces.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ for example, can have one, two or three possible types. See the example below:
3131

3232
.. code:: python
3333
34-
>>> from typing import NoReturn
34+
>>> from typing_extensions import Never
3535
3636
>>> from returns.interfaces.mappable import (
3737
... MappableN, Mappable1, Mappable2, Mappable3,
3838
... )
3939
40-
>>> one_type: MappableN[int, NoReturn, NoReturn]
41-
>>> two_types: MappableN[int, str, NoReturn]
40+
>>> one_type: MappableN[int, Never, Never]
41+
>>> two_types: MappableN[int, str, Never]
4242
>>> three_types: MappableN[int, str, bool]
4343
4444
>>> # We have a shortcut for each amount of arguments to reduce the boilerplate

returns/functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from functools import wraps
2-
from typing import Any, Callable, NoReturn, TypeVar
2+
from typing import Any, Callable, TypeVar
33

4-
from typing_extensions import ParamSpec
4+
from typing_extensions import Never, ParamSpec
55

66
_FirstType = TypeVar('_FirstType')
77
_SecondType = TypeVar('_SecondType')
@@ -105,7 +105,7 @@ def decorator(argument_to_return: _FirstType) -> None:
105105
return decorator
106106

107107

108-
def raise_exception(exception: Exception) -> NoReturn:
108+
def raise_exception(exception: Exception) -> Never:
109109
"""
110110
Helper function to raise exceptions as a function.
111111

returns/interfaces/altable.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
from abc import abstractmethod
2-
from typing import (
3-
Callable,
4-
ClassVar,
5-
Generic,
6-
NoReturn,
7-
Sequence,
8-
TypeVar,
9-
final,
10-
)
2+
from typing import Callable, ClassVar, Generic, Sequence, TypeVar, final
3+
4+
from typing_extensions import Never
115

126
from returns.functions import compose, identity
137
from returns.primitives.asserts import assert_equal
@@ -85,7 +79,7 @@ def alt(
8579

8680

8781
#: Type alias for kinds with two type arguments.
88-
Altable2 = AltableN[_FirstType, _SecondType, NoReturn]
82+
Altable2 = AltableN[_FirstType, _SecondType, Never]
8983

9084
#: Type alias for kinds with three type arguments.
9185
Altable3 = AltableN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/applicative.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from abc import abstractmethod
2-
from typing import Callable, ClassVar, NoReturn, Sequence, Type, TypeVar, final
2+
from typing import Callable, ClassVar, Sequence, Type, TypeVar, final
3+
4+
from typing_extensions import Never
35

46
from returns.functions import compose, identity
57
from returns.interfaces import mappable
@@ -162,10 +164,10 @@ def from_value(
162164

163165

164166
#: Type alias for kinds with one type argument.
165-
Applicative1 = ApplicativeN[_FirstType, NoReturn, NoReturn]
167+
Applicative1 = ApplicativeN[_FirstType, Never, Never]
166168

167169
#: Type alias for kinds with two type arguments.
168-
Applicative2 = ApplicativeN[_FirstType, _SecondType, NoReturn]
170+
Applicative2 = ApplicativeN[_FirstType, _SecondType, Never]
169171

170172
#: Type alias for kinds with three type arguments.
171173
Applicative3 = ApplicativeN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/bimappable.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from typing import NoReturn, TypeVar
1+
from typing import TypeVar
2+
3+
from typing_extensions import Never
24

35
from returns.interfaces import altable, mappable
46

@@ -25,7 +27,7 @@ class BiMappableN(
2527

2628

2729
#: Type alias for kinds with two type arguments.
28-
BiMappable2 = BiMappableN[_FirstType, _SecondType, NoReturn]
30+
BiMappable2 = BiMappableN[_FirstType, _SecondType, Never]
2931

3032
#: Type alias for kinds with three type arguments.
3133
BiMappable3 = BiMappableN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/bindable.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from abc import abstractmethod
2-
from typing import Callable, Generic, NoReturn, TypeVar
2+
from typing import Callable, Generic, TypeVar
3+
4+
from typing_extensions import Never
35

46
from returns.primitives.hkt import KindN
57

@@ -41,10 +43,10 @@ def bind(
4143

4244

4345
#: Type alias for kinds with one type argument.
44-
Bindable1 = BindableN[_FirstType, NoReturn, NoReturn]
46+
Bindable1 = BindableN[_FirstType, Never, Never]
4547

4648
#: Type alias for kinds with two type arguments.
47-
Bindable2 = BindableN[_FirstType, _SecondType, NoReturn]
49+
Bindable2 = BindableN[_FirstType, _SecondType, Never]
4850

4951
#: Type alias for kinds with three type arguments.
5052
Bindable3 = BindableN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/container.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from typing import Callable, ClassVar, NoReturn, Sequence, TypeVar, final
1+
from typing import Callable, ClassVar, Sequence, TypeVar, final
2+
3+
from typing_extensions import Never
24

35
from returns.interfaces import applicative, bindable
46
from returns.primitives.asserts import assert_equal
@@ -121,10 +123,10 @@ class ContainerN(
121123

122124

123125
#: Type alias for kinds with one type argument.
124-
Container1 = ContainerN[_FirstType, NoReturn, NoReturn]
126+
Container1 = ContainerN[_FirstType, Never, Never]
125127

126128
#: Type alias for kinds with two type arguments.
127-
Container2 = ContainerN[_FirstType, _SecondType, NoReturn]
129+
Container2 = ContainerN[_FirstType, _SecondType, Never]
128130

129131
#: Type alias for kinds with three type arguments.
130132
Container3 = ContainerN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/failable.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from abc import abstractmethod
2-
from typing import Callable, ClassVar, NoReturn, Sequence, Type, TypeVar, final
2+
from typing import Callable, ClassVar, Sequence, Type, TypeVar, final
3+
4+
from typing_extensions import Never
35

46
from returns.interfaces import container as _container
57
from returns.interfaces import lashable, swappable
@@ -73,7 +75,7 @@ class FailableN(
7375

7476

7577
#: Type alias for kinds with two type arguments.
76-
Failable2 = FailableN[_FirstType, _SecondType, NoReturn]
78+
Failable2 = FailableN[_FirstType, _SecondType, Never]
7779

7880
#: Type alias for kinds with three type arguments.
7981
Failable3 = FailableN[_FirstType, _SecondType, _ThirdType]
@@ -154,7 +156,7 @@ def empty(
154156

155157

156158
#: Type alias for kinds with two types arguments.
157-
SingleFailable2 = SingleFailableN[_FirstType, _SecondType, NoReturn]
159+
SingleFailable2 = SingleFailableN[_FirstType, _SecondType, Never]
158160

159161
#: Type alias for kinds with three type arguments.
160162
SingleFailable3 = SingleFailableN[_FirstType, _SecondType, _ThirdType]
@@ -258,7 +260,7 @@ def from_failure(
258260

259261

260262
#: Type alias for kinds with two type arguments.
261-
DiverseFailable2 = DiverseFailableN[_FirstType, _SecondType, NoReturn]
263+
DiverseFailable2 = DiverseFailableN[_FirstType, _SecondType, Never]
262264

263265
#: Type alias for kinds with three type arguments.
264266
DiverseFailable3 = DiverseFailableN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/lashable.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from abc import abstractmethod
2-
from typing import Callable, Generic, NoReturn, TypeVar
2+
from typing import Callable, Generic, TypeVar
3+
4+
from typing_extensions import Never
35

46
from returns.primitives.hkt import KindN
57

@@ -41,7 +43,7 @@ def lash(
4143

4244

4345
#: Type alias for kinds with two type arguments.
44-
Lashable2 = LashableN[_FirstType, _SecondType, NoReturn]
46+
Lashable2 = LashableN[_FirstType, _SecondType, Never]
4547

4648
#: Type alias for kinds with three type arguments.
4749
Lashable3 = LashableN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/mappable.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
from abc import abstractmethod
2-
from typing import (
3-
Callable,
4-
ClassVar,
5-
Generic,
6-
NoReturn,
7-
Sequence,
8-
TypeVar,
9-
final,
10-
)
2+
from typing import Callable, ClassVar, Generic, Sequence, TypeVar, final
3+
4+
from typing_extensions import Never
115

126
from returns.functions import compose, identity
137
from returns.primitives.asserts import assert_equal
@@ -93,10 +87,10 @@ def map(
9387

9488

9589
#: Type alias for kinds with one type argument.
96-
Mappable1 = MappableN[_FirstType, NoReturn, NoReturn]
90+
Mappable1 = MappableN[_FirstType, Never, Never]
9791

9892
#: Type alias for kinds with two type arguments.
99-
Mappable2 = MappableN[_FirstType, _SecondType, NoReturn]
93+
Mappable2 = MappableN[_FirstType, _SecondType, Never]
10094

10195
#: Type alias for kinds with three type arguments.
10296
Mappable3 = MappableN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/specific/future.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
Callable,
1717
Generator,
1818
Generic,
19-
NoReturn,
2019
TypeVar,
2120
)
2221

22+
from typing_extensions import Never
23+
2324
from returns.interfaces.specific import io
2425
from returns.primitives.hkt import KindN
2526

@@ -88,10 +89,10 @@ def from_future(
8889

8990

9091
#: Type alias for kinds with one type argument.
91-
FutureLike1 = FutureLikeN[_FirstType, NoReturn, NoReturn]
92+
FutureLike1 = FutureLikeN[_FirstType, Never, Never]
9293

9394
#: Type alias for kinds with two type arguments.
94-
FutureLike2 = FutureLikeN[_FirstType, _SecondType, NoReturn]
95+
FutureLike2 = FutureLikeN[_FirstType, _SecondType, Never]
9596

9697
#: Type alias for kinds with three type arguments.
9798
FutureLike3 = FutureLikeN[_FirstType, _SecondType, _ThirdType]
@@ -120,10 +121,10 @@ async def awaitable(
120121

121122

122123
#: Type alias for kinds with one type argument.
123-
AsyncFuture1 = AwaitableFutureN[_FirstType, NoReturn, NoReturn]
124+
AsyncFuture1 = AwaitableFutureN[_FirstType, Never, Never]
124125

125126
#: Type alias for kinds with two type arguments.
126-
AsyncFuture2 = AwaitableFutureN[_FirstType, _SecondType, NoReturn]
127+
AsyncFuture2 = AwaitableFutureN[_FirstType, _SecondType, Never]
127128

128129
#: Type alias for kinds with three type arguments.
129130
AsyncFuture3 = AwaitableFutureN[_FirstType, _SecondType, _ThirdType]
@@ -143,10 +144,10 @@ class FutureBasedN(
143144

144145

145146
#: Type alias for kinds with one type argument.
146-
FutureBased1 = FutureBasedN[_FirstType, NoReturn, NoReturn]
147+
FutureBased1 = FutureBasedN[_FirstType, Never, Never]
147148

148149
#: Type alias for kinds with two type arguments.
149-
FutureBased2 = FutureBasedN[_FirstType, _SecondType, NoReturn]
150+
FutureBased2 = FutureBasedN[_FirstType, _SecondType, Never]
150151

151152
#: Type alias for kinds with three type arguments.
152153
FutureBased3 = FutureBasedN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/specific/future_result.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from __future__ import annotations
1010

1111
from abc import abstractmethod
12-
from typing import TYPE_CHECKING, Awaitable, Callable, NoReturn, TypeVar
12+
from typing import TYPE_CHECKING, Awaitable, Callable, TypeVar
13+
14+
from typing_extensions import Never
1315

1416
from returns.interfaces.specific import future, ioresult
1517
from returns.primitives.hkt import KindN
@@ -80,7 +82,7 @@ def from_future_result(
8082

8183

8284
#: Type alias for kinds with two type arguments.
83-
FutureResultLike2 = FutureResultLikeN[_FirstType, _SecondType, NoReturn]
85+
FutureResultLike2 = FutureResultLikeN[_FirstType, _SecondType, Never]
8486

8587
#: Type alias for kinds with three type arguments.
8688
FutureResultLike3 = FutureResultLikeN[_FirstType, _SecondType, _ThirdType]
@@ -101,7 +103,7 @@ class FutureResultBasedN(
101103

102104

103105
#: Type alias for kinds with two type arguments.
104-
FutureResultBased2 = FutureResultBasedN[_FirstType, _SecondType, NoReturn]
106+
FutureResultBased2 = FutureResultBasedN[_FirstType, _SecondType, Never]
105107

106108
#: Type alias for kinds with three type arguments.
107109
FutureResultBased3 = FutureResultBasedN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/specific/io.py

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

33
from abc import abstractmethod
4-
from typing import TYPE_CHECKING, Callable, NoReturn, TypeVar
4+
from typing import TYPE_CHECKING, Callable, TypeVar
5+
6+
from typing_extensions import Never
57

68
from returns.interfaces import container, equable
79
from returns.primitives.hkt import KindN
@@ -46,10 +48,10 @@ def from_io(
4648

4749

4850
#: Type alias for kinds with one type argument.
49-
IOLike1 = IOLikeN[_FirstType, NoReturn, NoReturn]
51+
IOLike1 = IOLikeN[_FirstType, Never, Never]
5052

5153
#: Type alias for kinds with two type arguments.
52-
IOLike2 = IOLikeN[_FirstType, _SecondType, NoReturn]
54+
IOLike2 = IOLikeN[_FirstType, _SecondType, Never]
5355

5456
#: Type alias for kinds with three type arguments.
5557
IOLike3 = IOLikeN[_FirstType, _SecondType, _ThirdType]
@@ -75,10 +77,10 @@ class IOBasedN(
7577

7678

7779
#: Type alias for kinds with one type argument.
78-
IOBased1 = IOBasedN[_FirstType, NoReturn, NoReturn]
80+
IOBased1 = IOBasedN[_FirstType, Never, Never]
7981

8082
#: Type alias for kinds with two type arguments.
81-
IOBased2 = IOBasedN[_FirstType, _SecondType, NoReturn]
83+
IOBased2 = IOBasedN[_FirstType, _SecondType, Never]
8284

8385
#: Type alias for kinds with three type arguments.
8486
IOBased3 = IOBasedN[_FirstType, _SecondType, _ThirdType]

returns/interfaces/specific/ioresult.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
from __future__ import annotations
88

99
from abc import abstractmethod
10-
from typing import TYPE_CHECKING, Callable, NoReturn, TypeVar
10+
from typing import TYPE_CHECKING, Callable, TypeVar
11+
12+
from typing_extensions import Never
1113

1214
from returns.interfaces.specific import io, result
1315
from returns.primitives.hkt import KindN
@@ -74,7 +76,7 @@ def from_failed_io(
7476

7577

7678
#: Type alias for kinds with two type arguments.
77-
IOResultLike2 = IOResultLikeN[_FirstType, _SecondType, NoReturn]
79+
IOResultLike2 = IOResultLikeN[_FirstType, _SecondType, Never]
7880

7981
#: Type alias for kinds with three type arguments.
8082
IOResultLike3 = IOResultLikeN[_FirstType, _SecondType, _ThirdType]
@@ -102,7 +104,7 @@ class IOResultBasedN(
102104

103105

104106
#: Type alias for kinds with two type arguments.
105-
IOResultBased2 = IOResultBasedN[_FirstType, _SecondType, NoReturn]
107+
IOResultBased2 = IOResultBasedN[_FirstType, _SecondType, Never]
106108

107109
#: Type alias for kinds with three type arguments.
108110
IOResultBased3 = IOResultBasedN[_FirstType, _SecondType, _ThirdType]

0 commit comments

Comments
 (0)