Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#249)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: mscheltienne <mathieu.scheltienne@fcbg.ch>
  • Loading branch information
pre-commit-ci[bot] and mscheltienne authored Apr 30, 2024
1 parent de46260 commit c2fcabf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 62 deletions.
63 changes: 6 additions & 57 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install liblsl (linux)
if: ${{ matrix.os == 'ubuntu' }}
run: |
Expand All @@ -40,8 +39,12 @@ jobs:
- name: Install liblsl (macOS)
if: ${{ matrix.os == 'macos' }}
run: |
brew update
brew install labstreaminglayer/tap/lsl
curl -L https://github.com/sccn/liblsl/releases/download/v1.16.0/liblsl-1.16.0-OSX_arm64.tar.bz2 -o liblsl-1.16.0-OSX_arm64.tar.bz2
tar -xf liblsl-1.16.0-OSX_arm64.tar.bz2
mv lib/liblsl.1.16.0.dylib .
echo "MNE_LSL_LIB=$PWD/liblsl.1.16.0.dylib" >> $GITHUB_ENV
rm -R lib include bin
rm liblsl-1.16.0-OSX_arm64.tar.bz2
- name: Install liblsl (windows)
if: ${{ matrix.os == 'windows' }}
run: |
Expand Down Expand Up @@ -71,58 +74,6 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)

pytest-arm64:
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
name: macos-arm64 - py${{ matrix.python-version }}
runs-on: macos-14
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install liblsl
run: |
curl -L https://github.com/sccn/liblsl/releases/download/v1.16.0/liblsl-1.16.0-OSX_arm64.tar.bz2 -o liblsl-1.16.0-OSX_arm64.tar.bz2
tar -xf liblsl-1.16.0-OSX_arm64.tar.bz2
mv lib/liblsl.1.16.0.dylib .
rm -R lib include bin
rm liblsl-1.16.0-OSX_arm64.tar.bz2
- name: Install dependencies
run: |
python -m pip install --progress-bar off --upgrade pip setuptools
python -m pip install --progress-bar off .[test]
- name: Display system information
run: mne_lsl-sys_info --developer
env:
MNE_LSL_LIB: ${{ github.workspace }}/liblsl.1.16.0.dylib
- name: Run pytest
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
command: pytest mne_lsl --cov=mne_lsl --cov-report=xml --cov-config=pyproject.toml -s
env:
MNE_LSL_LIB: ${{ github.workspace }}/liblsl.1.16.0.dylib
- name: Upload to codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: false # optional (default = false)
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)

pytest-pip-pre:
timeout-minutes: 30
strategy:
Expand All @@ -141,7 +92,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install liblsl & linux dependencies
run: |
curl -L https://github.com/sccn/liblsl/releases/download/v1.16.2/liblsl-1.16.2-jammy_amd64.deb -o liblsl-1.16.2-jammy_amd64.deb
Expand Down Expand Up @@ -193,7 +143,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Install liblsl (linux)
run: |
curl -L https://github.com/sccn/liblsl/releases/download/v1.16.2/liblsl-1.16.2-jammy_amd64.deb -o liblsl-1.16.2-jammy_amd64.deb
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
files: mne_lsl

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
rev: v0.4.2
hooks:
- id: ruff
name: ruff linter
Expand Down
8 changes: 4 additions & 4 deletions mne_lsl/utils/_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def ensure_int(item: Any, item_name: Optional[str] = None) -> int:
raise TypeError
item = int(operator.index(item))
except TypeError:
item_name = "Item" if item_name is None else "'%s'" % item_name
item_name = "Item" if item_name is None else f"'{item_name}'"
raise TypeError(f"{item_name} must be an integer, got {type(item)} instead.")

return item
Expand Down Expand Up @@ -114,7 +114,7 @@ def check_type(item: Any, types: tuple, item_name: Optional[str] = None) -> None
else:
type_name[-1] = "or " + type_name[-1]
type_name = ", ".join(type_name)
item_name = "Item" if item_name is None else "'%s'" % item_name
item_name = "Item" if item_name is None else f"'{item_name}'"
raise TypeError(
f"{item_name} must be an instance of {type_name}, got {type(item)} instead."
)
Expand Down Expand Up @@ -145,15 +145,15 @@ def check_value(
When the value of the item is not one of the valid options.
"""
if item not in allowed_values:
item_name = "" if item_name is None else " '%s'" % item_name
item_name = "" if item_name is None else f" '{item_name}'"
extra = "" if extra is None else " " + extra
msg = (
"Invalid value for the{item_name} parameter{extra}. "
"{options}, but got {item!r} instead."
)
allowed_values = tuple(allowed_values) # e.g., if a dict was given
if len(allowed_values) == 1:
options = "The only allowed value is %s" % repr(allowed_values[0])
options = f"The only allowed value is {repr(allowed_values[0])}"
elif len(allowed_values) == 2:
options = (
f"Allowed values are {repr(allowed_values[0])} "
Expand Down

0 comments on commit c2fcabf

Please sign in to comment.