Skip to content

Commit 9cc7861

Browse files
authored
Merge pull request #2368 from beeware/autoupdates/pre-commit/black-pre-commit-mirror
Bump black-pre-commit-mirror from 23.12.1 to 24.1.1
2 parents d64fdfd + 43604b2 commit 9cc7861

File tree

20 files changed

+80
-98
lines changed

20 files changed

+80
-98
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
hooks:
2020
- id: isort
2121
- repo: https://github.com/psf/black-pre-commit-mirror
22-
rev: 23.12.1
22+
rev: 24.1.1
2323
hooks:
2424
- id: black
2525
language_version: python3

android/src/toga_android/widgets/base.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ def __init__(self, interface):
6868
self.interface.style.reapply()
6969

7070
@abstractmethod
71-
def create(self):
72-
...
71+
def create(self): ...
7372

7473
def set_app(self, app):
7574
pass

changes/2368.misc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The ``pre-commit`` hook for ``black-pre-commit-mirror`` was updated to its latest version.

cocoa/src/toga_cocoa/widgets/base.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def __init__(self, interface):
1717
self.interface.style.reapply()
1818

1919
@abstractmethod
20-
def create(self):
21-
...
20+
def create(self): ...
2221

2322
def set_app(self, app):
2423
pass
@@ -116,5 +115,4 @@ def refresh(self):
116115
self.rehint()
117116

118117
@abstractmethod
119-
def rehint(self):
120-
...
118+
def rehint(self): ...

core/src/toga/widgets/canvas.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def __repr__(self):
5858
return f"{self.__class__.__name__}()"
5959

6060
@abstractmethod
61-
def _draw(self, impl, **kwargs):
62-
...
61+
def _draw(self, impl, **kwargs): ...
6362

6463

6564
class BeginPath(DrawingObject):

core/src/toga/widgets/optioncontainer.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ def index(self, value: str | int | OptionItem):
270270
def append(
271271
self,
272272
text_or_item: OptionItem,
273-
):
274-
...
273+
): ...
275274

276275
@overload
277276
def append(
@@ -281,8 +280,7 @@ def append(
281280
*,
282281
icon: IconContent | None = None,
283282
enabled: bool = True,
284-
):
285-
...
283+
): ...
286284

287285
def append(
288286
self,
@@ -311,8 +309,7 @@ def insert(
311309
self,
312310
index: int | str | OptionItem,
313311
text_or_item: OptionItem,
314-
):
315-
...
312+
): ...
316313

317314
@overload
318315
def insert(
@@ -323,8 +320,7 @@ def insert(
323320
*,
324321
icon: IconContent | None = None,
325322
enabled: bool = True,
326-
):
327-
...
323+
): ...
328324

329325
def insert(
330326
self,

core/src/toga/widgets/slider.py

+13-26
Original file line numberDiff line numberDiff line change
@@ -318,36 +318,28 @@ def range(self, range):
318318

319319
class SliderImpl(ABC):
320320
@abstractmethod
321-
def get_value(self):
322-
...
321+
def get_value(self): ...
323322

324323
@abstractmethod
325-
def set_value(self, value):
326-
...
324+
def set_value(self, value): ...
327325

328326
@abstractmethod
329-
def get_min(self):
330-
...
327+
def get_min(self): ...
331328

332329
@abstractmethod
333-
def set_min(self, value):
334-
...
330+
def set_min(self, value): ...
335331

336332
@abstractmethod
337-
def get_max(self):
338-
...
333+
def get_max(self): ...
339334

340335
@abstractmethod
341-
def set_max(self, value):
342-
...
336+
def set_max(self, value): ...
343337

344338
@abstractmethod
345-
def get_tick_count(self):
346-
...
339+
def get_tick_count(self): ...
347340

348341
@abstractmethod
349-
def set_tick_count(self, tick_count):
350-
...
342+
def set_tick_count(self, tick_count): ...
351343

352344

353345
class IntSliderImpl(SliderImpl):
@@ -407,21 +399,16 @@ def on_change(self):
407399
self.interface.on_change()
408400

409401
@abstractmethod
410-
def get_int_value(self):
411-
...
402+
def get_int_value(self): ...
412403

413404
@abstractmethod
414-
def set_int_value(self, value):
415-
...
405+
def set_int_value(self, value): ...
416406

417407
@abstractmethod
418-
def get_int_max(self):
419-
...
408+
def get_int_max(self): ...
420409

421410
@abstractmethod
422-
def set_int_max(self, max):
423-
...
411+
def set_int_max(self, max): ...
424412

425413
@abstractmethod
426-
def set_ticks_visible(self, visible):
427-
...
414+
def set_ticks_visible(self, visible): ...

core/src/toga/window.py

+9-18
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,7 @@ def stack_trace_dialog(
516516
content: str,
517517
retry: Literal[False] = False,
518518
on_result: DialogResultHandler[None] | None = None,
519-
) -> Dialog:
520-
...
519+
) -> Dialog: ...
521520

