# `orchestrator.pkg.invention`
<!-- generated by `orchestrator understand`; the PKG is source of truth, edits here are advisory -->

[← Episteme](../README.md) · [Architecture](../architecture.md)

**Source:** [`src/orchestrator/pkg/invention.py`](../../src/orchestrator/pkg/invention.py)

3 types · 9 functions · python

## Changing this safely

**Tested by** (1): `tests.pkg.test_invention`

**Most depended-upon here** — a change to these reaches the most code (call graph, ≤4 hops):

- [`LanguageInvention`](../../src/orchestrator/pkg/invention.py#L99) — reaches **11** symbols
- [`InventionReport`](../../src/orchestrator/pkg/invention.py#L128) — reaches **9** symbols
- [`_python_invention`](../../src/orchestrator/pkg/invention.py#L227) — reaches **9** symbols
- [`_walked_invention`](../../src/orchestrator/pkg/invention.py#L281) — reaches **9** symbols
- [`InventedCall`](../../src/orchestrator/pkg/invention.py#L77) — reaches **8** symbols
- [`find_invented_calls`](../../src/orchestrator/pkg/invention.py#L328) — reaches **8** symbols
- [`_terminal_name`](../../src/orchestrator/pkg/invention.py#L214) — reaches **7** symbols
- [`_visible_names`](../../src/orchestrator/pkg/invention.py#L207) — reaches **7** symbols

## Types

### `InventedCall`

[`src/orchestrator/pkg/invention.py:77`](../../src/orchestrator/pkg/invention.py#L77)

- **Called by** (2): [`_python_invention`](../../src/orchestrator/pkg/invention.py#L227), [`_walked_invention`](../../src/orchestrator/pkg/invention.py#L281)
- **Fields**: `dst`, `file`, `language`, `line`, `name`, `src`

### `InventionReport`

[`src/orchestrator/pkg/invention.py:128`](../../src/orchestrator/pkg/invention.py#L128)

- **Called by** (1): [`find_invented_calls`](../../src/orchestrator/pkg/invention.py#L328)
- **Fields**: `by_language`, `candidates`, `external_calls`, `invented`, `total_calls`, `unexamined`

### `LanguageInvention`

[`src/orchestrator/pkg/invention.py:99`](../../src/orchestrator/pkg/invention.py#L99)

- **Called by** (3): [`_python_invention`](../../src/orchestrator/pkg/invention.py#L227), [`_walked_invention`](../../src/orchestrator/pkg/invention.py#L281), [`find_invented_calls`](../../src/orchestrator/pkg/invention.py#L328)
- **Fields**: `examined`, `invented`, `language`, `reason`, `shadowable`, `status`, `total_calls`, `unexamined`

## Functions

### `_direct_bindings`

[`src/orchestrator/pkg/invention.py:160`](../../src/orchestrator/pkg/invention.py#L160)

- **Called by** (1): [`_scopes`](../../src/orchestrator/pkg/invention.py#L187)

### `_python_invention`

[`src/orchestrator/pkg/invention.py:227`](../../src/orchestrator/pkg/invention.py#L227)

- **Called by** (1): [`find_invented_calls`](../../src/orchestrator/pkg/invention.py#L328)
- **Calls** (3): [`InventedCall`](../../src/orchestrator/pkg/invention.py#L77), [`LanguageInvention`](../../src/orchestrator/pkg/invention.py#L99), [`_visible_names`](../../src/orchestrator/pkg/invention.py#L207)

### `_scopes`

[`src/orchestrator/pkg/invention.py:187`](../../src/orchestrator/pkg/invention.py#L187)

- **Called by** (1 production · 1 test): [`scopes_for`](../../src/orchestrator/pkg/invention.py#L243), [`_visible`](../../tests/pkg/test_invention.py#L29)
- **Calls** (2): [`_direct_bindings`](../../src/orchestrator/pkg/invention.py#L160), `walk`

### `_terminal_name`

[`src/orchestrator/pkg/invention.py:214`](../../src/orchestrator/pkg/invention.py#L214)

- **Called by** (1): [`_walked_invention`](../../src/orchestrator/pkg/invention.py#L281)

### `_visible_names`

[`src/orchestrator/pkg/invention.py:207`](../../src/orchestrator/pkg/invention.py#L207)

- **Called by** (1 production · 1 test): [`_python_invention`](../../src/orchestrator/pkg/invention.py#L227), [`_visible`](../../tests/pkg/test_invention.py#L29)

### `_walked_invention`

[`src/orchestrator/pkg/invention.py:281`](../../src/orchestrator/pkg/invention.py#L281)

- **Called by** (1): [`find_invented_calls`](../../src/orchestrator/pkg/invention.py#L328)
- **Calls** (3): [`InventedCall`](../../src/orchestrator/pkg/invention.py#L77), [`LanguageInvention`](../../src/orchestrator/pkg/invention.py#L99), [`_terminal_name`](../../src/orchestrator/pkg/invention.py#L214)

### `find_invented_calls`

[`src/orchestrator/pkg/invention.py:328`](../../src/orchestrator/pkg/invention.py#L328)

- **Called by** (2 production · 11 test): [`_check_invention`](../../src/orchestrator/pkg/verify.py#L492), [`score_invention`](../../src/orchestrator/pkg/invention.py#L412), [`_one_language`](../../tests/pkg/test_invention.py#L255), [`test_a_genuine_external_call_is_not_flagged`](../../tests/pkg/test_invention.py#L163), [`test_a_language_with_no_walker_is_unwalked_not_clean`](../../tests/pkg/test_invention.py#L313), [`test_a_resolved_local_call_is_not_flagged`](../../tests/pkg/test_invention.py#L169), [`test_an_invented_edge_is_detected`](../../tests/pkg/test_invention.py#L125), [`test_c_is_the_control_and_stays_clean`](../../tests/pkg/test_invention.py#L295), [`test_java_and_sql_are_excluded_with_a_stated_reason`](../../tests/pkg/test_invention.py#L328), [`test_nothing_to_examine_scores_none_not_zero`](../../tests/pkg/test_invention.py#L187), [`test_the_denominator_is_bare_calls_not_every_call`](../../tests/pkg/test_invention.py#L342), [`test_the_python_front_end_no_longer_invents`](../../tests/pkg/test_invention.py#L150), [`test_the_rate_is_over_all_calls_not_just_candidates`](../../tests/pkg/test_invention.py#L176)
- **Calls** (5): [`InventionReport`](../../src/orchestrator/pkg/invention.py#L128), [`LanguageInvention`](../../src/orchestrator/pkg/invention.py#L99), [`_python_invention`](../../src/orchestrator/pkg/invention.py#L227), [`_walked_invention`](../../src/orchestrator/pkg/invention.py#L281), `pathlib.Path`

### `sample_edges`

[`src/orchestrator/pkg/invention.py:391`](../../src/orchestrator/pkg/invention.py#L391)

- **Called by** (1 production · 2 test): [`_invention_oracle`](../../src/orchestrator/cli.py#L3205), [`test_an_empty_or_zero_sample_is_empty`](../../tests/pkg/test_invention.py#L208), [`test_the_sample_is_deterministic`](../../tests/pkg/test_invention.py#L196)
- **Documented in**: `docs/specs/STATE-OF-SPINE.md#where-it-is-honestly-weak`, `docs/specs/enhancement-index.md#e5-oracle-coverage-gaps`, `docs/specs/invention-oracle-cross-language.md#what-the-numbers-mean-and-what-is-left`

### `score_invention`

[`src/orchestrator/pkg/invention.py:412`](../../src/orchestrator/pkg/invention.py#L412)

- **Called by** (2): [`_invention_oracle`](../../src/orchestrator/cli.py#L3205), [`build_scoreboard`](../../src/orchestrator/pkg/accuracy.py#L458)
- **Calls** (3): [`RepoCodeExtractor`](../../src/orchestrator/pkg/extractor.py#L577), [`find_invented_calls`](../../src/orchestrator/pkg/invention.py#L328), `pathlib.Path`

## Imports

`__future__.annotations`, `ast`, `dataclasses.dataclass`, [`orchestrator.pkg.extractor`](../../src/orchestrator/pkg/extractor.py#L1), [`orchestrator.pkg.facts`](../../src/orchestrator/pkg/facts.py#L1), [`orchestrator.pkg.scope`](orchestrator.pkg.scope.md), `pathlib.Path`

## Imported by

[`orchestrator.cli`](orchestrator.cli.md), [`orchestrator.pkg.accuracy`](orchestrator.pkg.accuracy.md), [`orchestrator.pkg.verify`](orchestrator.pkg.verify.md), [`tests.pkg.test_invention`](../../tests/pkg/test_invention.py#L1)
