home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_2851 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  1.9 KB  |  53 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from win32com.server.exception import Exception
  5. from pywintypes import UnicodeType
  6. import winerror
  7.  
  8. class Interpreter:
  9.     _public_methods_ = [
  10.         'Exec',
  11.         'Eval']
  12.     _reg_verprogid_ = 'Python.Interpreter.2'
  13.     _reg_progid_ = 'Python.Interpreter'
  14.     _reg_desc_ = 'Python Interpreter'
  15.     _reg_clsid_ = '{30BD3490-2632-11cf-AD5B-524153480001}'
  16.     _reg_class_spec_ = 'win32com.servers.interp.Interpreter'
  17.     
  18.     def __init__(self):
  19.         self.dict = { }
  20.  
  21.     
  22.     def Eval(self, exp):
  23.         if type(exp) not in [
  24.             type(''),
  25.             UnicodeType]:
  26.             raise Exception(desc = 'Must be a string', scode = winerror.DISP_E_TYPEMISMATCH)
  27.         type(exp) not in [
  28.             type(''),
  29.             UnicodeType]
  30.         return eval(str(exp), self.dict)
  31.  
  32.     
  33.     def Exec(self, exp):
  34.         if type(exp) not in [
  35.             type(''),
  36.             UnicodeType]:
  37.             raise Exception(desc = 'Must be a string', scode = winerror.DISP_E_TYPEMISMATCH)
  38.         type(exp) not in [
  39.             type(''),
  40.             UnicodeType]
  41.         exec str(exp) in self.dict
  42.  
  43.  
  44.  
  45. def Register():
  46.     import win32com.server.register as win32com
  47.     return win32com.server.register.UseCommandLine(Interpreter)
  48.  
  49. if __name__ == '__main__':
  50.     print 'Registering COM server...'
  51.     Register()
  52.  
  53.