Skip to content

Commit

Permalink
Add comment about prefix count
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-hilden committed Jun 1, 2021
1 parent 43304f0 commit e9a9a49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/black/strings.py
Expand Up @@ -136,8 +136,9 @@ def normalize_string_prefix(s: str, remove_u_prefix: bool = False) -> str:
match = re.match(r"^([" + STRING_PREFIX_CHARS + r"]*)(.*)$", s, re.DOTALL)
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")

# 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]
if remove_u_prefix:
Expand Down

0 comments on commit e9a9a49

Please sign in to comment.