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


Python mock.FILTER_DIR屬性代碼示例

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


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

示例1: __dir__

# 需要導入模塊: import mock [as 別名]
# 或者: from mock import FILTER_DIR [as 別名]
def __dir__(self):
        """Filter the output of `dir(mock)` to only useful members."""
        if not mock.FILTER_DIR and getattr(object, '__dir__', None):
            # object.__dir__ is not in 2.7
            return object.__dir__(self)

        extras = self._mock_methods or []
        from_type = dir(type(self))
        from_dict = list(self.__dict__)

        if mock.FILTER_DIR:
            # object.__dir__ is not in 2.7
            from_type = [e for e in from_type if not e.startswith('_')]
            from_dict = [e for e in from_dict if not e.startswith('_') or
                         _is_magic(e)]
        return sorted(set(extras + from_type + from_dict +
                          list(self._mock_children))) 
開發者ID:abhisuri97,項目名稱:auto-alt-text-lambda-api,代碼行數:19,代碼來源:mock.py

示例2: __dir__

# 需要導入模塊: import mock [as 別名]
# 或者: from mock import FILTER_DIR [as 別名]
def __dir__(self):
        """Filter the output of `dir(mock)` to only useful members."""
        if not mock.FILTER_DIR and getattr(object, '__dir__', None):
            # object.__dir__ is not in 2.7
            return object.__dir__(self)

        extras = self._mock_methods or []
        from_type = dir(type(self))
        from_dict = list(self.__dict__)
        from_child_mocks = [
            m_name for m_name, m_value in self._mock_children.items()
            if m_value is not _deleted]

        if mock.FILTER_DIR:
            # object.__dir__ is not in 2.7
            from_type = [e for e in from_type if not e.startswith('_')]
            from_dict = [e for e in from_dict if not e.startswith('_') or
                         _is_magic(e)]

        return sorted(set(extras + from_type + from_dict + from_child_mocks)) 
開發者ID:ali5h,項目名稱:rules_pip,代碼行數:22,代碼來源:mock.py

示例3: _isidentifier

# 需要導入模塊: import mock [as 別名]
# 或者: from mock import FILTER_DIR [as 別名]
def _isidentifier(string):
        if string in keyword.kwlist:
            return False
        return regex.match(string)


# NOTE: This FILTER_DIR is not used. The binding in mock.FILTER_DIR is. 
開發者ID:ali5h,項目名稱:rules_pip,代碼行數:9,代碼來源:mock.py


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