当前位置: 首页>>代码示例>>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;未经允许,请勿转载。