# ormaos tree

> Shows the calls below a recording or a call, with the shape of each argument and result, where each call is and how long it took.

```text
ormaos tree [-h] [--json] [--limit N] [--offset N] [--depth N]
            [--file GLOB] [--function NAME]
            [address]
```

| Argument | From the parser | Default |
|---|---|---|
| `address` | `last` (the default), a recording such as r3, or an address inside one: r3:c42 (a call), r3:e5 (an exception), r3:i7 (an io event), r3:l2 (a logging record) | `last` |
| `--json` | print JSON on stdout. |  |
| `--limit N` | show at most N entries (default 30) | `30` |
| `--offset N` | skip the first N entries. |  |
| `--depth N` | how many levels below the address (default 2) | `2` |
| `--file GLOB` | only the calls of the files that match, as a flat list: 'inventory.py', 'app/*.py' (the path as shown, or the file name) |  |
| `--function NAME` | only the calls of this function, as a flat list: check_order, Order.total, or a glob such as 'check_*'. |  |

```console
$ ormaos tree r1 --depth 2
r1:c1 <module>() -> raised  job.py:1  …  io 182  logs 8  calls below: 5
  r1:c2 <module>() -> NoneType  fetch.py:1  …
  r1:c3 <module>() -> NoneType  inventory.py:1  …  calls below: 1
    r1:c4 UnknownSkuError() -> NoneType  inventory.py:40  …
  r1:c5 <module>() -> NoneType  parse.py:1  …  calls below: 5
    r1:c6 ParseError() -> NoneType  parse.py:11  …
    r1:c7 Order() -> NoneType  parse.py:15  …
    r1:c8 Order.__annotate__(format: int) -> dict[6]  parse.py:15  …
    r1:c9 <module>() -> NoneType  <string>:1  …
    r1:c10 __create_fn__(__dataclass_HAS_DEFAULT_FACTORY__: dataclasses._HAS_DEFAULT_FACTORY_CLASS, ...) -> tuple[6 function]  <string>:1  …
  r1:c11 <module>() -> NoneType  validate.py:1  …  calls below: 4
    r1:c12 ValidationError() -> NoneType  validate.py:10  …
    r1:c13 SkuFormatError() -> NoneType  validate.py:14  …
    r1:c14 QuantityError() -> NoneType  validate.py:18  …
    r1:c15 UnitError() -> NoneType  validate.py:38  …
  r1:c16 main(argv: NoneType) -> int  job.py:63  …  io 182  logs 8  calls below: 4
    r1:c17 configure_logging() -> NoneType  job.py:28  …
    r1:c18 connect(db_path: pathlib.PosixPath) -> sqlite3.Connection  inventory.py:44  …  io 1
    r1:c19 load_orders(source: str[3], orders_csv: pathlib.PosixPath) -> list[36 parse.Order]  job.py:37  …  io 1  logs 1  calls below: 2
    r1:c130 sync_orders(conn: sqlite3.Connection, orders: list[36 parse.Order]) -> int  job.py:49  …  io 180  logs 6  [swallowed 6x validate.SkuFormatError: r1:e1]  calls below: 66
next: ormaos exceptions r1:e1 | ormaos tree r1:c19 | ormaos exceptions r1
```

Each line is one call: its address, the qualified name, the shape of each argument and of the result (`-> raised` when it ended with an exception), the file and line, the duration, then what it holds: `io N`, `logs N`, the exceptions it swallowed, and `calls below: N`. Under a call that received or returned a DataFrame, an array or a tensor, one more line per such value says its rows, columns, dtypes and nulls, or its shape, dtype, device, NaN and inf.

When a list, tuple, set or dict has more than 50 items, its length is exact and the types are those of its first 50 items: `list[1000 int in the first 50]`.

## Arguments

### `address`

A recording (the top of its calls), a call, or an exception (the call that handled it). Default `last`.

### `--depth N`

How many levels below the address. Default 2.

### `--limit N`

At most N calls. Default 30. The answer says how many were not shown and gives the `--offset` to see them.

### `--offset N`

Skips the first N calls.

```console
$ ormaos tree r1:c130 --depth 1 --limit 4
inside: r1:c1 <module> > r1:c16 main
r1:c130 sync_orders(conn: sqlite3.Connection, orders: list[36 parse.Order]) -> int  job.py:49  …  io 180  logs 6  [swallowed 6x validate.SkuFormatError: r1:e1]  calls below: 66
  r1:c131 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
  r1:c135 apply_order(conn: sqlite3.Connection, order: parse.Order) -> bool  inventory.py:78  …  io 6  calls below: 1
  r1:c137 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
... 63 of the 66 calls directly below r1:c130 are not shown (34 check_order, 29 apply_order; 6 raised): --offset 3
next: ormaos exceptions r1:e1 | ormaos tree r1:c130 --offset 3 | ormaos tree r1:c131 | ormaos tree r1:c16 | ormaos exceptions r1:c130
```

### `--function NAME`

A flat list of every call of one function below the address, in the order they ran. The name is the qualified name (`Order.total`), its last part (`total`) or a glob (`check_*`).

```console
$ ormaos tree r1 --function check_order --limit 5
r1: 36 of the 322 calls match --function check_order (36 check_order; 6 raised)
r1:c131 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
r1:c137 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
r1:c143 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
r1:c149 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
r1:c155 check_order(order: parse.Order) -> NoneType  validate.py:47  …  calls below: 3
... 31 more: --offset 5
next: ormaos tree r1:c131 | ormaos tree r1:c137 | ormaos tree r1 --offset 5 --function check_order | ormaos tree r1 | ormaos exceptions r1
```

### `--file GLOB`

A flat list of the calls of the files that match: `'inventory.py'`, `'app/*.py'`. The glob is matched against the path as shown and against the file name.

### `--json`

One JSON document of kind `tree`. Schema: [/schemas/tree.json](/schemas/tree.json).

---

Source: https://docs.ormaos.com/python/reference/cli/tree/ · ormaos 0.0.1 · ormaos-python 968f69776c · ormaos-examples 6e27be5922
