NL i>UdZddlmZddlZddlmZedDcgc]}d|d c}Zded <ejD] Z e ee e <d D]2Z de Z e jd jd Ze ee e<4d ee d<ddZddZycc}w)aEncode valid C string literals from Python strings. If a character is not allowed in C string literals, it is either emitted as a simple escape sequence (e.g. '\n'), or an octal escape sequence with exactly three digits ('\oXXX'). Question marks are escaped to prevent trigraphs in the string literal from being interpreted. Note that '\?' is an invalid escape sequence in Python. Consider the string literal "AB\xCDEF". As one would expect, Python parses it as ['A', 'B', 0xCD, 'E', 'F']. However, the C standard specifies that all hexadecimal digits immediately following '\x' will be interpreted as part of the escape sequence. Therefore, it is unexpectedly parsed as ['A', 'B', 0xCDEF]. Emitting ("AB\xCD" "EF") would avoid this behaviour. However, we opt for simplicity and use octal escape sequences instead. They do not suffer from the same issue as they are defined to parse at most three octal digits. ) annotationsN)Final\03orCHAR_MAP) '"rabfnrtvasciiunicode_escapez\??c\dj|Dcgc] }t| c}}|Scc}w)zIProduce contents of a C string literal for a byte string, without quotes.)joinr)r iescapeds [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypyc/codegen/cstring.pyencode_bytes_as_c_stringr+s)ggA.qx{./G N/s)c$dt|zdzS)zCreate initializer for a C char[]/ char * variable from a string. For example, if value if b'foo', the result would be '"foo"'. r )r)values rc_string_initializerr1s )%0 03 66)r bytesreturnstr)rr r!r")__doc__ __future__rstringtypingrranger__annotations__ printablecordrencodedecodedecodedrr)rs0rr/s(# ).s4AR#w<4%4   AHSV =%A1#hGnnW%,,-=>G$HS\% S 7/5s B