Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: check-docstring-first
- id: check-executables-have-shebangs
Expand All @@ -17,23 +17,23 @@ repos:
args: [--fix=lf]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 24.2.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.19.1
hooks:
- id: mypy
exclude: "village/pybpodapi/.*"
additional_dependencies:
- types-setuptools
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
rev: "0.51"
hooks:
- id: check-manifest
args: [--no-build-isolation]
Expand All @@ -42,7 +42,7 @@ repos:
- wheel
- repo: https://github.com/codespell-project/codespell
# Configuration for codespell is in pyproject.toml
rev: v2.2.6
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:
Expand Down
6 changes: 2 additions & 4 deletions village/custom_classes/training_protocol_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ def check_variables(self) -> None:
if self.settings.next_task == "-1":
raise TrainingError("The variable next_task is required (must be a string)")
if self.settings.refractory_period < 0:
raise TrainingError(
"""
raise TrainingError("""
The variable refractory_period is required (must be a positive integer)
"""
)
""")
if self.settings.minimum_duration < 0:
raise TrainingError(
"The variable minimum_duration is required (must be a positive float)"
Expand Down
24 changes: 8 additions & 16 deletions village/pybpodapi/bpod/bpod_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,32 +131,24 @@ def open(self):
try:
val = self._bpodcom_handshake()
except Exception:
raise BpodErrorException(
"""Error: Bpod failed to confirm connectivity.
Please reset Bpod and try again."""
)
raise BpodErrorException("""Error: Bpod failed to confirm connectivity.
Please reset Bpod and try again.""")

if not val:
raise BpodErrorException(
"""Error: Bpod failed to confirm connectivity.
Please reset Bpod and try again."""
)
raise BpodErrorException("""Error: Bpod failed to confirm connectivity.
Please reset Bpod and try again.""")

# check the firmware version
firmware_version, machine_type = self._bpodcom_firmware_version()

if firmware_version < settings.get("BPOD_TARGET_FIRMWARE"):
raise BpodErrorException(
"""Error: Old firmware detected.
Please update Bpod firmware to version 22 and try again."""
)
raise BpodErrorException("""Error: Old firmware detected.
Please update Bpod firmware to version 22 and try again.""")

if firmware_version > settings.get("BPOD_TARGET_FIRMWARE"):
print("Firmware version is new: ", firmware_version)
raise BpodErrorException(
"""Error: Future firmware detected.
Please change Bpod firmware to version 22 and try again."""
)
raise BpodErrorException("""Error: Future firmware detected.
Please change Bpod firmware to version 22 and try again.""")

self._hardware.firmware_version = firmware_version
self._hardware.machine_type = machine_type
Expand Down
10 changes: 5 additions & 5 deletions village/pybpodapi/state_machine/state_machine_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def build_message(self):
tmp += [transition[0]]
dest_state = transition[1]
tmp += [
(self.total_states_added if math.isnan(dest_state) else dest_state)
self.total_states_added if math.isnan(dest_state) else dest_state
]
message += tmp
logger.debug("INPUT MATRIX: %s", tmp)
Expand Down Expand Up @@ -202,7 +202,7 @@ def build_message(self):
- self.hardware.channels.events_positions.globalTimerStart
]
tmp += [
(self.total_states_added if math.isnan(dest_state) else dest_state)
self.total_states_added if math.isnan(dest_state) else dest_state
]
message += tmp
logger.debug("GLOBAL_TIMER_START_MATRIX: %s", tmp)
Expand All @@ -222,7 +222,7 @@ def build_message(self):
- self.hardware.channels.events_positions.globalTimerEnd
]
tmp += [
(self.total_states_added if math.isnan(dest_state) else dest_state)
self.total_states_added if math.isnan(dest_state) else dest_state
]
message += tmp
logger.debug("GLOBAL_TIMER_END_MATRIX: %s", tmp)
Expand All @@ -242,7 +242,7 @@ def build_message(self):
- self.hardware.channels.events_positions.globalCounter
]
tmp += [
(self.total_states_added if math.isnan(dest_state) else dest_state)
self.total_states_added if math.isnan(dest_state) else dest_state
]
message += tmp
logger.debug("GLOBAL_COUNTER_MATRIX: %s", tmp)
Expand All @@ -261,7 +261,7 @@ def build_message(self):
transition[0] - self.hardware.channels.events_positions.condition
]
tmp += [
(self.total_states_added if math.isnan(dest_state) else dest_state)
self.total_states_added if math.isnan(dest_state) else dest_state
]

message += tmp
Expand Down
2 changes: 1 addition & 1 deletion village/scripts/parse_bpod_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def parse_input_to_tuple_override(msg: str) -> tuple[str, int, int]:


def parse_output_to_tuple_override(
message: str | tuple[str, int]
message: str | tuple[str, int],
) -> tuple[str, Any, int]:
"""Parses a Bpod output message into a structured tuple.

Expand Down
Loading