Skip to content

translate_document should include bytes and str in type #131

@na50r

Description

@na50r

Currently, translate_document has the following type annotation for input_document

input_document: Union[TextIO, BinaryIO, Any],

However, translate_document essentially just calls translate_document_uploud, which has:

input_document: Union[TextIO, BinaryIO, str, bytes, Any]

I do not really see a reason why you would have less types in translate_document than translate_document_uploud, especially since in translate_document's docstring you have:

        :param filename: (Optional) Filename including extension, only required
            if uploading string or bytes containing file content.

So you allow the user to provide bytes or str as input but the only way to verify if bytes and str are valid under Any is to either read the docstring or drill down the code. Unsure if that was the intention, if it was, I apologize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions