code_convention¶
A well-behaved writer class.
It is important to help readability. Therefore, arte has code conventions.
- Rules:
Line indentation is 4 spaces. No Tabs!
Maximum line length is 80 characters.
Comments should be complete sentences in English.
Modules use short, all-lowercase names with underscores (snake_case).
Class names use the UpperCamelCase convention.
Method names use all-lowercase with underscore (snake_case) convention.
Docstrings use the numpydoc convention: https://numpydoc.readthedocs.io/
Eclipse Support
The Python plugin PyDev for Eclipse has a tool for checking source code on conformity with PEP8 standard. Use it!
Set Pydev->Editor->Code Style->Code Formatter->Formatter style=Pydev.Formatter
Check Pydev->Editor->Code Analysis->Do Code Analysis
- class arte.code_convention.InafIsAnAcronym¶
Bases:
object
InafIsAnAcronym is more readable than INAFIsAnAcronym
So use Inaf, Lbt, Eso and so on in acronyms
- class arte.code_convention.NiceWriter(path)¶
Bases:
object
A nice writer.
This class is an example of code styling conventions.
You can do some math:
\[f(x) = x^{-5/3} + \frac{1}{L_0^2}^{-42}\]- Parameters:
path (str) – the
path
of something
Examples
Show that 2+3=5
>>> a = 2 >>> b = 3 >>> print(a+b) 5
- A_CLASS_CONSTANT = 'whatever it is, centralize constant here'¶
- NUMBER_OF_SLOPES = 1600¶
- public_work(an_argument, an_array, a_keyword='not needed')¶
One-liner description here.
More detailed description here, using reStructuredText if needed.
- Parameters:
an_argument (str) – argument description here.
an_array (numpy.array) – pass
an_array
as an arraya_keyword (str, default='not needed') – something optional.
- Returns:
k – whatever.
- Return type:
int