You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run across an issue where the following code gets formatted not very nicely. This particular snippet should IMO already satisfy Black with line_length=120.
defmain(
client: AppRole,
role_name: str=Option(..., help="The name of the role to generate a secret ID for", metavar="ROLE_NAME"),
secret_id: str|None=Option(
None,
help="A custom secret ID to use. If not specified, one will be generated.",
metavar="SECRET_ID",
),
metadata: str|None=Option(None, help="JSON-formatted metadata to associate with the secret ID", metavar="JSON"),
metadata_file: Path|None=Option(
None,
help="A file containing JSON-formatted metadata to associate with the secret ID",
),
) ->None:
"""Generate a new secret ID for an approle."""
But running Black 23.3.0 over it gives an ugly split before two of the three | None parts:
defmain(
client: AppRole,
role_name: str=Option(..., help="The name of the role to generate a secret ID for", metavar="ROLE_NAME"),
secret_id: str|None=Option(
None,
help="A custom secret ID to use. If not specified, one will be generated.",
metavar="SECRET_ID",
),
metadata: str|None=Option(None, help="JSON-formatted metadata to associate with the secret ID", metavar="JSON"),
metadata_file: Path|None=Option(
None,
help="A file containing JSON-formatted metadata to associate with the secret ID",
),
) ->None:
"""Generate a new secret ID for an approle."""
To Reproduce
Run black example.py --line-length 120 on the above snippet.
Expected behavior
Black should not split str | None before the |. There appears to be no reason to do so as the line is not too long.
Environment
Black's version: 22.3.0
OS and Python version: Python 3.8.10
Additional context
The text was updated successfully, but these errors were encountered:
Describe the bug
I've run across an issue where the following code gets formatted not very nicely. This particular snippet should IMO already satisfy Black with
line_length=120
.But running Black 23.3.0 over it gives an ugly split before two of the three
| None
parts:To Reproduce
Run
black example.py --line-length 120
on the above snippet.Expected behavior
Black should not split
str | None
before the|
. There appears to be no reason to do so as the line is not too long.Environment
Additional context
The text was updated successfully, but these errors were encountered: