X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/66b82ced502a826649f9c7172a9a1d24e415d792..883689366ce0f0e0ddd66d81360c61abfd19b01a:/black.py diff --git a/black.py b/black.py index c899bde..b65693e 100644 --- a/black.py +++ b/black.py @@ -2891,7 +2891,8 @@ def is_python36(node: Node) -> bool: """Return True if the current file is using Python 3.6+ features. Currently looking for: - - f-strings; and + - f-strings; + - underscores in numeric literals; and - trailing commas after * or ** in function signatures and calls. """ for n in node.pre_order(): @@ -2900,6 +2901,10 @@ def is_python36(node: Node) -> bool: if value_head in {'f"', 'F"', "f'", "F'", "rf", "fr", "RF", "FR"}: return True + elif n.type == token.NUMBER: + if "_" in n.value: # type: ignore + return True + elif ( n.type in {syms.typedargslist, syms.arglist} and n.children