Return number of bits in address for a certain IP version. >>> _ipVersionToLen(4) 32 >>> _ipVersionToLen(6) 128 >>> _ipVersionToLen(5) Traceback (most recent call last): File " ", line 1, in ? File "IPy.py", line 1076, in _ipVersionToLen raise Value
(version)
| 1127 | |
| 1128 | |
| 1129 | def _ipVersionToLen(version): |
| 1130 | """Return number of bits in address for a certain IP version. |
| 1131 | |
| 1132 | >>> _ipVersionToLen(4) |
| 1133 | 32 |
| 1134 | >>> _ipVersionToLen(6) |
| 1135 | 128 |
| 1136 | >>> _ipVersionToLen(5) |
| 1137 | Traceback (most recent call last): |
| 1138 | File "<stdin>", line 1, in ? |
| 1139 | File "IPy.py", line 1076, in _ipVersionToLen |
| 1140 | raise ValueError, "only IPv4 and IPv6 supported" |
| 1141 | ValueError: only IPv4 and IPv6 supported |
| 1142 | """ |
| 1143 | |
| 1144 | if version == 4: |
| 1145 | return 32 |
| 1146 | elif version == 6: |
| 1147 | return 128 |
| 1148 | else: |
| 1149 | raise ValueError, "only IPv4 and IPv6 supported" |
| 1150 | |
| 1151 | |
| 1152 | def _countFollowingZeros(l): |
no outgoing calls
no test coverage detected