MCPcopy
hub / github.com/rspeer/python-ftfy / ExplanationStep

Class ExplanationStep

ftfy/__init__.py:35–58  ·  view source on GitHub ↗

A step in an ExplainedText, explaining how to decode text. The possible actions are: - "encode": take in a string and encode it as bytes, with the given encoding - "decode": take in bytes and decode them as a string, with the given encoding - "transcode": convert bytes to byte

Source from the content-addressed store, hash-verified

33
34
35class ExplanationStep(NamedTuple):
36 """
37 A step in an ExplainedText, explaining how to decode text.
38
39 The possible actions are:
40
41 - "encode": take in a string and encode it as bytes, with the given encoding
42 - "decode": take in bytes and decode them as a string, with the given encoding
43 - "transcode": convert bytes to bytes with a particular named function
44 - "apply": convert str to str with a particular named function
45
46 The `parameter` is the name of the encoding or function to use. If it's a
47 function, it must appear in the FIXERS dictionary.
48 """
49
50 action: str
51 parameter: str
52
53 def __repr__(self) -> str:
54 """
55 Get the string representation of an ExplanationStep. We output the
56 representation of the equivalent tuple, for simplicity.
57 """
58 return repr(tuple(self))
59
60
61class ExplainedText(NamedTuple):

Callers 3

_try_fixFunction · 0.85
fix_and_explainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected