Skip to content

Commit

Permalink
Add missing trailing commas
Browse files Browse the repository at this point in the history
  • Loading branch information
vlkorsakov committed Feb 3, 2024
1 parent 73e29dc commit 8226e4e
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions example/i18n/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from i18n_middleware import I18nMiddleware

from aiogram_dialog import (
Dialog, DialogManager, setup_dialogs, StartMode, Window
Dialog, DialogManager, setup_dialogs, StartMode, Window,
)
from aiogram_dialog.widgets.kbd import Button, Cancel, Row

Expand All @@ -43,7 +43,7 @@ async def get_data(dialog_manager: DialogManager, **kwargs):
),
getter=get_data,
state=DialogSG.greeting,
)
),
)

DEFAULT_LOCALE = "en"
Expand Down
4 changes: 2 additions & 2 deletions example/input_media_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from aiogram.types import CallbackQuery, Message

from aiogram_dialog import (
Dialog, DialogManager, setup_dialogs, StartMode, Window
Dialog, DialogManager, setup_dialogs, StartMode, Window,
)
from aiogram_dialog.api.entities import MediaAttachment, MediaId
from aiogram_dialog.widgets.common import ManagedScroll
Expand Down Expand Up @@ -70,7 +70,7 @@ async def getter(dialog_manager: DialogManager, **kwargs) -> dict:
StubScroll(id="pages", pages="media_count"),
Group(
NumberedPager(scroll="pages", when=F["pages"] > 1),
width=8
width=8,
),
Button(Format("🗑️ Delete photo #{media_number}"), id="del",
on_click=on_delete, when="media_count"),
Expand Down
6 changes: 3 additions & 3 deletions example/launch_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Product(StatesGroup):
Const("BANNER IS HERE"),
Start(Const("Try start"), id="start", state=MainSG.default),
Cancel(),
state=BannerSG.default
state=BannerSG.default,
),
launch_mode=LaunchMode.EXCLUSIVE,
)
Expand All @@ -43,7 +43,7 @@ class Product(StatesGroup):
Const("This is main menu"),
Start(Const("Product"), id="product", state=Product.show),
Cancel(),
state=MainSG.default
state=MainSG.default,
),
# we do not worry about resetting stack
# each time we start dialog with ROOT launch mode
Expand All @@ -67,7 +67,7 @@ async def product_getter(dialog_manager: DialogManager, **kwargs):
),
Cancel(),
getter=product_getter,
state=Product.show
state=Product.show,
),
# when this dialog is on top and tries to launch a copy
# it just replaces himself with it
Expand Down
10 changes: 5 additions & 5 deletions example/list_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def when_checked(data: Dict, widget, manager: SubManager) -> bool:
async def data_getter(*args, **kwargs):
return {
"fruits": ["mango", "papaya", "kiwi"],
"colors": ["blue", "pink"]
"colors": ["blue", "pink"],
}


dialog = Dialog(
Window(
Const(
"Hello, please check you options for each item:"
"Hello, please check you options for each item:",
),
ListGroup(
Checkbox(
Expand All @@ -62,7 +62,7 @@ async def data_getter(*args, **kwargs):
# items=F["data"]["colors"], # noqa: E800
# items=lambda d: d["data"]["colors"], # noqa: E800
when=when_checked,
)
),
),
id="lg",
item_id_getter=str,
Expand All @@ -72,9 +72,9 @@ async def data_getter(*args, **kwargs):
# items=lambda d: d["fruits"], # noqa: E800
),
state=DialogSG.greeting,
getter=data_getter
getter=data_getter,
),
launch_mode=LaunchMode.SINGLE_TOP
launch_mode=LaunchMode.SINGLE_TOP,
)


Expand Down
2 changes: 1 addition & 1 deletion example/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Bg(StatesGroup):

async def get_bg_data(dialog_manager: DialogManager, **kwargs):
return {
"progress": dialog_manager.dialog_data.get("progress", 0)
"progress": dialog_manager.dialog_data.get("progress", 0),
}


Expand Down
10 changes: 5 additions & 5 deletions example/mega/bot_dialogs/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ def _init_views(self) -> Dict[CalendarScope, CalendarScopeView]:
async def on_date_clicked(
callback: ChatEvent, widget: ManagedCalendar,
manager: DialogManager,
selected_date: date, /
selected_date: date, /,
):
await callback.answer(str(selected_date))


