pylink icon indicating copy to clipboard operation
pylink copied to clipboard

num_supported_devices in connect() adds test time

Open wallacbe opened this issue 5 years ago • 1 comments

num_supported_devices() call inconnect adds > 100 ms test time each call. If we are not using lock/unlock can we add flag argument to skip?

https://github.com/square/pylink/blob/master/pylink/jlink.py#L933

wallacbe avatar May 03 '19 15:05 wallacbe

I would rather not add a flag for this, but I think making _device be a property on doing it when needed makes sense, and would produce the same result. E.g.

def connect(...):
    <snipped>
    self._chip_name = chip_name

def disconnect(...):
    self._device = None

@property
def device(self):
    if not self._device:
        <do lookup>
        self._device = instance
    return self._device

If you want to go ahead and submit a patch, I'd be more than happy to merge it.

hkpeprah avatar May 06 '19 23:05 hkpeprah