Skip to content

Support dick-typed attachments in add_attachment methods #264

@adubovik

Description

@adubovik

This facilitates the integration of the DIAL SDK with the DIAL Client without requiring an actual dependency between the two.

See the method that needs to be relaxed:

def create_attachment(*args, **kwargs) -> Attachment:
if args and isinstance(args[0], Attachment):
return cast(Attachment, args[0])
elif isinstance(kwargs.get("attachment"), Attachment):
return cast(Attachment, kwargs.get("attachment"))
else:
return _attachment_from_fields(*args, **kwargs)

Don't forget to add unit tests that call add_attachment method on the user-defined MyAttachment class with and without extra fields such as index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions