Python NumpyDoc Docstring Generator
This prompt writes well-formatted docstrings to your Python code. NOTE: Always read and validate the generated docstring before using it. TIP: For more complex source code, it's recommended to use GPT4 as it generates better outputs.
Write in ⟨TARGETLANGUAGE⟩. As a senior Python developer, your task is to write docstrings using NumPy Doc style for all functions, classes, methods, and objects in a script. Each line should not exceed 80 characters (including spaces). The first line of the docstring should provide a summary of the function/class/method/module/script. You may choose to include additional paragraphs with more information about the function/method/class/module/script as needed. You should provide descriptions and type hints for all parameters and returning objects. If you find it useful, you may include sections such as "Notes", "See Also", "Examples", etc. An example is provided as a guideline. You are the authority on this subject, so write with confidence. Your goal is to be as concise as possible, including only the information necessary for another developer to use the code.
Docstring Example:
def foo(
var1: np.ndarray,
var2: int,
*args,
long_var_name: str="hi",
only_seldom_used_keyword:int=0,
**kwargs
):
"""Summarize the function in one line.
Several sentences providing an extended description.
Refer to variables using back-ticks, e.g., `var`.
Parameters
----------
var1 : array_like
`array_like` means all those
objects -- lists, nested lists, etc. –
that can be converted to an array.
We can also refer to variables like `var1`.
var2 : int
The type above can either refer to an actual Python
type (e.g., ``int``), or describe the type of the
variable in more detail,
e.g., ``(N,) ndarray`` or ``array_like``.
*args : iterable
Other arguments.
long_var_name : {'hi', 'ho'}, optional
Choices in brackets, default first when optional.
Returns
-------
type
Explanation of anonymous return value of type ``type``.
describe : type
Explanation of return value named `describe`.
out : type
Explanation of `out`.
Other Parameters
----------------
only_seldom_used_keyword : int, optional
Infrequently used parameters can be described under
this optional section to prevent cluttering the
Parameters section.
**kwargs : dict
Other infrequently used keyword arguments.
Note that all keyword arguments appearing after the
first parameter specified under the
Other Parameters section, should also be described under
this section.
Raises
------
BadException
Because you shouldn't have done that.
See Also
--------
numpy.array : Relationship (optional).
numpy.ndarray : Relationship (optional), which could be fairly long, in which case the line wraps here.
numpy.dot, numpy.linalg.norm, numpy.eye
Notes
-----
Notes about the implementation algorithm (if needed).
This can have multiple paragraphs.
You may include some math:
.. math:: X(e^{j\omega } ) = x(n)e^{ - j\omega n}
And even use a Greek symbol like :math:`\omega` inline.
References
----------
Cite the relevant literature, e.g. [1]_. You may also cite these references in the notes section above.
.. [1] O. McNoleg, "The integration of GIS, remote sensing,
expert systems and adaptive co-kriging for environmental habitat modelling of the Highland Haggis using object-oriented, fuzzy-logic and neural-network techniques," Computers & Geosciences, vol. 22, pp. 585-588, 1996.
Examples
--------
These are written in doctest format and should illustrate how to use the function.
>>> a = [1, 2, 3]
>>> print([x + 3 for x in a])
[4, 5, 6]
>>> print("a\nb")
a
b
"""
Given these instructions and the above example, write the docstring for the following code:
⟨PROMPT⟩
This prompt contains variables shown as ⟨variable_name⟩. Replace them with your own values before using.
How to Use
Use this prompt by entering: Paste your Python code here.
Related Prompts
More prompts in Coding & Development
This Prompt Ads Sequential Function Calling To Models Other Than GPT 0613
This prompt ads sequential function calling to models other than GPT-0613
Create a personalized workout routine
Tailor a workout routine specifically designed for individual fitness goals
GODMODE CHEATCODE
God Writes You a Letter Today. This is will help you find the perfect Bible Scripture that will guide you through a current problem you're facing.
Creating a Personal Finance Tracker with [Technology/Tool]
Learn to create a personal finance tracker using [Technology/Tool]. Get code samples and budgeting tips.
Build an entire application using bubble.io with ChatGPT4
Build an entire app with bubble.io, assisted by chatGPT4, that knows bubble very well and is accurate 95% of the time. This prompt will help you maximize the quality of chatGPT assistance. Having detailed and step-by-step instructions is essential to progress fast with Bubble. This initial prompt will help you get started on a good basis. Follow it because I will make it even better.
Become LawyerGPT
Are you in a legal bind? This prompt can help you gain knowledge about how to handle your legal proceedings. DISCLAIMER: Please meet with a real lawyer to discuss your options.