Skip to content

Commit b792772

Browse files
committed
fix for mypy errors
1 parent f942609 commit b792772

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

infrahub_sdk/ctl/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22

33
from __future__ import annotations
44

5+
import sys
56
from pathlib import Path
7+
from typing import TYPE_CHECKING
68

79
import typer
810
from pydantic import Field, ValidationError, field_validator
911
from pydantic_settings import BaseSettings, SettingsConfigDict
1012

11-
try:
13+
if sys.version_info >= (3, 11):
1214
import tomllib
13-
except ModuleNotFoundError:
15+
else:
1416
import tomli as tomllib
1517

18+
if TYPE_CHECKING:
19+
import tomllib
20+
1621
DEFAULT_CONFIG_FILE = "infrahubctl.toml"
1722
ENVVAR_CONFIG_FILE = "INFRAHUBCTL_CONFIG"
1823
INFRAHUB_REPO_CONFIG_FILE = ".infrahub.yml"

0 commit comments

Comments
 (0)