From 39aacfc00635f2af4f1e51e51a4f212407ad8ead Mon Sep 17 00:00:00 2001 From: Teodor Parvanov Date: Fri, 8 Nov 2024 09:05:34 +0100 Subject: [PATCH 1/4] Wiring flake8 with the PR pipeline Signed-off-by: Teodor Parvanov --- .github/workflows/lint.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1c7f9fe4aa..808142965a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,4 +26,7 @@ jobs: python -m pip install --upgrade pip pip install -r linters-requirements.txt - name: Lint using built-in script - run: bash shell/lint.sh \ No newline at end of file + run: bash shell/lint.sh + - name: Lint with flake8 + run: | + flake8 --show-source \ No newline at end of file From e554695917cdf008c6091715e434d5f077f90068 Mon Sep 17 00:00:00 2001 From: Teodor Parvanov Date: Fri, 8 Nov 2024 09:06:05 +0100 Subject: [PATCH 2/4] Fixing code formatting issues reported by flake8 Signed-off-by: Teodor Parvanov --- openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py | 6 +++--- .../keras_cnn_with_compression/src/tfmnist_inmemory.py | 6 +++--- openfl-workspace/torch_cnn_histology/src/dataloader.py | 6 +++--- openfl-workspace/torch_cnn_mnist/src/dataloader.py | 6 +++--- .../src/ptmnist_inmemory.py | 6 +++--- .../torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py | 6 +++--- .../torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py | 6 +++--- openfl-workspace/torch_unet_kvasir/src/data_loader.py | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py b/openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py index 51f4ccf739..bbad002681 100644 --- a/openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py +++ b/openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py @@ -28,10 +28,10 @@ def __init__(self, data_path, batch_size, **kwargs): # collaborator list. try: int(data_path) - except: + except ValueError: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " + - "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/keras_cnn_with_compression/src/tfmnist_inmemory.py b/openfl-workspace/keras_cnn_with_compression/src/tfmnist_inmemory.py index 80b913e5f5..f932502e31 100644 --- a/openfl-workspace/keras_cnn_with_compression/src/tfmnist_inmemory.py +++ b/openfl-workspace/keras_cnn_with_compression/src/tfmnist_inmemory.py @@ -28,10 +28,10 @@ def __init__(self, data_path, batch_size, **kwargs): # collaborator list. try: int(data_path) - except: + except ValueError: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " + - "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_histology/src/dataloader.py b/openfl-workspace/torch_cnn_histology/src/dataloader.py index fa4ae86778..b0655cf5f0 100644 --- a/openfl-workspace/torch_cnn_histology/src/dataloader.py +++ b/openfl-workspace/torch_cnn_histology/src/dataloader.py @@ -39,10 +39,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except: + except ValueError: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " + - "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_mnist/src/dataloader.py b/openfl-workspace/torch_cnn_mnist/src/dataloader.py index 3f3eeeb0bb..0557e81af4 100644 --- a/openfl-workspace/torch_cnn_mnist/src/dataloader.py +++ b/openfl-workspace/torch_cnn_mnist/src/dataloader.py @@ -28,10 +28,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except: + except ValueError: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " + - "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_mnist_eden_compression/src/ptmnist_inmemory.py b/openfl-workspace/torch_cnn_mnist_eden_compression/src/ptmnist_inmemory.py index 74c8ec5d03..ecd9f777e4 100644 --- a/openfl-workspace/torch_cnn_mnist_eden_compression/src/ptmnist_inmemory.py +++ b/openfl-workspace/torch_cnn_mnist_eden_compression/src/ptmnist_inmemory.py @@ -29,10 +29,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except: + except ValueError: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " + - "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py b/openfl-workspace/torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py index 324545a763..0438e5d812 100644 --- a/openfl-workspace/torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py +++ b/openfl-workspace/torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py @@ -29,10 +29,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except: + except ValueError: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " + - "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py b/openfl-workspace/torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py index ccf234239c..508bea12d0 100644 --- a/openfl-workspace/torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py +++ b/openfl-workspace/torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py @@ -28,10 +28,10 @@ def __init__(self, data_path, batch_size, **kwargs): # of collaborator list. try: int(data_path) - except: + except ValueError: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " + - "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_unet_kvasir/src/data_loader.py b/openfl-workspace/torch_unet_kvasir/src/data_loader.py index 0f968808e4..9d454b28af 100644 --- a/openfl-workspace/torch_unet_kvasir/src/data_loader.py +++ b/openfl-workspace/torch_unet_kvasir/src/data_loader.py @@ -124,10 +124,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except: + except ValueError: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " + - "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) From 1fe5d4ae8c837bc2ae1453124f6b9e2834d44136 Mon Sep 17 00:00:00 2001 From: Teodor Parvanov Date: Fri, 8 Nov 2024 10:31:27 +0100 Subject: [PATCH 3/4] Update ubuntu.yml to use custom lint configs as in lint.yml Signed-off-by: Teodor Parvanov --- .github/workflows/lint.yml | 5 +---- .github/workflows/ubuntu.yml | 8 +++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 808142965a..3bf1b32dac 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,8 +25,5 @@ jobs: run: | python -m pip install --upgrade pip pip install -r linters-requirements.txt - - name: Lint using built-in script + - name: Lint with OpenFL-specific rules run: bash shell/lint.sh - - name: Lint with flake8 - run: | - flake8 --show-source \ No newline at end of file diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 1c1dfe49c7..3f26c797fc 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -16,14 +16,12 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.8" - - name: Install dependencies + - name: Install linters run: | python -m pip install --upgrade pip pip install -r linters-requirements.txt - pip install . - - name: Lint with flake8 - run: | - flake8 --show-source + - name: Lint with OpenFL-specific rules + run: bash shell/lint.sh pytest-coverage: # from pytest_coverage.yml needs: lint From 1dccbba4b7a8d3dace5af2a2dd4f7389b82cb477 Mon Sep 17 00:00:00 2001 From: Teodor Parvanov Date: Mon, 11 Nov 2024 08:37:44 +0100 Subject: [PATCH 4/4] Revert "Fixing code formatting issues reported by flake8" This reverts commit e554695917cdf008c6091715e434d5f077f90068. Signed-off-by: Teodor Parvanov --- openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py | 6 +++--- .../keras_cnn_with_compression/src/tfmnist_inmemory.py | 6 +++--- openfl-workspace/torch_cnn_histology/src/dataloader.py | 6 +++--- openfl-workspace/torch_cnn_mnist/src/dataloader.py | 6 +++--- .../src/ptmnist_inmemory.py | 6 +++--- .../torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py | 6 +++--- .../torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py | 6 +++--- openfl-workspace/torch_unet_kvasir/src/data_loader.py | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py b/openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py index bbad002681..51f4ccf739 100644 --- a/openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py +++ b/openfl-workspace/keras_cnn_mnist/src/tfmnist_inmemory.py @@ -28,10 +28,10 @@ def __init__(self, data_path, batch_size, **kwargs): # collaborator list. try: int(data_path) - except ValueError: + except: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " - + "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/keras_cnn_with_compression/src/tfmnist_inmemory.py b/openfl-workspace/keras_cnn_with_compression/src/tfmnist_inmemory.py index f932502e31..80b913e5f5 100644 --- a/openfl-workspace/keras_cnn_with_compression/src/tfmnist_inmemory.py +++ b/openfl-workspace/keras_cnn_with_compression/src/tfmnist_inmemory.py @@ -28,10 +28,10 @@ def __init__(self, data_path, batch_size, **kwargs): # collaborator list. try: int(data_path) - except ValueError: + except: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " - + "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_histology/src/dataloader.py b/openfl-workspace/torch_cnn_histology/src/dataloader.py index b0655cf5f0..fa4ae86778 100644 --- a/openfl-workspace/torch_cnn_histology/src/dataloader.py +++ b/openfl-workspace/torch_cnn_histology/src/dataloader.py @@ -39,10 +39,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except ValueError: + except: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " - + "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_mnist/src/dataloader.py b/openfl-workspace/torch_cnn_mnist/src/dataloader.py index 0557e81af4..3f3eeeb0bb 100644 --- a/openfl-workspace/torch_cnn_mnist/src/dataloader.py +++ b/openfl-workspace/torch_cnn_mnist/src/dataloader.py @@ -28,10 +28,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except ValueError: + except: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " - + "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_mnist_eden_compression/src/ptmnist_inmemory.py b/openfl-workspace/torch_cnn_mnist_eden_compression/src/ptmnist_inmemory.py index ecd9f777e4..74c8ec5d03 100644 --- a/openfl-workspace/torch_cnn_mnist_eden_compression/src/ptmnist_inmemory.py +++ b/openfl-workspace/torch_cnn_mnist_eden_compression/src/ptmnist_inmemory.py @@ -29,10 +29,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except ValueError: + except: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " - + "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py b/openfl-workspace/torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py index 0438e5d812..324545a763 100644 --- a/openfl-workspace/torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py +++ b/openfl-workspace/torch_cnn_mnist_fed_eval/src/ptmnist_inmemory.py @@ -29,10 +29,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except ValueError: + except: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " - + "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py b/openfl-workspace/torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py index 508bea12d0..ccf234239c 100644 --- a/openfl-workspace/torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py +++ b/openfl-workspace/torch_cnn_mnist_straggler_check/src/ptmnist_inmemory.py @@ -28,10 +28,10 @@ def __init__(self, data_path, batch_size, **kwargs): # of collaborator list. try: int(data_path) - except ValueError: + except: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " - + "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path ) diff --git a/openfl-workspace/torch_unet_kvasir/src/data_loader.py b/openfl-workspace/torch_unet_kvasir/src/data_loader.py index 9d454b28af..0f968808e4 100644 --- a/openfl-workspace/torch_unet_kvasir/src/data_loader.py +++ b/openfl-workspace/torch_unet_kvasir/src/data_loader.py @@ -124,10 +124,10 @@ def __init__(self, data_path, batch_size, **kwargs): try: int(data_path) - except ValueError: + except: raise ValueError( - "Expected `%s` to be representable as `int`, as it refers to the data shard " - + "number used by the collaborator.", + "Expected `%s` to be representable as `int`, as it refers to the data shard " + + "number used by the collaborator.", data_path )