Skip to content
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

Doc string for sqlalchemy.column is misformatted #6004

Open
rchiodo opened this issue Jun 12, 2024 · 1 comment
Open

Doc string for sqlalchemy.column is misformatted #6004

rchiodo opened this issue Jun 12, 2024 · 1 comment
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@rchiodo
Copy link
Contributor

rchiodo commented Jun 12, 2024

Enabled the new supportRestructuredText setting and hover over a Column:

from typing import ClassVar

import sqlalchemy as sa
from sqlalchemy.orm import declarative_base, declarative_mixin, declared_attr

base = declarative_base()


@declarative_mixin
class Foo(base):
    __abstract__ = True
    __tablename__ = "foo"

    id = sa.Column(sa.Integer, primary_key=True)

    @declared_attr
    def baz_id(self) -> ClassVar[sa.Column]:
        return sa.Column(
            sa.ForeignKey("baz.baz.id"),
            comment="Keys to baz.baz.id",
        )


class FooBar(Foo):
    __table_args__ = {"schema": "foo"}

The type_ parameter formats incorrectly:
image

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jun 12, 2024
@rchiodo
Copy link
Contributor Author

rchiodo commented Jun 12, 2024

I would hazard a guess the automatic indent is off when the literal block is found:

Here's what that docstring looks like for that parameter:

        :param type\_: The column's type, indicated using an instance which
          subclasses :class:`~sqlalchemy.types.TypeEngine`.  If no arguments
          are required for the type, the class of the type can be sent
          as well, e.g.::

            # use a type with arguments
            Column('data', String(50))

            # use no arguments
            Column('level', Integer)

          The ``type`` argument may be the second positional argument
          or specified by keyword.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant