utils.codestyle

Small fake module to illustrate the basic coding guidelines and the use of docstrings for sphinx.

See PEP 0008 for more details. (And note that the module name is short, descriptive, and all lowercase). Also note we use the Napoleon sphinx extension with the Numpy style.

ximpol.utils.codestyle.square(x)[source]

Return the square of x.

Parameters:x (number or array) – The input x value (can be either a numeric type or an array).
Returns:The square of the input value
Return type:float

Examples

>>> x = 3.
>>> y = square(x)
>>> print(y)

Note

Yes, this is a pretty dumb function, but watch out for the use of doctrings.

class ximpol.utils.codestyle.xSampleClass(name, description=None)[source]

An example class, doing nothing useful.

Parameters:
  • name (string) – The instance name.
  • description (string) – An optional description.

Examples

>>> from codestyle import xSampleClass
>>> c1 = xSampleClass('hello')
>>> c2 = xSampleClass('world!')
>>> print(c1 + c2)