X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/f298032ddb624067aebc49f792b4308aeeb1841d..799f76f537f72ade97b8e6637c59fee49e05a4ab:/src/black/strings.py diff --git a/src/black/strings.py b/src/black/strings.py index 262c2ba..9d0e2eb 100644 --- a/src/black/strings.py +++ b/src/black/strings.py @@ -149,6 +149,10 @@ def normalize_string_prefix(s: str) -> str: .replace("U", "") .replace("u", "") ) + + # Python syntax guarantees max 2 prefixes and that one of them is "r" + if len(new_prefix) == 2 and "r" != new_prefix[0].lower(): + new_prefix = new_prefix[::-1] return f"{new_prefix}{match.group(2)}"