MCPcopy Index your code
hub / github.com/python/cpython / ip2num

Function ip2num

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

listClass · 0.85
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…