X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/5e2bb528e09df368ed7dea6b7fb9c53e799a569f..0f26a0369efc7305a1a0120355f78d85b3030e56:/src/black/strings.py diff --git a/src/black/strings.py b/src/black/strings.py index 06a5da0..262c2ba 100644 --- a/src/black/strings.py +++ b/src/black/strings.py @@ -138,17 +138,17 @@ def assert_is_leaf_string(string: str) -> None: ), f"{set(string[:quote_idx])} is NOT a subset of {set(STRING_PREFIX_CHARS)}." -def normalize_string_prefix(s: str, remove_u_prefix: bool = False) -> str: - """Make all string prefixes lowercase. - - If remove_u_prefix is given, also removes any u prefix from the string. - """ +def normalize_string_prefix(s: str) -> str: + """Make all string prefixes lowercase.""" match = STRING_PREFIX_RE.match(s) assert match is not None, f"failed to match string {s!r}" orig_prefix = match.group(1) - new_prefix = orig_prefix.replace("F", "f").replace("B", "b").replace("U", "u") - if remove_u_prefix: - new_prefix = new_prefix.replace("u", "") + new_prefix = ( + orig_prefix.replace("F", "f") + .replace("B", "b") + .replace("U", "") + .replace("u", "") + ) return f"{new_prefix}{match.group(2)}"