fix: formatting

This commit is contained in:
Aaron Stephens
2022-11-20 16:58:49 -08:00
parent e18fac9033
commit 710c69d3af
3 changed files with 9 additions and 13 deletions

View File

@@ -64,8 +64,7 @@ class NodeList(Sequence):
return self._nodes.index(widget)
def get_by_id(self, widget_id: str) -> Widget | None:
"""Get the widget for the given widget_id, or None if there's no matches in this list
"""
"""Get the widget for the given widget_id, or None if there's no matches in this list"""
return self._nodes_by_id.get(widget_id)
def _append(self, widget: Widget) -> None:
@@ -101,9 +100,9 @@ class NodeList(Sequence):
def _ensure_unique_id(self, widget_id: str) -> None:
if widget_id in self._nodes_by_id:
raise DuplicateIds(
f"Tried to insert a widget with ID {widget_id!r}, but a widget"
f" {self._nodes_by_id[widget_id]!r} already exists with that ID in this"
" list of children. The children of a widget must have unique IDs."
f"Tried to insert a widget with ID {widget_id!r}, but a widget {self._nodes_by_id[widget_id]!r} "
"already exists with that ID in this list of children. "
"The children of a widget must have unique IDs."
)
def _remove(self, widget: Widget) -> None:

View File

@@ -878,8 +878,7 @@ class App(Generic[ReturnType], DOMNode):
stylesheet.parse()
elapsed = (perf_counter() - time) * 1000
self.log.system(
f"<stylesheet> loaded {len(css_paths)} CSS files in"
f" {elapsed:.0f} ms"
f"<stylesheet> loaded {len(css_paths)} CSS files in {elapsed:.0f} ms"
)
except Exception as error:
# TODO: Catch specific exceptions
@@ -1829,8 +1828,7 @@ class App(Generic[ReturnType], DOMNode):
if private_method is None and public_method is None:
log(
f"<action> {action_name!r} has no target. Couldn't find methods"
f" {public_method_name!r} or {private_method_name!r}"
f"<action> {action_name!r} has no target. Couldn't find methods {public_method_name!r} or {private_method_name!r}"
)
if callable(private_method):

View File

@@ -552,8 +552,8 @@ class Widget(DOMNode):
for widget_id, count in counter.items():
if count > 1:
raise MountError(
f"Tried to insert {count!r} widgets with the same ID"
f" {widget_id!r}. Widget IDs must be unique."
f"Tried to insert {count!r} widgets with the same ID {widget_id!r}. "
"Widget IDs must be unique."
)
# Saying you want to mount before *and* after something is an error.
@@ -614,8 +614,7 @@ class Widget(DOMNode):
child = self.children[child]
except IndexError:
raise WidgetError(
f"An index of {child} for the child to {called} is out of"
" bounds"
f"An index of {child} for the child to {called} is out of bounds"
) from None
else:
# We got an actual widget, so let's be sure it really is one of