Skip to content

Commit

Permalink
Typing fixups (#875)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Oct 3, 2023
1 parent 6d6ce62 commit 292a699
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions traitlets/config/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,21 @@ class Application(SingletonConfigurable):

# The name of the application, will usually match the name of the command
# line application
name = Unicode("application")
name: str | Unicode[str, str | bytes] = Unicode("application")

# The description of the application that is printed at the beginning
# of the help.
description = Unicode("This is an application.")
description: str | Unicode[str, str | bytes] = Unicode("This is an application.")
# default section descriptions
option_description = Unicode(option_description)
keyvalue_description = Unicode(keyvalue_description)
subcommand_description = Unicode(subcommand_description)
option_description: str | Unicode[str, str | bytes] = Unicode(option_description)
keyvalue_description: str | Unicode[str, str | bytes] = Unicode(keyvalue_description)
subcommand_description: str | Unicode[str, str | bytes] = Unicode(subcommand_description)

python_config_loader_class = PyFileConfigLoader
json_config_loader_class = JSONFileConfigLoader

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

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

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

# the argv used to initialize the application
argv = List()
Expand Down Expand Up @@ -891,7 +891,7 @@ def parse_command_line(self, argv: ArgvType = None) -> None:
def _load_config_files(
cls,
basefilename: str,
path: list[str | None] | str | None = None,
path: list[str | None] | None = None,
log: AnyLogger | None = None,
raise_config_file_errors: bool = False,
) -> t.Generator[t.Any, None, None]:
Expand Down Expand Up @@ -949,7 +949,7 @@ def loaded_config_files(self) -> list[str]:
return self._loaded_config_files[:]

@catch_config_error
def load_config_file(self, filename: str, path: str | None = None) -> None:
def load_config_file(self, filename: str, path: list[str | None] | None = None) -> None:
"""Load config files by filename and path."""
filename, ext = os.path.splitext(filename)
new_config = Config()
Expand Down
4 changes: 2 additions & 2 deletions traitlets/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_output_error_code(cmd: str | list[str]) -> tuple[str, str, Any]:
return out_str, err_str, p.returncode


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


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

0 comments on commit 292a699

Please sign in to comment.