MCPcopy Create free account
hub / github.com/tortoise/tortoise-orm / tortoise_orm_config

Function tortoise_orm_config

tortoise/cli/utils.py:29–39  ·  view source on GitHub ↗

Get tortoise orm config from env or pyproject.toml. :param file: toml file that contains tool.tortoise settings :return: module path and var name that stores the tortoise config

(file: str = "pyproject.toml")

Source from the content-addressed store, hash-verified

27
28
29def tortoise_orm_config(file: str = "pyproject.toml") -> str:
30 """
31 Get tortoise orm config from env or pyproject.toml.
32
33 :param file: toml file that contains tool.tortoise settings
34 :return: module path and var name that stores the tortoise config
35 """
36 if not (config := os.getenv("TORTOISE_ORM", "")) and (p := Path(file)).exists():
37 doc = tomllib.loads(p.read_text("utf-8"))
38 config = doc.get("tool", {}).get("tortoise", {}).get("tortoise_orm", "")
39 return config
40
41
42def get_tortoise_config(config: str) -> TortoiseConfig:

Callers

nothing calls this directly

Calls 2

existsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…