summaryrefslogtreecommitdiffstats
path: root/Lib/ipaddress.py
diff options
context:
space:
mode:
authorBatuhan Taşkaya <batuhanosmantaskaya@gmail.com>2020-04-10 04:04:54 (GMT)
committerGitHub <noreply@github.com>2020-04-10 04:04:54 (GMT)
commit2fa67df605e4b0803e7e3aac0b85d851b4b4e09a (patch)
treecb4c56afdb10fff493317da2de2b5fd2286de799 /Lib/ipaddress.py
parenta8403d057d41a022d819fd8d6fbe2a666f72b6f5 (diff)
downloadcpython-2fa67df605e4b0803e7e3aac0b85d851b4b4e09a.zip
cpython-2fa67df605e4b0803e7e3aac0b85d851b4b4e09a.tar.gz
cpython-2fa67df605e4b0803e7e3aac0b85d851b4b4e09a.tar.bz2
bpo-39481: PEP 585 for ipaddress.py (GH-19418)
Diffstat (limited to 'Lib/ipaddress.py')
-rw-r--r--Lib/ipaddress.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index ac1143a..439f241 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -12,6 +12,7 @@ __version__ = '1.0'
import functools
+import types
IPV4LENGTH = 32
IPV6LENGTH = 128
@@ -1124,6 +1125,7 @@ class _BaseNetwork(_IPAddressBase):
return (self.network_address.is_loopback and
self.broadcast_address.is_loopback)
+ __class_getitem__ = classmethod(types.GenericAlias)
class _BaseV4:
@@ -1444,6 +1446,8 @@ class IPv4Interface(IPv4Address):
return '%s/%s' % (self._string_from_ip_int(self._ip),
self.hostmask)
+ __class_getitem__ = classmethod(types.GenericAlias)
+
class IPv4Network(_BaseV4, _BaseNetwork):
@@ -2152,6 +2156,8 @@ class IPv6Interface(IPv6Address):
def is_loopback(self):
return self._ip == 1 and self.network.is_loopback
+ __class_getitem__ = classmethod(types.GenericAlias)
+
class IPv6Network(_BaseV6, _BaseNetwork):