On this page
inspect.BlockFinder
Prev: inspect.Attribute | Up: inspect | Next: inspect.BoundArguments
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BoundArguments
Ref: docs.python.org — inspect.BlockFinder
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import BlockFinder
Signature & Overview
inspect.BlockFinder()
Provide a tokeneater() method to detect the end of a code block.
Methods & Attributes
BlockFinder.tokeneater(self, type, token, srowcol, erowcol, line)—BlockFinder.tokeneatermethod/property.
Usage
import inspect
# Internal token scanner used by inspect.getblock() to locate the end of a def/class block
bf = inspect.BlockFinder()
assert bf.started is False
Gotchas
- Internal helper for
inspect.getblock(): Callinspect.getsource()orinspect.getsourcelines()instead of usingBlockFinderdirectly.
REPL Inspect
from inspect import BlockFinder
help(BlockFinder)
Linked from
- tuts/python3/stdlib_module/inspect
- tuts/python3/stdlib_module/inspect/ArgInfo
- tuts/python3/stdlib_module/inspect/Arguments
- tuts/python3/stdlib_module/inspect/Attribute
- tuts/python3/stdlib_module/inspect/BoundArguments
- tuts/python3/stdlib_module/inspect/BufferFlags
- tuts/python3/stdlib_module/inspect/ClassFoundException
- tuts/python3/stdlib_module/inspect/classify_class_attrs
- tuts/python3/stdlib_module/inspect/cleandoc
- tuts/python3/stdlib_module/inspect/ClosureVars
- tuts/python3/stdlib_module/inspect/currentframe
- tuts/python3/stdlib_module/inspect/EndOfBlock
- tuts/python3/stdlib_module/inspect/findsource
- tuts/python3/stdlib_module/inspect/formatannotation
- tuts/python3/stdlib_module/inspect/formatannotationrelativeto
- tuts/python3/stdlib_module/inspect/formatargvalues
- tuts/python3/stdlib_module/inspect/FrameInfo
- tuts/python3/stdlib_module/inspect/FullArgSpec
- tuts/python3/stdlib_module/inspect/get_annotations
- tuts/python3/stdlib_module/inspect/getabsfile
- tuts/python3/stdlib_module/inspect/getargs
- tuts/python3/stdlib_module/inspect/getargvalues
- tuts/python3/stdlib_module/inspect/getasyncgenlocals
- tuts/python3/stdlib_module/inspect/getasyncgenstate
- tuts/python3/stdlib_module/inspect/getattr_static
- tuts/python3/stdlib_module/inspect/getblock
- tuts/python3/stdlib_module/inspect/getcallargs
- tuts/python3/stdlib_module/inspect/getclasstree
- tuts/python3/stdlib_module/inspect/getclosurevars
- tuts/python3/stdlib_module/inspect/getcomments
- tuts/python3/stdlib_module/inspect/getcoroutinelocals
- tuts/python3/stdlib_module/inspect/getcoroutinestate
- tuts/python3/stdlib_module/inspect/getdoc
- tuts/python3/stdlib_module/inspect/getfile
- tuts/python3/stdlib_module/inspect/getframeinfo
- tuts/python3/stdlib_module/inspect/getfullargspec
- tuts/python3/stdlib_module/inspect/getgeneratorlocals
- tuts/python3/stdlib_module/inspect/getgeneratorstate
- tuts/python3/stdlib_module/inspect/getinnerframes
- tuts/python3/stdlib_module/inspect/getlineno
- tuts/python3/stdlib_module/inspect/getmembers
- tuts/python3/stdlib_module/inspect/getmembers_static
- tuts/python3/stdlib_module/inspect/getmodule
- tuts/python3/stdlib_module/inspect/getmodulename
- tuts/python3/stdlib_module/inspect/getmro
- tuts/python3/stdlib_module/inspect/getouterframes
- tuts/python3/stdlib_module/inspect/Parameter
- tuts/python3/stdlib_module/inspect/Signature
- tuts/python3/stdlib_module/inspect/Traceback
Related notes
- tuts/python3/stdlib_module/inspect/ArgInfo Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Arguments Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Attribute Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BoundArguments Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/inspect/BufferFlags links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClassFoundException links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/classify_class_attrs links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/cleandoc links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClosureVars links to this page; shared tags: #inspect, #stdlib