Completed
Push — master ( 291ee9...9d841e )
by Matěj
20s queued 12s
created

ssg._shims.subprocess_check_output()   A

Complexity

Conditions 3

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 12
nop 2
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
1
import subprocess
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
2
3
4
def subprocess_check_output(*popenargs, **kwargs):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
5
    # Backport of subprocess.check_output taken from
6
    # https://gist.github.com/edufelipe/1027906
7
    #
8
    # Originally from Python 2.7 stdlib under PSF, compatible with BSD-3
9
    # Copyright (c) 2003-2005 by Peter Astrand <[email protected]>
10
    # Changes by Eduardo Felipe
11
12
    process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
13
    output, unused_err = process.communicate()
14
    retcode = process.poll()
15
    if retcode:
16
        cmd = kwargs.get("args")
17
        if cmd is None:
18
            cmd = popenargs[0]
19
        error = subprocess.CalledProcessError(retcode, cmd)
20
        error.output = output
21
        raise error
22
    return output
23
24
if hasattr(subprocess, "check_output"):
25
    # if available we just use the real function
26
    subprocess_check_output = subprocess.check_output
0 ignored issues
show
Coding Style Naming introduced by
The name subprocess_check_output does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
27