Skip to content

Commit

Permalink
Resolved all flake8 issues.
Browse files Browse the repository at this point in the history
Signed-off-by: Parth Mandaliya <[email protected]>
  • Loading branch information
ParthMandaliya committed Jul 19, 2024
1 parent 64f18ae commit 39b289a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
7 changes: 4 additions & 3 deletions openfl/component/aggregator/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,10 @@ def send_local_task_results(self, collaborator_name, round_number, task_name,
collab_name for collab_name in self.authorized_cols
if collab_name not in self.collaborators_done
]
if len(self.stragglers) != 0: self.logger.warning(
f"Identified straggler collaborators: {self.stragglers}"
)
if len(self.stragglers) != 0:
self.logger.warning(
f"Identified straggler collaborators: {self.stragglers}"
)
self._end_of_round_check()

def _process_named_tensor(self, named_tensor, collaborator_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def __straggler_time_expired(self) -> bool:
Determines if straggler_cutoff_time is elapsed.
"""
return (
self.round_start_time is not None and
((time.time() - self.round_start_time) > self.straggler_cutoff_time)
self.round_start_time is not None
and ((time.time() - self.round_start_time) > self.straggler_cutoff_time)
)

def __minimum_collaborators_reported(self, num_collaborators_done) -> bool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"""Percentage based Straggler Handling function."""
from logging import getLogger
from typing import Callable
from openfl.component.straggler_handling_functions import StragglerHandlingPolicy


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def straggler_cutoff_check(
Number of collaborators finished.
num_all_collaborators: int
Total number of collaborators.
Returns:
bool
"""
Expand Down
4 changes: 1 addition & 3 deletions openfl/native/fastestimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ def fit(self):

aggregator = plan.get_aggregator()

model_states = {
collaborator: None for collaborator in plan.authorized_cols
}
model_states = dict.fromkeys(plan.authorized_cols, None)
runners = {}
save_dir = {}
data_path = 1
Expand Down
2 changes: 1 addition & 1 deletion openfl/utilities/optimizers/numpy/adam_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(
self.beta_1, self.beta_2 = betas
self.initial_accumulator_value = initial_accumulator_value
self.epsilon = epsilon
self.current_step: Dict[str, int] = {param_name: 0 for param_name in self.params}
self.current_step: Dict[str, int] = dict.fromkeys(self.params, 0)

self.grads_first_moment, self.grads_second_moment = {}, {}

Expand Down

0 comments on commit 39b289a

Please sign in to comment.