Skip to content

type mismatch reported for audio.set_output_devices(self, *devices: List[str]) #2828

@kollhof

Description

@kollhof

What do you need help with?

When using pyatv in homeassistant I came across the following error being reported by mypy:

Example:

device_ids = ['foo', 'bar']
atv.audio.set_output_devices(*device_ids)

Error:

Argument 1 to "set_output_devices" of "Audio" has incompatible type "*list[str]"; expected "list[str]" 

It appears that I am calling the function correctly, i.e. passing a str for each argument, so I am wondering if the declarations are correct.

The code declares the types as follows:

async def set_output_devices(self, *devices: List[str]) -> None:

Mypy states the following for arguments:

# This says each positional arg and each keyword arg is a "str"
def call(self, *args: str, **kwargs: str) -> str:
    ...

To me this suggests that *_output_devices(...) functions should be declared as e.g.:

async def set_output_devices(self, *devices: str) -> None:

Is that correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions