MCPcopy Create free account
hub / github.com/eric-mitchell/direct-preference-optimization / get_open_port

Function get_open_port

utils.py:15–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13
14
15def get_open_port():
16 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
17 s.bind(('', 0)) # bind to all interfaces and use an OS provided port
18 return s.getsockname()[1] # return only the port number
19
20
21def get_remote_file(remote_path, local_path=None):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected