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

Format instability in 38 python files #7590

Closed
qarmin opened this issue Sep 22, 2023 · 1 comment
Closed

Format instability in 38 python files #7590

qarmin opened this issue Sep 22, 2023 · 1 comment
Labels
bug Something isn't working formatter Related to the formatter

Comments

@qarmin
Copy link

qarmin commented Sep 22, 2023

0.0.290 latest master branch

Zip contains 3 folders:

  • BD - original files
  • BD2 - files after running first time ruff
  • BD3 - files after running second time ruff on original files

and diff13986975832760036465.txt that shows diffs between files after second and first ruff run

broken_files.zip

Example instability

//////////////////////////////////////////////////////
--- /home/rafal/test/DOWNLOADED/broken_files//BD2/A_16119982587513585207.py	2023-09-22 09:04:47.281983181 +0200
+++ /home/rafal/test/DOWNLOADED/broken_files//BD3/A_16119982587513585207.py	2023-09-22 09:04:47.357981173 +0200
@@ -210,8 +210,7 @@
     input_shapes = [get_shape(v) for v in inputs]
     assert len(input_shapes) == 2, input_shapes
     assert (
-        input_shapes[0][-1]
-        == input_shapes[1][-2]  # type: ignore
+        input_shapes[0][-1] == input_shapes[1][-2]  # type: ignore
     ), input_shapes  # type: ignore
     flop = prod(input_shapes[0]) * input_shapes[-1][-1]  # type: ignore
     return flop
--- /home/rafal/test/DOWNLOADED/broken_files//BD2/A_7173176388825988664.py	2023-09-22 09:04:47.285983076 +0200
+++ /home/rafal/test/DOWNLOADED/broken_files//BD3/A_7173176388825988664.py	2023-09-22 09:04:47.357981173 +0200
@@ -78,7 +78,7 @@
         *_DISK_META_MAGIC,
         *memoryview(
             (image_name.encode("utf-8") + b"\x00" * _DISK_META_IMAGE_NAME_SIZE)[
-                  # type: ignore
+                # type: ignore
                 :_DISK_META_IMAGE_NAME_SIZE
             ]
         ).cast("c"),
//////////////////////////////////////////////////////
--- /home/rafal/test/DOWNLOADED/broken_files//BD2/A_14230110707883433080.py	2023-09-22 09:04:47.289982970 +0200
+++ /home/rafal/test/DOWNLOADED/broken_files//BD3/A_14230110707883433080.py	2023-09-22 09:04:47.349981385 +0200
@@ -412,7 +412,6 @@
 
             # else:
             # print(xsrfRequest.headers["x-csrf-token"],xsrfRequest.headers)
-
     except Exception as e:
         raise GetTokenException(
             f"'Get x-csrf-token' process returned an Exception: {e}'"
--- /home/rafal/test/DOWNLOADED/broken_files//BD2/A_1798643049678049848.py	2023-09-22 09:04:47.277983287 +0200
+++ /home/rafal/test/DOWNLOADED/broken_files//BD3/A_1798643049678049848.py	2023-09-22 09:04:47.349981385 +0200
@@ -212,8 +212,7 @@
     + list(itertools.product([0], ONE_TO_NINE + TEN_TO_LOTS))  # integer value of 0
     + list(itertools.product(ONE_TO_LOTS, [0]))  # decimal value of 0
     + list(itertools.product(NEGATIVE_NUMBERS, ONE_TO_NINE))  # negative integer
-    +
-    list(itertools.product(ONE_TO_LOTS, NEGATIVE_NUMBERS))  # negative decimal
+    + list(itertools.product(ONE_TO_LOTS, NEGATIVE_NUMBERS))  # negative decimal
 ] + [
     str(components[0]) + "." + str(components[1])
     for components in itertools.product(
--- /home/rafal/test/DOWNLOADED/broken_files//BD2/A_870428921595896654.py	2023-09-22 09:04:47.281983181 +0200
+++ /home/rafal/test/DOWNLOADED/broken_files//BD3/A_870428921595896654.py	2023-09-22 09:04:47.349981385 +0200
@@ -3,15 +3,13 @@
 
 
 def f2(
-    x: e2 = #
-    "foo",
+    x: e2 = "foo",  #
 ) -> r2:
     pass
 
 
 def f3(  #
-    x: e3 = #  # =  #
-    123,  #
+    x: e3 = 123,  #  # =  #  #
     #
 ) -> r3:
     pass
@charliermarsh
Copy link
Member

Okay, I tried a bunch of these into their own issues -- let's close for now and then rerun at some point once those are resolved. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatter Related to the formatter
Projects
None yet
Development

No branches or pull requests

2 participants