dummypackage package

Submodules

dummypackage.bar_module module

Module mimicking foo with more expensive memory and runtime requirements.

class dummypackage.bar_module.Bar(size=1000000)[source]

Bases: dummypackage.foo_module.Foo

Similar to Foo, with higher memory and runtime requirements.

dummypackage.foo_module module

Module containing a simple class with low memory and runtime requirements.

class dummypackage.foo_module.Foo(size=1000000)[source]

Bases: object

A simple class with low memory and runtime requirements.

get_result()[source]

This function does something.

Returns:a number stored in self._result
Return type:integer or float
loop(times)[source]

Restart result and run computation a number of times.

Parameters:times (int) – non-negative number.

Module contents

Main init file docstring.
It exemplifies the usage of restructured text, like:
  • 1 2 3 4
  • Italics
  • Bold
  • Numbered and nested lists:
    1. This is a numbered list
    2. Nested lists have at least three characters indentation
  • Inline literals
  • Parameter fields: see class and method docstrings.
Note that lines above 80 characters would break flake8 and therefore have to be wrapped. This can be achieved with | blocks.
This is a new line.

Section about sections:

  • Surrounding chars have to be at least as long as the title

No explicit hierarchy, but this recommended: #, *, =, -, ^, " (the first two with overline).

Subsection:

To exemplify the usage of \text{\LaTeX} and nested quotes, nothing better than the words of Isaac Newton himself:
“If I have seen further it is by standing on the shoulders of Giants.”

Or, in other words:

\sum_{k=1}^{\infty} k = -\frac{1}{12}

Emphasis:

Note

The sum of all parameters cannot exceed infinity

Warning

If the sum of all parameters exceeds infinity, behaviour is undefined!

Function descriptions:

Sphinx formatting:
dummypackage.add(a, b=None)

This is a cool function.

Parameters:
  • a (int or float) – a number
  • b (int, float or None) – another number
Returns:

a+b. If b is none, returns a

Return type:

integer or float

Note

Neither a nor b can be infinity!

Google formatting:

This function does something.

Args:
name (str): The name to use.
Kwargs:
state (bool): Current state to be in.
Returns:

int. The return code:

0 -- Success!
1 -- No good.
2 -- Try again.
Raises:
AttributeError, KeyError

Usage example:

>>> print public_fn_with_googley_docstring(name='foo', state=None)
0

BTW, this always returns 0. NEVER use with MyPublicClass.

Other structures:

Field lists:

Author:Homer J. Simpson
Email:hjs@compuglobalhypermega.net

Literal blocks, preceded by double colon:

This is a literal block

Markups are **not** rendered here.

Doctest blocks can be tested by the doc tool:

>>> [factorial(n) for n in range(6)]
[1, 1, 2, 6, 24, 120]
>>> [factorial(long(n)) for n in range(6)]
[1, 1, 2, 6, 24, 120]
Grid tables must be indented:
Header 1 Header 2 Header 3
body row 1 column 2 column 3
body row 2 Cells may span columns.
body row 3 Cells may span rows.
  • Cells
  • contain
  • blocks.
body row 4

Simple table:

Inputs Output
A B A or B
False False False
True False True
False True True
True True True