use is instead of == for class equality checks

************* Module salt.pillar.pepa
/Users/chris/code/salt/salt/pillar/pepa.py:460: [W1504(unidiomatic-typecheck), ext_pillar] Using type() instead of isinstance() for a typecheck.
************* Module salt.utils.process
/Users/chris/code/salt/salt/utils/process.py:225: [W1504(unidiomatic-typecheck), ProcessManager.add_process] Using type() instead of isinstance() for a typecheck.
This commit is contained in:
Chris Rebert 2015-02-22 19:22:08 -08:00 committed by Pedro Algarvio
parent 7fe3efa0f9
commit 03ae55c284
2 changed files with 10 additions and 10 deletions

View File

@ -455,7 +455,7 @@ def ext_pillar(minion_id, pillar, resource, sequence, subkey=False, subkey_only=
immutable[rkey] = True
if rkey not in output:
log.error('Cant\'t merge key {0} doesn\'t exist'.format(rkey))
elif type(results[key]) != type(output[rkey]):
elif type(results[key]) is not type(output[rkey]):
log.error('Can\'t merge different types for key {0}'.format(rkey))
elif type(results[key]) is dict:
output[rkey].update(results[key])

View File

@ -229,17 +229,17 @@ class ProcessManager(object):
if kwargs is None:
kwargs = {}
if type(multiprocessing.Process) == type(tgt) and issubclass(tgt, multiprocessing.Process):
p = tgt(*args, **kwargs)
if type(multiprocessing.Process) is type(tgt) and issubclass(tgt, multiprocessing.Process):
process = tgt(*args, **kwargs)
else:
p = multiprocessing.Process(target=tgt, args=args, kwargs=kwargs)
process = multiprocessing.Process(target=tgt, args=args, kwargs=kwargs)
p.start()
log.debug("Started '{0}' with pid {1}".format(tgt.__name__, p.pid))
self._process_map[p.pid] = {'tgt': tgt,
'args': args,
'kwargs': kwargs,
'Process': p}
process.start()
log.debug("Started '{0}' with pid {1}".format(tgt.__name__, process.pid))
self._process_map[process.pid] = {'tgt': tgt,
'args': args,
'kwargs': kwargs,
'Process': process}
def restart_process(self, pid):
'''