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
This PR fixes a bug in our formatter where it would remove the last empty line for docstrings when """ is not intented:
deftest7():
""" a, b"""
Would get formatted to
deftest7():
""" a, b"""
(Removing the last empty line).
This is inconsistent with Black and how we format docstrings when the closing quotes are indented. The empty line does not get removed for:
deftest7():
""" a, b """
The root cause of the divergence was that we use str::lines() which uses split_inclusive underneath that omits the last element if it matches the separator:
If the last element of the string is matched, that element will be considered the terminator of the preceding substring. That substring will be the last item returned by the iterator.
let v:Vec<&str> = "Mary had a little lamb\nlittle lamb\nlittle lamb.\n".split_inclusive('\n').collect();assert_eq!(v,["Mary had a little lamb\n","little lamb\n","little lamb.\n"]);
The PR fixes the divergence by using split instead.
If both ``palette`` and ``color_mapper`` are passed, a ``ValueError``
exception will be raised. If neither is passed, then the ``Greys9``
palette will be used as a default.
+
"""
@glyph_method(glyphs.ImageRGBA)
.. note::
The ``image_rgba`` method accepts images as a two-dimensional array of RGBA
values (encoded as 32-bit integers).
+
"""
@glyph_method(glyphs.ImageStack)
``Rect`` glyphs are not well defined on logarithmic scales. Use
:class:`~bokeh.models.Block` or :class:`~bokeh.models.Quad` glyphs
instead.
+
"""
@glyph_method(glyphs.Step)
.. note::
The location and angle of the text relative to the ``x``, ``y`` coordinates
is indicated by the alignment and baseline text properties.
+
"""
@marker_method()
def protect_password_sqlcipher(password: str) -> str:
"""A double quote in the password would close the string. To escape it double it
- source: https://stackoverflow.com/a/603579/110395"""+ source: https://stackoverflow.com/a/603579/110395+ """
return password.replace(r'"', r'""')
ruff format --no-preview --exclude tests/roots/test-pycode/cp_1251_coded.py
ruff failed
Cause: Selection of unstable rules without the `--preview` flag is not allowed. Enable preview or remove selection of:
- FURB113
- FURB131
- FURB132
If both ``palette`` and ``color_mapper`` are passed, a ``ValueError``
exception will be raised. If neither is passed, then the ``Greys9``
palette will be used as a default.
+
"""
@glyph_method(glyphs.ImageRGBA)
.. note::
The ``image_rgba`` method accepts images as a two-dimensional array of RGBA
values (encoded as 32-bit integers).
+
"""
@glyph_method(glyphs.ImageStack)
``Rect`` glyphs are not well defined on logarithmic scales. Use
:class:`~bokeh.models.Block` or :class:`~bokeh.models.Quad` glyphs
instead.
+
"""
@glyph_method(glyphs.Step)
.. note::
The location and angle of the text relative to the ``x``, ``y`` coordinates
is indicated by the alignment and baseline text properties.
+
"""
@marker_method()
def protect_password_sqlcipher(password: str) -> str:
"""A double quote in the password would close the string. To escape it double it
- source: https://stackoverflow.com/a/603579/110395"""+ source: https://stackoverflow.com/a/603579/110395+ """
return password.replace(r'"', r'""')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workingformatterRelated to the formatter
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a bug in our formatter where it would remove the last empty line for docstrings when
"""is not intented:Would get formatted to
(Removing the last empty line).
This is inconsistent with Black and how we format docstrings when the closing quotes are indented. The empty line does not get removed for:
The root cause of the divergence was that we use
str::lines()which usessplit_inclusiveunderneath that omits the last element if it matches the separator:The PR fixes the divergence by using
splitinstead.Fixes #9804
Preview
This change is not gated behind preview because it doesn't change the output for already formatted code.
Test Plan
Added snapshot test