Skip to content

Commit

Permalink
Typing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 1, 2024
1 parent 2ab262f commit ea2a2bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions trogon/run_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def to_cli_args(self, include_root_command: bool = False) -> list[str]:
return cli_args

def _to_cli_args(self) -> list[str]:
args = [self.name]
args: list[str] = [self.name]

multiples: dict[str, list[tuple[str]]] = defaultdict(list)
multiples_schemas: dict[str, OptionSchema] = {}
Expand Down Expand Up @@ -228,7 +228,7 @@ def to_cli_string(self, include_root_command: bool = False) -> Text:
"""
args = self.to_cli_args(include_root_command=include_root_command)

text_renderables = []
text_renderables: list[Text] = []
for arg in args:
text_renderables.append(
Text(shlex.quote(str(arg)))
Expand Down
11 changes: 4 additions & 7 deletions trogon/widgets/parameter_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

import functools
from functools import partial
from typing import Any, Callable, Iterable, TypeVar, Union, cast
from typing import Any, Callable, Iterable, Union, cast

import click
from rich.text import Text
from textual import log, on
from textual import on
from textual.app import ComposeResult
from textual.containers import Vertical, Horizontal
from textual.css.query import NoMatches
from textual.widget import Widget
from textual.widgets import (
RadioButton,
Label,
Checkbox,
Input,
Expand All @@ -24,7 +23,7 @@
from trogon.introspect import ArgumentSchema, OptionSchema, MultiValueParamData
from trogon.widgets.multiple_choice import MultipleChoice

ControlWidgetType: TypeVar = Union[Input, Checkbox, MultipleChoice, Select]
ControlWidgetType = Union[Input, Checkbox, MultipleChoice, Select[object]]


class ControlGroup(Vertical):
Expand Down Expand Up @@ -84,9 +83,7 @@ def apply_filter(self, filter_query: str) -> bool:
name_contains_query = any(
filter_query in name.casefold() for name in self.schema.name
)
help_contains_query = (
filter_query in help_text.casefold()
)
help_contains_query = filter_query in help_text.casefold()
should_be_visible = name_contains_query or help_contains_query

self.display = should_be_visible
Expand Down

0 comments on commit ea2a2bd

Please sign in to comment.