## methods.Refusal


ibnr will not answer this input, and says why with a reason code.


Usage

``` python
methods.Refusal(
    reason,
    template,
    *,
    option=None,
    column=None,
    options=(),
    given=None,
    cells=(),
    links=(),
    rows=(),
    count=None,
    method=None,
    quoted=False
)
```


`str(refusal)` is the message, as for any `ValueError`. The fields say the same thing in a form a program can use. (ibnr builds one as `Refusal(reason, template, **fields)`: `template` is the message with the placeholders `{cells}`, `{origins}`, `{links}` and `{given}`, filled in from the fields, and `quoted=True` puts text labels in quotes. A caller only reads refusals; the fields below and [to_dict()](methods.Refusal.md#ibnr.methods.Refusal.to_dict) are the contract.)


## Attributes


`reason: str`  
One of `REASONS`.

`kind: str`  
`KIND[reason]`: `"input"` or `"model"`.

`method: str or None`  
The `ibnr.methods` function that refused, such as `"mack"`; `None` when a kernel was called directly.

`option: str or None`  
The argument at fault, named as the called function names it (`"cells"`, `"premium"`, `"average"`).

`column: str or None`  
The column of a table argument (`"origin_period"`, `"dev_lag"`, `"value"`, `"premium"`).

`options: tuple of str`  
Every argument involved, `option` first, for a conflict between two.

`given: object`  
The argument's value as passed, for a refused option or label; `None` otherwise.

`cells: tuple of RefusedCell`  
The cells or origins at fault, sorted by origin period and age, at most `MAX_CELLS` of them.

`links: tuple of (int, int)`  
`(from_dev_lag, to_dev_lag)` in months, for a refusal about a development age.

`rows: tuple of int`  
0-based row positions in the table argument, when a cell cannot be named (a missing origin, for example); at most `MAX_CELLS`.

`count: int`  
How many cells, rows or items are at fault in all, which can be more than `cells` keeps.


## Methods

| Name | Description |
|----|----|
| [to_dict()](#to_dict) | The refusal as plain JSON types: no NaN or infinity, no dates. |

------------------------------------------------------------------------


#### to_dict()


The refusal as plain JSON types: no NaN or infinity, no dates.


Usage

``` python
to_dict()
```


`json.dumps(refusal.to_dict(), allow_nan=False)` always succeeds. A date or datetime becomes its ISO string; NaN and infinity become `None` (the message still says which); a `given` that is not a JSON scalar or a list of them becomes its `repr`.
