Skip to content

Commit

Permalink
Merge pull request #275 from ssciwr/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
lkeegan authored Sep 3, 2024
2 parents 9b3a6d6 + 3d7eadb commit d866c08
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
include:
- os: "ubuntu-22.04"
python-version: "3.10"
psychopy-version: "2024.1.2"
psychopy-version: "2024.1.4"
- os: "ubuntu-22.04"
python-version: "3.10"
psychopy-version: "2023.2.3"
Expand Down Expand Up @@ -76,6 +76,7 @@ jobs:
- uses: actions/upload-artifact@v4
if: failure()
with:
name: "${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.psychopy-version }}"
path: "*.*"
- uses: codecov/codecov-action@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: check-toml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
rev: v0.5.0
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand All @@ -32,13 +32,13 @@ repos:
- "prettier-plugin-toml"

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.4
rev: 0.28.6
hooks:
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.10.1
hooks:
- id: mypy
additional_dependencies: [numpy, PyQt5-stubs, types-requests]
Expand All @@ -51,7 +51,7 @@ repos:
]

- repo: https://github.com/rhysd/actionlint
rev: "v1.7.0"
rev: "v1.7.1"
hooks:
- id: actionlint

Expand Down
6 changes: 2 additions & 4 deletions src/vstt/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ def _has_valid_type(var: Any, correct_type: type) -> bool:
if isinstance(var, correct_type):
# var has the correct type
return True
if correct_type in (float, int) and type(var) in (float, int):
# int instead of float or vice versa is ok
return True
return False
# int instead of float or vice versa is also ok - anything else is not
return correct_type in (float, int) and type(var) in (float, int)


def import_typed_dict(
Expand Down
10 changes: 6 additions & 4 deletions tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def move_mouse_to_target(
) -> None:
# wait until target is activated
attempts = 0
sleep_interval = 0.1
while not gtu.pixel_color(target_pixel, target_color):
sleep(0.1)
sleep(sleep_interval)
sleep_interval += 0.1
# press Enter in case we are looking at a splash / display_results screen
gtu.press_enter()
attempts += 1
Expand Down Expand Up @@ -114,7 +116,7 @@ def test_task(
for timestamps in data["to_target_timestamps"][0][0]:
assert (
timestamps[-1] - timestamps[0]
< 0.5 * experiment_no_results.trial_list[0]["target_duration"]
< 0.8 * experiment_no_results.trial_list[0]["target_duration"]
)
for dest in ["target", "center"]:
assert np.all(data[f"to_{dest}_success"][0][0])
Expand Down Expand Up @@ -154,11 +156,11 @@ def test_task_no_automove_to_center(
):
assert (
to_target_timestamps[-1] - to_target_timestamps[0]
< 0.5 * experiment_no_results.trial_list[0]["target_duration"]
< 0.8 * experiment_no_results.trial_list[0]["target_duration"]
)
assert (
to_center_timestamps[-1] - to_target_timestamps[0]
< 0.5 * experiment_no_results.trial_list[0]["target_duration"]
< 0.8 * experiment_no_results.trial_list[0]["target_duration"]
)
for dest in ["target", "center"]:
assert np.all(data[f"to_{dest}_success"][0][0])
Expand Down

0 comments on commit d866c08

Please sign in to comment.