Skip to content

Commit 1b1da7a

Browse files
committed
Replace typing_extensions -> typing in examples
1 parent 3149e8c commit 1b1da7a

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

docs/guides/unreachable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ As an example, consider this simple calculator:
5454
.. code:: python
5555
5656
import enum
57-
from typing_extensions import Never
57+
from typing import Never
5858
5959
def assert_never(arg: Never) -> Never:
6060
raise AssertionError("Expected code to be unreachable")

docs/reference/generics.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,7 @@ for a more faithful type annotation:
651651

652652
.. code-block:: python
653653
654-
from typing import Callable, TypeVar
655-
from typing_extensions import ParamSpec
654+
from typing import Callable, ParamSpec, TypeVar
656655
657656
P = ParamSpec('P')
658657
T = TypeVar('T')
@@ -668,8 +667,7 @@ alter the signature of the input function:
668667

669668
.. code-block:: python
670669
671-
from typing import Callable, TypeVar
672-
from typing_extensions import ParamSpec
670+
from typing import Callable, ParamSpec, TypeVar
673671
674672
P = ParamSpec('P')
675673
T = TypeVar('T')
@@ -692,8 +690,7 @@ Or insert an argument:
692690

693691
.. code-block:: python
694692
695-
from typing import Callable, TypeVar
696-
from typing_extensions import Concatenate, ParamSpec
693+
from typing import Callable, Concatenate, ParamSpec, TypeVar
697694
698695
P = ParamSpec('P')
699696
T = TypeVar('T')
@@ -774,8 +771,7 @@ Example:
774771

775772
.. code-block:: python
776773
777-
from typing import TypeVar
778-
from typing_extensions import Protocol
774+
from typing import Protocol, TypeVar
779775
780776
T = TypeVar('T')
781777

docs/reference/protocols.rst

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ You can define your own protocol class by inheriting from the special
7171

7272
.. code-block:: python
7373
74-
from typing import Iterable
75-
from typing_extensions import Protocol
74+
from typing import Iterable, Protocol
7675
7776
class SupportsClose(Protocol):
7877
# Empty method body (explicit '...')
@@ -231,8 +230,7 @@ such as trees and linked lists:
231230

232231
.. code-block:: python
233232
234-
from typing import TypeVar, Optional
235-
from typing_extensions import Protocol
233+
from typing import TypeVar, Optional, Protocol
236234
237235
class TreeLike(Protocol):
238236
value: int
@@ -260,7 +258,7 @@ rudimentary support for runtime structural checks:
260258

261259
.. code-block:: python
262260
263-
from typing_extensions import Protocol, runtime_checkable
261+
from typing import Protocol, runtime_checkable
264262
265263
@runtime_checkable
266264
class Portable(Protocol):
@@ -303,8 +301,7 @@ member:
303301

304302
.. code-block:: python
305303
306-
from typing import Optional, Iterable
307-
from typing_extensions import Protocol
304+
from typing import Optional, Iterable, Protocol
308305
309306
class Combiner(Protocol):
310307
def __call__(self, *vals: bytes, maxlen: Optional[int] = None) -> list[bytes]: ...
@@ -328,8 +325,7 @@ a double underscore prefix is used. For example:
328325

329326
.. code-block:: python
330327
331-
from typing import Callable, TypeVar
332-
from typing_extensions import Protocol
328+
from typing import Callable, TypeVar, Protocol
333329
334330
T = TypeVar('T')
335331

docs/reference/quality.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ then the following file tests ``foo.py``:
4040

4141
.. code-block:: python
4242
43-
from typing_extensions import assert_type
43+
from typing import assert_type
4444
4545
assert_type(bar(42), str)
4646

0 commit comments

Comments
 (0)