From 4abd520d867da78da45443be34850cc1141512c7 Mon Sep 17 00:00:00 2001 From: flukx Date: Wed, 21 Aug 2024 20:07:18 +0200 Subject: [PATCH] beautify code --- flinventory_gui/search.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flinventory_gui/search.py b/flinventory_gui/search.py index a8a8990..3a2b5ec 100644 --- a/flinventory_gui/search.py +++ b/flinventory_gui/search.py @@ -68,7 +68,10 @@ def antilen(string: str): return 1 / len(string) if string else 0 -async def find_things(things: list[Thing], search_string: str, max_number: int = 10) -> Iterable[Thing]: +async def find_things( + things: list[Thing], + search_string: str, + max_number: int = 10) -> Iterable[Thing]: """Gives things that the user might have searched for. Args: @@ -170,7 +173,7 @@ async def list_things(ui_element: nicegui.ui.element, things: Iterable[Thing]) - # supplying card and thing as default arguments makes it use the current # value instead of the value at the time of usage - def change_card(_, c: ui.element=card, p: Thing=thing): + def change_card(_, c: ui.element = card, p: Thing = thing): show_thing_changer(c, p) with card: print(f"Create card {id(card)} for {thing.name}.") @@ -402,7 +405,8 @@ def show_thing_changer(ui_element: nicegui.ui.element, thing: Thing) -> None: input_fields[f"sign.{sign_member}"] = ui.input( label="sign: " + sign_member, value=vars(thing.sign).get(sign_member, "") - ).props('autogrow dense' + ).props( + 'autogrow dense' ).on_value_change( lambda e, m=sign_member: save_sign_value(e, m) )