X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/d90297c77bab6e22831b05ffc099bfc709cc7785..d1aee5f7fa136b1f0a7d8dfc318af81009074070:/.vim/bundle/black/src/black/numerics.py diff --git a/.vim/bundle/black/src/black/numerics.py b/.vim/bundle/black/src/black/numerics.py index cb1c83e..67ac859 100644 --- a/.vim/bundle/black/src/black/numerics.py +++ b/.vim/bundle/black/src/black/numerics.py @@ -1,6 +1,7 @@ """ Formatting numeric literals. """ + from blib2to3.pytree import Leaf @@ -25,13 +26,10 @@ def format_scientific_notation(text: str) -> str: return f"{before}e{sign}{after}" -def format_long_or_complex_number(text: str) -> str: - """Formats a long or complex string like `10L` or `10j`""" +def format_complex_number(text: str) -> str: + """Formats a complex string like `10j`""" number = text[:-1] suffix = text[-1] - # Capitalize in "2L" because "l" looks too similar to "1". - if suffix == "l": - suffix = "L" return f"{format_float_or_int_string(number)}{suffix}" @@ -47,9 +45,7 @@ def format_float_or_int_string(text: str) -> str: def normalize_numeric_literal(leaf: Leaf) -> None: """Normalizes numeric (float, int, and complex) literals. - All letters used in the representation are normalized to lowercase (except - in Python 2 long literals). - """ + All letters used in the representation are normalized to lowercase.""" text = leaf.value.lower() if text.startswith(("0o", "0b")): # Leave octal and binary literals alone. @@ -58,8 +54,8 @@ def normalize_numeric_literal(leaf: Leaf) -> None: text = format_hex(text) elif "e" in text: text = format_scientific_notation(text) - elif text.endswith(("j", "l")): - text = format_long_or_complex_number(text) + elif text.endswith("j"): + text = format_complex_number(text) else: text = format_float_or_int_string(text) leaf.value = text