cmatools.examplesubpackage.example_numpy

Example NumPy style docstrings.

This module demonstrates documentation as specified by the NumPy Documentation HOWTO. Docstrings may extend over multiple lines. Sections are created with a section header followed by an underline of equal length.

Example

Examples can be given using either the Example or Examples sections. Sections support any reStructuredText formatting, including literal blocks:

$ python example_numpy.py

Section breaks are created with two blank lines. Section breaks are also implicitly created anytime a new section starts. Section bodies may be indented:

Notes

This is an example of an indented section. It’s like any other section, but the body is indented to help it stand out from surrounding text.

If a section is indented, then a section break is created by resuming unindented text.

This file source: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html#example-numpy See also notes in the wiki https://github.com/cma-open/cmatools/wiki/Naming-conventions

This file has been added to and amended to include code style examples and further functional code, so the module can be well covered by tests.

Some codestyle ignore commands have been added, where the code examples are not fully functional. More detailed example code has been included in the associated :mod: example_cmatools.py

Attributes

module_level_variable1int

Module level variables may be documented in either the Attributes section of the module docstring, or in an inline docstring immediately following the variable.

Either form is acceptable, but the two should not be mixed. Choose one convention to document module level variables and be consistent with it.

CONSTANTint

Module constants are capitalised by convention and may be useful to distinguish from module level variables

DEBUGbool

The debug print status set for the module

Module Attributes

module_level_variable2

int: Module level variable documented inline.

Functions

example_generator(n)

Yield next number.

function_with_pep484_type_annotations(...)

Compare if param1 is greater than param2.

function_with_types_in_docstring(param1, param2)

Compare if param1 is greater than param2.

module_level_function(param1[, param2])

Evaluate to true if any paramaters are greater than 100.

Classes

ExampleClass(param1, param2, param3)

The summary line for a class docstring should fit on one line.

Exceptions

ExampleError(msg[, code])

Exceptions are documented in the same way as classes.