diff options
author | RĂ©mi Duraffort <remi.duraffort@linaro.org> | 2018-03-01 11:36:33 +0100 |
---|---|---|
committer | Matt Hart <matthew.hart@linaro.org> | 2018-03-09 10:52:19 +0000 |
commit | 5179d1de8790117fd40f74c39556a23a46de9d1c (patch) | |
tree | 111d81d68b33710ec1776e359cdbbef204bf6489 /lava_dispatcher/device.py | |
parent | c5645bc6c56da63555675d0241d14136c1ad3c9d (diff) |
Device: factorize code
Change-Id: Ief98dbd8ef9fcbcbd56f99dd6dc0221704151c26
Diffstat (limited to 'lava_dispatcher/device.py')
-rw-r--r-- | lava_dispatcher/device.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/lava_dispatcher/device.py b/lava_dispatcher/device.py index bfd8eab9f..4ca8d916f 100644 --- a/lava_dispatcher/device.py +++ b/lava_dispatcher/device.py @@ -44,33 +44,23 @@ class PipelineDevice(dict): @property def hard_reset_command(self): - if 'commands' in self and 'hard_reset' in self['commands']: - return self['commands']['hard_reset'] - return '' + return self.get('commands', {}).get('hard_reset', '') @property def soft_reset_command(self): - if 'commands' in self and 'soft_reset' in self['commands']: - return self['commands']['soft_reset'] - return '' + return self.get('commands', {}).get('soft_reset', '') @property def pre_os_command(self): - if 'commands' in self and 'pre_os_command' in self['commands']: - return self['commands']['pre_os_command'] - return None + return self.get('commands', {}).get('pre_os_command') @property def pre_power_command(self): - if 'commands' in self and 'pre_power_command' in self['commands']: - return self['commands']['pre_power_command'] - return None + return self.get('commands', {}).get('pre_power_command') @property def power_command(self): - if 'commands' in self and 'power_on' in self['commands']: - return self['commands']['power_on'] - return '' + return self.get('commands', {}).get('power_on', '') @property def connect_command(self): |