# lawref.population_bank

*module*

`population-bank` — сборка банка `law.population.bank/0.1` из манифеста
материализации `population-bind` и двух закреплённых пакетов-дел сторон
(DECISION-0264 [§7](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/03-part-iii-architecture-and-conformance.ru.md#7-обязательные-компоненты-реализации), трек О).

Оркестрация без семантики: пины сторон считаются тем же путём, которым
`population-impact` открывает сторону (DECISION-0255 [§1](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/01-part-i-audit.ru.md#1-что-сохраняется-без-изменений): пины манифеста и лока,
понижение корня, связанный мир, хэши [§209](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#209-theory-hash-и-artifact-hash), ресурсы лока), строки банка берутся
из манифеста, мера — из файла. Поток, все отказы — до записи:

    USAGE                                        флаги
    → файл -o не существует                      (POPULATION_BANK_ASSEMBLY_OUT_EXISTS)
    → манифест: схема, самопин                   (POPULATION_BANK_ASSEMBLY_INVALID)
    → класс данных synthetic                     (POPULATION_BANK_ASSEMBLY_DATA_CLASS)
    → отказанных строк нет либо --allow-refused  (POPULATION_BANK_ASSEMBLY_INCOMPLETE)
    → стороны: открытие как в population-impact  (POPULATION_WORLD_MISMATCH)
    → дела сторон против package.files манифеста (POPULATION_BANK_ASSEMBLY_MISMATCH)
    → банк: форма по схеме, самопин              (POPULATION_BANK_ASSEMBLY_INVALID)
    → запись канонических байтов [§208](https://github.com/arxohq/law/blob/master/spec/SPEC.ru/28-part-xxvii-canonical-legal-ir.ru.md#208-canonical-serialization) + перевод строки.

## lawref.population_bank.DATA_CLASS

*attribute* · *module attribute*

```python
DATA_CLASS = 'POPULATION_BANK_ASSEMBLY_DATA_CLASS'
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L42-L42)

## lawref.population_bank.INCOMPLETE

*attribute* · *module attribute*

```python
INCOMPLETE = 'POPULATION_BANK_ASSEMBLY_INCOMPLETE'
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L43-L43)

## lawref.population_bank.INVALID

*attribute* · *module attribute*

```python
INVALID = 'POPULATION_BANK_ASSEMBLY_INVALID'
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L41-L41)

## lawref.population_bank.MISMATCH

*attribute* · *module attribute*

```python
MISMATCH = 'POPULATION_BANK_ASSEMBLY_MISMATCH'
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L44-L44)

## lawref.population_bank.OUT_EXISTS

*attribute* · *module attribute*

```python
OUT_EXISTS = 'POPULATION_BANK_ASSEMBLY_OUT_EXISTS'
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L40-L40)

## lawref.population_bank.REFUSED_EXIT

*attribute* · *module attribute*

```python
REFUSED_EXIT = 2
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L45-L45)

## lawref.population_bank.TOOL

*attribute* · *module attribute*

```python
TOOL = 'population-bank'
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L34-L34)

## lawref.population_bank.USAGE

*attribute* · *module attribute*

```python
USAGE = 'POPULATION_BANK_ASSEMBLY_USAGE'
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L39-L39)

## lawref.population_bank.USAGE_TEXT

*attribute* · *module attribute*

```python
USAGE_TEXT = 'python -m lawref population-bank --manifest <materialization.json> --before <law.toml> --after <law.toml> --measure <measure.json> --bank-id <Name> -o <bank.json> [--distribution <distribution.json>] [--lawc <бинарь>] [--allow-refused]'
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L35-L37)

## lawref.population_bank.AssemblyRefusal

*class*

```python
class AssemblyRefusal(Exception)
```

Bases: `Exception`

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L48-L55)

### lawref.population_bank.AssemblyRefusal.code

*attribute* · *instance attribute*

```python
code = code
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L51-L51)

### lawref.population_bank.AssemblyRefusal.message

*attribute* · *instance attribute*

```python
message = message
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L52-L52)

### lawref.population_bank.AssemblyRefusal.line

*method*

```python
def line() -> str
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L54-L55)

## lawref.population_bank.assemble

*function*

```python
def assemble(manifest_path: Path, before: Path, after: Path, measure_path: Path, bank_id: str, out: Path, lower_root, allow_refused: bool, distribution_path: Path | None = None) -> bytes
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L154-L188)

## lawref.population_bank.check_side

*function*

```python
def check_side(label: str, cases: dict[str, bytes], manifest: dict) -> None
```

Множество дел стороны и байты каждого равны package.files манифеста.

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L115-L129)

## lawref.population_bank.load_distribution

*function*

```python
def load_distribution(path: Path) -> dict
```

Раздел `distribution` банка 0.2 (DECISION-0265): объект, самопин шкалы.

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L137-L151)

## lawref.population_bank.load_manifest

*function*

```python
def load_manifest(path: Path) -> dict
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L62-L76)

## lawref.population_bank.load_measure

*function*

```python
def load_measure(path: Path) -> dict
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L79-L86)

## lawref.population_bank.main

*function*

```python
def main(argv: list[str], lower=None) -> int
```

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L196-L246)

## lawref.population_bank.side_pins

*function*

```python
def side_pins(label: str, manifest_path: Path, lower_root) -> tuple[dict, dict]
```

Пины стороны в форме банка (без `package`) и зарегистрированные дела —
тем же путём, что `population.open_side`, но без сверки с прежними пинами.

[View source](https://github.com-arxohq/arxo-io/law/blob/2edc2b92ce22b52e03f4081d2769a58229684379/engines/lawref/lawref/population_bank.py#L89-L112)
