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
different code on the second pass of the formatter. #2563
Comments
Hi, could you paste your code directly into here? You can use the Alternatively, you can paste a black playground link. |
`"""Pretty reducing huge Python objects to visualise them nicely.""" class Dots(dict): # type: ignore # inherit from dict to blend with expected type
def ellipsize(
` |
andgineer/ellipsize@163812c |
Okay, here's a minimal reproduction: assert (
a_function(very_long_arguments_that_surpass_the_limit, which_is_eighty_eight_in_this_case_plus_a_bit_more)
== {"x": "this need to pass the line limit as well", "b": "but only by a little bit"}
) From what I gather, during the first pass, the dictionary is not expanded for some reason (still digging), but on the second pass it is expanded. This is only true if the dictionary passes the limit before the first pass, but not after the second pass. I'm not sure why it isn't expanding from the get go. From what I gather, the expansion in the second pass is indeed correct, so understanding why it doesn't expand for the first pass will be the first step towards solving this issue. |
I have same problem. May be my log
and full file code from api.permissions import IsAuthenticatedAndIsActive
class DriverPermission(IsAuthenticatedAndIsActive):
def has_permission(self, request, view):
if not super().has_permission(request, view):
return False
if request.user.is_superuser or request.user.is_company:
return True
if (
request.method.upper() in ("POST", "DELETE") and
view.action not in ("timescores", "telemetry")
):
return False
if request.user.is_driver and view.action == "switch":
return False
if request.user.is_driver:
return True
return False will be helpful |
The example from #2563 (comment) above still crashes on current main, where we always do two passes. (I was trying to include this case in #2815.) |
produce error
error: cannot format /Users/SOROKAN6/projects/idse-pqsar-api/tests/test_ellipsize.py: INTERNAL ERROR: Black produced different code on the second pass of the formatter.
run black for the file and it will show the error.
but there is impossible to attach py-file
Environment (please complete the following information):
black, version 21.8b0
Python 3.7.6
MacOS 11.6
Does this bug also happen on main?
No
Additional context
blk_9gtrwz8w.log
The text was updated successfully, but these errors were encountered: