MCPcopy Index your code
hub / github.com/python/cpython / _try_iter

Function _try_iter

Lib/unittest/mock.py:1137–1149  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1135
1136
1137def _try_iter(obj):
1138 if obj is None:
1139 return obj
1140 if _is_exception(obj):
1141 return obj
1142 if _callable(obj):
1143 return obj
1144 try:
1145 return iter(obj)
1146 except TypeError:
1147 # XXXX backwards compatibility
1148 # but this will blow up on first call - so maybe we should fail early?
1149 return obj
1150
1151
1152class CallableMixin(Base):

Callers 1

__set_side_effectMethod · 0.85

Calls 2

_is_exceptionFunction · 0.85
_callableFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…