522521
@overload
523522
def stack_trace_dialog(
@@ -527,8 +526,7 @@ def stack_trace_dialog(
527526
content: str,
528527
retry: Literal[True] = False,
529528
on_result: DialogResultHandler[bool] | None = None,
530-
) -> Dialog:
531-
...
529+
) -> Dialog: ...
532530

533531
@overload
534532
def stack_trace_dialog(
@@ -538,8 +536,7 @@ def stack_trace_dialog(
538536
content: str,
539537
retry: bool = False,
540538
on_result: DialogResultHandler[bool | None] | None = None,
541-
) -> Dialog:
542-
...
539+
) -> Dialog: ...
543540

544541
def stack_trace_dialog(
545542
self,
@@ -632,8 +629,7 @@ def open_file_dialog(
632629
multiple_select: Literal[False] = False,
633630
on_result: DialogResultHandler[Path | None] | None = None,
634631
multiselect=None, # DEPRECATED
635-
) -> Dialog:
636-
...
632+
) -> Dialog: ...
637633

638634
@overload
639635
def open_file_dialog(
@@ -644,8 +640,7 @@ def open_file_dialog(
644640
multiple_select: Literal[True] = True,
645641
on_result: DialogResultHandler[list[Path] | None] | None = None,
646642
multiselect=None, # DEPRECATED
647-
) -> Dialog:
648-
...
643+
) -> Dialog: ...
649644

650645
@overload
651646
def open_file_dialog(
@@ -656,8 +651,7 @@ def open_file_dialog(
656651
multiple_select: bool = False,
657652
on_result: DialogResultHandler[list[Path] | Path | None] | None = None,
658653
multiselect=None, # DEPRECATED
659-
) -> Dialog:
660-
...
654+
) -> Dialog: ...
661655

662656
def open_file_dialog(
663657
self,
@@ -724,8 +718,7 @@ def select_folder_dialog(
724718
multiple_select: Literal[False] = False,
725719
on_result: DialogResultHandler[Path | None] | None = None,
726720
multiselect=None, # DEPRECATED
727-
) -> Dialog:
728-
...
721+
) -> Dialog: ...
729722

730723
@overload
731724
def select_folder_dialog(
@@ -735,8 +728,7 @@ def select_folder_dialog(
735728
multiple_select: Literal[True] = True,
736729
on_result: DialogResultHandler[list[Path] | None] | None = None,
737730
multiselect=None, # DEPRECATED
738-
) -> Dialog:
739-
...
731+
) -> Dialog: ...
740732

741733
@overload
742734
def select_folder_dialog(
@@ -746,8 +738,7 @@ def select_folder_dialog(
746738
multiple_select: bool = False,
747739
on_result: DialogResultHandler[list[Path] | Path | None] | None = None,
748740
multiselect=None, # DEPRECATED
749-
) -> Dialog:
750-
...
741+
) -> Dialog: ...
751742

