]> 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:

Fix unstable formatting on string split + % formatting (#1680)
authorBryan Bugyi <bryanbugyi34@gmail.com>
Sun, 6 Sep 2020 00:24:00 +0000 (20:24 -0400)
committerGitHub <noreply@github.com>
Sun, 6 Sep 2020 00:24:00 +0000 (17:24 -0700)
Fixes #1595

src/black/__init__.py
src/blib2to3/pgen2/pgen.py
tests/data/long_strings.py
tests/data/long_strings__regression.py

index f7e7603321ae72b8605b9a6633bf06fb484093f3..eed059e28379aa56dc6717bdbca75468443b9ad7 100644 (file)
@@ -2668,9 +2668,9 @@ def transform_line(
                 transformers = [
                     string_merge,
                     string_paren_strip,
                 transformers = [
                     string_merge,
                     string_paren_strip,
+                    string_split,
                     delimiter_split,
                     standalone_comment_split,
                     delimiter_split,
                     standalone_comment_split,
-                    string_split,
                     string_paren_wrap,
                     rhs,
                 ]
                     string_paren_wrap,
                     rhs,
                 ]
index 13ec51d1878f51bd73d9d09778dc5a5a4726ea6c..a685145933c3c47cde23ef29996c29f81ec5bc36 100644 (file)
@@ -168,8 +168,7 @@ class ParserGenerator(object):
                 if symbol in inverse:
                     raise ValueError(
                         "rule %s is ambiguous; %s is in the first sets of %s as well"
                 if symbol in inverse:
                     raise ValueError(
                         "rule %s is ambiguous; %s is in the first sets of %s as well"
-                        " as %s"
-                        % (name, symbol, label, inverse[symbol])
+                        " as %s" % (name, symbol, label, inverse[symbol])
                     )
                 inverse[symbol] = label
         self.first[name] = totalset
                     )
                 inverse[symbol] = label
         self.first[name] = totalset
index e1ed90f22dedfd28721633947ad02700d1ae282d..151396b5239ee2a99921f7d5460c6bf2dfeeaf7a 100644 (file)
@@ -380,8 +380,7 @@ fmt_string2 = "But what about when the string is {} but {}".format(
 
 old_fmt_string1 = (
     "While we are on the topic of %s, we should also note that old-style formatting"
 
 old_fmt_string1 = (
     "While we are on the topic of %s, we should also note that old-style formatting"
-    " must also be preserved, since some %s still uses it."
-    % ("formatting", "code")
+    " must also be preserved, since some %s still uses it." % ("formatting", "code")
 )
 
 old_fmt_string2 = "This is a %s %s %s %s" % (
 )
 
 old_fmt_string2 = "This is a %s %s %s %s" % (
@@ -448,8 +447,7 @@ assert some_type_of_boolean_expression, (
 
 assert some_type_of_boolean_expression, (
     "Followed by a really really really long string that is used to provide context to"
 
 assert some_type_of_boolean_expression, (
     "Followed by a really really really long string that is used to provide context to"
-    " the AssertionError exception, which uses dynamic string %s."
-    % "formatting"
+    " the AssertionError exception, which uses dynamic string %s." % "formatting"
 )
 
 assert some_type_of_boolean_expression, (
 )
 
 assert some_type_of_boolean_expression, (
index 044bb4a5deb57b9fd01885ebec35769ddc1ef866..33bf14cfaa3e1a1886f863f859ec8dee698d4eef 100644 (file)
@@ -310,6 +310,13 @@ class Step(StepBase):
             passenger_association=passenger_association,
         )
 
             passenger_association=passenger_association,
         )
 
+if __name__ == "__main__":
+    for i in range(4, 8):
+        cmd = (
+            r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk '{print $2}'); do kill $pid; done"
+            % (i)
+        )
+
 # output
 
 
 # output
 
 
@@ -435,14 +442,12 @@ func_call_where_string_arg_has_method_call_and_bad_parens(
 
 func_call_where_string_arg_has_old_fmt_and_bad_parens(
     "A long string with {}. This string is so long that it is ridiculous. It can't fit"
 
 func_call_where_string_arg_has_old_fmt_and_bad_parens(
     "A long string with {}. This string is so long that it is ridiculous. It can't fit"
-    " on one line at alllll."
-    % "formatting",
+    " on one line at alllll." % "formatting",
 )
 
 func_call_where_string_arg_has_old_fmt_and_bad_parens(
     "A long string with {}. This {} is so long that it is ridiculous. It can't fit on"
 )
 
 func_call_where_string_arg_has_old_fmt_and_bad_parens(
     "A long string with {}. This {} is so long that it is ridiculous. It can't fit on"
-    " one line at alllll."
-    % ("formatting", "string"),
+    " one line at alllll." % ("formatting", "string"),
 )
 
 
 )
 
 
@@ -702,3 +707,11 @@ class Step(StepBase):
                 passenger_association=passenger_association,
             )
         )
                 passenger_association=passenger_association,
             )
         )
+
+
+if __name__ == "__main__":
+    for i in range(4, 8):
+        cmd = (
+            r"for pid in $(ps aux | grep paster | grep -v grep | grep '\-%d' | awk"
+            r" '{print $2}'); do kill $pid; done" % (i)
+        )