Here are the examples of the python api mock.FILTER_DIR taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
Source : mock.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
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))
def __setattr__(self, name, value):
0
Source : mock.py
with GNU General Public License v3.0
from guohuadeng
with GNU General Public License v3.0
from guohuadeng
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)))
def __setattr__(self, name, value):