MCPcopy Index your code
hub / github.com/RustPython/RustPython / ip2num

Function ip2num

Lib/urllib/request.py:1963–1968  ·  view source on GitHub ↗
(ipAddr)

Source from the content-addressed store, hash-verified

1961 hostonly, port = _splitport(host)
1962
1963 def ip2num(ipAddr):
1964 parts = ipAddr.split('.')
1965 parts = list(map(int, parts))
1966 if len(parts) != 4:
1967 parts = (parts + [0, 0, 0, 0])[:4]
1968 return (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3]
1969
1970 # Check for simple host names:
1971 if '.' not in host:

Callers 1

Calls 3

listClass · 0.85
lenFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected