Python numpy.compat.asunicode() Examples

The following are code examples for showing how to use numpy.compat.asunicode(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 2
Project: recruit   Author: Frank-qlu   File: _iotools.py    Apache License 2.0 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 3
Project: FUTU_Stop_Loss   Author: BigtoC   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 4
Project: MARRtino-2.0   Author: DaniAffCH   File: _iotools.py    GNU General Public License v3.0 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 5
Project: vnpy_crypto   Author: birforce   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 6
Project: ble5-nrf52-mac   Author: tomasero   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 7
Project: P3_image_processing   Author: latedude2   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 8
Project: GraphicDesignPatternByPython   Author: Relph1119   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 9
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: _iotools.py    Apache License 2.0 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 10
Project: fund   Author: Frank-qlu   File: _iotools.py    Apache License 2.0 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 11
Project: pySINDy   Author: luckystarufo   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 12
Project: facethin   Author: ParkerGod   File: _iotools.py    GNU General Public License v3.0 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 13
Project: islam-buddy   Author: hamir   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 14
Project: Deribit_funding_rate_indicator   Author: Dimasik007   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 15
Project: psychrometric-chart-makeover   Author: buds-lab   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 16
Project: SignLanguage_ML   Author: mareep-raljodid   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 17
Project: PYPIC   Author: max614   File: _iotools.py    BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 18
Project: lambda-tensorflow-object-detection   Author: mikylucky   File: _iotools.py    GNU General Public License v3.0 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 19
Project: AutoDraw   Author: yemi-Jump   File: _iotools.py    MIT License 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 20
Project: fund-rank-dashboard   Author: 1pani   File: _iotools.py    Apache License 2.0 6 votes vote down vote up
def _decode_line(line, encoding=None):
    """Decode bytes from binary input streams.

    Defaults to decoding from 'latin1'. That differs from the behavior of
    np.compat.asunicode that decodes from 'ascii'.

    Parameters
    ----------
    line : str or bytes
         Line to be decoded.

    Returns
    -------
    decoded_line : unicode
         Unicode in Python 2, a str (unicode) in Python 3.

    """
    if type(line) is bytes:
        if encoding is None:
            line = line.decode('latin1')
        else:
            line = line.decode(encoding)

    return line 
Example 21
Project: LaserTOF   Author: kyleuckert   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 22
Project: FX-RER-Value-Extraction   Author: tsKenneth   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 23
Project: recruit   Author: Frank-qlu   File: test_regression.py    Apache License 2.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 24
Project: att   Author: Centre-Alt-Rendiment-Esportiu   File: test_regression.py    GNU General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 25
Project: FUTU_Stop_Loss   Author: BigtoC   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 26
Project: MARRtino-2.0   Author: DaniAffCH   File: test_regression.py    GNU General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 27
Project: auto-alt-text-lambda-api   Author: abhisuri97   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 28
Project: vnpy_crypto   Author: birforce   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 29
Project: ble5-nrf52-mac   Author: tomasero   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 30
Project: Computable   Author: ktraunmueller   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 31
Project: poker   Author: surgebiswas   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 32
Project: P3_image_processing   Author: latedude2   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 33
Project: GraphicDesignPatternByPython   Author: Relph1119   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 34
Project: 3dprinteros-client   Author: panasevychol   File: test_regression.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 35
Project: 3dprinteros-client   Author: panasevychol   File: test_regression.py    GNU Affero General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 36
Project: predictive-maintenance-using-machine-learning   Author: awslabs   File: test_regression.py    Apache License 2.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 37
Project: fund   Author: Frank-qlu   File: test_regression.py    Apache License 2.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 38
Project: pySINDy   Author: luckystarufo   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 39
Project: linear_neuron   Author: uglyboxer   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 40
Project: facethin   Author: ParkerGod   File: test_regression.py    GNU General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 41
Project: islam-buddy   Author: hamir   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 42
Project: mxnet-lambda   Author: awslabs   File: test_regression.py    Apache License 2.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 43
Project: Deribit_funding_rate_indicator   Author: Dimasik007   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 44
Project: psychrometric-chart-makeover   Author: buds-lab   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 45
Project: wine-ml-on-aws-lambda   Author: pierreant   File: test_regression.py    Apache License 2.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 46
Project: linux-cross-gcc   Author: nmercier   File: test_regression.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 47
Project: SignLanguage_ML   Author: mareep-raljodid   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 48
Project: ImageFusion   Author: pfchai   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 49
Project: sarah   Author: ChonchoFronto   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 50
Project: honours_project   Author: JFriel   File: test_regression.py    GNU General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 51
Project: honours_project   Author: JFriel   File: test_regression.py    GNU General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 52
Project: Blackjack-Tracker   Author: martinabeleda   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 53
Project: PYPIC   Author: max614   File: test_regression.py    BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 54
Project: PYPIC   Author: max614   File: test_regression.py    BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 55
Project: PYPIC   Author: max614   File: test_regression.py    BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 56
Project: offlow   Author: satwikkansal   File: test_regression.py    GNU General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 57
Project: lambda-tensorflow-object-detection   Author: mikylucky   File: test_regression.py    GNU General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 58
Project: elasticintel   Author: securityclippy   File: test_regression.py    GNU General Public License v3.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 59
Project: cnidaria   Author: sauloal   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 60
Project: AutoDraw   Author: yemi-Jump   File: test_regression.py    MIT License 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val)) 
Example 61
Project: fund-rank-dashboard   Author: 1pani   File: test_regression.py    Apache License 2.0 5 votes vote down vote up
def test_string_truncation(self):
        # Ticket #1990 - Data can be truncated in creation of an array from a
        # mixed sequence of numeric values and strings
        for val in [True, 1234, 123.4, complex(1, 234)]:
            for tostr in [asunicode, asbytes]:
                b = np.array([val, tostr('xx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xx'), val])
                assert_equal(tostr(b[1]), tostr(val))

                # test also with longer strings
                b = np.array([val, tostr('xxxxxxxxxx')])
                assert_equal(tostr(b[0]), tostr(val))
                b = np.array([tostr('xxxxxxxxxx'), val])
                assert_equal(tostr(b[1]), tostr(val))