MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / _resolve_db_url

Function _resolve_db_url

trinity/cli/view.py:8–17  ·  view source on GitHub ↗

Normalize a database specifier into a connection URL. Accepts a plain path to a ``.db`` file (relative or absolute) and converts it to a ``sqlite:///`` URL. Anything that already looks like a DB URL (``sqlite:///``, ``postgresql://``, ...) is passed through unchanged.

(url: str)

Source from the content-addressed store, hash-verified

6
7
8def _resolve_db_url(url: str) -> str:
9 """Normalize a database specifier into a connection URL.
10
11 Accepts a plain path to a ``.db`` file (relative or absolute) and converts
12 it to a ``sqlite:///`` URL. Anything that already looks like a DB URL
13 (``sqlite:///``, ``postgresql://``, ...) is passed through unchanged.
14 """
15 if "://" in url:
16 return url
17 return "sqlite:///" + os.path.abspath(os.path.expanduser(url))
18
19
20def _resolve_from_config(config_path: str) -> tuple[str, str, str]:

Calls

no outgoing calls