bugbug icon indicating copy to clipboard operation
bugbug copied to clipboard

Add docstrings to functions in `bugbug/bugzilla.py`

Open suhaibmujahid opened this issue 1 year ago • 5 comments

Adding Args and Returns should follow Google Style Python Docstrings. The docstrings should not include type annotations; these types should be added to the function itself.

suhaibmujahid avatar Mar 15 '23 22:03 suhaibmujahid

@suhaibmujahid I would like to work on this issue!

Karnankita04 avatar Mar 16 '23 06:03 Karnankita04

def get_ids(params: dict) -> List[int]:
    """
    Retrieves a list of bug IDs from Bugzilla based on the given parameters.

    Args:
        params (dict): A dictionary of parameters to pass to the Bugzilla API.

    Returns:
        list of int: A list of bug IDs.

    Raises:
        None
    """
    assert "include_fields" not in params or params["include_fields"] == "id"

    old_CHUNK_SIZE = Bugzilla.BUGZILLA_CHUNK_SIZE
    try:
        Bugzilla.BUGZILLA_CHUNK_SIZE = 7000

        all_ids = []

        def bughandler(bug):
            all_ids.append(bug["id"])

        params["include_fields"] = "id"

        Bugzilla(params, bughandler=bughandler).get_data().wait()
    finally:
        Bugzilla.BUGZILLA_CHUNK_SIZE = old_CHUNK_SIZE

    return all_ids

This is an example for get_ids function, @suhaibmujahid I'm I on track with this?

skynette avatar Mar 16 '23 11:03 skynette

@suhaibmujahid I would like to work on this issue!

@Karnankita04 Anyone can work on any issue as long as it is not linked to an open pull request.

It's always good to have descriptive and informative docstrings ...

@fadebowaley Please do not post auto-generated content in this project

This is an example for get_ids function, @suhaibmujahid I'm I on track with this?

@skynette It will be more efficient to give feedback on code in a PR than here in the issue. Here some notes:

  1. See in the issue description: "docstrings should not include type annotations"
  2. You do not need to include Raises if the function is not raising specific exceptions
  3. The comment should start right after """

suhaibmujahid avatar Mar 16 '23 12:03 suhaibmujahid

okay noted, will make a PR soon

skynette avatar Mar 16 '23 13:03 skynette

@suhaibmujahid @Karnankita04 I apologise if my content was misleading. Thank you for further explanation on Docstring and type annotations

fadebowaley avatar Mar 16 '23 13:03 fadebowaley