Skip to content

Commit

Permalink
Merge pull request #12 from 2010019970909/dev
Browse files Browse the repository at this point in the history
Solve linting errors
  • Loading branch information
Vincent-Stragier authored Sep 27, 2021
2 parents 7ca4e24 + 37cbd3e commit fc4fb07
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/pyinstaller_builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,45 +14,45 @@ jobs:

- uses: actions/setup-python@master
with:
python-version: '3.8' # Version range or exact version of a Python version to use, using SemVer's version range syntax
python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x86' # optional x64 or x86. Defaults to x64 if not specified

- name: Install the requirements for the GUI
run: |
py -3.8-32 -m pip install --upgrade pip
py -3.8-32 -m pip install -r requirements.txt
py -3.9-32 -m pip install --upgrade pip
py -3.9-32 -m pip install -r requirements.txt
- name: Install PyInstaller
run: py -3.8-32 -m pip install --upgrade pyinstaller
run: py -3.9-32 -m pip install --upgrade pyinstaller

- name: Build the first package (EEG anonymiser, anonymiser.exe)
run: >
py -3.8-32 -m PyInstaller -F --workpath ./build --distpath ./
py -3.9-32 -m PyInstaller -F --workpath ./build --distpath ./
--specpath ./ --clean -n anonymiser
--icon=./ico/fpms_anonymous.ico ./anonymiser.py
- name: Build the second package (converter, coh3toEDF.exe)
run: >
py -3.8-32 -m PyInstaller -F --workpath ./build --distpath ./
py -3.9-32 -m PyInstaller -F --workpath ./build --distpath ./
--specpath ./ --clean -n coh3toEDFbatch
--icon=./ico/fpms.ico ./coh3toEDF.py
- name: Generate the anonymiser GUI Python script from the .ui file
run: |
py -3.8-32 .\ui_to_py_converter.py .\gui_anonymiser_main.ui .\gui_anonymiser_main.py
py -3.8-32 .\ui_to_py_converter.py .\gui_anonymiser_settings.ui .\gui_anonymiser_settings.py
py -3.8-32 .\generate_build_information.py
py -3.9-32 .\ui_to_py_converter.py .\gui_anonymiser_main.ui .\gui_anonymiser_main.py
py -3.9-32 .\ui_to_py_converter.py .\gui_anonymiser_settings.ui .\gui_anonymiser_settings.py
py -3.9-32 .\generate_build_information.py
- name: Build the third package (EEG anonymiser GUI, EEG_anonymiser.exe)
run: >
py -3.8-32 -m PyInstaller -F --workpath ./build --distpath ./
py -3.9-32 -m PyInstaller -F --workpath ./build --distpath ./
--specpath ./ --clean -n EEG_anonymiser
--icon=./ico/fpms_anonymous.ico
--add-data './ico/;ico' .\anonymiser_gui.pyw
- name: Build the fourth package (dataset maker, dataset_maker.exe)
run: >
py -3.8-32 -m PyInstaller -F --workpath ./build --distpath ./
py -3.9-32 -m PyInstaller -F --workpath ./build --distpath ./
--specpath ./ --clean -n dataset_maker
--icon=./ico/fpms.ico ./dataset_maker.py
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/release_lastest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,51 @@ jobs:

- uses: actions/setup-python@master
with:
python-version: '3.8' # Version range or exact version of a Python version to use, using SemVer's version range syntax
python-version: '3.9' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x86' # optional x64 or x86. Defaults to x64 if not specified

- name: Install the requirements for the GUI
run: |
py -3.8-32 -m pip install --upgrade pip
py -3.8-32 -m pip install -r requirements.txt
py -3.9-32 -m pip install --upgrade pip
py -3.9-32 -m pip install -r requirements.txt
- name: Install PyInstaller
run: py -3.8-32 -m pip install --upgrade pyinstaller
run: py -3.9-32 -m pip install --upgrade pyinstaller

