Skip to content

Conversation

yarqr
Copy link
Contributor

@yarqr yarqr commented Apr 30, 2024

No description provided.

def __eq__(self, other):
if type(other) is not MediaId:
def __eq__(self, other: object) -> bool:
if not isinstance(other, MediaId):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original code was correct

from aiogram.fsm.state import State

from aiogram_dialog.api.exceptions import DialogStackOverflow

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we had a discussion that this is probably can be configured

class Widget(Protocol):
@abstractmethod
def managed(self, manager: DialogManager) -> Any:
def managed(self, manager: DialogManager) -> "Widget":
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does'n return widget, it returns managed version of widget - it's a differnt type.

async def render_text(
self, data: Dict, manager: DialogManager,
self,
data: Dict[str, Union[DataDict, Dict[str, Any], ChatEvent]],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange values. I believe it should be data: Dict[str, Any]

from aiogram_dialog.api.entities import Data, LaunchMode, NewMessage
from ..internal import Widget

from ... import ChatEvent
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please, avoid ... imports. I would allow relative import within widgets package, but not outside of it.
  2. Do not import from library package itself, import from subpackages, otherwise it will lead to cycle imports


@abstractmethod
def find(self, widget_id) -> Any:
def find(self, widget_id: str) -> Optional[Widget]:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, it is not widget returned, but "managed" one

type: ContentType,
media_id: MediaId,
self,
path: Optional[Union[str, Path]],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It breaks compatibility, let's keep str

intent_id,
stack_id,
event.from_user.id,
cast(User, event.from_user).id,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we need to add check instead of cast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants