From 895ccdab1892cf4e2b431d912a0731f27bcf233f Mon Sep 17 00:00:00 2001 From: Doug Freed Date: Fri, 26 May 2017 05:02:24 -0400 Subject: [PATCH] ipaddress: make _BaseAddress subclass SupportsInt This fixes the following mypy error: error: Argument 1 to "int" has incompatible type "IPv4Address"; expected "Union[SupportsInt, str, bytes]" --- stdlib/3.3/ipaddress.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/3.3/ipaddress.pyi b/stdlib/3.3/ipaddress.pyi index 21d70b9a1706..3ca31ec7f96d 100644 --- a/stdlib/3.3/ipaddress.pyi +++ b/stdlib/3.3/ipaddress.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterator, Optional, Tuple, TypeVar, Union +from typing import Any, Iterator, Optional, SupportsInt, Tuple, TypeVar, Union _address = Union[bytes, int, str] @@ -24,9 +24,9 @@ class _IPAddressBase(_TotalOrderingMixin): @property def version(self): ... -class _BaseAddress(_IPAddressBase): +class _BaseAddress(_IPAddressBase, SupportsInt): def __init__(self, address) -> None: ... - def __int__(self): ... + def __int__(self) -> int: ... def __eq__(self, other): ... def __lt__(self, other): ... def __add__(self, other): ...