Skip to content

Commit

Permalink
Revert files
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll committed Jun 19, 2024
1 parent dfff406 commit 983f217
Show file tree
Hide file tree
Showing 243 changed files with 449 additions and 463 deletions.
2 changes: 1 addition & 1 deletion src/py/flwr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
"simulation",
]

__version__ = _package_version
__version__ = _package_version
2 changes: 1 addition & 1 deletion src/py/flwr/__init___test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ def test_version() -> None:
from flwr import __version__ # pylint: disable=import-outside-toplevel

# Assert
semver.VersionInfo.parse(__version__)
semver.VersionInfo.parse(__version__)
2 changes: 1 addition & 1 deletion src/py/flwr/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower command line interface."""
"""Flower command line interface."""
2 changes: 1 addition & 1 deletion src/py/flwr/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
app.command()(install)

if __name__ == "__main__":
app()
app()
2 changes: 1 addition & 1 deletion src/py/flwr/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ def _load_gitignore(directory: Path) -> pathspec.PathSpec:
if gitignore_path.exists():
with open(gitignore_path, encoding="UTF-8") as file:
patterns.extend(file.readlines())
return pathspec.PathSpec.from_lines("gitwildmatch", patterns)
return pathspec.PathSpec.from_lines("gitwildmatch", patterns)
2 changes: 1 addition & 1 deletion src/py/flwr/cli/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ def load_from_string(toml_content: str) -> Optional[Dict[str, Any]]:
data = tomli.loads(toml_content)
return data
except tomli.TOMLDecodeError:
return None
return None
2 changes: 1 addition & 1 deletion src/py/flwr/cli/config_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,4 @@ def test_validate_pyproject_toml_fail() -> None:
# Assert
assert not is_valid
assert len(errors) == 1
assert len(warnings) == 0
assert len(warnings) == 0
2 changes: 1 addition & 1 deletion src/py/flwr/cli/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ def example() -> None:
subprocess.check_output(["mv", examples_dir, "."])

print()
print(f"Example ready to use in {os.path.join(os.getcwd(), example_name)}")
print(f"Example ready to use in {os.path.join(os.getcwd(), example_name)}")
2 changes: 1 addition & 1 deletion src/py/flwr/cli/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,4 @@ def _verify_hashes(list_content: str, tmpdir: Path) -> bool:
file_path = tmpdir / rel_path
if not file_path.exists() or get_sha256_hash(file_path) != hash_expected:
return False
return True
return True
2 changes: 1 addition & 1 deletion src/py/flwr/cli/new/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

__all__ = [
"new",
]
]
2 changes: 1 addition & 1 deletion src/py/flwr/cli/new/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,4 @@ def new(
fg=typer.colors.BRIGHT_CYAN,
bold=True,
)
)
)
2 changes: 1 addition & 1 deletion src/py/flwr/cli/new/new_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ def test_new_incorrect_name(tmp_path: str) -> None:
assert "Failed to read from stdin" in str(exc_info.value)

finally:
os.chdir(origin)
os.chdir(origin)
2 changes: 1 addition & 1 deletion src/py/flwr/cli/new/templates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower CLI `new` command templates."""
"""Flower CLI `new` command templates."""
2 changes: 1 addition & 1 deletion src/py/flwr/cli/new/templates/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower CLI `new` command app templates."""
"""Flower CLI `new` command app templates."""
2 changes: 1 addition & 1 deletion src/py/flwr/cli/new/templates/app/code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Flower CLI `new` command app / code templates."""
"""Flower CLI `new` command app / code templates."""
2 changes: 1 addition & 1 deletion src/py/flwr/cli/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

__all__ = [
"run",
]
]
2 changes: 1 addition & 1 deletion src/py/flwr/cli/run/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ def on_channel_state_change(channel_connectivity: str) -> None:
stub = ExecStub(channel)

req = StartRunRequest()
stub.StartRun(req)
stub.StartRun(req)
2 changes: 1 addition & 1 deletion src/py/flwr/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@ def get_sha256_hash(file_path: Path) -> str:
if not data:
break
sha256.update(data)
return sha256.hexdigest()
return sha256.hexdigest()
2 changes: 1 addition & 1 deletion src/py/flwr/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"run_supernode",
"start_client",
"start_numpy_client",
]
]
2 changes: 1 addition & 1 deletion src/py/flwr/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,4 +624,4 @@ def signal_handler(sig, frame): # type: ignore
raise StopIteration from None

signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
4 changes: 2 additions & 2 deletions src/py/flwr/client/app_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -125,4 +125,4 @@ def test_start_numpy_client_transport_invalid() -> None:
)
raise AssertionError() # Fail the test if no exception was raised
except ValueError:
pass
pass
2 changes: 1 addition & 1 deletion src/py/flwr/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,4 @@ def maybe_call_evaluate(client: Client, evaluate_ins: EvaluateIns) -> EvaluateRe
)

# If the client implements `evaluate`, call it
return client.evaluate(evaluate_ins)
return client.evaluate(evaluate_ins)
4 changes: 2 additions & 2 deletions src/py/flwr/client/client_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
# Copyright 2023 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -237,4 +237,4 @@ def _registration_error(fn_name: str) -> ValueError:
>>> content=message.content()
>>> )
""",
)
)
4 changes: 2 additions & 2 deletions src/py/flwr/client/client_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -281,4 +281,4 @@ def test_maybe_call_evaluate_false() -> None:
actual = maybe_call_evaluate(client, MagicMock())

# Assert
assert actual.status.code == Code.EVALUATE_NOT_IMPLEMENTED
assert actual.status.code == Code.EVALUATE_NOT_IMPLEMENTED
4 changes: 2 additions & 2 deletions src/py/flwr/client/dpfedavg_numpy_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -184,4 +184,4 @@ def evaluate(
extended format (int, float, float, Dict[str, Scalar]) have been
deprecated and removed since Flower 0.19.
"""
return self.client.evaluate(parameters, config)
return self.client.evaluate(parameters, config)
2 changes: 1 addition & 1 deletion src/py/flwr/client/grpc_adapter_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Client-side part of the GrpcAdapter transport layer."""
"""Client-side part of the GrpcAdapter transport layer."""
2 changes: 1 addition & 1 deletion src/py/flwr/client/grpc_adapter_client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ def grpc_adapter( # pylint: disable=R0913
authentication_keys=None, # Authentication is not supported
adapter_cls=GrpcAdapter,
) as conn:
yield conn
yield conn
2 changes: 1 addition & 1 deletion src/py/flwr/client/grpc_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Client-side part of the gRPC transport layer."""
"""Client-side part of the gRPC transport layer."""
2 changes: 1 addition & 1 deletion src/py/flwr/client/grpc_client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@ def send(message: Message) -> None:
finally:
# Make sure to have a final
channel.close()
log(DEBUG, "gRPC channel closed")
log(DEBUG, "gRPC channel closed")
2 changes: 1 addition & 1 deletion src/py/flwr/client/grpc_client/connection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,4 @@ def run_client() -> int:
assert messages_received == EXPECTED_NUM_SERVER_MESSAGE

# Teardown
server.stop(1)
server.stop(1)
4 changes: 2 additions & 2 deletions src/py/flwr/client/grpc_rere_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Client-side part of the gRPC request-response transport layer."""
"""Client-side part of the gRPC request-response transport layer."""
2 changes: 1 addition & 1 deletion src/py/flwr/client/grpc_rere_client/client_interceptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ def intercept_unary_unary(
self.shared_secret = generate_shared_key(
self.private_key, self.server_public_key
)
return response
return response
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -372,4 +372,4 @@ def test_client_auth_get_run(self) -> None:


if __name__ == "__main__":
unittest.main(verbosity=2)
unittest.main(verbosity=2)
4 changes: 2 additions & 2 deletions src/py/flwr/client/grpc_rere_client/connection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -281,4 +281,4 @@ def get_run(run_id: int) -> Tuple[str, str]:
# Yield methods
yield (receive, send, create_node, delete_node, get_run)
except Exception as exc: # pylint: disable=broad-except
log(ERROR, exc)
log(ERROR, exc)
2 changes: 1 addition & 1 deletion src/py/flwr/client/grpc_rere_client/grpc_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ def GetRun( # pylint: disable=C0103
self, request: GetRunRequest, **kwargs: Any
) -> GetRunResponse:
"""."""
return self._send_and_receive(request, GetRunResponse, **kwargs)
return self._send_and_receive(request, GetRunResponse, **kwargs)
2 changes: 1 addition & 1 deletion src/py/flwr/client/grpc_rere_client/grpc_adapter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ def test_grpc_adapter_methods() -> None:
}

# Assert
assert expected_methods.issubset(methods)
assert expected_methods.issubset(methods)
2 changes: 1 addition & 1 deletion src/py/flwr/client/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ def start_ping_loop(
)
thread.start()

return thread
return thread
2 changes: 1 addition & 1 deletion src/py/flwr/client/heartbeat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def test_ping_loop_with_failures_terminates(self) -> None:

# Assert
self.assertTrue(ping_fn.called)
self.assertFalse(thread.is_alive())
self.assertFalse(thread.is_alive())
4 changes: 2 additions & 2 deletions src/py/flwr/client/message_handler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Client-side message handling."""
"""Client-side message handling."""
4 changes: 2 additions & 2 deletions src/py/flwr/client/message_handler/message_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -175,4 +175,4 @@ def validate_out_message(out_message: Message, in_message_metadata: Metadata) ->
and out_meta.created_at > in_meta.created_at
):
return True
return False
return False
4 changes: 2 additions & 2 deletions src/py/flwr/client/message_handler/message_handler_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Flower Labs GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -319,4 +319,4 @@ def test_invalid_message_run_id(self) -> None:
# Assert
for invalid_metadata in invalid_metadata_list:
msg.__dict__["_metadata"] = invalid_metadata
self.assertFalse(validate_out_message(msg, self.in_metadata))
self.assertFalse(validate_out_message(msg, self.in_metadata))
2 changes: 1 addition & 1 deletion src/py/flwr/client/message_handler/task_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ def get_task_ins(
# Only evaluate the first message
task_ins: TaskIns = pull_task_ins_response.task_ins_list[0]

return task_ins
return task_ins
2 changes: 1 addition & 1 deletion src/py/flwr/client/message_handler/task_handler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ def test_get_task_ins_multiple_ins() -> None:
reconnect=None, task_ins_list=[expected_task_ins, TaskIns(), TaskIns()]
)
actual_task_ins = get_task_ins(res)
assert actual_task_ins == expected_task_ins
assert actual_task_ins == expected_task_ins
4 changes: 2 additions & 2 deletions src/py/flwr/client/mod/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Flower Labs GmbH. All Rights Reserved.
# Copyright 2023 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,4 +30,4 @@
"parameters_size_mod",
"secagg_mod",
"secaggplus_mod",
]
]
2 changes: 1 addition & 1 deletion src/py/flwr/client/mod/centraldp_mods.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,4 @@ def adaptiveclipping_mod(

fit_res.metrics[KEY_NORM_BIT] = norm_bit
out_msg.content = compat.fitres_to_recordset(fit_res, keep_input=True)
return out_msg
return out_msg
2 changes: 1 addition & 1 deletion src/py/flwr/client/mod/comms_mods.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ def parameters_size_mod(

log(INFO, "Total parameters transmitted: %i bytes", parameters_size_in_bytes)

return call_next(msg, ctxt)
return call_next(msg, ctxt)
2 changes: 1 addition & 1 deletion src/py/flwr/client/mod/localdp_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ def __call__(
)

out_msg.content = compat.fitres_to_recordset(fit_res, keep_input=True)
return out_msg
return out_msg
Loading

0 comments on commit 983f217

Please sign in to comment.