Skip to content

Commit 51944f1

Browse files
Remove 'dummy_contextvars'. No longer needed after dropping Python 3.6.
1 parent a775996 commit 51944f1

File tree

5 files changed

+4
-80
lines changed

5 files changed

+4
-80
lines changed

src/prompt_toolkit/application/application.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import contextvars
23
import os
34
import re
45
import signal
@@ -92,12 +93,6 @@
9293
from .current import get_app_session, set_app
9394
from .run_in_terminal import in_terminal, run_in_terminal
9495

95-
try:
96-
import contextvars
97-
except ImportError:
98-
import prompt_toolkit.eventloop.dummy_contextvars as contextvars # type: ignore
99-
100-
10196
__all__ = [
10297
"Application",
10398
]

src/prompt_toolkit/application/current.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import sys
22
from contextlib import contextmanager
3+
from contextvars import ContextVar
34
from typing import TYPE_CHECKING, Any, Generator, Optional
45

5-
try:
6-
from contextvars import ContextVar
7-
except ImportError:
8-
from prompt_toolkit.eventloop.dummy_contextvars import ContextVar # type: ignore
9-
106
if TYPE_CHECKING:
117
from prompt_toolkit.input.base import Input
128
from prompt_toolkit.output.base import Output

src/prompt_toolkit/eventloop/dummy_contextvars.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/prompt_toolkit/eventloop/utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import asyncio
2+
import contextvars
23
import sys
34
import time
45
from asyncio import get_running_loop
56
from types import TracebackType
67
from typing import Any, Awaitable, Callable, Dict, Optional, TypeVar, cast
78

8-
try:
9-
import contextvars
10-
except ImportError:
11-
from . import dummy_contextvars as contextvars # type: ignore
12-
139
__all__ = [
1410
"run_in_executor_with_context",
1511
"call_soon_threadsafe",

src/prompt_toolkit/shortcuts/progress_bar/base.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
for item in pb(data):
88
...
99
"""
10+
import contextvars
1011
import datetime
1112
import functools
1213
import os
@@ -55,14 +56,6 @@
5556

5657
from .formatters import Formatter, create_default_formatters
5758

58-
try:
59-
import contextvars
60-
except ImportError:
61-
from prompt_toolkit.eventloop import dummy_contextvars
62-
63-
contextvars = dummy_contextvars # type: ignore
64-
65-
6659
__all__ = ["ProgressBar"]
6760

6861
E = KeyPressEvent

0 commit comments

Comments
 (0)