-
Notifications
You must be signed in to change notification settings - Fork 11
Code readability matters
This code base is currently being refactored to follow the PEP8 - Style Guide for Python.
A configure file called gtg_lint_file is provided for use with PyLint.
Currently we are using Python 2.7.x and pylint == 1.4.1 in this repo.
Use the following command to lint using the config file provide.
pylint --rcfile=../gtg_lint_file <your_file>
-
Spaces are used for indentation. NO TABS!!
-
Limit lines of code to a maximum of 120 characters.
-
Imports should ALL be placed at the top of the file in the following order
-
Standard library imports
-
Third party imports
-
Local application/ library specific imports
-
-
Use single-quoted strings
-
Class names should use the CapWords convention.
-
Function names should use lower_case_with_underscores
-
Variable names should use mixedCase
-
Constants are defined on a module level and written in all capital letters with underscores separating words. e.g. ECCENTRICITY_THRESHOLD_MAX = 1.0
-
Please write comprehensive extensive document strings for all modules, functions and classes following these standards:
-
Place docstring below the def line.
-
Follow the format below for the docstring Purpose:: A sentence or two describing the purpose of the module, function or class
-
Input:: name of parameter: a input type representing definition e.g. prunedGraph: a Networkx Graph representing the cloud clusters
Returns:: name of variable: a input type representing definition e.g. finalMCCList: a list of list of tuples representing a MCC
Generates:: output type in location for description e.g. plots in /images for each MCS cloud elements
Assumptions:: As it relates to the code and the repo, if necessary.
- Be consistent with the codebase regarding whitespaces in expressions.
e.g. if a == 4: print a
`cloudElement['time']`
`x = x*2 + 1`
`c = (a+b) / (a-b)`
`findCloudElements(mergImgs,timelist,TRMMdirName=None)`
For the generalizations of these rules, see Tim Peters' guidelines in PEP20.