X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/883689366ce0f0e0ddd66d81360c61abfd19b01a..d4f05217546dd98f81ca472aa00e68d978c900f4:/black.py diff --git a/black.py b/black.py index b65693e..5550b23 100644 --- a/black.py +++ b/black.py @@ -2564,7 +2564,9 @@ def format_int_string(text: str, allow_underscores: bool) -> str: # No underscores for numbers <= 6 digits long. return text - return format(int(text), "3_") + # Avoid removing leading zeros, which are important if we're formatting + # part of a number like "0.001". + return format(int("1" + text), "3_")[1:].lstrip("_") def normalize_invisible_parens(node: Node, parens_after: Set[str]) -> None: