replace-stdout-stderr (UP022)
Added in v0.0.199 · Related issues · View source
Derived from the pyupgrade linter.
Fix is sometimes available.
What it does
Checks for uses of subprocess.run that send stdout and stderr to a
pipe.
Why is this bad?
As of Python 3.7, subprocess.run has a capture_output keyword argument
that can be set to True to capture stdout and stderr outputs. This is
equivalent to setting stdout and stderr to subprocess.PIPE, but is
more explicit and readable.
Example
Use instead:
Fix safety
This rule's fix is marked as unsafe because replacing stdout=subprocess.PIPE and
stderr=subprocess.PIPE with capture_output=True may delete comments attached
to the original arguments.