From 88dc1e98b169f8f6355988637f647860b81a8cf0 Mon Sep 17 00:00:00 2001 From: takuoko Date: Sun, 24 Sep 2023 10:25:52 +0900 Subject: [PATCH] [Fix] Delete yapf verify parameter (#1365) --- mmengine/config/config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mmengine/config/config.py b/mmengine/config/config.py index f636cc81d5..316ac65d4d 100644 --- a/mmengine/config/config.py +++ b/mmengine/config/config.py @@ -17,6 +17,7 @@ from pathlib import Path from typing import Any, Optional, Sequence, Tuple, Union +import yapf from addict import Dict from rich.console import Console from rich.text import Text @@ -1472,8 +1473,11 @@ def _format_dict(input_dict, outest_level=False): blank_line_before_nested_class_or_def=True, split_before_expression_after_opening_paren=True) try: - text, _ = FormatCode( - text, style_config=yapf_style, verify=True) + if digit_version(yapf.__version__) >= digit_version('0.40.2'): + text, _ = FormatCode(text, style_config=yapf_style) + else: + text, _ = FormatCode( + text, style_config=yapf_style, verify=True) except: # noqa: E722 raise SyntaxError('Failed to format the config file, please ' f'check the syntax of: \n{text}')