[elbe-devel] [PATCH 03/25] pylint: shellhelper: rename input parameter to stdin
Torben Hohn
torben.hohn at linutronix.de
Wed Aug 22 10:42:04 CEST 2018
"input" is a builtin name, that should not be used.
rename input parameter, and fixup users.
fixes pylint warning:
elbepack/asciidoclog.py:48: [W0622(redefined-builtin), LogBase.do] Redefining built-in 'input'
elbepack/shellhelper.py:31: [W0622(redefined-builtin), command_out] Redefining built-in 'input'
elbepack/shellhelper.py:42: [W0622(redefined-builtin), system_out] Redefining built-in 'input'
elbepack/shellhelper.py:52: [W0622(redefined-builtin), command_out_stderr] Redefining built-in 'input'
elbepack/shellhelper.py:63: [W0622(redefined-builtin), system_out_stderr] Redefining built-in 'input'
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
elbepack/asciidoclog.py | 8 ++++----
elbepack/finetuning.py | 4 ++--
elbepack/shellhelper.py | 22 +++++++++++-----------
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/elbepack/asciidoclog.py b/elbepack/asciidoclog.py
index dc806fed..bcd55e7d 100644
--- a/elbepack/asciidoclog.py
+++ b/elbepack/asciidoclog.py
@@ -45,15 +45,15 @@ class LogBase(object):
"---------------------------------------")
self.printo()
- def do(self, cmd, allow_fail=False, input=None):
+ def do(self, cmd, allow_fail=False, stdin=None):
- if input is None:
+ if stdin is None:
self.printo("running cmd +%s+" % cmd)
else:
- self.printo("running cmd +%s with STDIN %s+" % (cmd, input))
+ self.printo("running cmd +%s with STDIN %s+" % (cmd, stdin))
self.verbatim_start()
- ret, out = command_out(cmd, input=input, output=self.fp)
+ ret, out = command_out(cmd, stdin=stdin, output=self.fp)
self.verbatim_end()
if ret != 0:
diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index 3c86eb05..402de73e 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -340,7 +340,7 @@ class CmdAction(FinetuningAction):
def execute(self, log, buildenv, target):
with target:
- log.chroot(target.path, "/bin/sh", input=self.node.et.text)
+ log.chroot(target.path, "/bin/sh", stdin=self.node.et.text)
FinetuningAction.register(CmdAction)
@@ -355,7 +355,7 @@ class BuildenvCmdAction(FinetuningAction):
def execute(self, log, buildenv, target):
with buildenv:
- log.chroot(buildenv.path, "/bin/sh", input=self.node.et.text)
+ log.chroot(buildenv.path, "/bin/sh", stdin=self.node.et.text)
FinetuningAction.register(BuildenvCmdAction)
diff --git a/elbepack/shellhelper.py b/elbepack/shellhelper.py
index 4ff6ad02..674f7fa7 100644
--- a/elbepack/shellhelper.py
+++ b/elbepack/shellhelper.py
@@ -28,19 +28,19 @@ def system(cmd, allow_fail=False):
raise CommandError(cmd, ret)
-def command_out(cmd, input=None, output=PIPE):
- if input is None:
+def command_out(cmd, stdin=None, output=PIPE):
+ if stdin is None:
p = Popen(cmd, shell=True, stdout=output, stderr=STDOUT)
- out, stderr = p.communicate()
+ out, _ = p.communicate()
else:
p = Popen(cmd, shell=True, stdout=output, stderr=STDOUT, stdin=PIPE)
- out, stderr = p.communicate(input=input)
+ out, _ = p.communicate(input=stdin)
return p.returncode, out
-def system_out(cmd, input=None, allow_fail=False):
- code, out = command_out(cmd, input)
+def system_out(cmd, stdin=None, allow_fail=False):
+ code, out = command_out(cmd, stdin)
if code != 0:
if not allow_fail:
@@ -49,19 +49,19 @@ def system_out(cmd, input=None, allow_fail=False):
return out
-def command_out_stderr(cmd, input=None):
- if input is None:
+def command_out_stderr(cmd, stdin=None):
+ if stdin is None:
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
output, stderr = p.communicate()
else:
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE, stdin=PIPE)
- output, stderr = p.communicate(input=input)
+ output, stderr = p.communicate(input=stdin)
return p.returncode, output, stderr
-def system_out_stderr(cmd, input=None, allow_fail=False):
- code, out, err = command_out(cmd, input)
+def system_out_stderr(cmd, stdin=None, allow_fail=False):
+ code, out, err = command_out(cmd, stdin)
if code != 0:
if not allow_fail:
--
2.11.0
More information about the elbe-devel
mailing list