MCPcopy Index your code
hub / github.com/numpy/numpy / TextIO

Class TextIO

numpy/lib/tests/test_io.py:42–58  ·  view source on GitHub ↗

Helper IO class. Writes encode strings to bytes if needed, reads return bytes. This makes it easier to emulate files opened in binary mode without needing to explicitly convert strings to bytes in setting up the test data.

Source from the content-addressed store, hash-verified

40
41
42class TextIO(BytesIO):
43 """Helper IO class.
44
45 Writes encode strings to bytes if needed, reads return bytes.
46 This makes it easier to emulate files opened in binary mode
47 without needing to explicitly convert strings to bytes in
48 setting up the test data.
49
50 """
51 def __init__(self, s=""):
52 BytesIO.__init__(self, asbytes(s))
53
54 def write(self, s):
55 BytesIO.write(self, asbytes(s))
56
57 def writelines(self, lines):
58 BytesIO.writelines(self, [asbytes(s) for s in lines])
59
60
61IS_64BIT = sys.maxsize > 2**32

Callers 15

test_recordMethod · 0.85
test_arrayMethod · 0.85
test_1DMethod · 0.85
test_missingMethod · 0.85
test_comments_unicodeMethod · 0.85
test_comments_byteMethod · 0.85
test_skiprowsMethod · 0.85
test_usecolsMethod · 0.85

Calls

no outgoing calls

Tested by 15

test_recordMethod · 0.68
test_arrayMethod · 0.68
test_1DMethod · 0.68
test_missingMethod · 0.68
test_comments_unicodeMethod · 0.68
test_comments_byteMethod · 0.68
test_skiprowsMethod · 0.68
test_usecolsMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…