MCPcopy Create free account
hub / github.com/apache/trafficserver / encode_stream

Function encode_stream

lib/yamlcpp/test/create-emitter-tests.py:8–19  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

6EVENT_COUNT = 5
7
8def encode_stream(line):
9 for c in line:
10 if c == '\n':
11 yield '\\n'
12 elif c == '"':
13 yield '\\"'
14 elif c == '\t':
15 yield '\\t'
16 elif ord(c) < 0x20:
17 yield '\\x' + hex(ord(c))
18 else:
19 yield c
20
21def encode(line):
22 return ''.join(encode_stream(line))

Callers 1

encodeFunction · 0.85

Calls 1

hexFunction · 0.85

Tested by

no test coverage detected