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

Improve docstrings #50

Open
znamensk opened this issue Jul 15, 2021 · 0 comments
Open

Improve docstrings #50

znamensk opened this issue Jul 15, 2021 · 0 comments
Assignees

Comments

@znamensk
Copy link
Member

At a minimum, all docstrings should include a list of function arguments and returned values. Docstrings should follow the Google style and can include references to be parsed by sphinx (e.g. :py:class:pandas.DataFrame):

    """
    Get entities of a given type and format results.

    Entities can be filtered by name, id, origin, or attribute (using the
    `query_key` / `query_value` arguments).

    Args:
        datatype (str): type of Flexylims entity to fetch, e.g. 'mouse', 'session',
            'recording', or 'dataset'. This is the only mandatory argument.
        query_key (str): attribute to filter by.
        query_value (str): attribute value to select
        project_id (str): text name of the project. Either `project_id` or
            `flexilims_session` must be provided.
        flexilims_session (:py:class:`flexilims.Flexilims`): Flexylims session
            object. This is preferred to providing `project_id` as it avoids
            creating new authentication tokens.
        name (str): filter by name
        origin_id (str): filter by origin / parent
        id (str): filter by hexadecimal id
        format_reply (bool): (default True) whether to format the reply into a
            `Dataframe`. If this is set to false, a list of dictionaries will be
            returned instead.

    Returns:
        :py:class:`pandas.DataFrame`: containing all matching entities

    """

For methods extensively used by end users, it would also be great to include examples:

    Examples:
        Examples should be written in doctest format, and should illustrate how
        to use the function.

        >>> print([i for i in example_generator(4)])
        [0, 1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants