Skip to content

Commit 66669cd

Browse files
authored
Merge pull request #1300 from dbcli/RW/typehint-main-py-pass-one
Typehint most of main.py, with consequent fixes elsewhere
2 parents 2189fa8 + 0261c9b commit 66669cd

File tree

11 files changed

+348
-258
lines changed

11 files changed

+348
-258
lines changed

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Upcoming Release (TBD)
22
======================
33

4+
Features
5+
--------
6+
* Add LLM support.
7+
8+
49
Bug Fixes
510
--------
611
* Improve missing ssh-extras message.
@@ -10,6 +15,7 @@ Bug Fixes
1015
Internal
1116
--------
1217
* Improve pull request template lint commands.
18+
* Continue typehinting the non-test codebase.
1319

1420

1521
1.37.1 (2025/07/28)

mycli/clibuffer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
from typing import Callable
1+
from __future__ import annotations
22

33
from prompt_toolkit.application import get_app
44
from prompt_toolkit.enums import DEFAULT_BUFFER
5-
from prompt_toolkit.filters import Condition
5+
from prompt_toolkit.filters import Condition, Filter
66

77
from mycli.packages.special import iocommands
88

99

10-
def cli_is_multiline(mycli) -> Callable:
10+
def cli_is_multiline(mycli) -> Filter:
1111
@Condition
1212
def cond():
1313
doc = get_app().layout.get_buffer_by_name(DEFAULT_BUFFER).document

mycli/config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from os.path import exists
99
import struct
1010
import sys
11-
from typing import IO, BinaryIO, Literal
11+
from typing import IO, BinaryIO, Literal, TextIO
1212

1313
from configobj import ConfigObj, ConfigObjError
1414
import pyaes
@@ -25,7 +25,7 @@ def log(logger: logging.Logger, level: int, message: str) -> None:
2525
logger.log(level, message)
2626

2727

28-
def read_config_file(f: str | TextIOWrapper, list_values: bool = True) -> ConfigObj | None:
28+
def read_config_file(f: str | TextIO | TextIOWrapper, list_values: bool = True) -> ConfigObj | None:
2929
"""Read a config file.
3030
3131
*list_values* set to `True` is the default behavior of ConfigObj.
@@ -52,7 +52,7 @@ def read_config_file(f: str | TextIOWrapper, list_values: bool = True) -> Config
5252
return config
5353

5454

55-
def get_included_configs(config_file: str | TextIOWrapper) -> list[str]:
55+
def get_included_configs(config_file: str | TextIOWrapper) -> list[str | TextIOWrapper]:
5656
"""Get a list of configuration files that are included into config_path
5757
with !includedir directive.
5858
@@ -64,7 +64,7 @@ def get_included_configs(config_file: str | TextIOWrapper) -> list[str]:
6464
"""
6565
if not isinstance(config_file, str) or not os.path.isfile(config_file):
6666
return []
67-
included_configs = []
67+
included_configs: list[str | TextIOWrapper] = []
6868

6969
try:
7070
with open(config_file) as f:
@@ -80,7 +80,7 @@ def get_included_configs(config_file: str | TextIOWrapper) -> list[str]:
8080
return included_configs
8181

8282

83-
def read_config_files(files: list[str], list_values: bool = True) -> ConfigObj:
83+
def read_config_files(files: list[str | TextIOWrapper], list_values: bool = True) -> ConfigObj:
8484
"""Read and merge a list of config files."""
8585

8686
config = create_default_config(list_values=list_values)

0 commit comments

Comments
 (0)