# Multiple download methods in api source code

**URL:** <https://community.viktor.ai/t/multiple-download-methods-in-api-source-code/226>\
**Category:** Bug & Error Reports\
**Created:** [10 January 2022 13:34 UTC](https://community.viktor.ai/t/multiple-download-methods-in-api-source-code/226 "2022-01-10T13:34:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fokke](https://community.viktor.ai/letter_avatar_proxy/v4/letter/f/e9a140/32.png) [@Fokke](https://community.viktor.ai/u/Fokke)\
**Post date:** [10 January 2022 13:34 UTC](https://community.viktor.ai/t/multiple-download-methods-in-api-source-code/226/1 "2022-01-10T13:34:45Z")

</div>

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)

```auto
    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.

Cheers

---

<div class="post-metadata">

**Author:** ![khameeteman](https://community.viktor.ai/user_avatar/community.viktor.ai/khameeteman/32/51_2.png) [@khameeteman](https://community.viktor.ai/u/khameeteman)\
**Post date:** [11 January 2022 09:26 UTC](https://community.viktor.ai/t/multiple-download-methods-in-api-source-code/226/2 "2022-01-11T09:26:06Z")

</div>

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](https://docs.python.org/3/library/typing.html#typing.overload)

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.

---

<div class="post-metadata">

**Author:** ![bvanderhulst](https://community.viktor.ai/user_avatar/community.viktor.ai/bvanderhulst/32/35_2.png) [@bvanderhulst](https://community.viktor.ai/u/bvanderhulst)\
**Post date:** [17 June 2022 09:03 UTC](https://community.viktor.ai/t/multiple-download-methods-in-api-source-code/226/3 "2022-06-17T09:03:35Z")

</div>

Closed on 17 June 2022 09:03 UTC


