-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Comments between fmt:on/off are reformatted #1245
Comments
This bug is affecting me too as my python code contains supercomputer queue manager options that must be formatted like "#PBS (option)" with no space between "#" and "PBS". As a workaround, a print statement within the "# fmt: off/on" block makes it work but ideally blocks of comments only within a "# fmt: off/on" block with no executable code in the block should still respect the "# fmt: off/on" directive. |
An interesting case from a duplicate:
|
I was just wondering if there were any updates related to this bug report. |
Thanks for creating the best opinionated formatter I've used. I'm having this issue with setup.cfg file:
The indentation is required for a successful build but it is removed by black. I was surprised this issue still persists after such a long time. |
@aljabadi I don't think we format CFG files 🤔 |
Another use-case that's affected: #!/usr/bin/env python3
# fmt: off
#SBATCH --job-name="Example"
#SBATCH --array=0-250
# ...
# fmt: on Black alters EDIT: already reported in #1024 |
Same issue here: Playground link Inputrawdata_schema = {
# fmt: off
"No" : "uint16[pyarrow]",
"year" : "uint16[pyarrow]",
"month" : "uint8[pyarrow]",
"day" : "uint8[pyarrow]",
"hour" : "uint8[pyarrow]",
"PM2.5" : "float32[pyarrow]",
"PM10" : "float32[pyarrow]",
"SO2" : "float32[pyarrow]",
"NO2" : "float32[pyarrow]",
"CO" : "float32[pyarrow]",
"O3" : "float32[pyarrow]",
"TEMP" : "float32[pyarrow]",
"PRES" : "float32[pyarrow]",
"DEWP" : "float32[pyarrow]",
"RAIN" : "float32[pyarrow]",
"wd" : "string", # FIXME bug in pandas prevents using pyarrrow here.
"WSPM" : "float32[pyarrow]",
"station" : "string", # FIXME bug in pandas prevents using pyarrrow here.
# fmt: on
} Outputrawdata_schema = {
# fmt: off
"No" : "uint16[pyarrow]",
"year" : "uint16[pyarrow]",
"month" : "uint8[pyarrow]",
"day" : "uint8[pyarrow]",
"hour" : "uint8[pyarrow]",
"PM2.5" : "float32[pyarrow]",
"PM10" : "float32[pyarrow]",
"SO2" : "float32[pyarrow]",
"NO2" : "float32[pyarrow]",
"CO" : "float32[pyarrow]",
"O3" : "float32[pyarrow]",
"TEMP" : "float32[pyarrow]",
"PRES" : "float32[pyarrow]",
"DEWP" : "float32[pyarrow]",
"RAIN" : "float32[pyarrow]",
"wd" : "string", # FIXME bug in pandas prevents using pyarrrow here.
"WSPM" : "float32[pyarrow]",
"station" : "string",
# FIXME bug in pandas prevents using pyarrrow here.
# fmt: on
} |
This code:
is changed to:
I expected the lines betwen
# fmt: off
and# fmt: on
to remain unchanged.Playground (master)
The text was updated successfully, but these errors were encountered: