Terminal output
terminal_output
¶
Defines Rich / Typer helpers to display content in a terminal window
Used by the the kotobase CLI to display command outputs, like
lookup information, and by the Build Pipeline to
display upstream source download and database build progress
build_status(message)
¶
Builds a themed rich.Status object from to display indeterminate progress
Used as a context manager to wrap database build step progress
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
The initial status message to display |
required |
Returns:
| Type | Description |
|---|---|
Status
|
A |
download_progress_bar()
¶
Builds a customized rich.Progress object to display network downloads
Used to show download progress for the kotobase databases and the upstream sources
inserted_rows_table(row_count_dict)
¶
Creates a rich.Table to display how many rows have been inserted into the
database for each table during a build
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row_count_dict
|
dict[str, int]
|
Mapping of table names to their inserted row count |
required |
Returns:
A themed rich.Table with the Table and Inserted Rows columns
populated from row_count_dict
render_audio(key, clips)
¶
render_audio_saved(paths)
¶
render_cache_cleared(removed, freed)
¶
render_cache_path(path)
¶
Render the cache directory path
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The cache directory path |
required |
render_cache_size(sizes)
¶
render_db_info(info)
¶
render_entries(entries, *, query)
¶
Render a list of dictionary entries in a panel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entries
|
Sequence[JMDictEntryDTO]
|
The entries to render |
required |
query
|
str
|
The query, shown in the panel title |
required |
render_furigana(items)
¶
Render furigana segmentations in a panel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[FuriganaDTO]
|
The furigana rows to render |
required |
render_jlpt_list(items, *, kind, level)
¶
render_kanji(kanji)
¶
Render the full profile of a single kanji
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kanji
|
KanjiDTO
|
The kanji profile to render |
required |
render_kanji_table(kanji, *, title)
¶
render_lookup(result, *, with_names)
¶
Render an aggregate word lookup as one panel of sub-sections
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
LookupResult
|
The aggregated lookup result |
required |
with_names
|
bool
|
Whether to include the proper names section |
required |
render_names(names)
¶
Render a list of proper names in a panel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
Sequence[JMNeDictEntryDTO]
|
The names to render |
required |
render_no_results(query)
¶
Print the shared empty result line
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The query that returned nothing |
required |
render_radicals(radicals)
¶
Render every search radical grouped by stroke count
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radicals
|
Sequence[RadicalDTO]
|
The radicals to render |
required |
render_sentences(sentences, *, query)
¶
Render example sentences in a panel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sentences
|
Sequence[SentenceDTO]
|
The sentences to render |
required |
query
|
str
|
The query, used in the empty result message |
required |
render_word_jlpt(result)
¶
Render the JLPT view for a word and its kanji
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
LookupResult
|
A lookup result carrying the JLPT data |
required |