# madbot_cli.manifest

*module*

The deposit file: read it, check it, and give access to its parts.

The file is YAML or JSON. It is checked against the JSON Schema of its
version, then against the rules a schema cannot say (titles unique in the
file, sources declared at the top and named where they are used, one key per
connection, a valid pattern), before any request
to the API. Every error comes with its path in the file.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L1-1)

## madbot_cli.manifest.FORMS

*attribute* · *module attribute*

```python
FORMS = {'externalIdEntry': ('external_id', '{source, external_id}'), 'browseEntry': ('browse', '{source, browse: {path, match or names}}'), 'matchEntry': ('match', '{source, match}'), 'namesEntry': ('names', '{source, names}')}
```

The forms of a data entry, by definition of the schema: the key that tells
the form, and the keys the form takes.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L101-106)

## madbot_cli.manifest.JSON_TYPES

*attribute* · *module attribute*

```python
JSON_TYPES = {'object': Mapping, 'array': list, 'string': str, 'boolean': bool}
```

The Python types of the JSON types a choice of the format names.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L238-243)

## madbot_cli.manifest.NEXT_TO

*attribute* · *module attribute*

```python
NEXT_TO = 3
```

How many keys of a place a message names.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L98-98)

## madbot_cli.manifest.PLACES

*attribute* · *module attribute*

```python
PLACES = {'source': ('a source', 'sources'), 'node': ('a node', 'nodes'), 'submission': ('a submission', 'submissions'), 'samples': ('the samples of a node', 'samples'), 'associationRule': ('an association rule', 'associations'), 'listedAssociation': ('an association of a list', 'list'), 'externalIdEntry': ('a data entry', 'data'), 'browseEntry': ('a data entry', 'data'), 'matchEntry': ('a data entry', 'data'), 'namesEntry': ('a data entry', 'data')}
```

The places of the format a person knows, by definition of the schema, with
the key of the file under which they are.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L83-94)

## madbot_cli.manifest.SUPPORTED_VERSIONS

*attribute* · *module attribute*

```python
SUPPORTED_VERSIONS = (1)
```

The versions of the format this release reads.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L29-29)

## madbot_cli.manifest.Loader

*class*

```python
class Loader(yaml.SafeLoader)
```

Bases: `yaml.SafeLoader`

Reads YAML as `yaml.safe_load` does; its numbers keep how they are written.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L314-315)

## madbot_cli.manifest.Manifest

*class* · *dataclass*

```python
class Manifest
```

A deposit file, checked.

**Attributes**

- `version` (`int`) — The version of the format.
- `workspace` (`str`) — The name of the workspace.
- `nodes` (`list of Node`) — The nodes at the top of the workspace, in the order of the file.
- `sources` (`dict of Source`) — The sources of the file, by key.
- `source` (`str`) — Where the file was read from.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L642-741)

### madbot_cli.manifest.Manifest.nodes

*attribute* · *instance attribute*

```python
nodes: list[Node]
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L663-663)

### madbot_cli.manifest.Manifest.source

*attribute* · *class attribute* · *instance attribute*

```python
source: str = '<file>'
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L665-665)

### madbot_cli.manifest.Manifest.sources

*attribute* · *class attribute* · *instance attribute*

```python
sources: dict[str, Source] = field(default_factory=dict)
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L664-664)

### madbot_cli.manifest.Manifest.version

*attribute* · *instance attribute*

```python
version: int
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L661-661)

### madbot_cli.manifest.Manifest.workspace

*attribute* · *instance attribute*

