__init__.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码
def __init__(self, dParams):
        PlatformBase.__init__(self, dParams)

        #
        # Since the code runs on all platforms, we have to do a lot of
        # importing here instead of at the top of the file where it's normally located.
        #
        from win32com import universal
        from win32com.client import gencache, DispatchBaseClass
        from win32com.client import constants, getevents
        import win32com
        import pythoncom
        import win32api
        import winerror
        from win32con import DUPLICATE_SAME_ACCESS
        from win32api import GetCurrentThread, GetCurrentThreadId, DuplicateHandle, GetCurrentProcess
        import threading

        self.winerror = winerror

        pid = GetCurrentProcess()
        self.tid = GetCurrentThreadId()
        handle = DuplicateHandle(pid, GetCurrentThread(), pid, 0, 0, DUPLICATE_SAME_ACCESS)
        self.handles = []
        self.handles.append(handle)

        # Hack the COM dispatcher base class so we can modify method and
        # attribute names to match those in xpcom.
        if _g_dCOMForward['setattr'] is None:
            _g_dCOMForward['getattr'] = DispatchBaseClass.__dict__['__getattr__']
            _g_dCOMForward['setattr'] = DispatchBaseClass.__dict__['__setattr__']
            setattr(DispatchBaseClass, '__getattr__', _CustomGetAttr)
            setattr(DispatchBaseClass, '__setattr__', _CustomSetAttr)

        # Hack the exception base class so the users doesn't need to check for
        # XPCOM or COM and do different things.
        ## @todo

        #
        # Make sure the gencache is correct (we don't quite follow the COM
        # versioning rules).
        #
        self.flushGenPyCache(win32com.client.gencache)
        win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
        win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')

        self.oIntCv = threading.Condition()
        self.fInterrupted = False

        _ = dParams
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号