Skip to content

Commit

Permalink
[Fix] Delete yapf verify parameter (#1365)
Browse files Browse the repository at this point in the history
  • Loading branch information
okotaku authored Sep 24, 2023
1 parent d617bca commit 88dc1e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mmengine/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}')
Expand Down

0 comments on commit 88dc1e9

Please sign in to comment.