```python
workspace: str
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L662-662)

### madbot_cli.manifest.Manifest.find_source

*method*

```python
def find_source(key: str) -> Source
```

Find a source of the file by its key.

**Parameters**

- `key` (`str`) — The key of the source.

**Returns**

- (`Source`) — The source.

**Raises**

- `MadbotError` — When the file has no source of that key.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L718-741)

### madbot_cli.manifest.Manifest.find_submission

*method*

```python
def find_submission(title: str) -> tuple[Node, Submission]
```

Find a submission of the file by its title.

**Parameters**

- `title` (`str`) — The title of the submission.

**Returns**

- (`tuple`) — The node and the submission.

**Raises**

- `MadbotError` — When the file has no submission of that title.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L692-716)

### madbot_cli.manifest.Manifest.submissions

*method*

```python
def submissions() -> Iterator[tuple[Node, Submission]]
```

List the submissions of the file with their node.

**Yields**

- (`tuple`) — The node and the submission.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L679-690)

### madbot_cli.manifest.Manifest.walk

*method*

```python
def walk() -> Iterator[Node]
```

List every node of the file, each before its children.

**Yields**

- (`Node`) — The nodes, at every depth.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L667-677)

## madbot_cli.manifest.ManifestError

*class*

```python
class ManifestError(MadbotError)
```

Bases: `madbot_cli.errors.MadbotError`

The deposit file is invalid.

**Attributes**

- `errors` (`list of str`) — One message per error, each starting with its path in the file.

**Parameters**

- `source` (`str`) — The file, or what the content came from.
- `errors` (`list of str`) — One message per error.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L55-80)

### madbot_cli.manifest.ManifestError.errors

*attribute* · *instance attribute*

```python
errors = errors
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L76-76)

## madbot_cli.manifest.Node

*class* · *dataclass*

```python
class Node
```

A node and what it holds, as the file describes it.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L595-639)

### madbot_cli.manifest.Node.associations

*attribute* · *class attribute* · *instance attribute*

```python
associations: list[dict] = field(default_factory=list)
```

The rules that make the associations of the data of the node.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L604-604)

### madbot_cli.manifest.Node.data

*attribute* · *class attribute* · *instance attribute*

```python
data: list[dict] = field(default_factory=list)
```

The data entries to link to the node, each naming its ``source``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L601-601)

### madbot_cli.manifest.Node.description

*attribute* · *class attribute* · *instance attribute*

```python
description: str | None = None
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L600-600)

### madbot_cli.manifest.Node.nodes

*attribute* · *class attribute* · *instance attribute*

```python
nodes: list[Node] = field(default_factory=list)
```

The child nodes, in the order of the file.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L607-607)

### madbot_cli.manifest.Node.path

*attribute* · *class attribute* · *instance attribute*

```python
path: tuple[str, ...] = ()
```

The titles from the top of the workspace to the node, its own last.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L609-609)

### madbot_cli.manifest.Node.samples

*attribute* · *class attribute* · *instance attribute*

```python
samples: dict[str, Any] | None = None
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L603-603)

### madbot_cli.manifest.Node.submissions

*attribute* · *class attribute* · *instance attribute*

```python
submissions: list[Submission] = field(default_factory=list)
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L606-606)

### madbot_cli.manifest.Node.title

*attribute* · *instance attribute*

```python
title: str
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L599-599)

### madbot_cli.manifest.Node.label

*property*

```python
label: str
```

The path of the node for a person, such as ``Campaign / Night``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L613-615)

### madbot_cli.manifest.Node.source_keys

*method*

```python
def source_keys() -> list[str]
```

List the sources the data of the node come from.

**Returns**

- (`list of str`) — The keys of the sources, in the order the entries name them.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L630-639)

### madbot_cli.manifest.Node.walk

*method*

```python
def walk() -> Iterator[Node]
```

List the node and the nodes under it, each before its children.

**Yields**

- (`Node`) — The node, then its descendants.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L617-628)

## madbot_cli.manifest.Source

*class* · *dataclass*

```python
class Source
```

A source of data, declared once at the top of the file.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L553-560)

### madbot_cli.manifest.Source.credentials_env

*attribute* · *class attribute* · *instance attribute*

```python
credentials_env: str | None = None
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L560-560)

### madbot_cli.manifest.Source.key

*attribute* · *instance attribute*

```python
key: str
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L557-557)

### madbot_cli.manifest.Source.plugin

*attribute* · *instance attribute*

```python
plugin: str
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L558-558)

### madbot_cli.manifest.Source.shared_params

*attribute* · *instance attribute*

```python
shared_params: dict[str, Any]
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L559-559)

## madbot_cli.manifest.Submission

*class* · *dataclass*

```python
class Submission
```

A submission of data of a node to a repository, as the file describes it.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L563-575)

### madbot_cli.manifest.Submission.data

*attribute* · *class attribute* · *instance attribute*

```python
data: list[dict] = field(default_factory=list)
```

