Python io.BytesIO.writelines() Examples

The following are 30 code examples of io.BytesIO.writelines(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module io.BytesIO , or try the search function .
Example #1
Source File: test_io.py    From pySINDy with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #2
Source File: test_io.py    From keras-lambda with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #3
Source File: test_io.py    From keras-lambda with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #4
Source File: test_io.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #5
Source File: test_io.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #6
Source File: test_io.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #7
Source File: test_io.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #8
Source File: test_io.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #9
Source File: test_io.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #10
Source File: test_io.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #11
Source File: test_io.py    From elasticintel with GNU General Public License v3.0 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #12
Source File: test_io.py    From ImageFusion with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #13
Source File: test_io.py    From ImageFusion with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #14
Source File: test_io.py    From mxnet-lambda with Apache License 2.0 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #15
Source File: test_io.py    From mxnet-lambda with Apache License 2.0 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #16
Source File: test_io.py    From pySINDy with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #17
Source File: test_io.py    From recruit with Apache License 2.0 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #18
Source File: test_io.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #19
Source File: test_io.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #20
Source File: test_io.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #21
Source File: test_io.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #22
Source File: test_io.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #23
Source File: test_io.py    From Mastering-Elasticsearch-7.0 with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #24
Source File: test_io.py    From Computable with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #25
Source File: test_io.py    From Computable with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #26
Source File: test_io.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #27
Source File: test_io.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #28
Source File: test_io.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66]) 
Example #29
Source File: test_io.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def writelines(self, lines):
        BytesIO.writelines(self, [asbytes(s) for s in lines]) 
Example #30
Source File: test_io.py    From lambda-packs with MIT License 5 votes vote down vote up
def test_unused_converter(self):
        c = TextIO()
        c.writelines(['1 21\n', '3 42\n'])
        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={0: lambda s: int(s, 16)})
        assert_array_equal(data, [21, 42])

        c.seek(0)
        data = np.loadtxt(c, usecols=(1,),
                          converters={1: lambda s: int(s, 16)})
        assert_array_equal(data, [33, 66])