File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -128,16 +128,19 @@ def get_pyproject_content(pyproject_file_path: str) -> str:
128128def format_content (content_str : str , pyproject_file_path : str = "" ) -> str :
129129 pyproject_dict : dict = {}
130130 try :
131- import toml # type: ignore
131+ import tomllib as toml
132132 except ImportError :
133- logging .warning (
134- "The toml module is not installed and the configuration information cannot be obtained through"
135- " pyproject.toml"
136- )
137- else :
138- pyproject_content = get_pyproject_content (pyproject_file_path )
139- if pyproject_content :
140- pyproject_dict = toml .loads (pyproject_content )
133+ try :
134+ import toml # type: ignore
135+ except ImportError :
136+ logging .warning (
137+ "The toml module is not installed and the configuration information cannot be obtained through"
138+ " pyproject.toml"
139+ )
140+ return content_str
141+ pyproject_content = get_pyproject_content (pyproject_file_path )
142+ if pyproject_content :
143+ pyproject_dict = toml .loads (pyproject_content )
141144 try :
142145 p2p_format_dict : dict = pyproject_dict ["tool" ]["protobuf-to-pydantic" ]["format" ]
143146 except KeyError :
You can’t perform that action at this time.
0 commit comments