policy.py 文件源码

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

项目:pupy 作者: ru-faraon 项目源码 文件源码
def _wrap_(self, object):
    """Wraps up the specified object.

       This function keeps a reference to the passed
       object, and may interogate it to determine how to respond to COM requests, etc.
    """
    # We "clobber" certain of our own methods with ones
    # provided by the wrapped object, iff they exist.
    self._name_to_dispid_ = { }
    ob = self._obj_ = object
    if hasattr(ob, '_query_interface_'):
      self._query_interface_ = ob._query_interface_

    if hasattr(ob, '_invoke_'):
      self._invoke_ = ob._invoke_

    if hasattr(ob, '_invokeex_'):
      self._invokeex_ = ob._invokeex_

    if hasattr(ob, '_getidsofnames_'):
      self._getidsofnames_ = ob._getidsofnames_

    if hasattr(ob, '_getdispid_'):
      self._getdispid_ = ob._getdispid_

    # Allow for override of certain special attributes.
    if hasattr(ob, '_com_interfaces_'):
      self._com_interfaces_ = []
      # Allow interfaces to be specified by name.
      for i in ob._com_interfaces_:
        if type(i) != pywintypes.IIDType:
          # Prolly a string!
          if i[0] != "{":
            i = pythoncom.InterfaceNames[i]
          else:
            i = pythoncom.MakeIID(i)
        self._com_interfaces_.append(i)
    else:
      self._com_interfaces_ = [ ]

  # "QueryInterface" handling.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号