eric6/E5Network/__init__.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
31 @type str 31 @type str
32 @return flag indicating validity 32 @return flag indicating validity
33 @rtype bool 33 @rtype bool
34 """ 34 """
35 h = QHostAddress(address) 35 h = QHostAddress(address)
36 return not h.isNull() and h.protocol() == QAbstractSocket.IPv4Protocol 36 return (
37 not h.isNull() and
38 h.protocol() == QAbstractSocket.NetworkLayerProtocol.IPv4Protocol
39 )
37 40
38 41
39 def isValidIPv6Address(address): 42 def isValidIPv6Address(address):
40 """ 43 """
41 Public function to check, if the given address is a valid IPv6 address. 44 Public function to check, if the given address is a valid IPv6 address.
44 @type str 47 @type str
45 @return flag indicating validity 48 @return flag indicating validity
46 @rtype bool 49 @rtype bool
47 """ 50 """
48 h = QHostAddress(address) 51 h = QHostAddress(address)
49 return not h.isNull() and h.protocol() == QAbstractSocket.IPv6Protocol 52 return (
53 not h.isNull() and
54 h.protocol() == QAbstractSocket.NetworkLayerProtocol.IPv6Protocol
55 )

eric ide

mercurial