752743
def select_folder_dialog(
753744
self,

core/tests/widgets/test_progressbar.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ def test_set_max(progressbar, value, actual, determinate):
103103
(
104104
object(),
105105
TypeError,
106-
r"must be a string or a number"
107-
if sys.version_info < (3, 10)
108-
else r"must be a string or a real number",
106+
(
107+
r"must be a string or a number"
108+
if sys.version_info < (3, 10)
109+
else r"must be a string or a real number"
110+
),
109111
), # Non-coercible to float
110112
(
111113
-42,

examples/optioncontainer/optioncontainer/app.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def on_insert_option(self, button):
3939
def on_enable_option(self, button):
4040
index = int(self.select_option.value)
4141
try:
42-
self.optioncontainer.content[
43-
index
44-
].enabled = not self.optioncontainer.content[index].enabled
42+
self.optioncontainer.content[index].enabled = (
43+
not self.optioncontainer.content[index].enabled
44+
)
4545
except ValueError as e:
4646
self.main_window.info_dialog("Oops", str(e))
4747

examples/positron-django/src/webapp/urls.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
1. Import the include() function: from django.urls import include, path
1414
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1515
"""
16+
1617
from django.contrib import admin
1718
from django.urls import path
1819

gtk/src/toga_gtk/app.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ def gtk_startup(self, data=None):
268268
m.open_file_dialog(
269269
self.interface.formal_name,
270270
file_types=self.interface.document_types.keys(),
271-
on_result=lambda dialog, path: self.interface._open(path)
272-
if path
273-
else self.exit(),
271+
on_result=lambda dialog, path: (
272+
self.interface._open(path) if path else self.exit()
273+
),
274274
)
275275

276276
def open_file(self, widget, **kwargs):

gtk/src/toga_gtk/widgets/base.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ def __init__(self, interface):
2828
self.interface.style.reapply()
2929

3030
@abstractmethod
31-
def create(self):
32-
...
31+
def create(self): ...
3332

3433
def set_app(self, app):
3534
pass

gtk/src/toga_gtk/widgets/scrollcontainer.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ def get_horizontal(self):
4747
def set_horizontal(self, value):
4848
self.native.set_policy(
4949
Gtk.PolicyType.AUTOMATIC if value else Gtk.PolicyType.NEVER,
50-
Gtk.PolicyType.AUTOMATIC
51-
if self.interface.vertical
52-
else Gtk.PolicyType.NEVER,
50+
(
51+
Gtk.PolicyType.AUTOMATIC
52+
if self.interface.vertical
53+
else Gtk.PolicyType.NEVER
54+
),
5355
)
5456
# Disabling scrolling implies a position reset; that's a scroll event.
5557
if not value:
@@ -61,9 +63,11 @@ def get_vertical(self):
6163

6264
def set_vertical(self, value):
6365
self.native.set_policy(
64-
Gtk.PolicyType.AUTOMATIC
65-
if self.interface.horizontal
66-
else Gtk.PolicyType.NEVER,
66+
(
67+
Gtk.PolicyType.AUTOMATIC
68+
if self.interface.horizontal
69+
else Gtk.PolicyType.NEVER
70+
),
6771
Gtk.PolicyType.AUTOMATIC if value else Gtk.PolicyType.NEVER,
6872
)
6973
# Disabling scrolling implies a position reset; that's a scroll event.

iOS/src/toga_iOS/dialogs.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def __init__(self, interface, title, message):
3333
)
3434

3535
@abstractmethod
36-
def populate_dialog(self, native):
37-
...
36+
def populate_dialog(self, native): ...
3837

3938
def response(self, value):
4039
self.interface.set_result(value)

iOS/src/toga_iOS/widgets/base.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def __init__(self, interface):
1717
self.interface.style.reapply()
1818

1919
@abstractmethod
20-
def create(self):
21-
...
20+
def create(self): ...
2221

2322
def set_app(self, app):
2423
pass
@@ -123,5 +122,4 @@ def refresh(self):
123122
self.rehint()
124123

125124
@abstractmethod
126-
def rehint(self):
127-
...
125+
def rehint(self): ...

iOS/src/toga_iOS/widgets/detailedlist.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ def tableView_trailingSwipeActionsConfigurationForRowAtIndexPath_(
8686
if self.impl.primary_action_enabled:
8787
actions = [
8888
UIContextualAction.contextualActionWithStyle(
89-
UIContextualActionStyle.Destructive
90-
if self.interface._primary_action in self.impl.DESTRUCTIVE_NAMES
91-
else UIContextualActionStyle.Normal,
89+
(
90+
UIContextualActionStyle.Destructive
91+
if self.interface._primary_action in self.impl.DESTRUCTIVE_NAMES
92+
else UIContextualActionStyle.Normal
93+
),
9294
title=self.interface._primary_action,
9395
handler=self.impl.primary_action_handler(indexPath.row),
9496
)
@@ -105,9 +107,12 @@ def tableView_leadingSwipeActionsConfigurationForRowAtIndexPath_(
105107
if self.impl.secondary_action_enabled:
106108
actions = [
107109
UIContextualAction.contextualActionWithStyle(
108-
UIContextualActionStyle.Destructive
109-
if self.interface._secondary_action in self.impl.DESTRUCTIVE_NAMES
110-
else UIContextualActionStyle.Normal,
110+
(
111+
UIContextualActionStyle.Destructive
112+
if self.interface._secondary_action
113+
in self.impl.DESTRUCTIVE_NAMES
114+
else UIContextualActionStyle.Normal
115+
),
111116
title=self.interface._secondary_action,
112117
handler=self.impl.secondary_action_handler(indexPath.row),
113118
)

0 commit comments

Comments
 (0)