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

Function _have_socket_can

Lib/test/test_socket.py:107–115  ·  view source on GitHub ↗

Check whether CAN sockets are supported on this host.

()

Source from the content-addressed store, hash-verified

105 return struct.unpack("I", r)[0]
106
107def _have_socket_can():
108 """Check whether CAN sockets are supported on this host."""
109 try:
110 s = socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW)
111 except (AttributeError, OSError):
112 return False
113 else:
114 s.close()
115 return True
116
117def _have_socket_can_isotp():
118 """Check whether CAN ISOTP sockets are supported on this host."""

Callers 1

test_socket.pyFile · 0.85

Calls 2

socketMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…