mirror of
https://github.com/open-mmlab/mmengine.git
synced 2025-06-03 21:54:44 +08:00
[Fix] Delete yapf verify parameter (#1365)
This commit is contained in:
parent
d617bcafdd
commit
88dc1e98b1
@ -17,6 +17,7 @@ from contextlib import contextmanager
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Optional, Sequence, Tuple, Union
|
from typing import Any, Optional, Sequence, Tuple, Union
|
||||||
|
|
||||||
|
import yapf
|
||||||
from addict import Dict
|
from addict import Dict
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
@ -1472,8 +1473,11 @@ class Config:
|
|||||||
blank_line_before_nested_class_or_def=True,
|
blank_line_before_nested_class_or_def=True,
|
||||||
split_before_expression_after_opening_paren=True)
|
split_before_expression_after_opening_paren=True)
|
||||||
try:
|
try:
|
||||||
text, _ = FormatCode(
|
if digit_version(yapf.__version__) >= digit_version('0.40.2'):
|
||||||
text, style_config=yapf_style, verify=True)
|
text, _ = FormatCode(text, style_config=yapf_style)
|
||||||
|
else:
|
||||||
|
text, _ = FormatCode(
|
||||||
|
text, style_config=yapf_style, verify=True)
|
||||||
except: # noqa: E722
|
except: # noqa: E722
|
||||||
raise SyntaxError('Failed to format the config file, please '
|
raise SyntaxError('Failed to format the config file, please '
|
||||||
f'check the syntax of: \n{text}')
|
f'check the syntax of: \n{text}')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user