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

Function _have_socket_can

Lib/test/test_socket.py:105–113  ·  view source on GitHub ↗

Check whether CAN sockets are supported on this host.

()

Source from the content-addressed store, hash-verified

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