X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/e401b6bb1e1c0ed534bba59d9dc908caf7ba898c..4da0851809e024760d3861ff43309125de34157a:/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)}"