Multiple download methods in api source code

Hi there,
While looking through the source code of the viktor.api module, I found that the Entity class has 3 download methods attached to it. (File api.pyi, lines 46-48)

    def download(self, encoding: str) -> str: ...
    def download(self, encoding: None=...) -> bytes: ...
    def download(self, encoding: str=...) -> Union[bytes, str]: ...

I think it is some redundant code leftover from development.


Hi Fokke, thanks for reporting.

This is actually a way in Python to annotate the return type of a function, in case it depends on the type of the input: typing — Support for type hints — Python 3.10.1 documentation

We use it in this case for inernal type checking, but it may look a bit confusing in the stubs and we will most likely not introduce this anywhere else.