The data entries the submission takes; empty when it takes them all.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L569-569)

### madbot_cli.manifest.Submission.metadata

*attribute* · *class attribute* · *instance attribute*

```python
metadata: dict[str, dict[str, Any]] = field(default_factory=dict)
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L575-575)

### madbot_cli.manifest.Submission.repository

*attribute* · *instance attribute*

```python
repository: dict[str, Any]
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L568-568)

### madbot_cli.manifest.Submission.take_all

*attribute* · *class attribute* · *instance attribute*

```python
take_all: bool = False
```

Whether the submission takes every data of its node and the nodes under it.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L571-571)

### madbot_cli.manifest.Submission.title

*attribute* · *instance attribute*

```python
title: str
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L567-567)

### madbot_cli.manifest.Submission.via

*attribute* · *class attribute* · *instance attribute*

```python
via: tuple[str, ...] | None = None
```

With ``take_all``, the node a data linked to several nodes goes through.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L573-573)

## madbot_cli.manifest.WrittenFloat

*class*

```python
class WrittenFloat(float)
```

Bases: `float`

A decimal number of the file that keeps how it is written, such as ``1.10``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L308-311)

### madbot_cli.manifest.WrittenFloat.written

*attribute* · *instance attribute*

```python
written: str
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L311-311)

## madbot_cli.manifest.WrittenInt

*class*

```python
class WrittenInt(int)
```

Bases: `int`

An integer of the file that keeps how it is written, such as ``01``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L302-305)

### madbot_cli.manifest.WrittenInt.written

*attribute* · *instance attribute*

