Skip to content

Commit

Permalink
Make all (API-exposed) dataclass kw-only (google#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwillchen authored Mar 21, 2024
1 parent 79755cf commit 2c42427
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions mesop/components/checkbox/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from mesop.events import MesopEvent


@dataclass
@dataclass(kw_only=True)
class CheckboxChangeEvent(MesopEvent):
"""Represents a checkbox state change event.
Expand All @@ -34,7 +34,7 @@ class CheckboxChangeEvent(MesopEvent):
)


@dataclass
@dataclass(kw_only=True)
class CheckboxIndeterminateChangeEvent(MesopEvent):
"""Represents a checkbox indeterminate state change event.
Expand Down
2 changes: 1 addition & 1 deletion mesop/components/progress_bar/progress_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from mesop.events import MesopEvent


@dataclass
@dataclass(kw_only=True)
class ProgressBarAnimationEndEvent(MesopEvent):
"""
Event emitted when the animation of the progress bar ends.
Expand Down
4 changes: 2 additions & 2 deletions mesop/components/radio/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from mesop.events import MesopEvent


@dataclass
@dataclass(kw_only=True)
class RadioChangeEvent(MesopEvent):
"""Event representing a change in the radio component's value.
Expand All @@ -29,7 +29,7 @@ class RadioChangeEvent(MesopEvent):
)


@dataclass
@dataclass(kw_only=True)
class RadioOption:
"""
Attributes:
Expand Down
6 changes: 3 additions & 3 deletions mesop/components/select/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from mesop.events import MesopEvent


@dataclass
@dataclass(kw_only=True)
class SelectOpenedChangeEvent(MesopEvent):
"""Event representing the opened state change of the select component.
Expand All @@ -32,7 +32,7 @@ class SelectOpenedChangeEvent(MesopEvent):
)


@dataclass
@dataclass(kw_only=True)
class SelectSelectionChangeEvent(MesopEvent):
"""Event representing a change in the select component's value.
Expand All @@ -53,7 +53,7 @@ class SelectSelectionChangeEvent(MesopEvent):
)


@dataclass
@dataclass(kw_only=True)
class SelectOption:
"""Represents an option within a select component.
Expand Down
2 changes: 1 addition & 1 deletion mesop/components/slide_toggle/slide_toggle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from mesop.events import MesopEvent


@dataclass
@dataclass(kw_only=True)
class SlideToggleChangeEvent(MesopEvent):
"""Event triggered when the slide toggle state changes.
Expand Down
2 changes: 1 addition & 1 deletion mesop/components/slider/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from mesop.events.events import MesopEvent


@dataclass
@dataclass(kw_only=True)
class SliderValueChangeEvent(MesopEvent):
"""
Event triggered when the slider value changes.
Expand Down
6 changes: 3 additions & 3 deletions mesop/events/events.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from dataclasses import dataclass


@dataclass
@dataclass(kw_only=True)
class MesopEvent:
key: str


@dataclass
@dataclass(kw_only=True)
class ClickEvent(MesopEvent):
"""Represents a user click event.
Expand All @@ -17,7 +17,7 @@ class ClickEvent(MesopEvent):
pass


@dataclass
@dataclass(kw_only=True)
class InputEvent(MesopEvent):
"""Represents a user input event.
Expand Down
2 changes: 1 addition & 1 deletion mesop/key/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import mesop.protos.ui_pb2 as pb


@dataclass
@dataclass(kw_only=True)
class Key:
key: str

Expand Down

0 comments on commit 2c42427

Please sign in to comment.