- name: Install Coverage for Python
run: py -3.8-32 -m pip install coverage
run: py -3.9-32 -m pip install coverage

- name: Run unit testing with Coverage
run: py -3.8-32 -m coverage run -m unittest discover -s .\tests\ -p 'test_*.py'
run: py -3.9-32 -m coverage run -m unittest discover -s .\tests\ -p 'test_*.py'

- name: Build the first package (EEG anonymiser, anonymiser.exe)
run: >
py -3.8-32 -m PyInstaller -F --workpath ./build --distpath ./
py -3.9-32 -m PyInstaller -F --workpath ./build --distpath ./
--specpath ./ --clean -n anonymiser
--icon=./ico/fpms_anonymous.ico ./anonymiser.py
- name: Build the second package (converter, coh3toEDF.exe)
run: >
py -3.8-32 -m PyInstaller -F --workpath ./build --distpath ./
py -3.9-32 -m PyInstaller -F --workpath ./build --distpath ./
--specpath ./ --clean -n coh3toEDFbatch
--icon=./ico/fpms.ico ./coh3toEDF.py
- name: Generate the anonymiser GUI Python script from the .ui file
run: |
py -3.8-32 .\ui_to_py_converter.py .\gui_anonymiser_main.ui .\gui_anonymiser_main.py
py -3.8-32 .\ui_to_py_converter.py .\gui_anonymiser_settings.ui .\gui_anonymiser_settings.py
py -3.8-32 .\generate_build_information.py
py -3.9-32 .\ui_to_py_converter.py .\gui_anonymiser_main.ui .\gui_anonymiser_main.py
py -3.9-32 .\ui_to_py_converter.py .\gui_anonymiser_settings.ui .\gui_anonymiser_settings.py
py -3.9-32 .\generate_build_information.py
- name: Build the third package (EEG anonymiser GUI, EEG_anonymiser.exe)
run: >
py -3.8-32 -m PyInstaller -F --workpath ./build --distpath ./
py -3.9-32 -m PyInstaller -F --workpath ./build --distpath ./
--specpath ./ --clean -n EEG_anonymiser
--icon=./ico/fpms_anonymous.ico
--add-data './ico/;ico' .\anonymiser_gui.pyw
- name: Build the fourth package (dataset maker, dataset_maker.exe)
run: >
py -3.8-32 -m PyInstaller -F --workpath ./build --distpath ./
py -3.9-32 -m PyInstaller -F --workpath ./build --distpath ./
--specpath ./ --clean -n dataset_maker
--icon=./ico/fpms.ico ./dataset_maker.py
Expand Down
2 changes: 1 addition & 1 deletion dataset_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def main(
dest for dest
in patient_info['destination_paths']
if isinstance(
patient_info['destination_paths']
patient_info['destination_paths'], str
)
][-1]
except IndexError:
Expand Down
17 changes: 9 additions & 8 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil
import sys
import traceback
import typing
from functools import reduce

import pywinauto
Expand Down Expand Up @@ -151,7 +152,7 @@ def extract_header(filename: str):


def change_field(
array, start: int, stop: int, content: list, filler: bytes = b'\x00',
array, start: int, stop: int, content: bytes, filler: bytes = b'\x00',
):
""" Change the content of a .eeg file field in memory.
Expand All @@ -174,13 +175,13 @@ def change_field(
def anonymise_eeg(
original_file: str,
destination_file: str,
field_name: str = '',
field_surname: str = '',
field_birthdate: str = '',
field_sex: str = '',
field_folder: str = '',
field_centre: str = '',
field_comment: str = ''
field_name: typing.Optional[str] = '',
field_surname: typing.Optional[str] = '',
field_birthdate: typing.Optional[str] = '',
field_sex: typing.Optional[str] = '',
field_folder: typing.Optional[str] = '',
field_centre: typing.Optional[str] = '',
field_comment: typing.Optional[str] = ''
):
"""Anonymise an .eeg file.
Expand Down

0 comments on commit fc4fb07

Please sign in to comment.