Python ipaddress._BaseNetwork() Examples
The following are 11
code examples of ipaddress._BaseNetwork().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ipaddress
, or try the search function
.
Example #1
Source File: test_ipaddress.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def testMissingNetworkVersion(self): class Broken(ipaddress._BaseNetwork): pass broken = Broken('127.0.0.1') with self.assertRaisesRegex(NotImplementedError, "Broken.*version"): broken.version
Example #2
Source File: test_ipaddress.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def testMissingAddressClass(self): class Broken(ipaddress._BaseNetwork): pass broken = Broken('127.0.0.1') with self.assertRaisesRegex(NotImplementedError, "Broken.*address"): broken._address_class
Example #3
Source File: test_ipaddress.py From ironpython3 with Apache License 2.0 | 5 votes |
def testMissingNetworkVersion(self): class Broken(ipaddress._BaseNetwork): pass broken = Broken('127.0.0.1') with self.assertRaisesRegex(NotImplementedError, "Broken.*version"): broken.version
Example #4
Source File: test_ipaddress.py From ironpython3 with Apache License 2.0 | 5 votes |
def testMissingAddressClass(self): class Broken(ipaddress._BaseNetwork): pass broken = Broken('127.0.0.1') with self.assertRaisesRegex(NotImplementedError, "Broken.*address"): broken._address_class
Example #5
Source File: utils.py From cloud-custodian with Apache License 2.0 | 5 votes |
def __contains__(self, other): if other is None: return False if isinstance(other, ipaddress._BaseNetwork): return self.supernet_of(other) return super(IPv4Network, self).__contains__(other)
Example #6
Source File: fields.py From openwisp-ipam with BSD 3-Clause "New" or "Revised" License | 5 votes |
def to_python(self, value): if not value: return None if isinstance(value, _BaseNetwork): network = value if isinstance(value, str): value = value.strip() try: network = ip_network(value, strict=False) except ValueError: raise ValidationError(self.default_error_messages['invalid']) return network
Example #7
Source File: test_ipaddress.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def testMissingNetworkVersion(self): class Broken(ipaddress._BaseNetwork): pass broken = Broken('127.0.0.1') with self.assertRaisesRegex(NotImplementedError, "Broken.*version"): broken.version
Example #8
Source File: test_ipaddress.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def testMissingAddressClass(self): class Broken(ipaddress._BaseNetwork): pass broken = Broken('127.0.0.1') with self.assertRaisesRegex(NotImplementedError, "Broken.*address"): broken._address_class
Example #9
Source File: fields.py From django-ipam with BSD 3-Clause "New" or "Revised" License | 5 votes |
def to_python(self, value): if not value: return None if isinstance(value, _BaseNetwork): network = value if isinstance(value, str): value = value.strip() try: network = ip_network(value, strict=False) except ValueError: raise ValidationError(self.default_error_messages['invalid']) return network
Example #10
Source File: test_ipaddress.py From android_universal with MIT License | 5 votes |
def testMissingNetworkVersion(self): class Broken(ipaddress._BaseNetwork): pass broken = Broken('127.0.0.1') with self.assertRaisesRegex(NotImplementedError, "Broken.*version"): broken.version
Example #11
Source File: test_ipaddress.py From android_universal with MIT License | 5 votes |
def testMissingAddressClass(self): class Broken(ipaddress._BaseNetwork): pass broken = Broken('127.0.0.1') with self.assertRaisesRegex(NotImplementedError, "Broken.*address"): broken._address_class