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

Function iscode

Lib/inspect.py:401–430  ·  view source on GitHub ↗

Return true if the object is a code object. Code objects provide these attributes: co_argcount number of arguments (not including *, ** args or keyword only arguments) co_code string of raw compiled bytecode co_cellvars

(object)

Source from the content-addressed store, hash-verified

399 return isinstance(object, types.FrameType)
400
401def iscode(object):
402 """Return true if the object is a code object.
403
404 Code objects provide these attributes:
405 co_argcount number of arguments (not including *, ** args
406 or keyword only arguments)
407 co_code string of raw compiled bytecode
408 co_cellvars tuple of names of cell variables
409 co_consts tuple of constants used in the bytecode
410 co_filename name of file in which this code object was created
411 co_firstlineno number of first line in Python source code
412 co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
413 | 16=nested | 32=generator | 64=nofree | 128=coroutine
414 | 256=iterable_coroutine | 512=async_generator
415 | 0x4000000=has_docstring
416 co_freevars tuple of names of free variables
417 co_posonlyargcount number of positional only arguments
418 co_kwonlyargcount number of keyword only arguments (not including ** arg)
419 co_lnotab encoded mapping of line numbers to bytecode indices
420 co_name name with which this code object was defined
421 co_names tuple of names other than arguments and function locals
422 co_nlocals number of local variables
423 co_stacksize virtual machine stack space required
424 co_varnames tuple of names of arguments and local variables
425 co_qualname fully qualified function name
426
427 co_lines() returns an iterator that yields successive bytecode ranges
428 co_positions() returns an iterator of source code positions for each bytecode instruction
429 replace() returns a copy of the code object with a new values"""
430 return isinstance(object, types.CodeType)
431
432def isbuiltin(object):
433 """Return true if the object is a built-in function or method.

Callers 3

getfileFunction · 0.85
findsourceFunction · 0.85
getargsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…