forked from neurodatascience/dFC
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request neurodatascience#16 from Remi-Gau/format
[STY] format and lint code
- Loading branch information
Showing
45 changed files
with
7,648 additions
and
5,601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[flake8] | ||
exclude = | ||
.git, | ||
__pycache__, | ||
build, | ||
dist, | ||
--select = D,E,F,W | ||
docstring-convention = numpy | ||
max-line-length = 240 | ||
# For PEP8 error codes see | ||
# http://pep8.readthedocs.org/en/latest/intro.html#error-codes | ||
# D100-D104: missing docstring | ||
# D105: missing docstring in magic method | ||
# D107: missing docstring in __init__ | ||
# W504: line break after binary operator | ||
per-file-ignores = | ||
**/__init__.py: D104 | ||
ignore = | ||
BLK100, | ||
D105 | ||
D107, | ||
E402, | ||
E266, | ||
E721, | ||
E731, | ||
E713, | ||
E714, | ||
E741, | ||
F403, | ||
F405, | ||
E401, | ||
F401, | ||
F811, | ||
F821, | ||
W503, | ||
|
||
|
||
# for compatibility with black | ||
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8 | ||
extend-ignore = E203 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
# Documentation | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: monthly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: pre-commit/action@v3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,89 @@ | ||
--- | ||
name: Build and test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- main | ||
# Run weekly to avoid missing deprecations during low activity | ||
schedule: | ||
- cron: '0 0 * * 1' | ||
schedule: | ||
- cron: 0 0 * * 1 | ||
# Allow job to be triggered manually from GitHub interface | ||
workflow_dispatch: | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
run: | ||
shell: bash | ||
|
||
# Force tox and pytest to use color | ||
env: | ||
FORCE_COLOR: true | ||
FORCE_COLOR: true | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
test: | ||
# Check each OS, all supported Python, minimum versions and latest releases | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ['ubuntu-latest'] | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
include: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
include: | ||
# Basic dependencies only | ||
- os: ubuntu-latest | ||
python-version: 3.8 | ||
dependencies: 'min' | ||
- os: ubuntu-latest | ||
python-version: 3.8 | ||
dependencies: min | ||
|
||
env: | ||
DEPENDS: ${{ matrix.dependencies }} | ||
ARCH: ${{ !contains(fromJSON('["none", "min"]'), matrix.dependencies) && matrix.architecture }} | ||
env: | ||
DEPENDS: ${{ matrix.dependencies }} | ||
ARCH: ${{ !contains(fromJSON('["none", "min"]'), matrix.dependencies) && matrix.architecture }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: ${{ matrix.architecture }} | ||
allow-prereleases: true | ||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
- name: Install tox | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox tox-gh-actions | ||
- name: Show tox config | ||
run: tox c | ||
- name: Run tox | ||
run: tox -v --exit-and-dump-after 1200 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: ${{ matrix.architecture }} | ||
allow-prereleases: true | ||
- name: Display Python version | ||
run: python -c "import sys; print(sys.version)" | ||
- name: Install tox | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox tox-gh-actions | ||
- name: Show tox config | ||
run: tox c | ||
- name: Run tox | ||
run: tox -v --exit-and-dump-after 1200 | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
environment: "Package deployment" | ||
needs: [test] | ||
permissions: | ||
publish: | ||
runs-on: ubuntu-latest | ||
environment: Package deployment | ||
needs: [test] | ||
permissions: | ||
# Required for trusted publishing | ||
id-token: write | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- run: pipx run build | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
id-token: write | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- run: pipx run build | ||
- uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
name: Update precommit hooks | ||
|
||
|
||
on: | ||
|
||
# Uses the cron schedule for github actions | ||
# | ||
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events | ||
# | ||
# ┌───────────── minute (0 - 59) | ||
# │ ┌───────────── hour (0 - 23) | ||
# │ │ ┌───────────── day of the month (1 - 31) | ||
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | ||
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# * * * * * | ||
schedule: | ||
- cron: 0 0 * * 1 # every monday | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update_precommit_hooks: | ||
|
||
# only run on upstream repo | ||
if: github.repository_owner == 'SIMEXP' | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
allow-prereleases: false | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
- name: Update pre-commit hooks | ||
run: pre-commit autoupdate | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: pre-commit hooks auto-update | ||
base: main | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
delete-branch: true | ||
title: '[BOT] update pre-commit hooks' | ||
body: done via this [GitHub Action](https://github.com/${{ github.repository_owner }}/giga_connectome/blob/main/.github/workflows/update_precommit_hooks.yml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
**/.DS_Store | ||
|
||
__pycache__ | ||
*.pyc | ||
*.cpython | ||
sample_data/sub-0001_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz | ||
sample_data/sub-0001_task-restingstate_acq-mb3_desc-confounds_regressors.tsv | ||
sample_data/sub-0002_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz | ||
sample_data/sub-0002_task-restingstate_acq-mb3_desc-confounds_regressors.tsv | ||
sample_data/sub-0003_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz | ||
sample_data/sub-0003_task-restingstate_acq-mb3_desc-confounds_regressors.tsv | ||
sample_data/sub-0004_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz | ||
sample_data/sub-0004_task-restingstate_acq-mb3_desc-confounds_regressors.tsv | ||
sample_data/sub-0005_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz | ||
sample_data/sub-0005_task-restingstate_acq-mb3_desc-confounds_regressors.tsv | ||
|
||
.vscode | ||
|
||
sample_data/ | ||
|
||
# build related | ||
pydfc.egg-info | ||
build | ||
dist/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-ast | ||
- id: check-case-conflict | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/ikamensh/flynt/ | ||
rev: 1.0.1 | ||
hooks: | ||
- id: flynt | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
args: [--profile, black] | ||
|
||
- repo: https://github.com/psf/black-pre-commit-mirror | ||
rev: 24.2.0 | ||
hooks: | ||
- id: black-jupyter | ||
args: [--config, pyproject.toml] | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.6 | ||
hooks: | ||
- id: codespell | ||
args: [--toml, pyproject.toml] | ||
additional_dependencies: [tomli] | ||
|
||
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt | ||
rev: 0.2.3 | ||
hooks: | ||
- id: yamlfmt | ||
args: [--mapping, '4', --sequence, '4', --offset, '0'] | ||
|
||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks | ||
rev: v2.12.0 | ||
hooks: | ||
- id: pretty-format-toml | ||
args: [--autofix, --indent, '4'] | ||
|
||
- repo: https://github.com/pyCQA/flake8 | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 | ||
args: [--config, .flake8, --verbose, pydfc, HCP_resting_state_analysis, task_dFC] | ||
additional_dependencies: [flake8-use-fstring] |
Oops, something went wrong.