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

Function _has_code_flag

Lib/inspect.py:285–296  ·  view source on GitHub ↗

Return true if ``f`` is a function (or a method or functools.partial wrapper wrapping a function or a functools.partialmethod wrapping a function) whose code object has the given ``flag`` set in its flags.

(f, flag)

Source from the content-addressed store, hash-verified

283 return isinstance(object, types.FunctionType)
284
285def _has_code_flag(f, flag):
286 """Return true if ``f`` is a function (or a method or functools.partial
287 wrapper wrapping a function or a functools.partialmethod wrapping a
288 function) whose code object has the given ``flag``
289 set in its flags."""
290 f = functools._unwrap_partialmethod(f)
291 while ismethod(f):
292 f = f.__func__
293 f = functools._unwrap_partial(f)
294 if not (isfunction(f) or _signature_is_functionlike(f)):
295 return False
296 return bool(f.__code__.co_flags & flag)
297
298def isgeneratorfunction(obj):
299 """Return true if the object is a user-defined generator function.

Callers 3

isgeneratorfunctionFunction · 0.85
iscoroutinefunctionFunction · 0.85
isasyncgenfunctionFunction · 0.85

Calls 3

ismethodFunction · 0.85
isfunctionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…