Loading black.py +8 −5 Changes for black.py: 8 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -3382,9 +3382,14 @@ def __str__(self) -> str: def parse_ast(src: str) -> Union[ast3.AST, ast27.AST]: for feature_version in (7, 6): try: return ast3.parse(src) print(f"-- 3.{feature_version}") return ast3.parse(src, feature_version=feature_version) except SyntaxError: continue print(f"-- 2.7") return ast27.parse(src) Loading Loading @@ -3438,11 +3443,9 @@ def _v(node: Union[ast3.AST, ast27.AST], depth: int = 0) -> Iterator[str]: try: src_ast = parse_ast(src) except Exception as exc: major, minor = sys.version_info[:2] raise AssertionError( f"cannot use --safe with this file; failed to parse source file " f"with Python {major}.{minor}'s builtin AST. Re-run with --fast " f"or stop using deprecated Python 2 syntax. AST error message: {exc}" f"cannot use --safe with this file; failed to parse source file. " f"AST error message: {exc}" ) try: Loading Loading
black.py +8 −5 Changes for black.py: 8 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -3382,9 +3382,14 @@ def __str__(self) -> str: def parse_ast(src: str) -> Union[ast3.AST, ast27.AST]: for feature_version in (7, 6): try: return ast3.parse(src) print(f"-- 3.{feature_version}") return ast3.parse(src, feature_version=feature_version) except SyntaxError: continue print(f"-- 2.7") return ast27.parse(src) Loading Loading @@ -3438,11 +3443,9 @@ def _v(node: Union[ast3.AST, ast27.AST], depth: int = 0) -> Iterator[str]: try: src_ast = parse_ast(src) except Exception as exc: major, minor = sys.version_info[:2] raise AssertionError( f"cannot use --safe with this file; failed to parse source file " f"with Python {major}.{minor}'s builtin AST. Re-run with --fast " f"or stop using deprecated Python 2 syntax. AST error message: {exc}" f"cannot use --safe with this file; failed to parse source file. " f"AST error message: {exc}" ) try: Loading