How to use the pipupgrade.util.string.safe_decode function in pipupgrade

To help you get started, we’ve selected a few pipupgrade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github achillesrasquinha / pipupgrade / tests / helpers / testutils.py View on Github external
def __exit__(self, *args):
        self.output     = safe_decode(self._output.getvalue())
        del self._output
        sys.stdout      = self._stdout
github achillesrasquinha / pipupgrade / tests / pipupgrade / util / test_string.py View on Github external
def test_safe_decode():
    assert safe_decode(b"foobar") == "foobar"
    assert safe_decode( "foobar") == "foobar"
    
    assert safe_decode(123456789) == 123456789
github achillesrasquinha / pipupgrade / tests / helpers / testutils.py View on Github external
def assert_stdout(capfd, output):
    stdout, _ = capfd.readouterr()
    assert safe_decode(output) == safe_decode(stdout)
github achillesrasquinha / pipupgrade / tests / pipupgrade / util / test_string.py View on Github external
def test_safe_decode():
    assert safe_decode(b"foobar") == "foobar"
    assert safe_decode( "foobar") == "foobar"
    
    assert safe_decode(123456789) == 123456789
github achillesrasquinha / pipupgrade / tests / pipupgrade / util / test_string.py View on Github external
def test_safe_decode():
    assert safe_decode(b"foobar") == "foobar"
    assert safe_decode( "foobar") == "foobar"
    
    assert safe_decode(123456789) == 123456789
github achillesrasquinha / pipupgrade / src / pipupgrade / util / system.py View on Github external
)

    code       = proc.wait()

    if code and raise_err:
        raise PopenError(code, command)

    if output:
        output, error = proc.communicate()

        if output:
            output = safe_decode(output)
            output = strip(output)

        if error:
            error  = safe_decode(error)
            error  = strip(error)

        if quiet:
            return code
        else:
            return code, output, error
    else:
        return code
github achillesrasquinha / pipupgrade / src / pipupgrade / util / system.py View on Github external
stderr  = sp.PIPE if output else None,
        env     = environ,
        cwd     = directory,
        shell   = shell
    )

    code       = proc.wait()

    if code and raise_err:
        raise PopenError(code, command)

    if output:
        output, error = proc.communicate()

        if output:
            output = safe_decode(output)
            output = strip(output)

        if error:
            error  = safe_decode(error)
            error  = strip(error)

        if quiet:
            return code
        else:
            return code, output, error
    else:
        return code