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 agree that if possible it would be good to keep the newline at the end of a block. Actually, I think doctests are just copied lines from the standard python REPL, so they should be as close to that as possible.
Consider this:
>>>1+2
...
I would like to have blackdoc collapse that to a single line since it's impossible to get multiple lines in the REPL unless the line contains more opening that closing brackets or parens, or if it is the opening line of a block.
Thinking about this some more, maybe it's enough to check whether the first line of the code block matches
[^:]+:(\s+#.*)?
there are still a few corner cases this wouldn't match, though (lambda definitions, for example)
Edit: I can't seem to be able to get black to split the lambda definition after the colon, so I'll wait for bug reports before trying to modify the regular expression.
To continue from pydata/xarray#4510 (comment):
I agree that if possible it would be good to keep the newline at the end of a block. Actually, I think doctests are just copied lines from the standard python REPL, so they should be as close to that as possible.
Consider this:
I would like to have
blackdoc
collapse that to a single line since it's impossible to get multiple lines in the REPL unless the line contains more opening that closing brackets or parens, or if it is the opening line of a block.Thinking about this some more, maybe it's enough to check whether the first line of the code block matches
there are still a few corner cases this wouldn't match, though (
lambda
definitions, for example)Edit: I can't seem to be able to get
black
to split thelambda
definition after the colon, so I'll wait for bug reports before trying to modify the regular expression.cc @max-sixty
The text was updated successfully, but these errors were encountered: