Update 'PYGUIDE.md'

This commit is contained in:
Guille 2020-06-09 12:09:21 -04:00
parent 1647c7df3a
commit 84ea64d672

View File

@ -5,7 +5,7 @@ Coding style is just how the code looks, it's incredibly personal, and everyone
Your preferred architectures, variable and function naming style all of then impacts in your code style and how the others read and understand it, so it could become a significant burden if everyone is coding on his own. Your preferred architectures, variable and function naming style all of then impacts in your code style and how the others read and understand it, so it could become a significant burden if everyone is coding on his own.
At CERC we are following the [PEP8](https://www.python.org/dev/peps/pep-0008/) with two spaces indentation instead of four. At CERC, we are following the [PEP8](https://www.python.org/dev/peps/pep-0008/) with two spaces indentation instead of four.
## Tools. ## Tools.
@ -18,14 +18,14 @@ For code analysis, we enforce the usage of [pylint](https://www.pylint.org/) wit
* Name your folders and files in lowercase. * Name your folders and files in lowercase.
* Your class names must start in capital letters and follow the python CapWords pattern. * Your class names must start in capital letters and follow the python CapWords pattern.
* Methods and properties that return lists must end in "s". * Methods and properties that return lists must end in "s".
* Methods and variables should be lowercase and use _ (underscore) as word separator. * Methods and variables should be lowercase and use _ (underscore) as a word separator.
* Constants names must be all capitals. * Constant names must be all capitals.
* Avoid the usage of "get_" and "set_" methods whenever possible, by using @property and @variable.setter decorators instead. * Avoid the usage of "get_" and "set_" methods whenever possible, by using @property and @variable.setter decorators instead.
* "Private" methods, variables and properties start with _ (underscore) * "Private" methods, variables and properties start with _ (underscore)
## Imports ## Imports
Place your imports at the top of the file, after the license and contact information
All the imports should be defined at the top of the file after the license and contact information comment comment
```python ```python
""" """
@ -42,7 +42,7 @@ Ensure that your imports are used and remove any unused.
## Object attributes and methods ## Object attributes and methods
Use properties whenever possible and encapsulate the access to all the calculated object attributes into a properties as shown in the following example. Use properties whenever possible and encapsulate the access to all the calculated object attributes into properties, as shown in the following example.
```python ```python
@ -55,7 +55,7 @@ Use properties whenever possible and encapsulate the access to all the calculate
``` ```
or if the property can be modified like in the following example or like in the following example for read and write properties
```python ```python
@ -82,7 +82,7 @@ If your method or attribute returns a complex object use type hints as in this e
``` ```
always access your variable throught the method and avoid to access directly. Always access your variable through the method and avoid to access directly.
```python ```python
@ -99,7 +99,7 @@ always access your variable throught the method and avoid to access directly.
#### code documentation #### code documentation
all public classes, properties and methods must have code comments all public classes, properties, and methods must have code comments
```python ```python
@ -128,7 +128,7 @@ all public classes, properties and methods must have code comments
``` ```
Attributes with known units should be explicit in method's comment Attributes with known units should be explicit in method's comment.
```python ```python
@ -143,9 +143,9 @@ Attributes with known units should be explicit in method's comment
#### To do's #### To do's
Pending to implement operations should be indicated with ToDo comments to highlight the missing operation Pending to implement operations should be indicated with ToDo comments to highlight the missing functionality.
```python ```python
# ToDo: right now extracted at city level, in the future should be extracted also at building level if exist # ToDo: right now extracted at the city level, in the future should be extracted also at building level if exist
``` ```