Return True if obj is a coroutine object.
(obj)
| 39 | |
| 40 | |
| 41 | def iscoroutine(obj): |
| 42 | """Return True if obj is a coroutine object.""" |
| 43 | if type(obj) in _iscoroutine_typecache: |
| 44 | return True |
| 45 | |
| 46 | if isinstance(obj, _COROUTINE_TYPES): |
| 47 | # Just in case we don't want to cache more than 100 |
| 48 | # positive types. That shouldn't ever happen, unless |
| 49 | # someone stressing the system on purpose. |
| 50 | if len(_iscoroutine_typecache) < 100: |
| 51 | _iscoroutine_typecache.add(type(obj)) |
| 52 | return True |
| 53 | else: |
| 54 | return False |
| 55 | |
| 56 | |
| 57 | def _format_coroutine(coro): |
no test coverage detected
searching dependent graphs…