(
ctx: click.Context, param: click.Option, value: str | None
)
| 413 | |
| 414 | |
| 415 | def _env_file_callback( |
| 416 | ctx: click.Context, param: click.Option, value: str | None |
| 417 | ) -> str | None: |
| 418 | if value is None: |
| 419 | return None |
| 420 | |
| 421 | import importlib |
| 422 | |
| 423 | try: |
| 424 | importlib.import_module("dotenv") |
| 425 | except ImportError: |
| 426 | raise click.BadParameter( |
| 427 | "python-dotenv must be installed to load an env file.", |
| 428 | ctx=ctx, |
| 429 | param=param, |
| 430 | ) from None |
| 431 | |
| 432 | # Don't check QUART_SKIP_DOTENV, that only disables automatically |
| 433 | # loading .env and .quartenv files. |
| 434 | load_dotenv(value) |
| 435 | return value |
| 436 | |
| 437 | |
| 438 | # This option is eager so env vars are loaded as early as possible to be |
nothing calls this directly
no test coverage detected
searching dependent graphs…