MCPcopy
hub / github.com/tortoise/tortoise-orm / _load_config

Function _load_config

tortoise/cli/cli.py:171–188  ·  view source on GitHub ↗

Load Tortoise ORM configuration from various sources. Returns: TortoiseConfig: Validated configuration object

(ctx: CLIContext)

Source from the content-addressed store, hash-verified

169
170
171def _load_config(ctx: CLIContext) -> TortoiseConfig:
172 """Load Tortoise ORM configuration from various sources.
173
174 Returns:
175 TortoiseConfig: Validated configuration object
176 """
177 config_value = ctx.config
178 config_file = ctx.config_file
179 if config_file:
180 config_dict = Tortoise._get_config_from_config_file(config_file)
181 return TortoiseConfig.from_dict(config_dict)
182 if not config_value:
183 config_value = utils.tortoise_orm_config()
184 if not config_value:
185 raise utils.CLIUsageError(
186 "You must specify TORTOISE_ORM in option or env, or pyproject.toml [tool.tortoise]",
187 )
188 return utils.get_tortoise_config(config_value)
189
190
191def _select_apps(config: TortoiseConfig, app_labels: Iterable[str] | None) -> dict[str, AppConfig]:

Callers 8

initFunction · 0.85
shellFunction · 0.85
makemigrationsFunction · 0.85
_run_migrateFunction · 0.85
downgradeFunction · 0.85
historyFunction · 0.85
headsFunction · 0.85
sqlmigrate_cmdFunction · 0.85

Calls 2

from_dictMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…