Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed May 5, 2023
1 parent f4b9a70 commit 378b41c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 3 additions & 1 deletion tyro/_argparse_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def set_accent_color(accent_color: Optional[str]) -> None:
THEME.helptext = Style(dim=True)
THEME.helptext_required = Style(color="bright_red", bold=True)
THEME.helptext_default = Style(
color="cyan" if accent_color != "cyan" else "magenta"
color="cyan"
if accent_color != "cyan"
else "magenta"
# Another option: make default color match accent color. This is maybe more
# visually consistent, but harder to read.
# color=accent_color if accent_color is not None else "cyan",
Expand Down
3 changes: 1 addition & 2 deletions tyro/_instantiators.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,7 @@ def union_instantiator(strings: List[str]) -> Any:
)
raise ValueError(
f"no type in {options} could be instantiated from"
f" {strings}.\n\nGot errors: \n- "
+ "\n- ".join(errors)
f" {strings}.\n\nGot errors: \n- " + "\n- ".join(errors)
)

return union_instantiator, InstantiatorMetadata(
Expand Down
12 changes: 6 additions & 6 deletions tyro/_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def from_callable_or_type(
# Don't make a subparser.
field = dataclasses.replace(field, typ=type(field.default))
else:
subparsers_from_prefix[subparsers_attempt.prefix] = (
subparsers_attempt
)
subparsers_from_prefix[
subparsers_attempt.prefix
] = subparsers_attempt
subparsers = add_subparsers_to_leaves(
subparsers, subparsers_attempt
)
Expand Down Expand Up @@ -345,9 +345,9 @@ def from_field(
return None

# Get subcommand configurations from `tyro.conf.subcommand()`.
subcommand_config_from_name: Dict[str, _confstruct._SubcommandConfiguration] = (
{}
)
subcommand_config_from_name: Dict[
str, _confstruct._SubcommandConfiguration
] = {}
subcommand_type_from_name: Dict[str, type] = {}
for option in options_no_none:
subcommand_name = _strings.subparser_name_from_type(prefix, option)
Expand Down

0 comments on commit 378b41c

Please sign in to comment.