Skip to content

DOC: flake8 flagging template strings in docstrings as syntax errors  #51377

Closed
@kkangs0226

Description

@kkangs0226

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.apply_index.html
https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.background_gradient.html

Documentation problem

Template strings that are in the first line of the doctest i.e. line starting with >>>, are flagged as syntax errors.

A guess is that perhaps flake8 identifies the doctests chunks & runs the syntax checking before the docstrings are rendered, and there is perhaps a bug (or perhaps there are other reasons) where the string interpolation is flagged as a syntax error for the first line.

Detailed testing & more information about this error can be found here #51356 (comment)

Suggested fix for documentation

Would need to discuss how to fix the template problem in doctests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIContinuous IntegrationCode StyleCode style, linting, code_checksDocs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions