|
1 | 1 | """Repl server cli.""" |
| 2 | +from __future__ import annotations |
| 3 | + |
2 | 4 | import functools |
3 | 5 | import inspect |
4 | 6 | import shutil |
5 | 7 | from collections import defaultdict |
6 | | -from typing import Dict, Optional |
7 | 8 |
|
8 | 9 | import click |
9 | 10 | from prompt_toolkit import PromptSession, print_formatted_text |
|
40 | 41 | ) |
41 | 42 | COMMAND_ARGS = ["response_type", "error_code", "delay_by", "clear_after", "data_len"] |
42 | 43 | RESPONSE_TYPES = ["normal", "error", "delayed", "empty", "stray"] |
43 | | -COMMANDS: Dict[str, Optional[Dict | Command]] = { |
| 44 | +COMMANDS: dict[str, dict | Command | None] = { |
44 | 45 | "manipulator": { |
45 | 46 | "response_type": None, |
46 | 47 | "error_code": None, |
|
78 | 79 | } |
79 | 80 |
|
80 | 81 |
|
81 | | -def manipulator_to_dict(response_type: str = 'normal', error_code: Optional[int] = None, |
82 | | - delay_by: Optional[float] = None, |
83 | | - clear_after: Optional[int] = None) -> dict: |
| 82 | +def manipulator_to_dict(response_type: str = 'normal', error_code: int | None = None, |
| 83 | + delay_by: float | None = None, |
| 84 | + clear_after: int | None = None) -> dict: |
84 | 85 | """ |
85 | 86 | Manipulate response from the server. |
86 | 87 |
|
@@ -147,7 +148,7 @@ def get_terminal_width(): |
147 | 148 | return shutil.get_terminal_size()[0] |
148 | 149 |
|
149 | 150 |
|
150 | | -def print_help(command: Optional[str] = None): |
| 151 | +def print_help(command: str | None = None): |
151 | 152 | """Print help.""" |
152 | 153 |
|
153 | 154 | def _print_formatted(cmd: str, hlp: str): |
|
0 commit comments