diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9b323cd..97f0d14 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ minimum_pre_commit_version: 3.3.3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: end-of-file-fixer files: \.py$ @@ -21,7 +21,7 @@ repos: - id: trailing-whitespace files: \.py$ - repo: https://github.com/PyCQA/autoflake - rev: v2.2.0 + rev: v2.3.1 hooks: - id: autoflake args: diff --git a/openfl_contrib/__version__.py b/openfl_contrib/__version__.py index a764983..b243927 100644 --- a/openfl_contrib/__version__.py +++ b/openfl_contrib/__version__.py @@ -1,4 +1,4 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openfl-contrib version information.""" -__version__ = '0.1.0' +__version__ = "0.1.0" diff --git a/openfl_contrib/interface/aggregation_functions/__init__.py b/openfl_contrib/interface/aggregation_functions/__init__.py index e3049d7..1d05dcc 100644 --- a/openfl_contrib/interface/aggregation_functions/__init__.py +++ b/openfl_contrib/interface/aggregation_functions/__init__.py @@ -3,4 +3,6 @@ """Aggregation functions package.""" -from openfl_contrib.interface.aggregation_functions.custom_weighted_average import CustomWeightedAverage +from openfl_contrib.interface.aggregation_functions.custom_weighted_average import ( + CustomWeightedAverage, +) diff --git a/openfl_contrib/interface/aggregation_functions/custom_weighted_average.py b/openfl_contrib/interface/aggregation_functions/custom_weighted_average.py index 7e7a8ce..2e4732c 100644 --- a/openfl_contrib/interface/aggregation_functions/custom_weighted_average.py +++ b/openfl_contrib/interface/aggregation_functions/custom_weighted_average.py @@ -4,7 +4,6 @@ """Custom Federated averaging module.""" import numpy as np - from openfl.interface.aggregation_functions.core import AggregationFunction @@ -41,7 +40,5 @@ def call(self, local_tensors, *_) -> np.ndarray: tensors, weights = zip(*[(x.tensor, x.weight) for x in local_tensors]) total_weight = sum(weights) - weighted_sum = np.sum( - [tensor * weight for tensor, weight in zip(tensors, weights)], axis=0 - ) + weighted_sum = np.sum([tensor * weight for tensor, weight in zip(tensors, weights)], axis=0) return weighted_sum / total_weight diff --git a/openfl_contrib/pipelines/skc_pipeline.py b/openfl_contrib/pipelines/skc_pipeline.py index fec7745..d2de2c7 100644 --- a/openfl_contrib/pipelines/skc_pipeline.py +++ b/openfl_contrib/pipelines/skc_pipeline.py @@ -7,11 +7,9 @@ import gzip as gz import numpy as np +from openfl.pipelines.pipeline import TransformationPipeline, Transformer from sklearn import cluster -from openfl.pipelines.pipeline import TransformationPipeline -from openfl.pipelines.pipeline import Transformer - class SparsityTransformer(Transformer): """A transformer class to sparsify input data.""" diff --git a/shell/format.sh b/shell/format.sh index 5d8f2c1..79332da 100755 --- a/shell/format.sh +++ b/shell/format.sh @@ -6,8 +6,8 @@ base_dir=$(dirname $(dirname $0)) # Run the pre-commit checks pre-commit run --all-files -isort --sp "${base_dir}/pyproject.toml" openfl +isort --sp "${base_dir}/pyproject.toml" openfl_contrib -black --config "${base_dir}/pyproject.toml" openfl +black --config "${base_dir}/pyproject.toml" openfl_contrib -flake8 --config "${base_dir}/setup.cfg" openfl \ No newline at end of file +flake8 --config "${base_dir}/setup.cfg" openfl_contrib \ No newline at end of file diff --git a/shell/lint.sh b/shell/lint.sh index f3cee9c..1e0209b 100644 --- a/shell/lint.sh +++ b/shell/lint.sh @@ -6,8 +6,8 @@ base_dir=$(dirname $(dirname $0)) # Run the pre-commit checks pre-commit run --all-files -isort --sp "${base_dir}/pyproject.toml" --check openfl +isort --sp "${base_dir}/pyproject.toml" --check openfl_contrib -black --config "${base_dir}/pyproject.toml" --check openfl +black --config "${base_dir}/pyproject.toml" --check openfl_contrib -flake8 --config "${base_dir}/setup.cfg" --show-source openfl \ No newline at end of file +flake8 --config "${base_dir}/setup.cfg" --show-source openfl_contrib \ No newline at end of file