[CLN] linter

This commit is contained in:
Benedek Racz 2020-02-19 16:13:29 +01:00
parent f6ff2fcf4d
commit 4b512294ee
2 changed files with 14 additions and 8 deletions

View File

@ -181,7 +181,7 @@ def run(command, timeout=-1, withexitstatus=False, events=None, extra_args=None,
child_result_list.append(child.before) child_result_list.append(child.before)
if type(responses[index]) in (str,): if type(responses[index]) in (str,):
child.send(responses[index]) child.send(responses[index])
elif type(responses[index]) is types.FunctionType: elif isinstance(responses[index], types.FunctionType):
callback_result = responses[index](locals()) callback_result = responses[index](locals())
sys.stdout.flush() sys.stdout.flush()
if type(callback_result) in (str,): if type(callback_result) in (str,):
@ -261,11 +261,17 @@ class SpawnBase:
self.interact_state = interact self.interact_state = interact
# If command is an int type then it may represent a file descriptor. # If command is an int type then it may represent a file descriptor.
if type(command) == type(0): if isinstance(command, int):
logger.warning("ExceptionPexpect('Command is an int type. If this is a file descriptor then maybe you want to use fdpexpect.fdspawn which takes an existing file descriptor instead of a command string.')") logger.warning(
raise ExceptionPexpect('Command is an int type. If this is a file descriptor then maybe you want to use fdpexpect.fdspawn which takes an existing file descriptor instead of a command string.') "ExceptionPexpect :'Command is an int type. If this is a file descriptor then maybe"
" you want to use fdpexpect.fdspawn which takes an existing file descriptor instead"
" of a command string.')")
raise ExceptionPexpect(
'Command is an int type. If this is a file descriptor then maybe you want to use'
' fdpexpect.fdspawn which takes an existing file descriptor instead of a command '
'string.')
if type (args) != type([]): if not isinstance(args, list):
logger.warning("TypeError ('The argument, args, must be a list.')") logger.warning("TypeError ('The argument, args, must be a list.')")
raise TypeError('The argument, args, must be a list.') raise TypeError('The argument, args, must be a list.')