python-manilaclient/HACKING
Stephen Finucane 0002625e2b utils: Remove unicode-related helpers
The 'unicode_key_value_to_string' and '_encode' helpers were used to
handle the difference between unicode and byte strings in Python 2. In a
Python 3-only world, they are unnecessary. Remove them.

Some references to text encoding in the HACKING file are removed. In
theory, we should no longer have to worry about byte strings.

Change-Id: I0694b25dc4d72e817cb08ce6cafb39bb8226293d
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-07-14 10:26:30 +01:00

76 lines
2.2 KiB
Plaintext

Manila Style Commandments
=========================
Step 1: Read https://www.python.org/dev/peps/pep-0008/
Step 2: Read https://www.python.org/dev/peps/pep-0008/ again
Step 3: Read on
Imports
-------
- thou shalt not import objects, only modules
- thou shalt not import more than one module per line
- thou shalt not make relative imports
- thou shalt organize your imports according to the following template
::
# vim: tabstop=4 shiftwidth=4 softtabstop=4
{{stdlib imports in human alphabetical order}}
\n
{{manila imports in human alphabetical order}}
\n
\n
{{begin your code}}
General
-------
- thou shalt put two newlines twixt toplevel code (funcs, classes, etc)
- thou shalt put one newline twixt methods in classes and anywhere else
- thou shalt not write "except:", use "except Exception:" at the very least
- thou shalt include your name with TODOs as in "TODO(termie)"
- thou shalt not name anything the same name as a builtin or reserved word
- thou shalt not violate causality in our time cone, or else
Human Alphabetical Order Examples
---------------------------------
::
import httplib
import logging
import random
import StringIO
import time
import unittest
from manila.auth import users
from manila.endpoint import api
from manila.endpoint import cloud
from manila import flags
from manila import test
Docstrings
----------
"""A one line docstring looks like this and ends in a period."""
"""A multiline docstring has a one-line summary, less than 80 characters.
Then a new paragraph after a newline that explains in more detail any
general information about the function, class or method. Example usages
are also great to have here if it is a complex class for function. After
you have finished your descriptions add an extra newline and close the
quotations.
When writing the docstring for a class, an extra line should be placed
after the closing quotations. For more in-depth explanations for these
decisions see https://www.python.org/dev/peps/pep-0257/
If you are going to describe parameters and return values, use Sphinx, the
appropriate syntax is as follows.
:param foo: the foo parameter
:param bar: the bar parameter
:returns: description of the return value
"""