Skip to content

Commit

Permalink
update ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
bimac committed Nov 22, 2024
1 parent 07dc869 commit ff36cdf
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 67 deletions.
7 changes: 3 additions & 4 deletions iblrig/base_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,11 +727,10 @@ def send2bonsai(self, **kwargs):
:example: client.send2bonsai(trial_num=6, sim_freq=50)
:return:
"""
for k in kwargs:
for k, v in kwargs.items():
if k in self.OSC_PROTOCOL:
# need to convert basic numpy types to low-level python types for
# punch card generation OSC module, I might as well have written C code
value = kwargs[k].item() if isinstance(kwargs[k], np.generic) else kwargs[k]
# need to convert basic numpy types to low-level python types for OSC module
value = v.item() if isinstance(v, np.generic) else v
self.send_message(self.OSC_PROTOCOL[k]['mess'], self.OSC_PROTOCOL[k]['type'](value))

def exit(self):
Expand Down
10 changes: 4 additions & 6 deletions iblrig/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,10 @@ def get_session_path(path: str | Path) -> Path | None:

def get_port_events(events: dict, name: str = '') -> list:
out: list = []
for k in events:
if name in k:
out.extend(events[k])
out = sorted(out)

return out
for key, value in events.items():
if name in key:
out.extend(value)
return sorted(out)


def truncated_exponential(scale: float = 0.35, min_value: float = 0.2, max_value: float = 0.5) -> float:
Expand Down
4 changes: 2 additions & 2 deletions iblrig/test/tasks/test_training_choice_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ def test_acquisition_description(self):
}
],
}
for k in ed:
assert ad[k] == ed[k], f'Failed on {k}'
for key, ed_value in ed.items():
assert ad[key] == ed_value, f'Failed on {key}'
111 changes: 56 additions & 55 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ff36cdf

Please sign in to comment.