Skip to content

Commit 4381784

Browse files
authored
Make Mypy happy (python-zeroconf#281)
Otherwise it'd complain: % make mypy mypy examples/*.py zeroconf/*.py zeroconf/__init__.py:2039: error: Returning Any from function declared to return "int" Found 1 error in 1 file (checked 6 source files) make: *** [mypy] Error 1
1 parent 64056ab commit 4381784

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

zeroconf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2036,7 +2036,7 @@ def ip_to_index(adapters: List[Any], ip: str) -> int:
20362036
for adapter_ip in adapter.ips:
20372037
# IPv6 addresses are represented as tuples
20382038
if isinstance(adapter_ip.ip, tuple) and ipaddress.ip_address(adapter_ip.ip[0]) == ipaddr:
2039-
return adapter.index
2039+
return cast(int, adapter.index)
20402040

20412041
raise RuntimeError('No adapter found for IP address %s' % ip)
20422042

0 commit comments

Comments
 (0)