Skip to content

Commit 950dfd6

Browse files
committed
satisfy mypy's types
1 parent b0bbcd6 commit 950dfd6

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

gambaterm/telnet.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
import asyncio
88
import argparse
99
import traceback
10-
from contextlib import contextmanager
10+
from contextlib import contextmanager, nullcontext
1111
from pathlib import Path
12+
from contextlib import AbstractContextManager as ContextManager
1213
from typing import TYPE_CHECKING, Any, Callable, Coroutine, Iterator
1314
from concurrent.futures import ThreadPoolExecutor
1415

@@ -83,15 +84,15 @@ def thread_target(
8384
console: Console = console_callback()
8485

8586
if app_config.input_file is not None:
86-
console_input_context = console_input_from_file_context(
87-
console, term, app_config.input_file, app_config.skip_inputs
87+
console_input_context: ContextManager[BaseInputGetter] = (
88+
console_input_from_file_context(
89+
console, term, app_config.input_file, app_config.skip_inputs
90+
)
8891
)
8992
elif input_state is not None:
90-
input_getter = TelnetInputGetter(console, term, input_state)
91-
console_input_context = contextmanager(lambda: (yield input_getter))()
93+
console_input_context = nullcontext(TelnetInputGetter(console, term, input_state))
9294
else:
93-
input_getter = NoInputGetter(console, term)
94-
console_input_context = contextmanager(lambda: (yield input_getter))()
95+
console_input_context = nullcontext(NoInputGetter(console, term))
9596

9697
with console_input_context as get_console_input:
9798
try:

0 commit comments

Comments
 (0)