MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / __init__

Method __init__

bindings/python/graphlite/graphlite.py:200–220  ·  view source on GitHub ↗

Open a GraphLite database Args: path: Path to database directory Raises: GraphLiteError: If database cannot be opened

(self, path: str)

Source from the content-addressed store, hash-verified

198 """
199
200 def __init__(self, path: str):
201 """
202 Open a GraphLite database
203
204 Args:
205 path: Path to database directory
206
207 Raises:
208 GraphLiteError: If database cannot be opened
209 """
210 self._db = None
211 self._sessions = set()
212
213 error = ctypes.c_int(0)
214 self._db = _lib.graphlite_open(path.encode('utf-8'), ctypes.byref(error))
215
216 if not self._db:
217 raise GraphLiteError(
218 ErrorCode(error.value),
219 f"Failed to open database at {path}"
220 )
221
222 def create_session(self, username: str) -> str:
223 """

Callers 1

__init__Method · 0.45

Calls 3

graphlite_openMethod · 0.80
GraphLiteErrorClass · 0.70
ErrorCodeClass · 0.70

Tested by

no test coverage detected