-
Notifications
You must be signed in to change notification settings - Fork 1
Code Style Guide
Kyle Seidenthal edited this page May 11, 2020
·
2 revisions
This project follows the PEP8 style guide, with exceptions stated below.
Docstrings for classes should describe what the class is for, and list any public attributes:
Class Foo():
'''
A description
Attributes:
attribute1: Description
attribute2: Description
'''
...Function docstrings should provide a brief description of their functionality, a list of arguments, return values, and any raised exceptions. For tricky or ambiguous functions, an example is also recommended.
def function(a, b, c):
'''
Do a thing
Args:
a: A thing
b: B thing
c: C thing
Returns:
Some stuff
Raises:
An exception if you do the wrong thing.
'''
...For test functions, docstrings do not need to include return values or exceptions, as they generally don't do those things. Instead, a Test Condition should be supplied:
def test_function(setup):
'''
Test a function
Args:
setup: The setup fixture used to set up the tests
Test Condition:
a == b and c < a.
'''
...