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


Python functools.WRAPPER_ASSIGNMENTS屬性代碼示例

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


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

示例1: update_wrapper

# 需要導入模塊: import functools [as 別名]
# 或者: from functools import WRAPPER_ASSIGNMENTS [as 別名]
def update_wrapper(wrapper,
                   wrapped,
                   assigned = functools.WRAPPER_ASSIGNMENTS,
                   updated = functools.WRAPPER_UPDATES):
    """
    Patch two bugs in functools.update_wrapper.
    """
    # workaround for http://bugs.python.org/issue3445
    assigned = tuple(attr for attr in assigned if hasattr(wrapped, attr))
    wrapper = functools.update_wrapper(wrapper, wrapped, assigned, updated)
    # workaround for https://bugs.python.org/issue17482
    wrapper.__wrapped__ = wrapped
    return wrapper 
開發者ID:kislyuk,項目名稱:aegea,代碼行數:15,代碼來源:functools_lru_cache.py

示例2: wraps

# 需要導入模塊: import functools [as 別名]
# 或者: from functools import WRAPPER_ASSIGNMENTS [as 別名]
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
              updated=functools.WRAPPER_UPDATES):
        def wrapper(f):
            f = functools.wraps(wrapped, assigned, updated)(f)
            f.__wrapped__ = wrapped
            return f
        return wrapper 
開發者ID:rafasashi,項目名稱:razzy-spinner,代碼行數:9,代碼來源:six.py

示例3: _update_wrapper

# 需要導入模塊: import functools [as 別名]
# 或者: from functools import WRAPPER_ASSIGNMENTS [as 別名]
def _update_wrapper(wrapper, wrapped,
                        assigned=functools.WRAPPER_ASSIGNMENTS,
                        updated=functools.WRAPPER_UPDATES):
        for attr in assigned:
            try:
                value = getattr(wrapped, attr)
            except AttributeError:
                continue
            else:
                setattr(wrapper, attr, value)
        for attr in updated:
            getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
        wrapper.__wrapped__ = wrapped
        return wrapper 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:16,代碼來源:six.py

示例4: wraps

# 需要導入模塊: import functools [as 別名]
# 或者: from functools import WRAPPER_ASSIGNMENTS [as 別名]
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
              updated=functools.WRAPPER_UPDATES):
        return functools.partial(_update_wrapper, wrapped=wrapped,
                                 assigned=assigned, updated=updated) 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:6,代碼來源:six.py

示例5: wraps

# 需要導入模塊: import functools [as 別名]
# 或者: from functools import WRAPPER_ASSIGNMENTS [as 別名]
def wraps(
        wrapped,
        assigned=functools.WRAPPER_ASSIGNMENTS,
        updated=functools.WRAPPER_UPDATES,
    ):
        def wrapper(f):
            f = functools.wraps(wrapped, assigned, updated)(f)
            f.__wrapped__ = wrapped
            return f

        return wrapper 
開發者ID:remg427,項目名稱:misp42splunk,代碼行數:13,代碼來源:six.py


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