inspect.iscode()

inspect.iscode(object) Return true if the object is a code.

inspect.isclass()

inspect.isclass(object) Return true if the object is a class, whether built-in or created in Python code.

inspect.isbuiltin()

inspect.isbuiltin(object) Return true if the object is a built-in function or a bound built-in method.

inspect.isawaitable()

inspect.isawaitable(object) Return true if the object can be used in await expression. Can also be used to distinguish generator-based coroutines from regular generators: def gen(): yield @types.coroutine def gen_coro(): yield assert not isawaitable(gen()) assert isawaitable(gen_coro()) New in version 3.5.

inspect.isabstract()

inspect.isabstract(object) Return true if the object is an abstract base class.

inspect.getsourcelines()

inspect.getsourcelines(object) Return a list of source lines and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of the lines corresponding to the object and the line number indicates where in the original source file the first line of code was found. An OSError is raised if the source code cannot be retrieved. Changed in version 3.3: OSError is raised instead of IOError, now a

inspect.getsourcefile()

inspect.getsourcefile(object) Return the name of the Python source file in which an object was defined. This will fail with a TypeError if the object is a built-in module, class, or function.

inspect.getsource()

inspect.getsource(object) Return the text of the source code for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a single string. An OSError is raised if the source code cannot be retrieved. Changed in version 3.3: OSError is raised instead of IOError, now an alias of the former.

inspect.getouterframes()

inspect.getouterframes(frame, context=1) Get a list of frame records for a frame and all outer frames. These frames represent the calls that lead to the creation of frame. The first entry in the returned list represents frame; the last entry represents the outermost call on frame‘s stack. Changed in version 3.5: A list of named tuples FrameInfo(frame, filename, lineno, function, code_context, index) is returned.

inspect.getmro()

inspect.getmro(cls) Return a tuple of class cls’s base classes, including cls, in method resolution order. No class appears more than once in this tuple. Note that the method resolution order depends on cls’s type. Unless a very peculiar user-defined metatype is in use, cls will be the first element of the tuple.