]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

string prefixes: don't normalise capital R-strings (#1271)
authorShantanu <hauntsaninja@users.noreply.github.com>
Tue, 3 Mar 2020 13:55:14 +0000 (05:55 -0800)
committerGitHub <noreply@github.com>
Tue, 3 Mar 2020 13:55:14 +0000 (14:55 +0100)
Resolves #1244

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
black.py
tests/data/string_prefixes.py

index 69d24c54133320e3cd7b6c8e0a17cc3c23f17981..b7cacf7767855ec903578b5be7499d526f1d542f 100644 (file)
--- a/black.py
+++ b/black.py
@@ -2842,7 +2842,7 @@ def normalize_string_prefix(leaf: Leaf, remove_u_prefix: bool = False) -> None:
     match = re.match(r"^([furbFURB]*)(.*)$", leaf.value, re.DOTALL)
     assert match is not None, f"failed to match string {leaf.value!r}"
     orig_prefix = match.group(1)
-    new_prefix = orig_prefix.lower()
+    new_prefix = orig_prefix.replace("F", "f").replace("B", "b").replace("U", "u")
     if remove_u_prefix:
         new_prefix = new_prefix.replace("u", "")
     leaf.value = f"{new_prefix}{match.group(2)}"
index fbad5e0704ffb249dc759a16beb5a3efb0b62e43..0ca3686a2b6c0fee3004c0e78c066b24b1b0c5a1 100644 (file)
@@ -3,12 +3,16 @@
 name = R"Łukasz"
 F"hello {name}"
 B"hello"
+r"hello"
+fR"hello"
 
 # output
 
 
 #!/usr/bin/env python3.6
 
-name = r"Łukasz"
+name = R"Łukasz"
 f"hello {name}"
 b"hello"
+r"hello"
+fR"hello"