home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / plugins / digsby_achievements / adapters.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  2.4 KB  |  72 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import types
  5. import protocols
  6. from interfaces import IThresholdAchievementPoster, IAccountAchievementPoster, IMultiAccountAchievementPoster
  7.  
  8. class InterfaceAdapter(object):
  9.     myclass = None
  10.     
  11.     def __init__(self, object):
  12.         
  13.         try:
  14.             for name, func in (lambda .0: for name, func in .0:
  15. if isinstance(func, types.FunctionType):
  16. (name, func)continue)(self.myclass.__dict__.iteritems()):
  17.                 getattr(object, name)
  18.         except AttributeError:
  19.             e = None
  20.             raise protocols.AdaptationFailure(e)
  21.  
  22.         self.object = object
  23.  
  24.     
  25.     def __getattr__(self, attr):
  26.         
  27.         try:
  28.             return object.__getattribute__(self, attr)
  29.         except AttributeError:
  30.             e = None
  31.             
  32.             try:
  33.                 return getattr(self.object, attr)
  34.             except AttributeError:
  35.                 raise e
  36.             except:
  37.                 None<EXCEPTION MATCH>AttributeError
  38.             
  39.  
  40.             None<EXCEPTION MATCH>AttributeError
  41.  
  42.  
  43.  
  44.  
  45. class ThresholdAchievementPoster(InterfaceAdapter):
  46.     myclass = IThresholdAchievementPoster
  47.     protocols.advise(instancesProvide = [
  48.         myclass])
  49.  
  50.  
  51. class AccountAchievementPoster(InterfaceAdapter):
  52.     myclass = IAccountAchievementPoster
  53.     protocols.advise(instancesProvide = [
  54.         myclass])
  55.  
  56.  
  57. class MultiAccountAchievementPoster(InterfaceAdapter):
  58.     myclass = IMultiAccountAchievementPoster
  59.     protocols.advise(instancesProvide = [
  60.         myclass])
  61.  
  62. from common import AccountBase
  63. protocols.declareAdapter(ThresholdAchievementPoster, provides = [
  64.     ThresholdAchievementPoster.myclass], forTypes = [
  65.     AccountBase])
  66. protocols.declareAdapter(AccountAchievementPoster, provides = [
  67.     AccountAchievementPoster.myclass], forTypes = [
  68.     AccountBase])
  69. protocols.declareAdapter(MultiAccountAchievementPoster, provides = [
  70.     MultiAccountAchievementPoster.myclass], forTypes = [
  71.     AccountBase])
  72.