Development documents and examples for stack-data
6 | for i in range(5): 7 | row = [] 8 | result.append(row) --> 9 | print_stack() 10 | for j in range(5): ``` The code for `print_stack()` is fairly self-explanatory. If you want to learn more details about a particular class or method I suggest looking through some docstrings. `FrameInfo` is a class that accepts either a frame or a traceback object and provides a bunch of nice attributes and properties (which are cached so you don't need to worry about performance). In particular `frame_info.lines` is a list of `Line` objects. `line.render()` returns the source code of that line suitable for display. Without any arguments it simply strips any common leading indentation. Later on we'll see a more powerful use for it. You can see that `frame_info.lines` includes some lines of surrounding context. By default it includes 3 pieces of context before the main line and 1 piece after. We can configure the amount of context by passing options: ```python options = stack_data.Options(before=1, after=0) frame_info = stack_data.FrameInfo(frame, options) ``` Then the output looks like: ```
acquired package info from repodata DB: repodata/69e709f4d2852d98f12867a74015d19384fe2727ff670fd70178cdde80b1e77e-primary.sqlite.bz2