async def on_date_selected(
callback: ChatEvent, widget: ManagedCalendar,
manager: DialogManager,
clicked_date: date, /
clicked_date: date, /,
):
selected = manager.dialog_data.setdefault(SELECTED_DAYS_KEY, [])
serial_date = clicked_date.isoformat()
Expand All @@ -100,7 +100,7 @@ async def on_date_selected(
async def selection_getter(dialog_manager, **_):
selected = dialog_manager.dialog_data.get(SELECTED_DAYS_KEY, [])
return {
"selected": ", ".join(sorted(selected))
"selected": ", ".join(sorted(selected)),
}


Expand All @@ -113,12 +113,12 @@ async def selection_getter(dialog_manager, **_):
SwitchTo(
Const("Default"),
id="default",
state=states.Calendar.DEFAULT
state=states.Calendar.DEFAULT,
),
SwitchTo(
Const("Customized"),
id="custom",
state=states.Calendar.CUSTOM
state=states.Calendar.CUSTOM,
),
MAIN_MENU_BUTTON,
state=states.Calendar.MAIN,
Expand Down
2 changes: 1 addition & 1 deletion example/mega/bot_dialogs/mutltiwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
),
MAIN_MENU_BUTTON,
state=states.Multiwidget.MAIN,
)
),
)
2 changes: 1 addition & 1 deletion example/mega/bot_dialogs/reply_buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
resize_keyboard=True,
),
state=states.ReplyKeyboard.MAIN,
)
),
)
2 changes: 1 addition & 1 deletion example/mega/bot_dialogs/scrolls.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ async def paging_getter(dialog_manager: DialogManager, **_kwargs):
width=1,
height=10,
id=ID_SYNC_SCROLL,
on_page_changed=sync_scroll(ID_LIST_SCROLL)
on_page_changed=sync_scroll(ID_LIST_SCROLL),
),
SCROLLS_MAIN_MENU_BUTTON,
state=states.Scrolls.SYNC,
Expand Down
14 changes: 7 additions & 7 deletions example/mega/bot_dialogs/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from aiogram_dialog import Dialog, DialogManager, Window
from aiogram_dialog.widgets.kbd import (
Column, Multiselect, Radio, Select, SwitchTo, Toggle
Column, Multiselect, Radio, Select, SwitchTo, Toggle,
)
from aiogram_dialog.widgets.text import Const, Format, List
from . import states
Expand Down Expand Up @@ -40,7 +40,7 @@ async def getter(**_kwargs):
Fruit("pineapple_p", "Pineapple", "🍍"),
Fruit("kiwi_k", "Kiwi", "🥝"),
],
}
},
}


Expand Down Expand Up @@ -86,7 +86,7 @@ async def on_item_selected(
Const("Select widget"),
List(
field=Format("+ {item.emoji} {item.name} - {item.id}"),
items=FRUITS_KEY
items=FRUITS_KEY,
# Alternatives:
# items=lambda d: d[OTHER_KEY][FRUITS_KEY], # noqa: E800
# items=F[OTHER_KEY][FRUITS_KEY], # noqa: E800
Expand All @@ -101,7 +101,7 @@ async def on_item_selected(
# items=F[OTHER_KEY][FRUITS_KEY], # noqa: E800
item_id_getter=fruit_id_getter,
on_click=on_item_selected,
)
),
),
Selects_MAIN_MENU_BUTTON,
state=states.Selects.SELECT,
Expand All @@ -120,7 +120,7 @@ async def on_item_selected(
# items=lambda d: d[OTHER_KEY][FRUITS_KEY], # noqa: E800
# items=F[OTHER_KEY][FRUITS_KEY], # noqa: E800
item_id_getter=fruit_id_getter,
)
),
),
Selects_MAIN_MENU_BUTTON,
state=states.Selects.RADIO,
Expand All @@ -140,7 +140,7 @@ async def on_item_selected(
# items=lambda d: d[OTHER_KEY][FRUITS_KEY], # noqa: E800
# items=F[OTHER_KEY][FRUITS_KEY], # noqa: E800
item_id_getter=fruit_id_getter,
)
),
),
Selects_MAIN_MENU_BUTTON,
state=states.Selects.MULTI,
Expand All @@ -156,7 +156,7 @@ async def on_item_selected(
id="radio",
items=FRUITS_KEY,
item_id_getter=fruit_id_getter,
)
),
),
Selects_MAIN_MENU_BUTTON,
state=states.Selects.TOGGLE,
Expand Down
2 changes: 1 addition & 1 deletion example/multistack.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def get_data(dialog_manager: DialogManager, **kwargs):
("Pear", 2),
("Orange", 3),
("Banana", 4),
]
],
}


Expand Down
2 changes: 1 addition & 1 deletion example/scrolls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from aiogram.types import Message

from aiogram_dialog import (
Dialog, DialogManager, setup_dialogs, StartMode, Window
Dialog, DialogManager, setup_dialogs, StartMode, Window,
)
from aiogram_dialog.widgets.kbd import (
CurrentPage, FirstPage, LastPage, Multiselect, NextPage, NumberedPager,
Expand Down
12 changes: 6 additions & 6 deletions example/subdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class NameSG(StatesGroup):


async def name_handler(
message: Message, widget: MessageInput, manager: DialogManager
message: Message, widget: MessageInput, manager: DialogManager,
):
manager.dialog_data["name"] = message.text
await manager.next()


async def get_name_data(dialog_manager: DialogManager, **kwargs):
return {
"name": dialog_manager.dialog_data.get("name")
"name": dialog_manager.dialog_data.get("name"),
}


Expand All @@ -63,8 +63,8 @@ async def on_finish(callback: CallbackQuery, button: Button,
state=NameSG.confirm,
getter=get_name_data,
preview_add_transitions=[Cancel()], # hint for graph rendering
preview_data={"name": "John Doe"} # for preview rendering
)
preview_data={"name": "John Doe"}, # for preview rendering
),
)


Expand Down Expand Up @@ -99,11 +99,11 @@ async def on_reset_name(callback: CallbackQuery, button: Button,
Group(
Start(Const("Enter name"), id="set", state=NameSG.input),
Button(Const("Reset name"), id="reset",
on_click=on_reset_name, when="name")
on_click=on_reset_name, when="name"),
),
state=MainSG.main,
getter=get_main_data,
preview_data={"name": "John Doe"} # for preview rendering
preview_data={"name": "John Doe"}, # for preview rendering
),
on_process_result=process_result,
)
Expand Down
2 changes: 1 addition & 1 deletion example/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def result_getter(dialog_manager: DialogManager, **kwargs):
"<b>Опции</b>: \n"
"{% for item in options %}"
"• {{item}}\n"
"{% endfor %}"
"{% endfor %}",
),
SwitchTo(
Const("Изменить название"),
Expand Down

0 comments on commit 8226e4e

Please sign in to comment.