module decoding_attempts_table
Methods to build the rich.table
used to display decoding attempts of a given bytes array.
Final output should be a rich.table
of decoding attempts that are sorted like this:
-
String representation of undecoded bytes is always the first row
-
Encodings which
chardet.detect()
ranked as > 0% likelihood are sorted based on that confidence -
Then the unchardetectable:
-
Decodings that were successful, unforced, and new
-
Decodings that were "successful" but forced
-
Decodings that were the same as other decodings
-
Failed decodings
Global Variables
- CENTER
- FOLD
- MIDDLE
- RIGHT
function new_decoding_attempts_table
new_decoding_attempts_table(bytes_match: BytesMatch) → Table
Build a new rich Table
with two rows, the raw and hex views of the bytes_match
data.
function decoding_table_row
decoding_table_row(
assessment: EncodingAssessment,
is_forced: Text,
txt: Text,
score: float
) → DecodingTableRow
Build a table row for a decoding attempt.
Args:
assessment
(EncodingAssessment): Thechardet
assessment for the encoding used.is_forced
(Text): Text indicating if the decode was forced.txt
(Text): The decoded string as a richText
object (with highlighting).score
(float): The score to use for sorting this row in the table.
Returns:
DecodingTableRow
: The constructed table row named tuple.
function assessment_only_row
assessment_only_row(
assessment: EncodingAssessment,
score: float
) → DecodingTableRow
Build a DecodingTableRow
with just chardet
assessment confidence data and no actual decoding attempt string.
Args:
assessment
(EncodingAssessment): Thechardet
assessment for the encoding used.score
(float): The score to use for sorting this row within the table.
Returns:
DecodingTableRow
: The constructed table row named tuple with no decoding attempt string.
class DecodingTableRow
DecodingTableRow(encoding_label, confidence_text, errors_while_decoded, decoded_string, confidence, encoding, sort_score, encoding_label_plain)
This file was automatically generated via lazydocs.