module documentation

A collection of utility functions and classes FROM MATPLOTLIB. Many (but not all) from the Python Cookbook -- hence the name cbook.

Class Bunch Often we want to just collect a bunch of stuff together, naming each item of the bunch; a dictionary's OK for that, but a small do- nothing class is even handier, and prettier to use. Whenever you want to group a few variables:...
Class Null Null objects always and reliably "do nothing."
Class RingBuffer class that implements a not-yet-full buffer
Class silent_list override repr when returning a list of matplotlib artists to prevent long, meaningless output. This is meant to be used for a homogeneous list of a give type
Class Sorter Sort by attribute or item
Class Stack Implement a stack where elements can be pushed on and you can move back and forth. But no pop. Should mimic home / back / forward in a browser.
Class Xlator All-in-one multiple-string-substitution class
Function allequal return true if all elements of seq compare equal. If seq is 0 or 1 length, return True
Function allpairs Return all possible pairs in sequence x
Function alltrue Undocumented
Function dict_delall delete all of the keys from the dict d
Function exception_to_str Undocumented
Function finddir return all attributes of o which match string in match. if case is True require an exact case match.
Function flatten this generator flattens nested containers such as
Function get_recursive_filelist Recurs all the files and dirs in args ignoring symbolic links and return the files as a list of strings
Function get_split_ind seq is a list of words. Return the index into seq such that len(' '.join(seq[:ind])<=N
Function is_file_like Undocumented
Function is_scalar Undocumented
Function is_string_like Undocumented
Function iterable Undocumented
Function listFiles Recursively list files from Parmar and Martelli in the Python Cookbook
Function mkdirs Undocumented
Function onetrue Undocumented
Function pieces Break up the seq into num tuples
Function popall empty a list
Function reverse_dict reverse the dictionary -- may lose data if values are not uniq!
Function soundex soundex module conforming to Odell-Russell algorithm
Function strip_math remove latex formatting from mathtext
Function unique Return a list of unique elements of x
Function wrap wrap text with prefix at length cols
Variable major Undocumented
Variable minor1 Undocumented
Variable minor2 Undocumented
Variable s Undocumented
Variable tmp Undocumented
def allequal(seq): (source)

return true if all elements of seq compare equal. If seq is 0 or 1 length, return True

def allpairs(x): (source)

Return all possible pairs in sequence x Condensed by Alex Martelli from this thread on comp.lang.python:: http://groups.google.com/groups?q=all+pairs+group:*python*&hl=en&lr=&ie=UTF-8&selm=mailman.4028.1096403649.5135.python-list%40python.org&rnum=1

def alltrue(seq): (source)

Undocumented

def dict_delall(d, keys): (source)

delete all of the keys from the dict d

def exception_to_str(s=None): (source)

Undocumented

def finddir(o, match, case=False): (source)

return all attributes of o which match string in match. if case is True require an exact case match.

def flatten(seq, scalarp=is_scalar): (source)

this generator flattens nested containers such as >>> l=( ('John', 'Hunter'), (1,23), [[[[42,(5,23)]]]]) so that >>> for i in flatten(l): print i, John Hunter 1 23 42 5 23 By: Composite of Holger Krekel and Luther Blissett From: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/121294 and Recipe 1.12 in cookbook

def get_recursive_filelist(args): (source)

Recurs all the files and dirs in args ignoring symbolic links and return the files as a list of strings

def get_split_ind(seq, N): (source)

seq is a list of words. Return the index into seq such that len(' '.join(seq[:ind])<=N

def is_file_like(obj): (source)

Undocumented

def is_scalar(obj): (source)

Undocumented

def is_string_like(obj): (source)

Undocumented

def iterable(obj): (source)

Undocumented

def listFiles(root, patterns='*', recurse=1, return_folders=0): (source)

Recursively list files from Parmar and Martelli in the Python Cookbook

def mkdirs(newdir, mode=511): (source)

Undocumented

def onetrue(seq): (source)

Undocumented

def pieces(seq, num=2): (source)

Break up the seq into num tuples

def popall(seq): (source)

empty a list

def reverse_dict(d): (source)

reverse the dictionary -- may lose data if values are not uniq!

def soundex(name, len=4): (source)

soundex module conforming to Odell-Russell algorithm

def strip_math(s): (source)

remove latex formatting from mathtext

def unique(x): (source)

Return a list of unique elements of x

def wrap(prefix, text, cols): (source)

wrap text with prefix at length cols

major = (source)

Undocumented

minor1 = (source)

Undocumented

minor2 = (source)

Undocumented

Undocumented

Undocumented