Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL ERROR: Black produced different code on the second pass of the formatter #1658

Closed
FinnStutzenstein opened this issue Aug 31, 2020 · 2 comments
Labels
C: unstable formatting Formatting changed on the second pass R: duplicate This issue or pull request already exists T: bug Something isn't working

Comments

@FinnStutzenstein
Copy link

FinnStutzenstein commented Aug 31, 2020

Hi, black promted me to create this issue :)
It happens with the newest version (20.8b1):

Mode(target_versions=set(), line_length=88, string_normalization=True, experimental_string_processing=False, is_pyi=False)
--- source
+++ first pass
@@ -51,15 +51,15 @@
 
                 if not permission:
                     # Parse values of restriction field.
                     # If at least one restriction is ok, permissions are granted.
                     for value in restriction:
-                        if (
-                            value
-                            in ("motions.can_see_internal","motions.can_manage_metadata","motions.can_manage")
-                            and await async_has_perm(user_id, value)
-                        ):
+                        if value in (
+                            "motions.can_see_internal",
+                            "motions.can_manage_metadata",
+                            "motions.can_manage",
+                        ) and await async_has_perm(user_id, value):
                             permission = True
                             break
                         elif value == "is_submitter" and is_submitter:
                             permission = True
                             break
--- first pass
+++ second pass
@@ -51,15 +51,19 @@
 
                 if not permission:
                     # Parse values of restriction field.
                     # If at least one restriction is ok, permissions are granted.
                     for value in restriction:
-                        if value in (
-                            "motions.can_see_internal",
-                            "motions.can_manage_metadata",
-                            "motions.can_manage",
-                        ) and await async_has_perm(user_id, value):
+                        if (
+                            value
+                            in (
+                                "motions.can_see_internal",
+                                "motions.can_manage_metadata",
+                                "motions.can_manage",
+                            )
+                            and await async_has_perm(user_id, value)
+                        ):
                             permission = True
                             break
                         elif value == "is_submitter" and is_submitter:
                             permission = True
                             break

I hope this helps. Greets!

@FinnStutzenstein FinnStutzenstein added the T: bug Something isn't working label Aug 31, 2020
@erdnaxeli
Copy link

I have a similar issue with a None not in being broken in two line None then not in.

Mode(target_versions=set(), line_length=88, string_normalization=True, experimental_string_processing=False, is_pyi=False)
--- source
+++ first pass
@@ -1,2 +1,5 @@
-if None not in [1111111111111111111111111111111111111, 2222222222222222222222222] and 22222222222222222222222222222 > ["11111111111111111111111111"].get(0):
+if None not in [
+    1111111111111111111111111111111111111,
+    2222222222222222222222222,
+] and 22222222222222222222222222222 > ["11111111111111111111111111"].get(0):
     pass
--- first pass
+++ second pass
@@ -1,5 +1,9 @@
-if None not in [
-    1111111111111111111111111111111111111,
-    2222222222222222222222222,
-] and 22222222222222222222222222222 > ["11111111111111111111111111"].get(0):
+if (
+    None
+    not in [
+        1111111111111111111111111111111111111,
+        2222222222222222222222222,
+    ]
+    and 22222222222222222222222222222 > ["11111111111111111111111111"].get(0)
+):
     pass

andersk added a commit to andersk/zulip that referenced this issue Sep 3, 2020
andersk added a commit to andersk/zulip that referenced this issue Sep 3, 2020
timabbott pushed a commit to zulip/zulip that referenced this issue Sep 4, 2020
Amitsinghyadav pushed a commit to Amitsinghyadav/zulip that referenced this issue Sep 20, 2020
@ichard26 ichard26 added the C: unstable formatting Formatting changed on the second pass label Apr 1, 2021
@ichard26 ichard26 added the R: duplicate This issue or pull request already exists label Apr 25, 2021
@ichard26
Copy link
Collaborator

Hello!

All reproduction cases in this issue format without error on master. The fixing commit was 8672af3 from PR GH-2126. I'll be marking this issue as a duplicate of GH-1629 since that's what GH-2126 aimed to fix and it's highly likely this issue falls under GH-1629.

Since we use the issue tracker as a reflection of what's on master, I'll be closing this issue. If you have any issues, especially with the new (but stable) output, please open a new issue. Oh and the fix should be available in a published release soon, see GH-2125 for more info.

Thank you for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: unstable formatting Formatting changed on the second pass R: duplicate This issue or pull request already exists T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants