noc.core.ecma48

Module Contents

noc.core.ecma48.c(x, y)
Convert ECMA-48 character notation to 8-bit form
>>> c(0,0)
noc.core.ecma48.0()
>>> c(1,11)
noc.core.ecma48.27()
>>> c(15,15)
noc.core.ecma48.255()
noc.core.ecma48.ESC
noc.core.ecma48.C0 = [00/00-01/15]
noc.core.ecma48.C1 = 01/11,[04/00-05/15]
noc.core.ecma48.CSI = 01/11,05/11,[03/00-03/15]*,[02/00-02/15]*,[04/00-07/14]
noc.core.ecma48.rx_char
noc.core.ecma48.rx_range
noc.core.ecma48.compile_ecma_def(s)
noc.core.ecma48.BS = 
noc.core.ecma48.rx_bs_sol
noc.core.ecma48.rx_bs
noc.core.ecma48.rx_lf_spaces
noc.core.ecma48.rx_ecma
noc.core.ecma48.strip_control_sequences(s)
Normal text leaved untouched
>>> strip_control_sequences("Lorem Ipsum")
'Lorem Ipsum'

CR,LF and ESC survive from C0 set >>> repr(strip_control_sequences(“”.join([chr(i) for i in range(32)]))) “’\t\n\r’”

C1 set stripped (ESC+[ survive) >>> strip_control_sequences(“”.join([“”+chr(i) for i in range(64,96)])) ‘x1b[‘

CSI without P and I stripped >>> strip_control_sequences(“[@[~”) ‘’

CSI with I stripped >>> strip_control_sequences(“[ @[/~”) ‘’

CSI with P and I stripped >>> strip_control_sequences(“[0 @[0;7/~”) ‘’

Cleaned stream >>> strip_control_sequences(“L[@or[/~em[0 @ Ips[0;7/~um”) ‘Lorem Ipsum’

Incomplete CSI passed >>> strip_control_sequences(“[“) ‘x1b[‘

Incomplete C1 passed >>> strip_control_sequences(‘’) ‘x1b’

Single backspace >>> strip_control_sequences(‘1234’) ‘124’

Triple backspace >>> strip_control_sequences(‘1234’) ‘4’

Backspaces followed with spaces >>> strip_control_sequences(‘    test’) ‘ test’

ASCII mess >>> strip_control_sequences(‘[?7l[?6l[?25h[?6l[?7l[?7l[?6l[?25hswitch# [?25h’) ‘switch# ‘