MCPcopy Index your code
hub / github.com/python/cpython / read_unicodestringnl

Function read_unicodestringnl

Lib/pickletools.py:603–615  ·  view source on GitHub ↗

r""" >>> import io >>> read_unicodestringnl(io.BytesIO(b"abc\\uabcd\njunk")) == 'abc\uabcd' True

(f)

Source from the content-addressed store, hash-verified

601 """)
602
603def read_unicodestringnl(f):
604 r"""
605 >>> import io
606 >>> read_unicodestringnl(io.BytesIO(b"abc\\uabcd\njunk")) == 'abc\uabcd'
607 True
608 """
609
610 data = f.readline()
611 if not data.endswith(b'\n'):
612 raise ValueError("no newline found when trying to read "
613 "unicodestringnl")
614 data = data[:-1] # lose the newline
615 return str(data, 'raw-unicode-escape')
616
617unicodestringnl = ArgumentDescriptor(
618 name='unicodestringnl',

Callers

nothing calls this directly

Calls 3

strFunction · 0.85
readlineMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…