Skip to content

Commit

Permalink
fix: improve code readability
Browse files Browse the repository at this point in the history
  • Loading branch information
chirizxc committed Nov 6, 2024
1 parent 9c2a593 commit 6897cc6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/aiogram_dialog/widgets/kbd/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _is_text_checked(
if manager.is_preview():
return (
# just stupid way to make it differ in preview
ord(item_id[-1]) % 2 == 1
ord(item_id[-1]) % 2 == 1
)
return self.is_checked(item_id, manager)

Expand Down Expand Up @@ -387,9 +387,11 @@ async def set_checked(
if not checked and len(data) > self.min_selected:
data.remove(item_id_str)
changed = True
elif checked and self.max_selected == 0 or self.max_selected > len(data): # noqa: E501
data.append(item_id_str)
changed = True
else: # noqa: PLR5501
if checked: # noqa: SIM102
if self.max_selected == 0 or self.max_selected > len(data):
data.append(item_id_str)
changed = True
if changed:
self.set_widget_data(manager, data)
await self._process_on_state_changed(event, item_id_str, manager)
Expand Down

0 comments on commit 6897cc6

Please sign in to comment.