Skip to content

Commit

Permalink
Merge pull request #2368 from beeware/autoupdates/pre-commit/black-pr…
Browse files Browse the repository at this point in the history
…e-commit-mirror

Bump black-pre-commit-mirror from 23.12.1 to 24.1.1
  • Loading branch information
freakboy3742 authored Jan 29, 2024
2 parents d64fdfd + 43604b2 commit 9cc7861
Show file tree
Hide file tree
Showing 20 changed files with 80 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
language_version: python3
Expand Down
3 changes: 1 addition & 2 deletions android/src/toga_android/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def __init__(self, interface):
self.interface.style.reapply()

@abstractmethod
def create(self):
...
def create(self): ...

def set_app(self, app):
pass
Expand Down
1 change: 1 addition & 0 deletions changes/2368.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The ``pre-commit`` hook for ``black-pre-commit-mirror`` was updated to its latest version.
6 changes: 2 additions & 4 deletions cocoa/src/toga_cocoa/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def __init__(self, interface):
self.interface.style.reapply()

@abstractmethod
def create(self):
...
def create(self): ...

def set_app(self, app):
pass
Expand Down Expand Up @@ -116,5 +115,4 @@ def refresh(self):
self.rehint()

@abstractmethod
def rehint(self):
...
def rehint(self): ...
3 changes: 1 addition & 2 deletions core/src/toga/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def __repr__(self):
return f"{self.__class__.__name__}()"

@abstractmethod
def _draw(self, impl, **kwargs):
...
def _draw(self, impl, **kwargs): ...


class BeginPath(DrawingObject):
Expand Down
12 changes: 4 additions & 8 deletions core/src/toga/widgets/optioncontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ def index(self, value: str | int | OptionItem):
def append(
self,
text_or_item: OptionItem,
):
...
): ...

@overload
def append(
Expand All @@ -281,8 +280,7 @@ def append(
*,
icon: IconContent | None = None,
enabled: bool = True,
):
...
): ...

def append(
self,
Expand Down Expand Up @@ -311,8 +309,7 @@ def insert(
self,
index: int | str | OptionItem,
text_or_item: OptionItem,
):
...
): ...

@overload
def insert(
Expand All @@ -323,8 +320,7 @@ def insert(
*,
icon: IconContent | None = None,
enabled: bool = True,
):
...
): ...

def insert(
self,
Expand Down
39 changes: 13 additions & 26 deletions core/src/toga/widgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,36 +318,28 @@ def range(self, range):

class SliderImpl(ABC):
@abstractmethod
def get_value(self):
...
def get_value(self): ...

@abstractmethod
def set_value(self, value):
...
def set_value(self, value): ...

@abstractmethod
def get_min(self):
...
def get_min(self): ...

@abstractmethod
def set_min(self, value):
...
def set_min(self, value): ...

@abstractmethod
def get_max(self):
...
def get_max(self): ...

@abstractmethod
def set_max(self, value):
...
def set_max(self, value): ...

@abstractmethod
def get_tick_count(self):
...
def get_tick_count(self): ...

@abstractmethod
def set_tick_count(self, tick_count):
...
def set_tick_count(self, tick_count): ...


class IntSliderImpl(SliderImpl):
Expand Down Expand Up @@ -407,21 +399,16 @@ def on_change(self):
self.interface.on_change()

@abstractmethod
def get_int_value(self):
...
def get_int_value(self): ...

@abstractmethod
def set_int_value(self, value):
...
def set_int_value(self, value): ...

@abstractmethod
def get_int_max(self):
...
def get_int_max(self): ...

@abstractmethod
def set_int_max(self, max):
...
def set_int_max(self, max): ...

@abstractmethod
def set_ticks_visible(self, visible):
...
def set_ticks_visible(self, visible): ...
27 changes: 9 additions & 18 deletions core/src/toga/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,7 @@ def stack_trace_dialog(
content: str,
retry: Literal[False] = False,
on_result: DialogResultHandler[None] | None = None,
) -> Dialog:
...
) -> Dialog: ...

@overload
def stack_trace_dialog(
Expand All @@ -527,8 +526,7 @@ def stack_trace_dialog(
content: str,
retry: Literal[True] = False,
on_result: DialogResultHandler[bool] | None = None,
) -> Dialog:
...
) -> Dialog: ...

@overload
def stack_trace_dialog(
Expand All @@ -538,8 +536,7 @@ def stack_trace_dialog(
content: str,
retry: bool = False,
on_result: DialogResultHandler[bool | None] | None = None,
) -> Dialog:
...
) -> Dialog: ...

