opatio.misc.misc module

opatio.misc.misc.is_float_castable(value: Any) bool[source]

Check if a value can be cast to a float.

Parameters:

value (Any) – The value to check.

Returns:

True if the value can be cast to a float, False otherwise.

Return type:

bool

Examples

>>> is_float_castable("123.45")
True
>>> is_float_castable("abc")
False
opatio.misc.misc.print_table_indexes(table_indexes: List[CardCatalogEntry]) str[source]

Generate a formatted string representation of table indexes.

Parameters:

table_indexes (List[CardCatalogEntry]) – A list of CardCatalogEntry objects representing table indexes.

Returns:

A formatted string containing table index details.

Return type:

str

Raises:

ValueError – If table_indexes is empty.

Examples

>>> from opatio.catalog.entry import CardCatalogEntry
>>> entry = CardCatalogEntry(index=[1.0, 2.0], byteStart=0, byteEnd=100, sha256="abcdef1234567890")
>>> print(print_table_indexes([entry]))
Table Indexes in OPAT File:
Index 0    Index 1    Byte Start      Byte End        Checksum (SHA-256)
================================================================================
1.0000     2.0000     0              100            abcdef1234567890...

Notes

This function is used to display table index information in a human-readable format.