081bfc7df6fb857ac0af0eda1571f4d28e94ae60 vsmalladi Fri May 11 10:36:18 2012 -0700 Updated files to state the new name of the library, didn't modify examples as that would be too hard to update with constant reorganization. Redmine #7029. diff --git python/style.txt python/style.txt index 0f138f6..b55a218 100644 --- python/style.txt +++ python/style.txt @@ -50,61 +50,61 @@ Numbers are considered words. You would represent "chromosome 22 annotations" as "chromosome22Annotations" or "chr22Ann." Note the capitalized 'A" after the 22. Packages and Modules In Python, a package is represented as a directory with an __init__.py file in it, and contains some number of modules, which are represented as files with a .py extension. A module may in turn contain any number of related classes and methods. This differs from Java, where one file correlates to one class: in Python it is correct to treat one module similar to a whole namespace in Java. In general try to keep modules on the order of 100's of lines. Internal packages and modules should have short names in mixedCase, with no spaces or underscores. -A good example of this style is the ucscGenomics package: +A good example of this style is the ucscGb package: - ucscGenomics/ + ucscGb/ __init__.py ra.py cv.py ... For more information: http://docs.python.org/tutorial/modules.html Imports The most correct way to import something in Python is by specifying its containing module: import os - from ucscGenomics import ra + from ucscGb import ra Then, the qualified name can be used: someRa = ra.RaFile() Do not import as below, as this may cause local naming conflicts: - from ucscGenomics.ra import RaFile - from ucscGenomics.track import * + from ucscGb.ra import RaFile + from ucscGb.track import * Imports should follow the structure: 1. Each import should be on a separate line, unless modules are from the same package: import os import sys - from ucscGenomics import ra, track, qa + from ucscGb import ra, track, qa 2. Imports should be at the top of the file. Each section should be separated by a blank line: a. standard library imports b. third party package/module imports c. local package/module imports For more information, see the "Imports" section: http://www.python.org/dev/peps/pep-0008/ Classes CapitalCase names. Note the leading capital letter to distinguish between a ClassName and