Skip to content

Ignore mypy errors related to CueWidget #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/scwidgets/cue/_widget_cue.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def set_widgets_to_observe(
"traits_to_observe cannot contain lists when "
"widgets_to_observe is not a list."
)
traits_to_observe = [traits_to_observe]
traits_to_observe = [traits_to_observe] # type: ignore[list-item]
else:
if not (isinstance(traits_to_observe, list)):
raise ValueError(
Expand Down
16 changes: 12 additions & 4 deletions src/scwidgets/cue/_widget_cue_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class CueBox(VBox, CueWidget):
def __init__(
self,
widgets_to_observe: Union[List[Widget], Widget],
traits_to_observe: Union[str, List[str], List[List[str]], Sentinel] = "value",
traits_to_observe: Union[
str, Sentinel, List[Union[str, Sentinel, List[str]]]
] = "value",
widget_to_cue: Optional[Widget] = None,
cued: bool = True,
css_style: Optional[dict] = None,
Expand Down Expand Up @@ -112,7 +114,9 @@ class SaveCueBox(CueBox):
def __init__(
self,
widgets_to_observe: Widget,
traits_to_observe: Union[str, List[str], Sentinel] = "value",
traits_to_observe: Union[
str, Sentinel, List[Union[str, Sentinel, List[str]]]
] = "value",
widget_to_cue: Optional[Widget] = None,
cued: bool = True,
*args,
Expand Down Expand Up @@ -151,7 +155,9 @@ class CheckCueBox(CueBox):
def __init__(
self,
widgets_to_observe: Widget,
traits_to_observe: Union[str, List[str], Sentinel] = "value",
traits_to_observe: Union[
str, Sentinel, List[Union[str, Sentinel, List[str]]]
] = "value",
widget_to_cue: Optional[Widget] = None,
cued: bool = True,
*args,
Expand Down Expand Up @@ -190,7 +196,9 @@ class UpdateCueBox(CueBox):
def __init__(
self,
widgets_to_observe: Widget,
traits_to_observe: Union[str, List[str], Sentinel] = "value",
traits_to_observe: Union[
str, Sentinel, List[Union[str, Sentinel, List[str]]]
] = "value",
widget_to_cue: Optional[Widget] = None,
cued: bool = True,
*args,
Expand Down
2 changes: 1 addition & 1 deletion src/scwidgets/cue/_widget_cue_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(
figure: Figure,
widgets_to_observe: Union[None, List[Widget], Widget] = None,
traits_to_observe: Union[
None, str, List[str], List[List[str]], Sentinel
None, str, Sentinel, List[Union[str, Sentinel, List[str]]]
] = None,
cued: bool = True,
show_toolbars: bool = False,
Expand Down
2 changes: 1 addition & 1 deletion src/scwidgets/cue/_widget_cue_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
object: Any = None,
widgets_to_observe: Union[None, List[Widget], Widget] = None,
traits_to_observe: Union[
None, str, List[str], List[List[str]], Sentinel
None, str, Sentinel, List[Union[str, Sentinel, List[str]]]
] = None,
cued: bool = True,
css_style: Optional[dict] = None,
Expand Down
2 changes: 1 addition & 1 deletion src/scwidgets/cue/_widget_cue_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
self,
widgets_to_observe: Union[None, List[Widget], Widget] = None,
traits_to_observe: Union[
None, str, List[str], List[List[str]], Sentinel
None, str, Sentinel, List[Union[str, Sentinel, List[str]]]
] = None,
cued: bool = True,
css_style: Optional[dict] = None,
Expand Down
7 changes: 3 additions & 4 deletions src/scwidgets/exercise/_widget_code_exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def __init__(

self._cue_parameter_panel = UpdateCueBox(
self._parameter_panel.parameters_widget,
self._parameter_panel.parameters_trait,
self._parameter_panel.parameters_trait, # type: ignore
self._parameter_panel,
)

Expand Down Expand Up @@ -362,7 +362,6 @@ def __init__(
else:
description = "Update"
button_tooltip = "Updates outputs with the specified parameters"

self._update_button = UpdateResetCueButton(
reset_update_cue_widgets, # type: ignore[arg-type]
self._on_click_update_action,
Expand All @@ -374,7 +373,7 @@ def __init__(
update_button_disable_during_action,
),
widgets_to_observe=widgets_to_observe,
traits_to_observe=traits_to_observe,
traits_to_observe=traits_to_observe, # type: ignore[arg-type]
description=description,
button_tooltip=button_tooltip,
cued=True,
Expand Down Expand Up @@ -403,7 +402,7 @@ def __init__(
if self._cue_code is not None:
self._cue_code = SaveCueBox(
save_widgets_to_observe,
save_traits_to_observe,
save_traits_to_observe, # type: ignore[arg-type]
self._cue_code,
cued=True,
)
Expand Down
Loading