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
| 33 | |
| 34 | |
| 35 | class 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 | |
| 61 | class ExplainedText(NamedTuple): |
no outgoing calls
no test coverage detected