home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / hooks.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  787 b   |  34 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. from __future__ import with_statement
  5. from peak.util.plugins import Hook
  6. from traceback import print_exc
  7. __all__ = [
  8.     'register',
  9.     'reduce',
  10.     'foldl']
  11.  
  12. def register(hook_identifier, cb):
  13.     return Hook(hook_identifier).register(cb)
  14.  
  15.  
  16. def reduce(hook_identifier, arg, raise_exceptions = False):
  17.     for hook in Hook(hook_identifier):
  18.         if raise_exceptions:
  19.             arg = hook(arg)
  20.             continue
  21.         
  22.         try:
  23.             arg = hook(arg)
  24.         continue
  25.         except Exception:
  26.             print_exc()
  27.             continue
  28.         
  29.  
  30.     
  31.     return arg
  32.  
  33. foldl = reduce
  34.