numpy / numpy/numpydoc

Dealing with class `__slots__`

Open
#456 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
355
Forks
181
Avg merge
1d 9h
Merged PRs (30d)
3

Description

I have a class like this,

class MyClass:
    """
    Summary line.

    Parameters
    ----------
    a: str
        Description of ``a``.
    b: `.SomeType`
        Description of ``b``.
    c: float
        Description of ``c``.
    """

   __slots__ = (
        "a",
        "b",
        "c",
    )

    def __init__(self ,a, b, c):

        self.a = a
        self.b = b
        self.c = c

    # methods after this line

I thought this was sufficient, but I still get warnings like this,

WARNING: [numpydoc] Validation warnings while processing docstring for 'XXX.MyClass.a':
  GL01: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
  SS01: No summary found (a short summary in a single line should be present at the beginning of the docstring)

Have I forgotten to do something or is this a bug?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported MyClass example and reproduce the numpydoc validation warnings for attributes defined through slots. Then trace the validator entry point that processes class attributes and docstrings. Done means determining whether the warnings are expected or correcting validation so this documented class is handled appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.