def stack_trace_dialog(
self,
Expand Down Expand Up @@ -632,8 +629,7 @@ def open_file_dialog(
multiple_select: Literal[False] = False,
on_result: DialogResultHandler[Path | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

@overload
def open_file_dialog(
Expand All @@ -644,8 +640,7 @@ def open_file_dialog(
multiple_select: Literal[True] = True,
on_result: DialogResultHandler[list[Path] | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

@overload
def open_file_dialog(
Expand All @@ -656,8 +651,7 @@ def open_file_dialog(
multiple_select: bool = False,
on_result: DialogResultHandler[list[Path] | Path | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

def open_file_dialog(
self,
Expand Down Expand Up @@ -724,8 +718,7 @@ def select_folder_dialog(
multiple_select: Literal[False] = False,
on_result: DialogResultHandler[Path | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

@overload
def select_folder_dialog(
Expand All @@ -735,8 +728,7 @@ def select_folder_dialog(
multiple_select: Literal[True] = True,
on_result: DialogResultHandler[list[Path] | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

@overload
def select_folder_dialog(
Expand All @@ -746,8 +738,7 @@ def select_folder_dialog(
multiple_select: bool = False,
on_result: DialogResultHandler[list[Path] | Path | None] | None = None,
multiselect=None, # DEPRECATED
) -> Dialog:
...
) -> Dialog: ...

def select_folder_dialog(
self,
Expand Down
8 changes: 5 additions & 3 deletions core/tests/widgets/test_progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ def test_set_max(progressbar, value, actual, determinate):
(
object(),
TypeError,
r"must be a string or a number"
if sys.version_info < (3, 10)
else r"must be a string or a real number",
(
r"must be a string or a number"
if sys.version_info < (3, 10)
else r"must be a string or a real number"
),
), # Non-coercible to float
(
-42,
Expand Down
6 changes: 3 additions & 3 deletions examples/optioncontainer/optioncontainer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def on_insert_option(self, button):
def on_enable_option(self, button):
index = int(self.select_option.value)
try:
self.optioncontainer.content[
index
].enabled = not self.optioncontainer.content[index].enabled
self.optioncontainer.content[index].enabled = (
not self.optioncontainer.content[index].enabled
)
except ValueError as e:
self.main_window.info_dialog("Oops", str(e))

Expand Down
1 change: 1 addition & 0 deletions examples/positron-django/src/webapp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.contrib import admin
from django.urls import path

Expand Down
6 changes: 3 additions & 3 deletions gtk/src/toga_gtk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ def gtk_startup(self, data=None):
m.open_file_dialog(
self.interface.formal_name,
file_types=self.interface.document_types.keys(),
on_result=lambda dialog, path: self.interface._open(path)
if path
else self.exit(),
on_result=lambda dialog, path: (
self.interface._open(path) if path else self.exit()
),
)

def open_file(self, widget, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions gtk/src/toga_gtk/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def __init__(self, interface):
self.interface.style.reapply()

@abstractmethod
def create(self):
...
def create(self): ...

def set_app(self, app):
pass
Expand Down
16 changes: 10 additions & 6 deletions gtk/src/toga_gtk/widgets/scrollcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ def get_horizontal(self):
def set_horizontal(self, value):
self.native.set_policy(
Gtk.PolicyType.AUTOMATIC if value else Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC
if self.interface.vertical
else Gtk.PolicyType.NEVER,
(
Gtk.PolicyType.AUTOMATIC
if self.interface.vertical
else Gtk.PolicyType.NEVER
),
)
# Disabling scrolling implies a position reset; that's a scroll event.
if not value:
Expand All @@ -61,9 +63,11 @@ def get_vertical(self):

def set_vertical(self, value):
self.native.set_policy(
Gtk.PolicyType.AUTOMATIC
if self.interface.horizontal
else Gtk.PolicyType.NEVER,
(
Gtk.PolicyType.AUTOMATIC
if self.interface.horizontal
else Gtk.PolicyType.NEVER
),
Gtk.PolicyType.AUTOMATIC if value else Gtk.PolicyType.NEVER,
)
# Disabling scrolling implies a position reset; that's a scroll event.
Expand Down
3 changes: 1 addition & 2 deletions iOS/src/toga_iOS/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def __init__(self, interface, title, message):
)

@abstractmethod
def populate_dialog(self, native):
...
def populate_dialog(self, native): ...

def response(self, value):
self.interface.set_result(value)
Expand Down
6 changes: 2 additions & 4 deletions iOS/src/toga_iOS/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def __init__(self, interface):
self.interface.style.reapply()

@abstractmethod
def create(self):
...
def create(self): ...

def set_app(self, app):
pass
Expand Down Expand Up @@ -123,5 +122,4 @@ def refresh(self):
self.rehint()

@abstractmethod
def rehint(self):
...
def rehint(self): ...
17 changes: 11 additions & 6 deletions iOS/src/toga_iOS/widgets/detailedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ def tableView_trailingSwipeActionsConfigurationForRowAtIndexPath_(
if self.impl.primary_action_enabled:
actions = [
UIContextualAction.contextualActionWithStyle(
UIContextualActionStyle.Destructive
if self.interface._primary_action in self.impl.DESTRUCTIVE_NAMES
else UIContextualActionStyle.Normal,
(
UIContextualActionStyle.Destructive
if self.interface._primary_action in self.impl.DESTRUCTIVE_NAMES
else UIContextualActionStyle.Normal
),
title=self.interface._primary_action,
handler=self.impl.primary_action_handler(indexPath.row),
)
Expand All @@ -105,9 +107,12 @@ def tableView_leadingSwipeActionsConfigurationForRowAtIndexPath_(
if self.impl.secondary_action_enabled:
actions = [
UIContextualAction.contextualActionWithStyle(
UIContextualActionStyle.Destructive
if self.interface._secondary_action in self.impl.DESTRUCTIVE_NAMES
else UIContextualActionStyle.Normal,
(
UIContextualActionStyle.Destructive
if self.interface._secondary_action
in self.impl.DESTRUCTIVE_NAMES
else UIContextualActionStyle.Normal
),
title=self.interface._secondary_action,
handler=self.impl.secondary_action_handler(indexPath.row),
)
Expand Down
Loading

0 comments on commit 9cc7861

Please sign in to comment.