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

Function _have_socket_bluetooth

Lib/test/test_socket.py:173–183  ·  view source on GitHub ↗

Check whether AF_BLUETOOTH sockets are supported on this host.

()

Source from the content-addressed store, hash-verified

171
172
173def _have_socket_bluetooth():
174 """Check whether AF_BLUETOOTH sockets are supported on this host."""
175 try:
176 # RFCOMM is supported by all platforms with bluetooth support. Windows
177 # does not support omitting the protocol.
178 s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
179 except (AttributeError, OSError):
180 return False
181 else:
182 s.close()
183 return True
184
185
186def _have_socket_bluetooth_l2cap():

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…