| Home | Trees | Index | Help |
|
|---|
| Package cheesecake :: Module cheesecake_index |
|
Cheesecake: How tasty is your code?
The idea of the Cheesecake project is to rank Python packages based on various empirical "kwalitee" factors, such as:
- whether the package can be downloaded from PyPI given its name
- whether the package can be unpacked
- whether the package can be installed into an alternate directory
- existence of certain files such as README, INSTALL, LICENSE, setup.py etc.
- percentage of modules/functions/classes/methods with docstrings
- ... and many others
| Classes | |
|---|---|
Cheesecake |
Computes 'goodness' of Python packages. |
CheesecakeIndex |
|
FilesIndex |
|
Index |
Class describing one index. |
IndexCodeKwalitee |
|
IndexDocstrings |
Compute how many objects have relevant docstrings. |
IndexDocumentation |
|
IndexFormattedDocstrings |
Compute how many of existing docstrings include any formatting, like epytext or reST. |
IndexGeneratedFiles |
Lower score for automatically generated files that should not be present in a package. |
IndexInstall |
Check if package can be installed via "python setup.py" command. |
IndexInstallability |
|
IndexPEP8 |
Compute PEP8 index for the modules in the package. |
IndexPyLint |
Compute pylint index of the whole package. |
IndexPyPIDownload |
Check if package was successfully downloaded from PyPI and how far from it actual package was. |
IndexRequiredFiles |
Check for existence of important files, like README or INSTALL. |
IndexSetupPy |
Reward packages that have setup.py file. |
IndexUnitTested |
Check if the package has unit tests which can be easily found by any of known test frameworks. |
IndexUnitTests |
Compute unittest index as percentage of methods/functions that are exercised in unit tests. |
IndexUnpack |
Give points for successful unpacking of a package archive. |
IndexUnpackDir |
Check if package unpack directory resembles package archive name. |
IndexUrlDownload |
Give points for successful downloading of a package. |
NameSetter |
|
OneOf |
|
Step |
Single step during computation of package score. |
StepByVariable |
Step which is always run if given Cheesecake instance variable is true. |
| Exceptions | |
|---|---|
CheesecakeError |
Custom exception class for Cheesecake-specific errors. |
| Function Summary | |
|---|---|
Convert name from CamelCase to underscore_name. | |
Discover type of a file according to its name and its parent directory. | |
Doc(name)
| |
Pass list of strings in chunks of size not greater than max_length. | |
Return attributes dictionary with keys from names. | |
Return list of all files and directories below root. | |
Return files from file_list that match given file_type. | |
Return tuple of arguments for given method, excluding self. | |
Return package name and type. | |
Get package name as file portion of path. | |
Use urlparse to obtain package name from URL. | |
Check if filename has given extension. | |
Covert index class name to index name. | |
Returns True if file or directory pointed by path is empty. | |
Check whether object is iterable. | |
Overall length of all strings in list. | |
Display Cheesecake index for package specified via command-line options. | |
make_indices_dict(indices)
| |
Parse command-line options. | |
sorted(L)
| |
Strip root part from path. | |
Handy way of writing Cheese rules for files with extensions. | |
| Variable Summary | |
|---|---|
str |
__revision__ = '176'
|
| Function Details |
|---|
camel2underscore(name)Convert name from CamelCase to underscore_name.
>>> camel2underscore('CamelCase')
'camel_case'
>>> camel2underscore('already_underscore_name')
'already_underscore_name'
>>> camel2underscore('BigHTMLClass')
'big_html_class'
>>> camel2underscore('')
''
|
discover_file_type(filename)Discover type of a file according to its name and its parent directory.
>>> discover_file_type('module.py')
'module'
>>> discover_file_type('./setup.py')
'special'
>>> discover_file_type('some/directory/junk.pyc')
'pyc'
>>> discover_file_type('examples/readme.txt')
>>> discover_file_type('examples/runthis.py')
'demo'
>>> discover_file_type('optimized.pyo')
'pyo'
>>> test_files = ['ut/test_this_and_that.py', ... 'another_test.py', ... 'TEST_MY_MODULE.PY'] >>> for filename in test_files: ... assert discover_file_type(filename) == 'test', filename
>>> discover_file_type('this_is_not_a_test_really.py')
'module'
|
generate_arguments(arguments, max_length)Pass list of strings in chunks of size not greater than max_length. >>> for x in generate_arguments(['abc', 'def'], 4): ... print x ['abc'] ['def'] >>> for x in generate_arguments(['a', 'bc', 'd', 'e', 'f'], 2): ... print x ['a'] ['bc'] ['d', 'e'] ['f']
|
get_attributes(obj, names)Return attributes dictionary with keys from Object is queried for each attribute name, if it doesn't have this attribute, default value None will be returned. >>> class Class: ... pass >>> obj = Class() >>> obj.attr = True >>> obj.value = 13 >>> obj.string = "Hello"
>>> d = get_attributes(obj, ['attr', 'string', 'other'])
>>> d == {'attr': True, 'string': "Hello", 'other': None}
True
|
get_files_dirs_list(root)Return list of all files and directories below Root directory is excluded from files/directories paths. |
get_files_of_type(file_list, file_type)Return files from >>> file_list = ['test/test_foo.py', 'setup.py', 'README', 'test/test_bar.py'] >>> get_files_of_type(file_list, 'test') ['test/test_foo.py', 'test/test_bar.py'] |
get_method_arguments(method)Return tuple of arguments for given method, excluding self.
>>> class Class:
... def method(s, arg1, arg2, other_arg):
... pass
>>> get_method_arguments(Class.method)
('arg1', 'arg2', 'other_arg')
|
get_package_name_and_type(package, known_extensions)Return package name and type. Package type must exists in known_extensions list. Otherwise None is returned.
>>> extensions = ['tar.gz', 'zip']
>>> get_package_name_and_type('underscored_name.zip', extensions)
('underscored_name', 'zip')
>>> get_package_name_and_type('unknown.extension.txt', extensions)
|
get_package_name_from_path(path)Get package name as file portion of path.
>>> get_package_name_from_path('/some/random/path/package.tar.gz')
'package.tar.gz'
>>> get_package_name_from_path('/path/underscored_name.zip')
'underscored_name.zip'
>>> get_package_name_from_path('/path/unknown.extension.txt')
'unknown.extension.txt'
|
get_package_name_from_url(url)Use urlparse to obtain package name from URL.
>>> get_package_name_from_url('http://www.example.com/file.tar.bz2')
'file.tar.bz2'
>>> get_package_name_from_url('https://www.example.com/some/dir/file.txt')
'file.txt'
|
has_extension(filename, ext)Check if filename has given extension.
>>> has_extension("foobar.py", ".py")
True
>>> has_extension("foo.bar.py", ".py")
True
>>> has_extension("foobar.pyc", ".py")
False
|
index_class_to_name(clsname)Covert index class name to index name.
>>> index_class_to_name("IndexDownload")
'download'
>>> index_class_to_name("IndexUnitTests")
'unit_tests'
>>> index_class_to_name("IndexPyPIDownload")
'py_pi_download'
|
is_empty(path)Returns True if file or directory pointed by |
isiterable(obj)Check whether object is iterable.
>>> isiterable([1,2,3])
True
>>> isiterable("string")
True
>>> isiterable(object)
False
|
length(L)Overall length of all strings in list. >>> length(['a', 'bc', 'd', '', 'efg']) 7 |
main()Display Cheesecake index for package specified via command-line options. |
process_cmdline_args()Parse command-line options. |
strip_dir_part(path, root)
>>> strip_dir_part('/home/ruby/file', '/home')
'ruby/file'
>>> strip_dir_part('/home/ruby/file', '/home/')
'ruby/file'
>>> strip_dir_part('/home/ruby/', '/home')
'ruby/'
>>> strip_dir_part('/home/ruby/', '/home/')
'ruby/'
|
WithOptionalExt(name, extensions)Handy way of writing Cheese rules for files with extensions.
|
| Variable Details |
|---|
__revision__
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Fri Feb 9 02:15:13 2007 | http://epydoc.sf.net |