```python
written: str
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L305-305)

## madbot_cli.manifest.as_text

*function*

```python
def as_text(document: Any) -> Any
```

Read as names the numbers of the paths and names of the data entries.

YAML reads ``path: [24343971]`` or ``names: [2026]`` as numbers, while
a folder or a file is named by text. A number read by `Loader` gives
the text it is written with, so that ``01`` stays ``"01"`` and ``1.10``
stays ``"1.10"``. Only the places of the format that hold names are
read again; a value of a metadata field keeps its number.

**Parameters**

- `document` (`Any`) — The content of the file, as `Loader` reads it.

**Returns**

- (`Any`) — A copy of the document, with those numbers written as text.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L504-526)

## madbot_cli.manifest.check_pattern

*function*

```python
def check_pattern(samples: Mapping, where: list) -> list[str]
```

Check the pattern of the rule of samples of a node.

**Parameters**

- `samples` (`mapping`) — The ``samples`` of a node.
- `where` (`list`) — The path of the node in the file.

**Returns**

- (`list of str`) — The errors, each starting with its path.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L762-787)

## madbot_cli.manifest.check_rules

*function*

```python
def check_rules(document: Mapping) -> list[str]
```

Check the rules of a deposit file that its JSON Schema cannot say.

**Parameters**

- `document` (`mapping`) — A document valid against the JSON Schema.

**Returns**

- (`list of str`) — The errors, each starting with its path.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L1002-1019)

## madbot_cli.manifest.connection_of

*function*

```python
def connection_of(spec: Mapping) -> tuple[str, tuple]
```

Tell which connection a source of the file stands for, as the file writes it.

**Parameters**

- `spec` (`mapping`) — A source: its ``plugin`` and ``shared_params``.

**Returns**

- (`tuple`) — The plugin and the shared parameters, as text and sorted.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L744-759)

## madbot_cli.manifest.credentials

*function*

```python
def credentials(env_name: str | None, environ: Mapping[str, str] | None = None) -> dict | None
```

Read credentials from an environment variable holding a JSON object.

**Parameters**

- `env_name` (`str or None`) — The name of the variable.
- `environ` (`mapping`) (default: `None`) — The environment; `os.environ` by default.

**Returns**

- (`dict or None`) — The credentials, None when no variable is named or it is not set.

**Raises**

- `MadbotError` — When the variable does not hold a JSON object.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L1165-1201)

## madbot_cli.manifest.descendants

*function*

```python
def descendants(node: Mapping) -> set[tuple[str, ...]]
```

List the paths of a node of the document and of the nodes under it.

**Parameters**

- `node` (`mapping`) — A node of the document.

**Returns**

- (`set of tuple`) — The paths under the node, ``()`` for the node itself.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L810-827)

## madbot_cli.manifest.details_of

*function*

```python
def details_of(errors: list[jsonschema.ValidationError], schema: Mapping) -> str
```

Explain the errors inside a choice, each with its path from the choice.

**Parameters**

- `errors` (`list of ValidationError`) — The errors of the choice.
- `schema` (`mapping`) — The JSON Schema of the format.

**Returns**

- (`str`) — The messages, joined by ``; ``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L278-299)

## madbot_cli.manifest.each

*function*

```python
def each(items: Any, convert: Any) -> Any
```

Convert each item of a list, and leave anything else as it is.

**Parameters**

- `items` (`Any`) — A list, or a value the format will refuse.
- `convert` (`callable`) — What to do to each item.

**Returns**

- (`Any`) — The converted list, or `items` itself.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L420-436)

## madbot_cli.manifest.entry_as_text

*function*

```python
def entry_as_text(entry: Any) -> Any
```

Read as names the numbers of the path and names of a data entry.

**Parameters**

- `entry` (`Any`) — A data entry of a node or a submission, or a data of an association.

**Returns**

- (`Any`) — A copy of the entry, with those numbers written as text.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L392-417)

## madbot_cli.manifest.label_of_path

*function*

```python
def label_of_path(path: Iterable[str]) -> str
```

Write the path of a node for a person.

**Parameters**

- `path` (`iterable of str`) — The titles from the top of the workspace.

**Returns**

- (`str`) — The titles joined by `` / ``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L578-592)

## madbot_cli.manifest.load

*function*

```python
def load(path: str | os.PathLike) -> Manifest
```

Read and check a deposit file.

**Parameters**

- `path` (`str or path - like`) — The file, YAML or JSON.

**Returns**

- (`Manifest`) — The checked deposit.

**Raises**

- `ManifestError` — When the file cannot be read or is invalid.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L1130-1162)

## madbot_cli.manifest.load_schema

*function*

```python
def load_schema(version: int = 1) -> dict
```

Return the JSON Schema of a version of the deposit file.

**Parameters**

- `version` (`int`) (default: `1`) — The version of the format.

**Returns**

- (`dict`) — The JSON Schema.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L33-52)

## madbot_cli.manifest.message_of

*function*

```python
def message_of(error: jsonschema.ValidationError, schema: Mapping) -> str
```

Explain an error of the format, saying where a misplaced key goes.

**Parameters**

- `error` (`ValidationError`) — An error of the file against the format.
- `schema` (`mapping`) — The JSON Schema of the format.

**Returns**

- (`str`) — The message; for a key not expected where it is, the place the format expects it (those on the path of the key first), or the keys expected there.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L144-192)

## madbot_cli.manifest.message_of_forms

*function*

```python
def message_of_forms(error: jsonschema.ValidationError, schema: Mapping) -> str | None
```

Explain a data entry that takes none of its forms, or several.

**Parameters**

- `error` (`ValidationError`) — A ``oneOf`` error of the file against the format.
- `schema` (`mapping`) — The JSON Schema of the format.

**Returns**

- (`str or None`) — The form the entry was meant to take, from the key that tells it, with what is wrong in it; the forms expected when no key tells one; None when the error is not on a data entry.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L195-235)

## madbot_cli.manifest.message_of_type

*function*

```python
def message_of_type(error: jsonschema.ValidationError, schema: Mapping) -> str | None
```

Explain a value that takes the one choice of its type with an error in it.

**Parameters**

- `error` (`ValidationError`) — A ``oneOf`` error of the file against the format.
- `schema` (`mapping`) — The JSON Schema of the format.

**Returns**

- (`str or None`) — The errors inside the one choice whose type is that of the value; None when no choice, or several, have that type.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L247-275)

## madbot_cli.manifest.name_of

*function*

```python
def name_of(item: Any) -> Any
```

Read a number given as a name as the text it is written with.

**Parameters**

- `item` (`Any`) — An item of a path or of a list of names.

**Returns**

- (`Any`) — ``"01"`` for ``01``, ``"1.10"`` for ``1.10``; any other item as it is.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L373-389)

## madbot_cli.manifest.node_as_text

*function*

```python
def node_as_text(node: Any) -> Any
```

Read as names the numbers of the data entries of a node and its children.

**Parameters**

- `node` (`Any`) — A node of the file.

**Returns**

- (`Any`) — A copy of the node, with the names of its data entries, those of its submissions and of its associations given one by one, as text.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L439-472)

## madbot_cli.manifest.node_of

*function*

```python
def node_of(node: Mapping, parent: tuple[str, ...] = ()) -> Node
```

Read a node of a checked document, and the nodes under it.

**Parameters**

- `node` (`mapping`) — A node of the document.
- `parent` (`tuple of str`) (default: `()`) — The path of its parent.

**Returns**

- (`Node`) — The node.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L1022-1062)

## madbot_cli.manifest.parse

*function*

```python
def parse(document: Any, source: str = '<file>') -> Manifest
```

Check a deposit document and return it as a `Manifest`.

**Parameters**

- `document` (`Any`) — The content of the file, as YAML or JSON decode it.
- `source` (`str`) (default: `'<file>'`) — Where it comes from, for the messages.

**Returns**

- (`Manifest`) — The checked deposit.

**Raises**

- `ManifestError` — With the path of each error.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L1065-1127)

## madbot_cli.manifest.path_of

*function*

```python
def path_of(parts: Any) -> str
```

Write a path in a document the way a person reads it.

**Parameters**

- `parts` (`iterable`) — The keys and indexes from the root.

**Returns**

- (`str`) — Such as ``sources.instrument.plugin``; ``(file)`` for the root.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L529-550)

## madbot_cli.manifest.places_of

*function*

```python
def places_of(schema: Mapping) -> dict[str, dict[tuple[str, str], list[str]]]
```

List, for each key of the format, the places it goes and the keys beside it.

**Parameters**

- `schema` (`mapping`) — The JSON Schema of the format.

**Returns**

- (`dict`) — For each key, each place it goes, as ``(name, key of the file it is under)`` such as ``("a submission", "submissions")``, with the keys of that place, the required ones first.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L111-141)

## madbot_cli.manifest.read_yaml

*function*

```python
def read_yaml(text: str) -> Any
```

Read a YAML or JSON document with `Loader`, a safe loader.

**Parameters**

- `text` (`str`) — The document.

**Returns**

- (`Any`) — Its content, its numbers keeping how they are written.

**Raises**

- `yaml.YAMLError` — When the text is not valid YAML.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L347-370)

## madbot_cli.manifest.rule_as_text

*function*

```python
def rule_as_text(rule: Any) -> Any
```

Read as names the numbers of the data of the associations of a rule.

**Parameters**

- `rule` (`Any`) — A rule of associations of a node.

**Returns**

- (`Any`) — A copy of the rule, ``data: [{names: [2026]}]`` read as ``["2026"]``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L475-501)

## madbot_cli.manifest.via_path

*function*

```python
def via_path(via: str | list[str] | None) -> tuple[str, ...] | None
```

Read the ``via`` of a data entry as a path of titles.

**Parameters**

- `via` (`str or list of str or None`) — The title of a child node, a path of titles, or ``[]`` for the node of the submission itself.

**Returns**

- (`tuple of str or None`) — The path under the node of the submission; None when not given.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L790-807)

## madbot_cli.manifest.without_empty

*function*

```python
def without_empty(value: Any) -> Any
```

Drop the empty parts of a metadata value, at any depth.

A skeleton of `madbot-cli fields` writes an object field with its keys
and empty values: the parts left empty are no value, so that a part
filled is sent alone and a part forgotten is named as missing.

**Parameters**

- `value` (`Any`) — The value, as the file gives it.

**Returns**

- (`Any`) — The value, each mapping and list without its empty parts.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L1204-1227)

## madbot_cli.manifest.written_number

*function*

```python
def written_number(loader: Loader, node: yaml.ScalarNode) -> WrittenInt | WrittenFloat
```

Read a number of the file, with the text it is written with.

**Parameters**

- `loader` (`Loader`) — The loader reading the file.
- `node` (`ScalarNode`) — The number, as written.

**Returns**

- (`WrittenInt or WrittenFloat`) — The number, its ``written`` text such as ``01``, ``1.10`` or ``0x1F``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/manifest.py#L318-340)
