Skip to content

Commit

Permalink
isort, black, flake8 formatting
Browse files Browse the repository at this point in the history
Signed-off-by: kta-intel <[email protected]>
  • Loading branch information
kta-intel committed Oct 30, 2024
1 parent 3345143 commit 79332c3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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$
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion openfl_contrib/__version__.py
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 3 additions & 1 deletion openfl_contrib/interface/aggregation_functions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""Custom Federated averaging module."""

import numpy as np

from openfl.interface.aggregation_functions.core import AggregationFunction


Expand Down Expand Up @@ -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
4 changes: 1 addition & 3 deletions openfl_contrib/pipelines/skc_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
6 changes: 3 additions & 3 deletions shell/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
flake8 --config "${base_dir}/setup.cfg" openfl_contrib
6 changes: 3 additions & 3 deletions shell/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
flake8 --config "${base_dir}/setup.cfg" --show-source openfl_contrib

0 comments on commit 79332c3

Please sign in to comment.