當前位置: 首頁>>代碼示例>>Python>>正文


Python types.GetSetDescriptorType方法代碼示例

本文整理匯總了Python中types.GetSetDescriptorType方法的典型用法代碼示例。如果您正苦於以下問題:Python types.GetSetDescriptorType方法的具體用法?Python types.GetSetDescriptorType怎麽用?Python types.GetSetDescriptorType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在types的用法示例。


在下文中一共展示了types.GetSetDescriptorType方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: isgetsetdescriptor

# 需要導入模塊: import types [as 別名]
# 或者: from types import GetSetDescriptorType [as 別名]
def isgetsetdescriptor(object):
        """Return true if the object is a getset descriptor.

        getset descriptors are specialized descriptors defined in extension
        modules."""
        return isinstance(object, types.GetSetDescriptorType) 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:8,代碼來源:inspect.py

示例2: _shadowed_dict

# 需要導入模塊: import types [as 別名]
# 或者: from types import GetSetDescriptorType [as 別名]
def _shadowed_dict(klass):
    dict_attr = type.__dict__["__dict__"]
    for entry in _static_getmro(klass):
        try:
            class_dict = dict_attr.__get__(entry)["__dict__"]
        except KeyError:
            pass
        else:
            if not (type(class_dict) is types.GetSetDescriptorType and
                    class_dict.__name__ == "__dict__" and
                    class_dict.__objclass__ is entry):
                return class_dict
    return _sentinel 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:15,代碼來源:inspect.py

示例3: _shadowed_dict_newstyle

# 需要導入模塊: import types [as 別名]
# 或者: from types import GetSetDescriptorType [as 別名]
def _shadowed_dict_newstyle(klass):
    dict_attr = type.__dict__['__dict__']
    for entry in _static_getmro(klass):
        try:
            class_dict = dict_attr.__get__(entry)['__dict__']
        except KeyError:
            pass
        else:
            if not (type(class_dict) is types.GetSetDescriptorType and  # noqa
                    class_dict.__name__ == '__dict__' and
                    class_dict.__objclass__ is entry):
                return class_dict
    return _sentinel 
開發者ID:ionelmc,項目名稱:python-hunter,代碼行數:15,代碼來源:inspect.py

示例4: save_dictproxy

# 需要導入模塊: import types [as 別名]
# 或者: from types import GetSetDescriptorType [as 別名]
def save_dictproxy(pickler, obj):
        log.info("Dp: %s" % obj)
        attr = obj.get('__dict__')
       #pickler.save_reduce(_create_dictproxy, (attr,'nested'), obj=obj)
        if type(attr) == GetSetDescriptorType and attr.__name__ == "__dict__" \
        and getattr(attr.__objclass__, "__dict__", None) == obj:
            pickler.save_reduce(getattr, (attr.__objclass__,"__dict__"),obj=obj)
            return
        # all bad below... so throw ReferenceError or TypeError
        from weakref import ReferenceError
        raise ReferenceError("%s does not reference a class __dict__" % obj) 
開發者ID:dagbldr,項目名稱:dagbldr,代碼行數:13,代碼來源:dill.py


注:本文中的types.GetSetDescriptorType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。