prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  `Switch.action_toggle` name clash
  Similar to #4214 `Switch` has an `action_toggle` method whose name and form clash with `DOMNode.action_toggle`.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/textual/widgets/_switch.py`
  Content:
  ```
  1 from __future__ import annotations
  2 
  3 from typing import TYPE_CHECKING, ClassVar
  4 
  5 if TYPE_CHECKING:
  6     from ..app import RenderResult
  7 from ..binding import Binding, BindingType
  8 from ..events import Click
  9 from ..geometry import Size
  10 from ..message import Message
  11 from ..reactive import reactive
  12 from ..scrollbar import ScrollBarRender
  13 from ..widget import Widget
  14 
  15 if TYPE_CHECKING:
  16     from typing_extensions import Self
  17 
  18 
  19 class Switch(Widget, can_focus=True):
  20     """A switch widget that represents a boolean value.
  21 
  22     Can be toggled by clicking on it or through its [bindings][textual.widgets.Switch.BINDINGS].
  23 
  24     The switch widget also contains [component classes][textual.widgets.Switch.COMPONENT_CLASSES]
  25     that enable more customization.
  26     """
  27 
  28     BINDINGS: ClassVar[list[BindingType]] = [
  29         Binding("enter,space", "toggle", "Toggle", show=False),
  30     ]
  31     """
  32     | Key(s) | Description |
  33     | :- | :- |
  34     | enter,space | Toggle the switch state. |
  35     """
  36 
  37     COMPONENT_CLASSES: ClassVar[set[str]] = {
  38         "switch--slider",
  39     }
  40     """
  41     | Class | Description |
  42     | :- | :- |
  43     | `switch--slider` | Targets the slider of the switch. |
  44     """
  45 
  46     DEFAULT_CSS = """
  47     Switch {
  48         border: tall transparent;
  49         background: $boost;
  50         height: auto;
  51         width: auto;
  52         padding: 0 2;
  53     }
  54 
  55     Switch > .switch--slider {
  56         background: $panel-darken-2;
  57         color: $panel-lighten-2;
  58     }
  59 
  60     Switch:hover {
  61         border: tall $background;
  62     }
  63 
  64     Switch:focus {
  65         border: tall $accent;
  66     }
  67 
  68     Switch.-on {
  69 
  70     }
  71 
  72     Switch.-on > .switch--slider {
  73         color: $success;
  74     }
  75     """
  76 
  77     value: reactive[bool] = reactive(False, init=False)
  78     """The value of the switch; `True` for on and `False` for off."""
  79 
  80     slider_pos = reactive(0.0)
  81     """The position of the slider."""
  82 
  83     class Changed(Message):
  84         """Posted when the status of the switch changes.
  85 
  86         Can be handled using `on_switch_changed` in a subclass of `Switch`
  87         or in a parent widget in the DOM.
  88 
  89         Attributes:
  90             value: The value that the switch was changed to.
  91             switch: The `Switch` widget that was changed.
  92         """
  93 
  94         def __init__(self, switch: Switch, value: bool) -> None:
  95             super().__init__()
  96             self.value: bool = value
  97             self.switch: Switch = switch
  98 
  99         @property
  100         def control(self) -> Switch:
  101             """Alias for self.switch."""
  102             return self.switch
  103 
  104     def __init__(
  105         self,
  106         value: bool = False,
  107         *,
  108         animate: bool = True,
  109         name: str | None = None,
  110         id: str | None = None,
  111         classes: str | None = None,
  112         disabled: bool = False,
  113     ):
  114         """Initialise the switch.
  115 
  116         Args:
  117             value: The initial value of the switch.
  118             animate: True if the switch should animate when toggled.
  119             name: The name of the switch.
  120             id: The ID of the switch in the DOM.
  121             classes: The CSS classes of the switch.
  122             disabled: Whether the switch is disabled or not.
  123         """
  124         super().__init__(name=name, id=id, classes=classes, disabled=disabled)
  125         if value:
  126             self.slider_pos = 1.0
  127             self.set_reactive(Switch.value, value)
  128         self._should_animate = animate
  129 
  130     def watch_value(self, value: bool) -> None:
  131         target_slider_pos = 1.0 if value else 0.0
  132         if self._should_animate:
  133             self.animate(
  134                 "slider_pos",
  135                 target_slider_pos,
  136                 duration=0.3,
  137                 level="basic",
  138             )
  139         else:
  140             self.slider_pos = target_slider_pos
  141         self.post_message(self.Changed(self, self.value))
  142 
  143     def watch_slider_pos(self, slider_pos: float) -> None:
  144         self.set_class(slider_pos == 1, "-on")
  145 
  146     def render(self) -> RenderResult:
  147         style = self.get_component_rich_style("switch--slider")
  148         return ScrollBarRender(
  149             virtual_size=100,
  150             window_size=50,
  151             position=self.slider_pos * 50,
  152             style=style,
  153             vertical=False,
  154         )
  155 
  156     def get_content_width(self, container: Size, viewport: Size) -> int:
  157         return 4
  158 
  159     def get_content_height(self, container: Size, viewport: Size, width: int) -> int:
  160         return 1
  161 
  162     async def _on_click(self, event: Click) -> None:
  163         """Toggle the state of the switch."""
  164         event.stop()
  165         self.toggle()
  166 
  167     def action_toggle(self) -> None:
  168         """Toggle the state of the switch."""
  169         self.toggle()
  170 
  171     def toggle(self) -> Self:
  172         """Toggle the switch value.
  173 
  174         As a result of the value changing, a `Switch.Changed` message will
  175         be posted.
  176 
  177         Returns:
  178             The `Switch` instance.
  179         """
  180         self.value = not self.value
  181         return self
  182
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/textual/widgets/_switch.py b/src/textual/widgets/_switch.py
  --- a/src/textual/widgets/_switch.py
  +++ b/src/textual/widgets/_switch.py
  @@ -26,7 +26,7 @@
       """
   
       BINDINGS: ClassVar[list[BindingType]] = [
  -        Binding("enter,space", "toggle", "Toggle", show=False),
  +        Binding("enter,space", "toggle_switch", "Toggle", show=False),
       ]
       """
       | Key(s) | Description |
  @@ -164,7 +164,7 @@
           event.stop()
           self.toggle()
   
  -    def action_toggle(self) -> None:
  +    def action_toggle_switch(self) -> None:
           """Toggle the state of the switch."""
           self.toggle()
  
verification_info: {"golden_diff": "diff --git a/src/textual/widgets/_switch.py b/src/textual/widgets/_switch.py\n--- a/src/textual/widgets/_switch.py\n+++ b/src/textual/widgets/_switch.py\n@@ -26,7 +26,7 @@\n     \"\"\"\n \n     BINDINGS: ClassVar[list[BindingType]] = [\n-        Binding(\"enter,space\", \"toggle\", \"Toggle\", show=False),\n+        Binding(\"enter,space\", \"toggle_switch\", \"Toggle\", show=False),\n     ]\n     \"\"\"\n     | Key(s) | Description |\n@@ -164,7 +164,7 @@\n         event.stop()\n         self.toggle()\n \n-    def action_toggle(self) -> None:\n+    def action_toggle_switch(self) -> None:\n         \"\"\"Toggle the state of the switch.\"\"\"\n         self.toggle()\n", "issue": "`Switch.action_toggle` name clash\nSimilar to #4214 `Switch` has an `action_toggle` method whose name and form clash with `DOMNode.action_toggle`.\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING, ClassVar\n\nif TYPE_CHECKING:\n    from ..app import RenderResult\nfrom ..binding import Binding, BindingType\nfrom ..events import Click\nfrom ..geometry import Size\nfrom ..message import Message\nfrom ..reactive import reactive\nfrom ..scrollbar import ScrollBarRender\nfrom ..widget import Widget\n\nif TYPE_CHECKING:\n    from typing_extensions import Self\n\n\nclass Switch(Widget, can_focus=True):\n    \"\"\"A switch widget that represents a boolean value.\n\n    Can be toggled by clicking on it or through its [bindings][textual.widgets.Switch.BINDINGS].\n\n    The switch widget also contains [component classes][textual.widgets.Switch.COMPONENT_CLASSES]\n    that enable more customization.\n    \"\"\"\n\n    BINDINGS: ClassVar[list[BindingType]] = [\n        Binding(\"enter,space\", \"toggle\", \"Toggle\", show=False),\n    ]\n    \"\"\"\n    | Key(s) | Description |\n    | :- | :- |\n    | enter,space | Toggle the switch state. |\n    \"\"\"\n\n    COMPONENT_CLASSES: ClassVar[set[str]] = {\n        \"switch--slider\",\n    }\n    \"\"\"\n    | Class | Description |\n    | :- | :- |\n    | `switch--slider` | Targets the slider of the switch. |\n    \"\"\"\n\n    DEFAULT_CSS = \"\"\"\n    Switch {\n        border: tall transparent;\n        background: $boost;\n        height: auto;\n        width: auto;\n        padding: 0 2;\n    }\n\n    Switch > .switch--slider {\n        background: $panel-darken-2;\n        color: $panel-lighten-2;\n    }\n\n    Switch:hover {\n        border: tall $background;\n    }\n\n    Switch:focus {\n        border: tall $accent;\n    }\n\n    Switch.-on {\n\n    }\n\n    Switch.-on > .switch--slider {\n        color: $success;\n    }\n    \"\"\"\n\n    value: reactive[bool] = reactive(False, init=False)\n    \"\"\"The value of the switch; `True` for on and `False` for off.\"\"\"\n\n    slider_pos = reactive(0.0)\n    \"\"\"The position of the slider.\"\"\"\n\n    class Changed(Message):\n        \"\"\"Posted when the status of the switch changes.\n\n        Can be handled using `on_switch_changed` in a subclass of `Switch`\n        or in a parent widget in the DOM.\n\n        Attributes:\n            value: The value that the switch was changed to.\n            switch: The `Switch` widget that was changed.\n        \"\"\"\n\n        def __init__(self, switch: Switch, value: bool) -> None:\n            super().__init__()\n            self.value: bool = value\n            self.switch: Switch = switch\n\n        @property\n        def control(self) -> Switch:\n            \"\"\"Alias for self.switch.\"\"\"\n            return self.switch\n\n    def __init__(\n        self,\n        value: bool = False,\n        *,\n        animate: bool = True,\n        name: str | None = None,\n        id: str | None = None,\n        classes: str | None = None,\n        disabled: bool = False,\n    ):\n        \"\"\"Initialise the switch.\n\n        Args:\n            value: The initial value of the switch.\n            animate: True if the switch should animate when toggled.\n            name: The name of the switch.\n            id: The ID of the switch in the DOM.\n            classes: The CSS classes of the switch.\n            disabled: Whether the switch is disabled or not.\n        \"\"\"\n        super().__init__(name=name, id=id, classes=classes, disabled=disabled)\n        if value:\n            self.slider_pos = 1.0\n            self.set_reactive(Switch.value, value)\n        self._should_animate = animate\n\n    def watch_value(self, value: bool) -> None:\n        target_slider_pos = 1.0 if value else 0.0\n        if self._should_animate:\n            self.animate(\n                \"slider_pos\",\n                target_slider_pos,\n                duration=0.3,\n                level=\"basic\",\n            )\n        else:\n            self.slider_pos = target_slider_pos\n        self.post_message(self.Changed(self, self.value))\n\n    def watch_slider_pos(self, slider_pos: float) -> None:\n        self.set_class(slider_pos == 1, \"-on\")\n\n    def render(self) -> RenderResult:\n        style = self.get_component_rich_style(\"switch--slider\")\n        return ScrollBarRender(\n            virtual_size=100,\n            window_size=50,\n            position=self.slider_pos * 50,\n            style=style,\n            vertical=False,\n        )\n\n    def get_content_width(self, container: Size, viewport: Size) -> int:\n        return 4\n\n    def get_content_height(self, container: Size, viewport: Size, width: int) -> int:\n        return 1\n\n    async def _on_click(self, event: Click) -> None:\n        \"\"\"Toggle the state of the switch.\"\"\"\n        event.stop()\n        self.toggle()\n\n    def action_toggle(self) -> None:\n        \"\"\"Toggle the state of the switch.\"\"\"\n        self.toggle()\n\n    def toggle(self) -> Self:\n        \"\"\"Toggle the switch value.\n\n        As a result of the value changing, a `Switch.Changed` message will\n        be posted.\n\n        Returns:\n            The `Switch` instance.\n        \"\"\"\n        self.value = not self.value\n        return self\n", "path": "src/textual/widgets/_switch.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING, ClassVar\n\nif TYPE_CHECKING:\n    from ..app import RenderResult\nfrom ..binding import Binding, BindingType\nfrom ..events import Click\nfrom ..geometry import Size\nfrom ..message import Message\nfrom ..reactive import reactive\nfrom ..scrollbar import ScrollBarRender\nfrom ..widget import Widget\n\nif TYPE_CHECKING:\n    from typing_extensions import Self\n\n\nclass Switch(Widget, can_focus=True):\n    \"\"\"A switch widget that represents a boolean value.\n\n    Can be toggled by clicking on it or through its [bindings][textual.widgets.Switch.BINDINGS].\n\n    The switch widget also contains [component classes][textual.widgets.Switch.COMPONENT_CLASSES]\n    that enable more customization.\n    \"\"\"\n\n    BINDINGS: ClassVar[list[BindingType]] = [\n        Binding(\"enter,space\", \"toggle_switch\", \"Toggle\", show=False),\n    ]\n    \"\"\"\n    | Key(s) | Description |\n    | :- | :- |\n    | enter,space | Toggle the switch state. |\n    \"\"\"\n\n    COMPONENT_CLASSES: ClassVar[set[str]] = {\n        \"switch--slider\",\n    }\n    \"\"\"\n    | Class | Description |\n    | :- | :- |\n    | `switch--slider` | Targets the slider of the switch. |\n    \"\"\"\n\n    DEFAULT_CSS = \"\"\"\n    Switch {\n        border: tall transparent;\n        background: $boost;\n        height: auto;\n        width: auto;\n        padding: 0 2;\n    }\n\n    Switch > .switch--slider {\n        background: $panel-darken-2;\n        color: $panel-lighten-2;\n    }\n\n    Switch:hover {\n        border: tall $background;\n    }\n\n    Switch:focus {\n        border: tall $accent;\n    }\n\n    Switch.-on {\n\n    }\n\n    Switch.-on > .switch--slider {\n        color: $success;\n    }\n    \"\"\"\n\n    value: reactive[bool] = reactive(False, init=False)\n    \"\"\"The value of the switch; `True` for on and `False` for off.\"\"\"\n\n    slider_pos = reactive(0.0)\n    \"\"\"The position of the slider.\"\"\"\n\n    class Changed(Message):\n        \"\"\"Posted when the status of the switch changes.\n\n        Can be handled using `on_switch_changed` in a subclass of `Switch`\n        or in a parent widget in the DOM.\n\n        Attributes:\n            value: The value that the switch was changed to.\n            switch: The `Switch` widget that was changed.\n        \"\"\"\n\n        def __init__(self, switch: Switch, value: bool) -> None:\n            super().__init__()\n            self.value: bool = value\n            self.switch: Switch = switch\n\n        @property\n        def control(self) -> Switch:\n            \"\"\"Alias for self.switch.\"\"\"\n            return self.switch\n\n    def __init__(\n        self,\n        value: bool = False,\n        *,\n        animate: bool = True,\n        name: str | None = None,\n        id: str | None = None,\n        classes: str | None = None,\n        disabled: bool = False,\n    ):\n        \"\"\"Initialise the switch.\n\n        Args:\n            value: The initial value of the switch.\n            animate: True if the switch should animate when toggled.\n            name: The name of the switch.\n            id: The ID of the switch in the DOM.\n            classes: The CSS classes of the switch.\n            disabled: Whether the switch is disabled or not.\n        \"\"\"\n        super().__init__(name=name, id=id, classes=classes, disabled=disabled)\n        if value:\n            self.slider_pos = 1.0\n            self.set_reactive(Switch.value, value)\n        self._should_animate = animate\n\n    def watch_value(self, value: bool) -> None:\n        target_slider_pos = 1.0 if value else 0.0\n        if self._should_animate:\n            self.animate(\n                \"slider_pos\",\n                target_slider_pos,\n                duration=0.3,\n                level=\"basic\",\n            )\n        else:\n            self.slider_pos = target_slider_pos\n        self.post_message(self.Changed(self, self.value))\n\n    def watch_slider_pos(self, slider_pos: float) -> None:\n        self.set_class(slider_pos == 1, \"-on\")\n\n    def render(self) -> RenderResult:\n        style = self.get_component_rich_style(\"switch--slider\")\n        return ScrollBarRender(\n            virtual_size=100,\n            window_size=50,\n            position=self.slider_pos * 50,\n            style=style,\n            vertical=False,\n        )\n\n    def get_content_width(self, container: Size, viewport: Size) -> int:\n        return 4\n\n    def get_content_height(self, container: Size, viewport: Size, width: int) -> int:\n        return 1\n\n    async def _on_click(self, event: Click) -> None:\n        \"\"\"Toggle the state of the switch.\"\"\"\n        event.stop()\n        self.toggle()\n\n    def action_toggle_switch(self) -> None:\n        \"\"\"Toggle the state of the switch.\"\"\"\n        self.toggle()\n\n    def toggle(self) -> Self:\n        \"\"\"Toggle the switch value.\n\n        As a result of the value changing, a `Switch.Changed` message will\n        be posted.\n\n        Returns:\n            The `Switch` instance.\n        \"\"\"\n        self.value = not self.value\n        return self\n", "path": "src/textual/widgets/_switch.py"}]}