Skip to content

Commit

Permalink
ENH: Speed up search by index by specifying class
Browse files Browse the repository at this point in the history
  • Loading branch information
TEParsons committed May 16, 2024
1 parent 102376c commit 3ff620b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions psychopy_cedrus/riponda.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ def resolve(cls, requested):
return pad
# try to get by index
if isinstance(requested, int):
pad = DeviceManager.getDeviceBy("index", requested)
pad = DeviceManager.getDeviceBy("index", requested, deviceClass="psychopy_cedrus.riponda.Riponda")
# if found, return
if pad is not None:
return pad
# if given an index of a not-yet setup device, set one up
if requested is None or isinstance(requested, int):
return DeviceManager.addDevice(
deviceClass="psychopy_cedrus.riponda.Riponda",
deviceName=f"Riponda{requested}",
deviceName=f"Riponda@{requested}",
index=requested
)
# if still not found, raise error
Expand Down

0 comments on commit 3ff620b

Please sign in to comment.