MCPcopy Index your code
hub / github.com/dbcli/mycli / guess_socket_location

Function guess_socket_location

mycli/packages/filepaths.py:113–123  ·  view source on GitHub ↗

Try to guess the location of the default mysql socket file.

()

Source from the content-addressed store, hash-verified

111
112
113def guess_socket_location() -> str | None:
114 """Try to guess the location of the default mysql socket file."""
115 socket_dirs = filter(os.path.exists, DEFAULT_SOCKET_DIRS)
116 for directory in socket_dirs:
117 for r, dirs, files in os.walk(directory, topdown=True):
118 for filename in files:
119 name, ext = os.path.splitext(filename)
120 if name.startswith("mysql") and name != "mysqlx" and ext in (".socket", ".sock"):
121 return os.path.join(r, filename)
122 dirs[:] = [d for d in dirs if d.startswith("mysql")]
123 return None

Callers 1

connectMethod · 0.90

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected