This repository was archived by the owner on Dec 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Style Guide
Chris Wells Wood edited this page Nov 14, 2016
·
1 revision
The style of ISAMBARD code should almost always adhere to PEP8. The few exceptions are as follows:
- Lines of code should be no longer than 120 characters.
- Comments should be no longer than 80 characters including the newline character, so they're effectively 79 chars.
- Do not write getters and setters manually, please use the property decorator and corresponding setter decorator.
- Use class attributes (section 9.3.5) to keep the
__init__method lightweight, by only defining an attribute in the__init__method if it is unique to the instance. - Use class methods to define alternate ways to instantiate a class. Try to avoid having multiple ways to instantiate a class in the
__init__method as this can be difficult to read. Consider which should be the preferred method of instantiation and use that to define the__init__. - Class methods should have names that start with 'from'. For example
Quaternion.from_axis_and_angle.
- Any class that inherits from
BaseAmpal, or any of its subclasses, is required to have following methods:get_atomsmake_pdb
- All strings produced by and fed into ISAMBARD must be in unicode, therefore if the external program requires byte strings, any decoding and decoding must occur in the body of the external program handler function.
- Any external program handler function that interacts with structural data from ISAMBARD should take a PDB string as an input (or a path to a pdb file) and if it returns any structural data it should return a PDB string, not an AMPAL object.
ISAMBARD - Woolfson Group, School of Chemistry, University of Bristol, 2017.