Skip to content

Commit

Permalink
Added type hints for UseEnum and InstanceDict based traits that don't…
Browse files Browse the repository at this point in the history
… yet provide built in type hints.
  • Loading branch information
Alan Fleming committed Feb 4, 2024
1 parent 9bb38ac commit 1d9b490
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ipylab/main_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class MainArea(AsyncWidgetBase, HasApp):
path = Unicode(read_only=True).tag(sync=True)
name = Unicode(read_only=True).tag(sync=True)
content = Instance(Panel, (), read_only=True).tag(sync=True, **widget_serialization)
status = UseEnum(ViewStatus, read_only=True).tag(sync=True)
console_status = UseEnum(ViewStatus, read_only=True).tag(sync=True)
status: ViewStatus = UseEnum(ViewStatus, read_only=True).tag(sync=True)
console_status: ViewStatus = UseEnum(ViewStatus, read_only=True).tag(sync=True)

@validate("name", "path")
def _validate_name_path(self, proposal):
Expand Down
4 changes: 2 additions & 2 deletions ipylab/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Title(WidgetBase):
dataset = Dict().tag(sync=True)
icon_label = Unicode().tag(sync=True)
# Widgets
icon = InstanceDict(Icon, allow_none=True).tag(sync=True, **widget_serialization)
icon: Icon = InstanceDict(Icon, allow_none=True).tag(sync=True, **widget_serialization)


@register
Expand All @@ -49,7 +49,7 @@ class Panel(Box, HasApp):

_model_name = Unicode("PanelModel").tag(sync=True)
_view_name = Unicode("PanelView").tag(sync=True)
title = InstanceDict(Title, ()).tag(sync=True, **widget_serialization)
title: Title = InstanceDict(Title, ()).tag(sync=True, **widget_serialization)
class_name = Unicode("ipylab-panel").tag(sync=True)
_comm = None
closed = Bool(read_only=True).tag(sync=True)
Expand Down

0 comments on commit 1d9b490

Please sign in to comment.