]>
git.madduck.net Git - etc/vim.git/commitdiff
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f5381c7 )
def parse_ast(src: str) -> Union[ast3.AST, ast27.AST]:
def parse_ast(src: str) -> Union[ast3.AST, ast27.AST]:
- try:
- return ast3.parse(src)
- except SyntaxError:
- return ast27.parse(src)
+ for feature_version in (7, 6):
+ try:
+ print(f"-- 3.{feature_version}")
+ return ast3.parse(src, feature_version=feature_version)
+ except SyntaxError:
+ continue
+
+ print(f"-- 2.7")
+ return ast27.parse(src)
def assert_equivalent(src: str, dst: str) -> None:
def assert_equivalent(src: str, dst: str) -> None:
try:
src_ast = parse_ast(src)
except Exception as exc:
try:
src_ast = parse_ast(src)
except Exception as exc:
- major, minor = sys.version_info[:2]
- 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}"