MCPcopy
hub / github.com/Xyntax/POC-T / len

Method len

thirdparty/IPy/IPy.py:538–549  ·  view source on GitHub ↗

Return the length of a subnet. >>> print(IP('195.185.1.0/28').len()) 16 >>> print(IP('195.185.1.0/24').len()) 256

(self)

Source from the content-addressed store, hash-verified

536 return "/%d" % self._prefixlen
537
538 def len(self):
539 """Return the length of a subnet.
540
541 >>> print(IP('195.185.1.0/28').len())
542 16
543 >>> print(IP('195.185.1.0/24').len())
544 256
545 """
546
547 bits = _ipVersionToLen(self._ipversion)
548 locallen = bits - self._prefixlen
549 return 2 ** locallen
550
551
552 def __nonzero__(self):

Callers 10

broadcastMethod · 0.95
_printPrefixMethod · 0.95
__len__Method · 0.95
__getitem__Method · 0.95
__contains__Method · 0.95
overlapsMethod · 0.95
reverseNamesMethod · 0.45
reverseNameMethod · 0.45
lenMethod · 0.45
_remove_subprefixFunction · 0.45

Calls 1

_ipVersionToLenFunction · 0.85

Tested by

no test coverage detected