Skip to content

Commit b5b91ec

Browse files
committed
Merging two functions for simplicity
1 parent eb3bfcb commit b5b91ec

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

mbed_lstools/lstools_base.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,12 @@ def _update_device_from_fs(self, device, include_extra_info):
204204
return
205205

206206
device['device_type'] = self._detect_device_type(device['mount_point'])
207-
208207
device['target_id'] = device['target_id_usb_id']
209-
self._update_device_details(device, include_extra_info)
208+
209+
{
210+
'daplink': self._update_device_details_daplink,
211+
'jlink': self._update_device_details_jlink
212+
}[device['device_type']](device, include_extra_info)
210213

211214
def _detect_device_type(self, mount_point):
212215
""" Returns a string of the device type
@@ -216,17 +219,6 @@ def _detect_device_type(self, mount_point):
216219
files = [f.lower() for f in os.listdir(mount_point)]
217220
return 'jlink' if 'segger.html' in files else 'daplink'
218221

219-
def _update_device_details(self, device, include_extra_info):
220-
""" Updates device dict with information from the filesystem
221-
@param device Device dictionary to update. Should contain a valid
222-
'mount_point' value
223-
@param include_extra_info Controls how much information (and by extension,
224-
the performance) is returned from the filesystem
225-
"""
226-
{
227-
'daplink': self._update_device_details_daplink,
228-
'jlink': self._update_device_details_jlink
229-
}[device['device_type']](device, include_extra_info)
230222

231223
def _update_device_details_daplink(self, device, include_extra_info):
232224
self._update_device_from_htm(device)

0 commit comments

Comments
 (0)