Skip to content

Commit 292a699

Browse files
authored
Typing fixups (#875)
1 parent 6d6ce62 commit 292a699

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

traitlets/config/application.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,21 @@ class Application(SingletonConfigurable):
153153

154154
# The name of the application, will usually match the name of the command
155155
# line application
156-
name = Unicode("application")
156+
name: str | Unicode[str, str | bytes] = Unicode("application")
157157

158158
# The description of the application that is printed at the beginning
159159
# of the help.
160-
description = Unicode("This is an application.")
160+
description: str | Unicode[str, str | bytes] = Unicode("This is an application.")
161161
# default section descriptions
162-
option_description = Unicode(option_description)
163-
keyvalue_description = Unicode(keyvalue_description)
164-
subcommand_description = Unicode(subcommand_description)
162+
option_description: str | Unicode[str, str | bytes] = Unicode(option_description)
163+
keyvalue_description: str | Unicode[str, str | bytes] = Unicode(keyvalue_description)
164+
subcommand_description: str | Unicode[str, str | bytes] = Unicode(subcommand_description)
165165

166166
python_config_loader_class = PyFileConfigLoader
167167
json_config_loader_class = JSONFileConfigLoader
168168

169169
# The usage and example string that goes at the end of the help string.
170-
examples = Unicode()
170+
examples: str | Unicode[str, str | bytes] = Unicode()
171171

172172
# A sequence of Configurable subclasses whose config=True attributes will
173173
# be exposed at the command line.
@@ -196,7 +196,7 @@ def _classes_inc_parents(
196196
yield parent
197197

198198
# The version string of this application.
199-
version = Unicode("0.0")
199+
version: str | Unicode[str, str | bytes] = Unicode("0.0")
200200

201201
# the argv used to initialize the application
202202
argv = List()
@@ -891,7 +891,7 @@ def parse_command_line(self, argv: ArgvType = None) -> None:
891891
def _load_config_files(
892892
cls,
893893
basefilename: str,
894-
path: list[str | None] | str | None = None,
894+
path: list[str | None] | None = None,
895895
log: AnyLogger | None = None,
896896
raise_config_file_errors: bool = False,
897897
) -> t.Generator[t.Any, None, None]:
@@ -949,7 +949,7 @@ def loaded_config_files(self) -> list[str]:
949949
return self._loaded_config_files[:]
950950

951951
@catch_config_error
952-
def load_config_file(self, filename: str, path: str | None = None) -> None:
952+
def load_config_file(self, filename: str, path: list[str | None] | None = None) -> None:
953953
"""Load config files by filename and path."""
954954
filename, ext = os.path.splitext(filename)
955955
new_config = Config()

traitlets/tests/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def get_output_error_code(cmd: str | list[str]) -> tuple[str, str, Any]:
1414
return out_str, err_str, p.returncode
1515

1616

17-
def check_help_output(pkg: str, subcommand: str | None = None) -> tuple[str, str]:
17+
def check_help_output(pkg: str, subcommand: list[str] | None = None) -> tuple[str, str]:
1818
"""test that `python -m PKG [subcommand] -h` works"""
1919
cmd = [sys.executable, "-m", pkg]
2020
if subcommand:
@@ -28,7 +28,7 @@ def check_help_output(pkg: str, subcommand: str | None = None) -> tuple[str, str
2828
return out, err
2929

3030

31-
def check_help_all_output(pkg: str, subcommand: str | None = None) -> tuple[str, str]:
31+
def check_help_all_output(pkg: str, subcommand: list[str] | None = None) -> tuple[str, str]:
3232
"""test that `python -m PKG --help-all` works"""
3333
cmd = [sys.executable, "-m", pkg]
3434
if subcommand:

0 commit comments

Comments
 (0)