Convert a string representing bytes into actual bytes. This is needed because the literal characters of BytesExpr (the characters inside b'') are stored in BytesExpr.value, whose type is 'str' not 'bytes'.
(value: str)
| 296 | |
| 297 | |
| 298 | def bytes_from_str(value: str) -> bytes: |
| 299 | """Convert a string representing bytes into actual bytes. |
| 300 | |
| 301 | This is needed because the literal characters of BytesExpr (the |
| 302 | characters inside b'') are stored in BytesExpr.value, whose type is |
| 303 | 'str' not 'bytes'. |
| 304 | """ |
| 305 | return bytes(value, "utf8").decode("unicode-escape").encode("raw-unicode-escape") |
no test coverage detected
searching dependent graphs…