diff --git a/pyproject.toml b/pyproject.toml index 2dd592050468..7fcc60d89594 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ classifiers = [ ] packages = [ { include = "flwr", from = "src/py" }, + { include = "flwr_tool", from = "src/py" }, ] exclude = [ "src/py/**/*_test.py", diff --git a/src/py/flwr/__init__.py b/src/py/flwr/__init__.py index ccaf07c6012f..cfe1fc3c006a 100644 --- a/src/py/flwr/__init__.py +++ b/src/py/flwr/__init__.py @@ -26,4 +26,4 @@ "simulation", ] -__version__ = _package_version +__version__ = _package_version \ No newline at end of file diff --git a/src/py/flwr/__init___test.py b/src/py/flwr/__init___test.py index 61785d093b2d..6e1d710d6e33 100644 --- a/src/py/flwr/__init___test.py +++ b/src/py/flwr/__init___test.py @@ -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__) \ No newline at end of file diff --git a/src/py/flwr/cli/__init__.py b/src/py/flwr/cli/__init__.py index d4d3b8ac4d48..ce55f0dff98a 100644 --- a/src/py/flwr/cli/__init__.py +++ b/src/py/flwr/cli/__init__.py @@ -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.""" \ No newline at end of file diff --git a/src/py/flwr/cli/app.py b/src/py/flwr/cli/app.py index 477b990bf1da..97631de03592 100644 --- a/src/py/flwr/cli/app.py +++ b/src/py/flwr/cli/app.py @@ -38,4 +38,4 @@ app.command()(install) if __name__ == "__main__": - app() + app() \ No newline at end of file diff --git a/src/py/flwr/cli/build.py b/src/py/flwr/cli/build.py index 2981eacf925d..639d8767a703 100644 --- a/src/py/flwr/cli/build.py +++ b/src/py/flwr/cli/build.py @@ -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) \ No newline at end of file diff --git a/src/py/flwr/cli/config_utils.py b/src/py/flwr/cli/config_utils.py index d06a1d6dba96..55d51b5832cc 100644 --- a/src/py/flwr/cli/config_utils.py +++ b/src/py/flwr/cli/config_utils.py @@ -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 \ No newline at end of file diff --git a/src/py/flwr/cli/config_utils_test.py b/src/py/flwr/cli/config_utils_test.py index b24425cd08f4..4d84cf390b15 100644 --- a/src/py/flwr/cli/config_utils_test.py +++ b/src/py/flwr/cli/config_utils_test.py @@ -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 \ No newline at end of file diff --git a/src/py/flwr/cli/example.py b/src/py/flwr/cli/example.py index 4790e72d48bf..0bd5422abfb1 100644 --- a/src/py/flwr/cli/example.py +++ b/src/py/flwr/cli/example.py @@ -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)}") \ No newline at end of file diff --git a/src/py/flwr/cli/install.py b/src/py/flwr/cli/install.py index de9227bee450..dc549f1dff73 100644 --- a/src/py/flwr/cli/install.py +++ b/src/py/flwr/cli/install.py @@ -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 \ No newline at end of file diff --git a/src/py/flwr/cli/new/__init__.py b/src/py/flwr/cli/new/__init__.py index a973f47021c3..32d8ce816fc5 100644 --- a/src/py/flwr/cli/new/__init__.py +++ b/src/py/flwr/cli/new/__init__.py @@ -18,4 +18,4 @@ __all__ = [ "new", -] +] \ No newline at end of file diff --git a/src/py/flwr/cli/new/new.py b/src/py/flwr/cli/new/new.py index 9bbc016de1a8..3ac78ccab53f 100644 --- a/src/py/flwr/cli/new/new.py +++ b/src/py/flwr/cli/new/new.py @@ -194,4 +194,4 @@ def new( fg=typer.colors.BRIGHT_CYAN, bold=True, ) - ) + ) \ No newline at end of file diff --git a/src/py/flwr/cli/new/new_test.py b/src/py/flwr/cli/new/new_test.py index 33ad745efa93..17fff7e2ebd6 100644 --- a/src/py/flwr/cli/new/new_test.py +++ b/src/py/flwr/cli/new/new_test.py @@ -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) \ No newline at end of file diff --git a/src/py/flwr/cli/new/templates/__init__.py b/src/py/flwr/cli/new/templates/__init__.py index 7a951c2da1a2..aec0cea648f0 100644 --- a/src/py/flwr/cli/new/templates/__init__.py +++ b/src/py/flwr/cli/new/templates/__init__.py @@ -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.""" \ No newline at end of file diff --git a/src/py/flwr/cli/new/templates/app/__init__.py b/src/py/flwr/cli/new/templates/app/__init__.py index 617628fc9138..fe43d55c73ad 100644 --- a/src/py/flwr/cli/new/templates/app/__init__.py +++ b/src/py/flwr/cli/new/templates/app/__init__.py @@ -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.""" \ No newline at end of file diff --git a/src/py/flwr/cli/new/templates/app/code/__init__.py b/src/py/flwr/cli/new/templates/app/code/__init__.py index 7f1a0e9f4fa2..37d3c1172445 100644 --- a/src/py/flwr/cli/new/templates/app/code/__init__.py +++ b/src/py/flwr/cli/new/templates/app/code/__init__.py @@ -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.""" \ No newline at end of file diff --git a/src/py/flwr/cli/run/__init__.py b/src/py/flwr/cli/run/__init__.py index 43523c215d3e..27a37ea99506 100644 --- a/src/py/flwr/cli/run/__init__.py +++ b/src/py/flwr/cli/run/__init__.py @@ -18,4 +18,4 @@ __all__ = [ "run", -] +] \ No newline at end of file diff --git a/src/py/flwr/cli/run/run.py b/src/py/flwr/cli/run/run.py index 7577d9efbd8c..79757f4076ac 100644 --- a/src/py/flwr/cli/run/run.py +++ b/src/py/flwr/cli/run/run.py @@ -118,4 +118,4 @@ def on_channel_state_change(channel_connectivity: str) -> None: stub = ExecStub(channel) req = StartRunRequest() - stub.StartRun(req) + stub.StartRun(req) \ No newline at end of file diff --git a/src/py/flwr/cli/utils.py b/src/py/flwr/cli/utils.py index 2f5a8831fa7c..045f039e2fbb 100644 --- a/src/py/flwr/cli/utils.py +++ b/src/py/flwr/cli/utils.py @@ -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() \ No newline at end of file diff --git a/src/py/flwr/client/__init__.py b/src/py/flwr/client/__init__.py index 58fd94448586..797a83765981 100644 --- a/src/py/flwr/client/__init__.py +++ b/src/py/flwr/client/__init__.py @@ -34,4 +34,4 @@ "run_supernode", "start_client", "start_numpy_client", -] +] \ No newline at end of file diff --git a/src/py/flwr/client/app.py b/src/py/flwr/client/app.py index cdb7b25cbf6b..7c9a6bd29c4b 100644 --- a/src/py/flwr/client/app.py +++ b/src/py/flwr/client/app.py @@ -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) \ No newline at end of file diff --git a/src/py/flwr/client/app_test.py b/src/py/flwr/client/app_test.py index 56d6308a0fe2..0fe75cf49a19 100644 --- a/src/py/flwr/client/app_test.py +++ b/src/py/flwr/client/app_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -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 \ No newline at end of file diff --git a/src/py/flwr/client/client.py b/src/py/flwr/client/client.py index 23a3755f3efe..9a6918431c76 100644 --- a/src/py/flwr/client/client.py +++ b/src/py/flwr/client/client.py @@ -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) \ No newline at end of file diff --git a/src/py/flwr/client/client_app.py b/src/py/flwr/client/client_app.py index 82539834eaad..1458f119945b 100644 --- a/src/py/flwr/client/client_app.py +++ b/src/py/flwr/client/client_app.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -237,4 +237,4 @@ def _registration_error(fn_name: str) -> ValueError: >>> content=message.content() >>> ) """, - ) + ) \ No newline at end of file diff --git a/src/py/flwr/client/client_test.py b/src/py/flwr/client/client_test.py index 373c676e5edc..f92bc6a07713 100644 --- a/src/py/flwr/client/client_test.py +++ b/src/py/flwr/client/client_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -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 \ No newline at end of file diff --git a/src/py/flwr/client/dpfedavg_numpy_client.py b/src/py/flwr/client/dpfedavg_numpy_client.py index ab31a289d29b..95ee6df72fbc 100644 --- a/src/py/flwr/client/dpfedavg_numpy_client.py +++ b/src/py/flwr/client/dpfedavg_numpy_client.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -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) \ No newline at end of file diff --git a/src/py/flwr/client/grpc_adapter_client/__init__.py b/src/py/flwr/client/grpc_adapter_client/__init__.py index 5900e2dc2d06..bb134b63c2f8 100644 --- a/src/py/flwr/client/grpc_adapter_client/__init__.py +++ b/src/py/flwr/client/grpc_adapter_client/__init__.py @@ -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.""" \ No newline at end of file diff --git a/src/py/flwr/client/grpc_adapter_client/connection.py b/src/py/flwr/client/grpc_adapter_client/connection.py index e4e32b3accd0..fc9b58f0870d 100644 --- a/src/py/flwr/client/grpc_adapter_client/connection.py +++ b/src/py/flwr/client/grpc_adapter_client/connection.py @@ -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 \ No newline at end of file diff --git a/src/py/flwr/client/grpc_client/__init__.py b/src/py/flwr/client/grpc_client/__init__.py index 9e987e86b254..c4e7400831d0 100644 --- a/src/py/flwr/client/grpc_client/__init__.py +++ b/src/py/flwr/client/grpc_client/__init__.py @@ -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.""" \ No newline at end of file diff --git a/src/py/flwr/client/grpc_client/connection.py b/src/py/flwr/client/grpc_client/connection.py index 8c049861c672..cec7ccf5f5e8 100644 --- a/src/py/flwr/client/grpc_client/connection.py +++ b/src/py/flwr/client/grpc_client/connection.py @@ -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") \ No newline at end of file diff --git a/src/py/flwr/client/grpc_client/connection_test.py b/src/py/flwr/client/grpc_client/connection_test.py index da7800b26639..14b7e717fafc 100644 --- a/src/py/flwr/client/grpc_client/connection_test.py +++ b/src/py/flwr/client/grpc_client/connection_test.py @@ -167,4 +167,4 @@ def run_client() -> int: assert messages_received == EXPECTED_NUM_SERVER_MESSAGE # Teardown - server.stop(1) + server.stop(1) \ No newline at end of file diff --git a/src/py/flwr/client/grpc_rere_client/__init__.py b/src/py/flwr/client/grpc_rere_client/__init__.py index 93903e725776..fe9580e6823b 100644 --- a/src/py/flwr/client/grpc_rere_client/__init__.py +++ b/src/py/flwr/client/grpc_rere_client/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -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.""" \ No newline at end of file diff --git a/src/py/flwr/client/grpc_rere_client/client_interceptor.py b/src/py/flwr/client/grpc_rere_client/client_interceptor.py index d2dded8a73d9..e5d4b6715546 100644 --- a/src/py/flwr/client/grpc_rere_client/client_interceptor.py +++ b/src/py/flwr/client/grpc_rere_client/client_interceptor.py @@ -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 \ No newline at end of file diff --git a/src/py/flwr/client/grpc_rere_client/client_interceptor_test.py b/src/py/flwr/client/grpc_rere_client/client_interceptor_test.py index cc35ffef46db..441b82dd7b0f 100644 --- a/src/py/flwr/client/grpc_rere_client/client_interceptor_test.py +++ b/src/py/flwr/client/grpc_rere_client/client_interceptor_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -372,4 +372,4 @@ def test_client_auth_get_run(self) -> None: if __name__ == "__main__": - unittest.main(verbosity=2) + unittest.main(verbosity=2) \ No newline at end of file diff --git a/src/py/flwr/client/grpc_rere_client/connection.py b/src/py/flwr/client/grpc_rere_client/connection.py index b1c268d51d55..474f89c8ee6d 100644 --- a/src/py/flwr/client/grpc_rere_client/connection.py +++ b/src/py/flwr/client/grpc_rere_client/connection.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -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) \ No newline at end of file diff --git a/src/py/flwr/client/grpc_rere_client/grpc_adapter.py b/src/py/flwr/client/grpc_rere_client/grpc_adapter.py index 77c3d601020d..bc781c58c57a 100644 --- a/src/py/flwr/client/grpc_rere_client/grpc_adapter.py +++ b/src/py/flwr/client/grpc_rere_client/grpc_adapter.py @@ -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) \ No newline at end of file diff --git a/src/py/flwr/client/grpc_rere_client/grpc_adapter_test.py b/src/py/flwr/client/grpc_rere_client/grpc_adapter_test.py index e62111e084bc..131f8a91c7b5 100644 --- a/src/py/flwr/client/grpc_rere_client/grpc_adapter_test.py +++ b/src/py/flwr/client/grpc_rere_client/grpc_adapter_test.py @@ -35,4 +35,4 @@ def test_grpc_adapter_methods() -> None: } # Assert - assert expected_methods.issubset(methods) + assert expected_methods.issubset(methods) \ No newline at end of file diff --git a/src/py/flwr/client/heartbeat.py b/src/py/flwr/client/heartbeat.py index b68e6163cc01..39d67693a2ad 100644 --- a/src/py/flwr/client/heartbeat.py +++ b/src/py/flwr/client/heartbeat.py @@ -71,4 +71,4 @@ def start_ping_loop( ) thread.start() - return thread + return thread \ No newline at end of file diff --git a/src/py/flwr/client/heartbeat_test.py b/src/py/flwr/client/heartbeat_test.py index 286429e075b1..19d517d34ccb 100644 --- a/src/py/flwr/client/heartbeat_test.py +++ b/src/py/flwr/client/heartbeat_test.py @@ -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()) \ No newline at end of file diff --git a/src/py/flwr/client/message_handler/__init__.py b/src/py/flwr/client/message_handler/__init__.py index 653563963de5..07b452d420ab 100644 --- a/src/py/flwr/client/message_handler/__init__.py +++ b/src/py/flwr/client/message_handler/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -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.""" \ No newline at end of file diff --git a/src/py/flwr/client/message_handler/message_handler.py b/src/py/flwr/client/message_handler/message_handler.py index e5acbe0cc9d0..7cdf6cc64b55 100644 --- a/src/py/flwr/client/message_handler/message_handler.py +++ b/src/py/flwr/client/message_handler/message_handler.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -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 \ No newline at end of file diff --git a/src/py/flwr/client/message_handler/message_handler_test.py b/src/py/flwr/client/message_handler/message_handler_test.py index 8a2db1804e4a..91d54c9d715a 100644 --- a/src/py/flwr/client/message_handler/message_handler_test.py +++ b/src/py/flwr/client/message_handler/message_handler_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -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)) \ No newline at end of file diff --git a/src/py/flwr/client/message_handler/task_handler.py b/src/py/flwr/client/message_handler/task_handler.py index 7f515a30fe5a..816c2b074624 100644 --- a/src/py/flwr/client/message_handler/task_handler.py +++ b/src/py/flwr/client/message_handler/task_handler.py @@ -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 \ No newline at end of file diff --git a/src/py/flwr/client/message_handler/task_handler_test.py b/src/py/flwr/client/message_handler/task_handler_test.py index c8b9e14737ff..6f156133e2c7 100644 --- a/src/py/flwr/client/message_handler/task_handler_test.py +++ b/src/py/flwr/client/message_handler/task_handler_test.py @@ -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 \ No newline at end of file diff --git a/src/py/flwr/client/mod/__init__.py b/src/py/flwr/client/mod/__init__.py index 0b4cf6488421..e039f134c0a8 100644 --- a/src/py/flwr/client/mod/__init__.py +++ b/src/py/flwr/client/mod/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -30,4 +30,4 @@ "parameters_size_mod", "secagg_mod", "secaggplus_mod", -] +] \ No newline at end of file diff --git a/src/py/flwr/client/mod/centraldp_mods.py b/src/py/flwr/client/mod/centraldp_mods.py index e6276ccf2245..f2b6288efd3e 100644 --- a/src/py/flwr/client/mod/centraldp_mods.py +++ b/src/py/flwr/client/mod/centraldp_mods.py @@ -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 \ No newline at end of file diff --git a/src/py/flwr/client/mod/comms_mods.py b/src/py/flwr/client/mod/comms_mods.py index 058fd6a70001..e7a3cd4abdf6 100644 --- a/src/py/flwr/client/mod/comms_mods.py +++ b/src/py/flwr/client/mod/comms_mods.py @@ -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) \ No newline at end of file diff --git a/src/py/flwr/client/mod/localdp_mod.py b/src/py/flwr/client/mod/localdp_mod.py index fe369ad1c7e6..611f3a12cf0a 100644 --- a/src/py/flwr/client/mod/localdp_mod.py +++ b/src/py/flwr/client/mod/localdp_mod.py @@ -150,4 +150,4 @@ def __call__( ) out_msg.content = compat.fitres_to_recordset(fit_res, keep_input=True) - return out_msg + return out_msg \ No newline at end of file diff --git a/src/py/flwr/client/mod/secure_aggregation/__init__.py b/src/py/flwr/client/mod/secure_aggregation/__init__.py index 8892d8c03935..77a4705ad7b9 100644 --- a/src/py/flwr/client/mod/secure_aggregation/__init__.py +++ b/src/py/flwr/client/mod/secure_aggregation/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -21,4 +21,4 @@ __all__ = [ "secagg_mod", "secaggplus_mod", -] +] \ No newline at end of file diff --git a/src/py/flwr/client/mod/secure_aggregation/secagg_mod.py b/src/py/flwr/client/mod/secure_aggregation/secagg_mod.py index d87af59a4e6e..4fc3acb6be4f 100644 --- a/src/py/flwr/client/mod/secure_aggregation/secagg_mod.py +++ b/src/py/flwr/client/mod/secure_aggregation/secagg_mod.py @@ -27,4 +27,4 @@ def secagg_mod( call_next: ClientAppCallable, ) -> Message: """Handle incoming message and return results, following the SecAgg protocol.""" - return secaggplus_mod(msg, ctxt, call_next) + return secaggplus_mod(msg, ctxt, call_next) \ No newline at end of file diff --git a/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod.py b/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod.py index 5b196ad84321..39d7c39bf4b6 100644 --- a/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod.py +++ b/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod.py @@ -515,4 +515,4 @@ def _unmask( shares += [state.sk1_share_dict[nid] for nid in dead_nids] log(DEBUG, "Node %d: stage 3 completes. uploading key shares...", state.nid) - return {Key.NODE_ID_LIST: all_nids, Key.SHARE_LIST: shares} + return {Key.NODE_ID_LIST: all_nids, Key.SHARE_LIST: shares} \ No newline at end of file diff --git a/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod_test.py b/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod_test.py index 36844a2983a1..a7a2e3beb95e 100644 --- a/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod_test.py +++ b/src/py/flwr/client/mod/secure_aggregation/secaggplus_mod_test.py @@ -320,4 +320,4 @@ def test_stage_unmask_check(self) -> None: set_stage(Stage.COLLECT_MASKED_VECTORS) with self.assertRaises(TypeError): - handler(invalid_configs) + handler(invalid_configs) \ No newline at end of file diff --git a/src/py/flwr/client/mod/utils.py b/src/py/flwr/client/mod/utils.py index 4c3c32944f01..3dac3b6f7aee 100644 --- a/src/py/flwr/client/mod/utils.py +++ b/src/py/flwr/client/mod/utils.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -33,4 +33,4 @@ def new_ffn(message: Message, context: Context) -> Message: for mod in reversed(mods): ffn = wrap_ffn(ffn, mod) - return ffn + return ffn \ No newline at end of file diff --git a/src/py/flwr/client/mod/utils_test.py b/src/py/flwr/client/mod/utils_test.py index 4676a2c02c4b..23d8d6e184f3 100644 --- a/src/py/flwr/client/mod/utils_test.py +++ b/src/py/flwr/client/mod/utils_test.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -152,4 +152,4 @@ def filter_mod( self.assertEqual(footprint, ["filter"]) # pylint: disable-next=no-member self.assertEqual(list(message.content.configs_records.keys())[0], "filter") - self.assertEqual(list(out_message.content.configs_records.keys())[0], "filter") + self.assertEqual(list(out_message.content.configs_records.keys())[0], "filter") \ No newline at end of file diff --git a/src/py/flwr/client/node_state.py b/src/py/flwr/client/node_state.py index 71681b783419..7a0c0360cbf7 100644 --- a/src/py/flwr/client/node_state.py +++ b/src/py/flwr/client/node_state.py @@ -45,4 +45,4 @@ def retrieve_context(self, run_id: int) -> Context: def update_context(self, run_id: int, context: Context) -> None: """Update run context.""" - self.run_contexts[run_id] = context + self.run_contexts[run_id] = context \ No newline at end of file diff --git a/src/py/flwr/client/node_state_tests.py b/src/py/flwr/client/node_state_tests.py index 193f52661579..6160cdba748f 100644 --- a/src/py/flwr/client/node_state_tests.py +++ b/src/py/flwr/client/node_state_tests.py @@ -62,4 +62,4 @@ def test_multirun_in_node_state() -> None: for run_id, context in node_state.run_contexts.items(): assert ( context.state.configs_records["counter"]["count"] == expected_values[run_id] - ) + ) \ No newline at end of file diff --git a/src/py/flwr/client/numpy_client.py b/src/py/flwr/client/numpy_client.py index 0247958d88a9..2f27423ae5c5 100644 --- a/src/py/flwr/client/numpy_client.py +++ b/src/py/flwr/client/numpy_client.py @@ -313,4 +313,4 @@ def _wrap_numpy_client(client: NumPyClient) -> Client: wrapper_class = type("NumPyClientWrapper", (Client,), member_dict) # Create and return an instance of the newly created class - return wrapper_class(numpy_client=client) # type: ignore + return wrapper_class(numpy_client=client) # type: ignore \ No newline at end of file diff --git a/src/py/flwr/client/numpy_client_test.py b/src/py/flwr/client/numpy_client_test.py index 526098798e45..4f5f9aab6ddb 100644 --- a/src/py/flwr/client/numpy_client_test.py +++ b/src/py/flwr/client/numpy_client_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -157,4 +157,4 @@ def test_has_evaluate_false() -> None: actual = has_evaluate(client=client) # Assert - assert actual == expected + assert actual == expected \ No newline at end of file diff --git a/src/py/flwr/client/rest_client/__init__.py b/src/py/flwr/client/rest_client/__init__.py index c3485483ad35..c9f7ae1eb1a8 100644 --- a/src/py/flwr/client/rest_client/__init__.py +++ b/src/py/flwr/client/rest_client/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Client-side part of the REST transport layer.""" +"""Client-side part of the REST transport layer.""" \ No newline at end of file diff --git a/src/py/flwr/client/rest_client/connection.py b/src/py/flwr/client/rest_client/connection.py index 5f5e153f9d8d..eddecf9810ff 100644 --- a/src/py/flwr/client/rest_client/connection.py +++ b/src/py/flwr/client/rest_client/connection.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -359,4 +359,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) \ No newline at end of file diff --git a/src/py/flwr/client/supernode/__init__.py b/src/py/flwr/client/supernode/__init__.py index bc505f693875..cf895d36ce70 100644 --- a/src/py/flwr/client/supernode/__init__.py +++ b/src/py/flwr/client/supernode/__init__.py @@ -21,4 +21,4 @@ __all__ = [ "run_client_app", "run_supernode", -] +] \ No newline at end of file diff --git a/src/py/flwr/client/supernode/app.py b/src/py/flwr/client/supernode/app.py index 362b09c5d5b5..0b7da7986a26 100644 --- a/src/py/flwr/client/supernode/app.py +++ b/src/py/flwr/client/supernode/app.py @@ -397,4 +397,4 @@ def _try_setup_client_authentication( return ( ssh_private_key, ssh_public_key, - ) + ) \ No newline at end of file diff --git a/src/py/flwr/client/typing.py b/src/py/flwr/client/typing.py index 956ac7a15c05..00c2ba1ca81e 100644 --- a/src/py/flwr/client/typing.py +++ b/src/py/flwr/client/typing.py @@ -25,4 +25,4 @@ ClientFn = Callable[[str], Client] ClientAppCallable = Callable[[Message, Context], Message] -Mod = Callable[[Message, Context, ClientAppCallable], Message] +Mod = Callable[[Message, Context, ClientAppCallable], Message] \ No newline at end of file diff --git a/src/py/flwr/common/__init__.py b/src/py/flwr/common/__init__.py index bbdf48425e0a..0534ea32862d 100644 --- a/src/py/flwr/common/__init__.py +++ b/src/py/flwr/common/__init__.py @@ -107,4 +107,4 @@ "ndarrays_to_parameters", "now", "parameters_to_ndarrays", -] +] \ No newline at end of file diff --git a/src/py/flwr/common/address.py b/src/py/flwr/common/address.py index 71b6d684597f..fbff6bb2b2fa 100644 --- a/src/py/flwr/common/address.py +++ b/src/py/flwr/common/address.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -56,4 +56,4 @@ def parse_address(address: str) -> Optional[Tuple[str, int, Optional[bool]]]: return host, port, version except ValueError: - return None + return None \ No newline at end of file diff --git a/src/py/flwr/common/address_test.py b/src/py/flwr/common/address_test.py index 420b89871d69..5c137e538d9e 100644 --- a/src/py/flwr/common/address_test.py +++ b/src/py/flwr/common/address_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -139,4 +139,4 @@ def test_domain_incorrect() -> None: actual = parse_address(address) # Assert - assert actual is None + assert actual is None \ No newline at end of file diff --git a/src/py/flwr/common/config.py b/src/py/flwr/common/config.py index 95bf8ce31c45..39b000cf57e1 100644 --- a/src/py/flwr/common/config.py +++ b/src/py/flwr/common/config.py @@ -68,4 +68,4 @@ def get_project_config(project_dir: Union[str, Path]) -> Dict[str, Any]: f"Invalid {FAB_CONFIG_FILE}:\n{error_msg}", ) - return config + return config \ No newline at end of file diff --git a/src/py/flwr/common/constant.py b/src/py/flwr/common/constant.py index ac35549d2051..8438915c323b 100644 --- a/src/py/flwr/common/constant.py +++ b/src/py/flwr/common/constant.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -98,4 +98,4 @@ class ErrorCode: def __new__(cls) -> ErrorCode: """Prevent instantiation.""" - raise TypeError(f"{cls.__name__} cannot be instantiated.") + raise TypeError(f"{cls.__name__} cannot be instantiated.") \ No newline at end of file diff --git a/src/py/flwr/common/context.py b/src/py/flwr/common/context.py index b6349307d150..350ac4d164b6 100644 --- a/src/py/flwr/common/context.py +++ b/src/py/flwr/common/context.py @@ -35,4 +35,4 @@ class Context: multiple rounds) """ - state: RecordSet + state: RecordSet \ No newline at end of file diff --git a/src/py/flwr/common/date.py b/src/py/flwr/common/date.py index f47ad5470106..d9d80d30b6b1 100644 --- a/src/py/flwr/common/date.py +++ b/src/py/flwr/common/date.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -20,4 +20,4 @@ def now() -> datetime: """Construct a datetime from time.time() with time zone set to UTC.""" - return datetime.now(tz=timezone.utc) + return datetime.now(tz=timezone.utc) \ No newline at end of file diff --git a/src/py/flwr/common/differential_privacy.py b/src/py/flwr/common/differential_privacy.py index 85dc198ef8a0..29d92f6736aa 100644 --- a/src/py/flwr/common/differential_privacy.py +++ b/src/py/flwr/common/differential_privacy.py @@ -173,4 +173,4 @@ def add_localdp_gaussian_noise_to_params( model_params_ndarrays, sensitivity * np.sqrt(2 * np.log(1.25 / delta)) / epsilon, ) - return ndarrays_to_parameters(model_params_ndarrays) + return ndarrays_to_parameters(model_params_ndarrays) \ No newline at end of file diff --git a/src/py/flwr/common/differential_privacy_constants.py b/src/py/flwr/common/differential_privacy_constants.py index 415759dfdf0b..760018c64fd2 100644 --- a/src/py/flwr/common/differential_privacy_constants.py +++ b/src/py/flwr/common/differential_privacy_constants.py @@ -22,4 +22,4 @@ " differs from the number of sampled clients (%s)." " This could impact the differential privacy guarantees," " potentially leading to privacy leakage or inadequate noise calibration." -) +) \ No newline at end of file diff --git a/src/py/flwr/common/differential_privacy_test.py b/src/py/flwr/common/differential_privacy_test.py index ea2e193df2f3..29a6f325a3ba 100644 --- a/src/py/flwr/common/differential_privacy_test.py +++ b/src/py/flwr/common/differential_privacy_test.py @@ -206,4 +206,4 @@ def test_compute_adaptive_noise_params() -> None: temp_value = (noise_multiplier ** (-2) - (2 * clipped_count_stddev) ** (-2)) ** -0.5 # Assert - assert np.isclose(result[1], temp_value, rtol=1e-6) + assert np.isclose(result[1], temp_value, rtol=1e-6) \ No newline at end of file diff --git a/src/py/flwr/common/dp.py b/src/py/flwr/common/dp.py index 83a72b8ce749..cdf0e2b00830 100644 --- a/src/py/flwr/common/dp.py +++ b/src/py/flwr/common/dp.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -47,4 +47,4 @@ def clip_by_l2(update: NDArrays, threshold: float) -> Tuple[NDArrays, bool]: update_norm = _get_update_norm(update) scaling_factor = min(1, threshold / update_norm) update_clipped: NDArrays = [layer * scaling_factor for layer in update] - return update_clipped, (scaling_factor < 1) + return update_clipped, (scaling_factor < 1) \ No newline at end of file diff --git a/src/py/flwr/common/exit_handlers.py b/src/py/flwr/common/exit_handlers.py index 30750c28a450..2def2b7c38db 100644 --- a/src/py/flwr/common/exit_handlers.py +++ b/src/py/flwr/common/exit_handlers.py @@ -84,4 +84,4 @@ def graceful_exit_handler( # type: ignore default_handlers[SIGTERM] = signal( # type: ignore SIGTERM, graceful_exit_handler, # type: ignore - ) + ) \ No newline at end of file diff --git a/src/py/flwr/common/grpc.py b/src/py/flwr/common/grpc.py index ead0329ca79c..01321d60284d 100644 --- a/src/py/flwr/common/grpc.py +++ b/src/py/flwr/common/grpc.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -61,4 +61,4 @@ def create_channel( if interceptors is not None: channel = grpc.intercept_channel(channel, interceptors) - return channel + return channel \ No newline at end of file diff --git a/src/py/flwr/common/logger.py b/src/py/flwr/common/logger.py index 7225b0663ae7..9516d3860cfd 100644 --- a/src/py/flwr/common/logger.py +++ b/src/py/flwr/common/logger.py @@ -220,4 +220,4 @@ def set_logger_propagation( child_logger.propagate = value if not child_logger.propagate: child_logger.log(logging.DEBUG, "Logger propagate set to False") - return child_logger + return child_logger \ No newline at end of file diff --git a/src/py/flwr/common/message.py b/src/py/flwr/common/message.py index 7f7a0e4dd995..c958c01673b9 100644 --- a/src/py/flwr/common/message.py +++ b/src/py/flwr/common/message.py @@ -399,4 +399,4 @@ def _create_reply_metadata(msg: Message, ttl: float) -> Metadata: ttl=ttl, message_type=msg.metadata.message_type, partition_id=msg.metadata.partition_id, - ) + ) \ No newline at end of file diff --git a/src/py/flwr/common/message_test.py b/src/py/flwr/common/message_test.py index 19f8aeb1eb63..1681eff19a08 100644 --- a/src/py/flwr/common/message_test.py +++ b/src/py/flwr/common/message_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -202,4 +202,4 @@ def test_repr(cls: type, kwargs: Dict[str, Any]) -> None: actual = cls(**kwargs) # Assert - assert str(actual) == str(expected) + assert str(actual) == str(expected) \ No newline at end of file diff --git a/src/py/flwr/common/object_ref.py b/src/py/flwr/common/object_ref.py index ac52be160c2e..9a6eaeaac9c1 100644 --- a/src/py/flwr/common/object_ref.py +++ b/src/py/flwr/common/object_ref.py @@ -175,4 +175,4 @@ def _is_module_in_all(attribute_name: str, target: ast.expr, n: ast.Assign) -> b for elt in n.value.elts: if isinstance(elt, ast.Str) and elt.s == attribute_name: return True - return False + return False \ No newline at end of file diff --git a/src/py/flwr/common/object_ref_test.py b/src/py/flwr/common/object_ref_test.py index f4513a4319ab..c22ee6c33ed3 100644 --- a/src/py/flwr/common/object_ref_test.py +++ b/src/py/flwr/common/object_ref_test.py @@ -43,4 +43,4 @@ def test_validate_object_reference_fails() -> None: assert ( error == f"Unable to find attribute runa in module flwr.cli.run{OBJECT_REF_HELP_STR}" - ) + ) \ No newline at end of file diff --git a/src/py/flwr/common/parameter.py b/src/py/flwr/common/parameter.py index eefd7abc19a8..b2c1d614ffd7 100644 --- a/src/py/flwr/common/parameter.py +++ b/src/py/flwr/common/parameter.py @@ -51,4 +51,4 @@ def bytes_to_ndarray(tensor: bytes) -> NDArray: # Reason: loading pickled data can execute arbitrary code # Source: https://numpy.org/doc/stable/reference/generated/numpy.load.html ndarray_deserialized = np.load(bytes_io, allow_pickle=False) - return cast(NDArray, ndarray_deserialized) + return cast(NDArray, ndarray_deserialized) \ No newline at end of file diff --git a/src/py/flwr/common/parameter_test.py b/src/py/flwr/common/parameter_test.py index 965038ead6d2..92d67ce2bbef 100644 --- a/src/py/flwr/common/parameter_test.py +++ b/src/py/flwr/common/parameter_test.py @@ -36,4 +36,4 @@ def test_serialisation_deserialisation() -> None: # Test false positive with pytest.raises(AssertionError, match="Arrays are not equal"): - np.testing.assert_equal(arr_deserialized, np.ones((3, 2))) + np.testing.assert_equal(arr_deserialized, np.ones((3, 2))) \ No newline at end of file diff --git a/src/py/flwr/common/pyproject.py b/src/py/flwr/common/pyproject.py index 66585e422397..6a1ba7f96b28 100644 --- a/src/py/flwr/common/pyproject.py +++ b/src/py/flwr/common/pyproject.py @@ -38,4 +38,4 @@ def validate_project_name(name: str) -> bool: """ if not name or len(name) > 40 or not re.match(r"^[a-z0-9-_]+$", name): return False - return True + return True \ No newline at end of file diff --git a/src/py/flwr/common/pyproject_test.py b/src/py/flwr/common/pyproject_test.py index 88a945054b83..b006e5ebbd43 100644 --- a/src/py/flwr/common/pyproject_test.py +++ b/src/py/flwr/common/pyproject_test.py @@ -1,108 +1,108 @@ -# Copyright 2024 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============================================================================== -"""Tests for the function that validates name property.""" - -from .pyproject import validate_project_name - - -# Happy Flow -def test_valid_name_with_lower_case() -> None: - """Test a valid single-word project name with all lower case.""" - # Prepare - name = "myproject" - expected = True - # Execute - actual = validate_project_name(name) - # Assert - assert actual == expected, f"Expected {name} to be valid" - - -def test_valid_name_with_dashes() -> None: - """Test a valid project name with hyphens inbetween.""" - # Prepare - name = "valid-project-name" - expected = True - # Execute - actual = validate_project_name(name) - # Assert - assert actual == expected, f"Expected {name} to be valid" - - -def test_valid_name_with_underscores() -> None: - """Test a valid project name with underscores inbetween.""" - # Prepare - name = "valid_project_name" - expected = True - # Execute - actual = validate_project_name(name) - # Assert - assert actual == expected, f"Expected {name} to be valid" - - -def test_invalid_name_with_upper_letters() -> None: - """Tests a project name with Spaces and Uppercase letter.""" - # Prepare - name = "Invalid Project Name" - expected = False - # Execute - actual = validate_project_name(name) - # Assert - assert actual == expected, "Upper Case and Spaces are not allowed" - - -def test_name_with_spaces() -> None: - """Tests a project name with spaces inbetween.""" - # Prepare - name = "name with spaces" - expected = False - # Execute - actual = validate_project_name(name) - # Assert - assert actual == expected, "Spaces are not allowed" - - -def test_empty_name() -> None: - """Tests use-case for an empty project name.""" - # Prepare - name = "" - expected = False - # Execute - actual = validate_project_name(name) - # Assert - assert actual == expected, "Empty name is not valid" - - -def test_long_name() -> None: - """Tests for long project names.""" - # Prepare - name = "a" * 41 - expected = False - # Execute - actual = validate_project_name(name) - # Assert - # It can be more than 40 but generally - # it is recommended not to be more than 40 - assert actual == expected, "Name longer than 40 characters is not recommended" - - -def test_name_with_special_characters() -> None: - """Tests for project names with special characters.""" - # Prepare - name = "name!@#" - expected = False - # Execute - actual = validate_project_name(name) - # Assert - assert actual == expected, "Special characters are not allowed" +# Copyright 2024 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""Tests for the function that validates name property.""" + +from .pyproject import validate_project_name + + +# Happy Flow +def test_valid_name_with_lower_case() -> None: + """Test a valid single-word project name with all lower case.""" + # Prepare + name = "myproject" + expected = True + # Execute + actual = validate_project_name(name) + # Assert + assert actual == expected, f"Expected {name} to be valid" + + +def test_valid_name_with_dashes() -> None: + """Test a valid project name with hyphens inbetween.""" + # Prepare + name = "valid-project-name" + expected = True + # Execute + actual = validate_project_name(name) + # Assert + assert actual == expected, f"Expected {name} to be valid" + + +def test_valid_name_with_underscores() -> None: + """Test a valid project name with underscores inbetween.""" + # Prepare + name = "valid_project_name" + expected = True + # Execute + actual = validate_project_name(name) + # Assert + assert actual == expected, f"Expected {name} to be valid" + + +def test_invalid_name_with_upper_letters() -> None: + """Tests a project name with Spaces and Uppercase letter.""" + # Prepare + name = "Invalid Project Name" + expected = False + # Execute + actual = validate_project_name(name) + # Assert + assert actual == expected, "Upper Case and Spaces are not allowed" + + +def test_name_with_spaces() -> None: + """Tests a project name with spaces inbetween.""" + # Prepare + name = "name with spaces" + expected = False + # Execute + actual = validate_project_name(name) + # Assert + assert actual == expected, "Spaces are not allowed" + + +def test_empty_name() -> None: + """Tests use-case for an empty project name.""" + # Prepare + name = "" + expected = False + # Execute + actual = validate_project_name(name) + # Assert + assert actual == expected, "Empty name is not valid" + + +def test_long_name() -> None: + """Tests for long project names.""" + # Prepare + name = "a" * 41 + expected = False + # Execute + actual = validate_project_name(name) + # Assert + # It can be more than 40 but generally + # it is recommended not to be more than 40 + assert actual == expected, "Name longer than 40 characters is not recommended" + + +def test_name_with_special_characters() -> None: + """Tests for project names with special characters.""" + # Prepare + name = "name!@#" + expected = False + # Execute + actual = validate_project_name(name) + # Assert + assert actual == expected, "Special characters are not allowed" \ No newline at end of file diff --git a/src/py/flwr/common/record/__init__.py b/src/py/flwr/common/record/__init__.py index 88eef5f7aea1..c6c0e2f7fea1 100644 --- a/src/py/flwr/common/record/__init__.py +++ b/src/py/flwr/common/record/__init__.py @@ -27,4 +27,4 @@ "ParametersRecord", "RecordSet", "array_from_numpy", -] +] \ No newline at end of file diff --git a/src/py/flwr/common/record/configsrecord.py b/src/py/flwr/common/record/configsrecord.py index 471c85f0b961..85776ac1d7f5 100644 --- a/src/py/flwr/common/record/configsrecord.py +++ b/src/py/flwr/common/record/configsrecord.py @@ -120,4 +120,4 @@ def get_var_bytes(value: ConfigsScalar) -> int: # We also count the bytes footprint of the keys num_bytes += len(k) - return num_bytes + return num_bytes \ No newline at end of file diff --git a/src/py/flwr/common/record/conversion_utils.py b/src/py/flwr/common/record/conversion_utils.py index 7cc0b04283e9..3b8ec88e66f2 100644 --- a/src/py/flwr/common/record/conversion_utils.py +++ b/src/py/flwr/common/record/conversion_utils.py @@ -37,4 +37,4 @@ def array_from_numpy(ndarray: NDArray) -> Array: shape=list(ndarray.shape), stype=SType.NUMPY, data=data, - ) + ) \ No newline at end of file diff --git a/src/py/flwr/common/record/conversion_utils_test.py b/src/py/flwr/common/record/conversion_utils_test.py index 84be37fda4a3..325e6578430d 100644 --- a/src/py/flwr/common/record/conversion_utils_test.py +++ b/src/py/flwr/common/record/conversion_utils_test.py @@ -41,4 +41,4 @@ def test_array_from_numpy(self) -> None: self.assertEqual(array_instance.dtype, str(original_array.dtype)) self.assertEqual(array_instance.shape, list(original_array.shape)) self.assertEqual(array_instance.stype, SType.NUMPY) - np.testing.assert_array_equal(deserialized_array, original_array) + np.testing.assert_array_equal(deserialized_array, original_array) \ No newline at end of file diff --git a/src/py/flwr/common/record/metricsrecord.py b/src/py/flwr/common/record/metricsrecord.py index 2b6e584be390..40d1f33fe475 100644 --- a/src/py/flwr/common/record/metricsrecord.py +++ b/src/py/flwr/common/record/metricsrecord.py @@ -99,4 +99,4 @@ def count_bytes(self) -> int: num_bytes += 8 # We also count the bytes footprint of the keys num_bytes += len(k) - return num_bytes + return num_bytes \ No newline at end of file diff --git a/src/py/flwr/common/record/parametersrecord.py b/src/py/flwr/common/record/parametersrecord.py index 93db6d387b53..80178ceb5c31 100644 --- a/src/py/flwr/common/record/parametersrecord.py +++ b/src/py/flwr/common/record/parametersrecord.py @@ -132,4 +132,4 @@ def count_bytes(self) -> int: # We also count the bytes footprint of the keys num_bytes += len(k) - return num_bytes + return num_bytes \ No newline at end of file diff --git a/src/py/flwr/common/record/parametersrecord_test.py b/src/py/flwr/common/record/parametersrecord_test.py index e840e5e266e4..b95a3c4a2d04 100644 --- a/src/py/flwr/common/record/parametersrecord_test.py +++ b/src/py/flwr/common/record/parametersrecord_test.py @@ -98,4 +98,4 @@ def test_count_bytes(shape: List[int], dtype: str) -> None: key_name = "data" p_record = ParametersRecord(OrderedDict({key_name: array_instance})) - assert len(buff) + len(key_name) == p_record.count_bytes() + assert len(buff) + len(key_name) == p_record.count_bytes() \ No newline at end of file diff --git a/src/py/flwr/common/record/recordset.py b/src/py/flwr/common/record/recordset.py index 74eed46ad86f..60aba5607d0a 100644 --- a/src/py/flwr/common/record/recordset.py +++ b/src/py/flwr/common/record/recordset.py @@ -127,4 +127,4 @@ def __eq__(self, other: object) -> bool: """Compare two instances of the class.""" if not isinstance(other, self.__class__): raise NotImplementedError - return self.__dict__ == other.__dict__ + return self.__dict__ == other.__dict__ \ No newline at end of file diff --git a/src/py/flwr/common/record/recordset_test.py b/src/py/flwr/common/record/recordset_test.py index 01260793cb41..a1523b907183 100644 --- a/src/py/flwr/common/record/recordset_test.py +++ b/src/py/flwr/common/record/recordset_test.py @@ -429,4 +429,4 @@ def test_recordset_repr() -> None: expected = namedtuple("RecordSet", kwargs.keys())(**kwargs) # Assert - assert str(rs) == str(expected) + assert str(rs) == str(expected) \ No newline at end of file diff --git a/src/py/flwr/common/record/typeddict.py b/src/py/flwr/common/record/typeddict.py index 23d70dc4f7e8..fd4f2c3ac763 100644 --- a/src/py/flwr/common/record/typeddict.py +++ b/src/py/flwr/common/record/typeddict.py @@ -110,4 +110,4 @@ def clear(self) -> None: Remove all items from R. """ - self._data.clear() + self._data.clear() \ No newline at end of file diff --git a/src/py/flwr/common/recordset_compat.py b/src/py/flwr/common/recordset_compat.py index 1b0bf52d8277..afb10924d9d4 100644 --- a/src/py/flwr/common/recordset_compat.py +++ b/src/py/flwr/common/recordset_compat.py @@ -403,4 +403,4 @@ def getpropertiesres_to_recordset(getpropertiesres: GetPropertiesRes) -> RecordS res_str, getpropertiesres.status, recordset ) - return recordset + return recordset \ No newline at end of file diff --git a/src/py/flwr/common/recordset_compat_test.py b/src/py/flwr/common/recordset_compat_test.py index e0ac7f216af9..f9e1fab71dbd 100644 --- a/src/py/flwr/common/recordset_compat_test.py +++ b/src/py/flwr/common/recordset_compat_test.py @@ -311,4 +311,4 @@ def test_get_parameters_res_to_recordset_and_back( assert validate_freed_fn( getparameteres_res, getparameters_res_copy, getparameteres_res_ - ) + ) \ No newline at end of file diff --git a/src/py/flwr/common/retry_invoker.py b/src/py/flwr/common/retry_invoker.py index d12124b89840..1495c919df42 100644 --- a/src/py/flwr/common/retry_invoker.py +++ b/src/py/flwr/common/retry_invoker.py @@ -298,4 +298,4 @@ def giveup_check(_exception: Exception) -> bool: else: # Trigger success event try_call_event_handler(self.on_success) - return ret + return ret \ No newline at end of file diff --git a/src/py/flwr/common/retry_invoker_test.py b/src/py/flwr/common/retry_invoker_test.py index 2259ae47ded4..7629fe0978a9 100644 --- a/src/py/flwr/common/retry_invoker_test.py +++ b/src/py/flwr/common/retry_invoker_test.py @@ -184,4 +184,4 @@ def should_give_up(exc: Exception) -> bool: # Execute and Assert with pytest.raises(ValueError): - invoker.invoke(failing_function) + invoker.invoke(failing_function) \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/__init__.py b/src/py/flwr/common/secure_aggregation/__init__.py index b4e0acc0c148..fef36721f323 100644 --- a/src/py/flwr/common/secure_aggregation/__init__.py +++ b/src/py/flwr/common/secure_aggregation/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Utility functions for Secure Aggregation.""" +"""Utility functions for Secure Aggregation.""" \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/crypto/__init__.py b/src/py/flwr/common/secure_aggregation/crypto/__init__.py index 2cb34493f7d0..39728ad59fd1 100644 --- a/src/py/flwr/common/secure_aggregation/crypto/__init__.py +++ b/src/py/flwr/common/secure_aggregation/crypto/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Cryptographic primitives for Secure Aggregation.""" +"""Cryptographic primitives for Secure Aggregation.""" \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/crypto/shamir.py b/src/py/flwr/common/secure_aggregation/crypto/shamir.py index e56e21b89371..2bffcdcb79b8 100644 --- a/src/py/flwr/common/secure_aggregation/crypto/shamir.py +++ b/src/py/flwr/common/secure_aggregation/crypto/shamir.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -72,4 +72,4 @@ def combine_shares(share_list: List[bytes]) -> bytes: def _shamir_combine(shares: List[Tuple[int, bytes]]) -> bytes: - return Shamir.combine(shares, ssss=False) + return Shamir.combine(shares, ssss=False) \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption.py b/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption.py index 1d004a398ea8..baa9d2f0f0ba 100644 --- a/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption.py +++ b/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -116,4 +116,4 @@ def verify_hmac(key: bytes, message: bytes, hmac_value: bytes) -> bool: computed_hmac.verify(hmac_value) return True except InvalidSignature: - return False + return False \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption_test.py b/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption_test.py index f62276b63ff3..374d6c2a15c6 100644 --- a/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption_test.py +++ b/src/py/flwr/common/secure_aggregation/crypto/symmetric_encryption_test.py @@ -99,4 +99,4 @@ def test_wrong_message_hmac() -> None: client_compute_hmac = compute_hmac(client_shared_secret, other_message) # Assert - assert verify_hmac(server_shared_secret, message, client_compute_hmac) is False + assert verify_hmac(server_shared_secret, message, client_compute_hmac) is False \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/ndarrays_arithmetic.py b/src/py/flwr/common/secure_aggregation/ndarrays_arithmetic.py index e926a9531bea..5a0be09eb12b 100644 --- a/src/py/flwr/common/secure_aggregation/ndarrays_arithmetic.py +++ b/src/py/flwr/common/secure_aggregation/ndarrays_arithmetic.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -78,4 +78,4 @@ def parameters_divide( parameters: List[NDArray[Any]], divisor: Union[int, float] ) -> List[NDArray[Any]]: """Divide weight by an integer/float divisor.""" - return [parameters[idx] / divisor for idx in range(len(parameters))] + return [parameters[idx] / divisor for idx in range(len(parameters))] \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/quantization.py b/src/py/flwr/common/secure_aggregation/quantization.py index 56c25e2bd59c..b0a81c9b30da 100644 --- a/src/py/flwr/common/secure_aggregation/quantization.py +++ b/src/py/flwr/common/secure_aggregation/quantization.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -61,4 +61,4 @@ def dequantize( recon_arr = arr.view(np.ndarray).astype(float) recon_arr = cast(NDArrayFloat, recon_arr * quantizer + shift) reverse_quantized_list.append(recon_arr) - return reverse_quantized_list + return reverse_quantized_list \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/secaggplus_constants.py b/src/py/flwr/common/secure_aggregation/secaggplus_constants.py index 8a15908c13c5..0d3eff67678d 100644 --- a/src/py/flwr/common/secure_aggregation/secaggplus_constants.py +++ b/src/py/flwr/common/secure_aggregation/secaggplus_constants.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -66,4 +66,4 @@ class Key: def __new__(cls) -> Key: """Prevent instantiation.""" - raise TypeError(f"{cls.__name__} cannot be instantiated.") + raise TypeError(f"{cls.__name__} cannot be instantiated.") \ No newline at end of file diff --git a/src/py/flwr/common/secure_aggregation/secaggplus_utils.py b/src/py/flwr/common/secure_aggregation/secaggplus_utils.py index c373573477b9..8a120a50646c 100644 --- a/src/py/flwr/common/secure_aggregation/secaggplus_utils.py +++ b/src/py/flwr/common/secure_aggregation/secaggplus_utils.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -99,4 +99,4 @@ def pseudo_rand_gen( else: arr = gen.randint(0, num_range - 1, dimension) output.append(arr) - return output + return output \ No newline at end of file diff --git a/src/py/flwr/common/serde.py b/src/py/flwr/common/serde.py index 84932b806aff..e7f808102876 100644 --- a/src/py/flwr/common/serde.py +++ b/src/py/flwr/common/serde.py @@ -670,4 +670,4 @@ def message_from_taskres(taskres: TaskRes) -> Message: ), ) message.metadata.created_at = taskres.task.created_at - return message + return message \ No newline at end of file diff --git a/src/py/flwr/common/serde_test.py b/src/py/flwr/common/serde_test.py index f9969426fc36..77ef5548c0c3 100644 --- a/src/py/flwr/common/serde_test.py +++ b/src/py/flwr/common/serde_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -386,4 +386,4 @@ def test_message_to_and_from_taskres( assert original.content == deserialized.content if original.has_error(): assert original.error == deserialized.error - assert metadata == deserialized.metadata + assert metadata == deserialized.metadata \ No newline at end of file diff --git a/src/py/flwr/common/telemetry.py b/src/py/flwr/common/telemetry.py index eeb255e8d6eb..91fadc276d81 100644 --- a/src/py/flwr/common/telemetry.py +++ b/src/py/flwr/common/telemetry.py @@ -260,4 +260,4 @@ def create_event(event_type: EventType, event_details: Optional[Dict[str, Any]]) if FLWR_TELEMETRY_LOGGING == "1": log(ex) - return "disabled" + return "disabled" \ No newline at end of file diff --git a/src/py/flwr/common/telemetry_test.py b/src/py/flwr/common/telemetry_test.py index a5eea48443b5..1091194d6ac2 100644 --- a/src/py/flwr/common/telemetry_test.py +++ b/src/py/flwr/common/telemetry_test.py @@ -108,4 +108,4 @@ def _new_failing_get_home() -> None: source_id = _get_source_id() # Assert - self.assertEqual(source_id, except_value) + self.assertEqual(source_id, except_value) \ No newline at end of file diff --git a/src/py/flwr/common/typing.py b/src/py/flwr/common/typing.py index f51830955679..9f50b36c7feb 100644 --- a/src/py/flwr/common/typing.py +++ b/src/py/flwr/common/typing.py @@ -193,4 +193,4 @@ class Run: run_id: int fab_id: str - fab_version: str + fab_version: str \ No newline at end of file diff --git a/src/py/flwr/common/version.py b/src/py/flwr/common/version.py index 6808c66606b1..9725bf2aee67 100644 --- a/src/py/flwr/common/version.py +++ b/src/py/flwr/common/version.py @@ -1,3 +1,17 @@ +# 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. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== """Flower package version helper.""" import importlib.metadata as importlib_metadata @@ -25,4 +39,4 @@ def _version() -> Tuple[str, str]: return ("unknown", "unknown") -package_name, package_version = _version() +package_name, package_version = _version() \ No newline at end of file diff --git a/src/py/flwr/server/__init__.py b/src/py/flwr/server/__init__.py index 546ce263e2d5..47a462384e85 100644 --- a/src/py/flwr/server/__init__.py +++ b/src/py/flwr/server/__init__.py @@ -43,4 +43,4 @@ "start_server", "strategy", "workflow", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/app.py b/src/py/flwr/server/app.py index 1574ec46f968..15eec8d7bbe3 100644 --- a/src/py/flwr/server/app.py +++ b/src/py/flwr/server/app.py @@ -618,4 +618,4 @@ def _add_args_fleet_api(parser: argparse.ArgumentParser) -> None: default=1, type=int, help="Set the number of concurrent workers for the Fleet API server.", - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/client_manager.py b/src/py/flwr/server/client_manager.py index 7956e282bd2c..c5e4cf449d01 100644 --- a/src/py/flwr/server/client_manager.py +++ b/src/py/flwr/server/client_manager.py @@ -203,4 +203,4 @@ def sample( return [] sampled_cids = random.sample(available_cids, num_clients) - return [self.clients[cid] for cid in sampled_cids] + return [self.clients[cid] for cid in sampled_cids] \ No newline at end of file diff --git a/src/py/flwr/server/client_manager_test.py b/src/py/flwr/server/client_manager_test.py index 5820881b6aad..0acc137bab73 100644 --- a/src/py/flwr/server/client_manager_test.py +++ b/src/py/flwr/server/client_manager_test.py @@ -52,4 +52,4 @@ def test_simple_client_manager_unregister() -> None: client_manager.unregister(client) # Assert - assert len(client_manager) == 0 + assert len(client_manager) == 0 \ No newline at end of file diff --git a/src/py/flwr/server/client_proxy.py b/src/py/flwr/server/client_proxy.py index 951e4ae992da..1ff57c5ff6ef 100644 --- a/src/py/flwr/server/client_proxy.py +++ b/src/py/flwr/server/client_proxy.py @@ -85,4 +85,4 @@ def reconnect( timeout: Optional[float], group_id: Optional[int], ) -> DisconnectRes: - """Disconnect and (optionally) reconnect later.""" + """Disconnect and (optionally) reconnect later.""" \ No newline at end of file diff --git a/src/py/flwr/server/client_proxy_test.py b/src/py/flwr/server/client_proxy_test.py index 685698558e3a..ce6507ea5ffd 100644 --- a/src/py/flwr/server/client_proxy_test.py +++ b/src/py/flwr/server/client_proxy_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -116,4 +116,4 @@ def test_properties_are_empty() -> None: actual_properties = client_proxy.properties # Assert - assert not actual_properties + assert not actual_properties \ No newline at end of file diff --git a/src/py/flwr/server/compat/__init__.py b/src/py/flwr/server/compat/__init__.py index 7bae196ddb65..e494e32a7054 100644 --- a/src/py/flwr/server/compat/__init__.py +++ b/src/py/flwr/server/compat/__init__.py @@ -21,4 +21,4 @@ __all__ = [ "LegacyContext", "start_driver", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/compat/app.py b/src/py/flwr/server/compat/app.py index 4bb23b846ab7..73942d65ae6e 100644 --- a/src/py/flwr/server/compat/app.py +++ b/src/py/flwr/server/compat/app.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -98,4 +98,4 @@ def start_driver( # pylint: disable=too-many-arguments, too-many-locals event(EventType.START_SERVER_LEAVE) - return hist + return hist \ No newline at end of file diff --git a/src/py/flwr/server/compat/app_utils.py b/src/py/flwr/server/compat/app_utils.py index 1cdf1efbffb9..8f8e19173bc4 100644 --- a/src/py/flwr/server/compat/app_utils.py +++ b/src/py/flwr/server/compat/app_utils.py @@ -100,4 +100,4 @@ def _update_client_manager( # Sleep for 3 seconds if not f_stop.is_set(): - f_stop.wait(3) + f_stop.wait(3) \ No newline at end of file diff --git a/src/py/flwr/server/compat/app_utils_test.py b/src/py/flwr/server/compat/app_utils_test.py index 023d65b0dc72..b1dc96a6f3b5 100644 --- a/src/py/flwr/server/compat/app_utils_test.py +++ b/src/py/flwr/server/compat/app_utils_test.py @@ -68,4 +68,4 @@ def custom_wait(self: Event, timeout: Optional[float] = None) -> None: assert updated_node_ids == set(updated_expected_node_ids) # Exit - thread.join() + thread.join() \ No newline at end of file diff --git a/src/py/flwr/server/compat/driver_client_proxy.py b/src/py/flwr/server/compat/driver_client_proxy.py index 150803786f98..a6b94855ffa3 100644 --- a/src/py/flwr/server/compat/driver_client_proxy.py +++ b/src/py/flwr/server/compat/driver_client_proxy.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -147,4 +147,4 @@ def _send_receive_recordset( if timeout is not None and time.time() > start_time + timeout: raise RuntimeError("Timeout reached") - time.sleep(SLEEP_TIME) + time.sleep(SLEEP_TIME) \ No newline at end of file diff --git a/src/py/flwr/server/compat/driver_client_proxy_test.py b/src/py/flwr/server/compat/driver_client_proxy_test.py index d9e3d3bc0824..9ffc2f8af299 100644 --- a/src/py/flwr/server/compat/driver_client_proxy_test.py +++ b/src/py/flwr/server/compat/driver_client_proxy_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -288,4 +288,4 @@ def _common_assertions(self, original_ins: Any) -> None: except AssertionError: self.driver.pull_messages.assert_called_with( message_ids=[INSTRUCTION_MESSAGE_ID] - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/compat/legacy_context.py b/src/py/flwr/server/compat/legacy_context.py index 0b00c98bb16d..26b4d5cfeb0c 100644 --- a/src/py/flwr/server/compat/legacy_context.py +++ b/src/py/flwr/server/compat/legacy_context.py @@ -52,4 +52,4 @@ def __init__( self.strategy = strategy self.client_manager = client_manager self.history = History() - super().__init__(state) + super().__init__(state) \ No newline at end of file diff --git a/src/py/flwr/server/criterion.py b/src/py/flwr/server/criterion.py index 199a609104cb..2b4f0bfbe6d3 100644 --- a/src/py/flwr/server/criterion.py +++ b/src/py/flwr/server/criterion.py @@ -25,4 +25,4 @@ class Criterion(ABC): @abstractmethod def select(self, client: ClientProxy) -> bool: - """Decide whether a client should be eligible for sampling or not.""" + """Decide whether a client should be eligible for sampling or not.""" \ No newline at end of file diff --git a/src/py/flwr/server/criterion_test.py b/src/py/flwr/server/criterion_test.py index f678825f064e..08d8919e5e15 100644 --- a/src/py/flwr/server/criterion_test.py +++ b/src/py/flwr/server/criterion_test.py @@ -74,4 +74,4 @@ def test_criterion_not_applied() -> None: assert client1 in sampled_clients assert client2 in sampled_clients assert client3 in sampled_clients - assert client4 in sampled_clients + assert client4 in sampled_clients \ No newline at end of file diff --git a/src/py/flwr/server/driver/__init__.py b/src/py/flwr/server/driver/__init__.py index deaddff77702..c9eabc58e998 100644 --- a/src/py/flwr/server/driver/__init__.py +++ b/src/py/flwr/server/driver/__init__.py @@ -23,4 +23,4 @@ "Driver", "GrpcDriver", "InMemoryDriver", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/driver/driver.py b/src/py/flwr/server/driver/driver.py index b95cec95ab47..8fef9c2ea564 100644 --- a/src/py/flwr/server/driver/driver.py +++ b/src/py/flwr/server/driver/driver.py @@ -137,4 +137,4 @@ def send_and_receive( to collect the replies. If `timeout` is set, the method may not return replies for all sent messages. A message remains valid until its TTL, which is not affected by `timeout`. - """ + """ \ No newline at end of file diff --git a/src/py/flwr/server/driver/grpc_driver.py b/src/py/flwr/server/driver/grpc_driver.py index d339f1b232f9..2bd34d9716f3 100644 --- a/src/py/flwr/server/driver/grpc_driver.py +++ b/src/py/flwr/server/driver/grpc_driver.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -312,4 +312,4 @@ def close(self) -> None: if self.driver_helper is None: return # Disconnect - self.driver_helper.disconnect() + self.driver_helper.disconnect() \ No newline at end of file diff --git a/src/py/flwr/server/driver/grpc_driver_test.py b/src/py/flwr/server/driver/grpc_driver_test.py index fbead0e3043d..4c55c4790003 100644 --- a/src/py/flwr/server/driver/grpc_driver_test.py +++ b/src/py/flwr/server/driver/grpc_driver_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -219,4 +219,4 @@ def test_del_with_uninitialized_driver(self) -> None: self.driver.close() # Assert - self.mock_grpc_driver_helper.disconnect.assert_not_called() + self.mock_grpc_driver_helper.disconnect.assert_not_called() \ No newline at end of file diff --git a/src/py/flwr/server/driver/inmemory_driver.py b/src/py/flwr/server/driver/inmemory_driver.py index 8c71b1067293..99a234750b3b 100644 --- a/src/py/flwr/server/driver/inmemory_driver.py +++ b/src/py/flwr/server/driver/inmemory_driver.py @@ -178,4 +178,4 @@ def send_and_receive( break # Sleep time.sleep(3) - return ret + return ret \ No newline at end of file diff --git a/src/py/flwr/server/driver/inmemory_driver_test.py b/src/py/flwr/server/driver/inmemory_driver_test.py index 95c2a0b277af..86cb3318a602 100644 --- a/src/py/flwr/server/driver/inmemory_driver_test.py +++ b/src/py/flwr/server/driver/inmemory_driver_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -244,4 +244,4 @@ def test_task_store_consistency_after_push_pull_inmemory_state(self) -> None: # Assert self.assertEqual(reply_tos, msg_ids) self.assertEqual(len(self.driver.state.task_res_store), 0) # type: ignore - self.assertEqual(len(self.driver.state.task_ins_store), 0) # type: ignore + self.assertEqual(len(self.driver.state.task_ins_store), 0) # type: ignore \ No newline at end of file diff --git a/src/py/flwr/server/history.py b/src/py/flwr/server/history.py index 291974a4323c..57d61c9004bd 100644 --- a/src/py/flwr/server/history.py +++ b/src/py/flwr/server/history.py @@ -122,4 +122,4 @@ def __repr__(self) -> str: rep += "History (metrics, centralized):\n" + pprint.pformat( self.metrics_centralized ) - return rep + return rep \ No newline at end of file diff --git a/src/py/flwr/server/history_test.py b/src/py/flwr/server/history_test.py index adb9d697e409..f1721bb2d255 100644 --- a/src/py/flwr/server/history_test.py +++ b/src/py/flwr/server/history_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -79,4 +79,4 @@ def test_add_metrics_centralized() -> None: assert len(history.losses_centralized) == 0 assert len(history.metrics_distributed) == 0 assert len(history.metrics_centralized) == 1 - assert (0, 0.9) == history.metrics_centralized["acc"][0] + assert (0, 0.9) == history.metrics_centralized["acc"][0] \ No newline at end of file diff --git a/src/py/flwr/server/run_serverapp.py b/src/py/flwr/server/run_serverapp.py index efd3f6846264..c2a710071525 100644 --- a/src/py/flwr/server/run_serverapp.py +++ b/src/py/flwr/server/run_serverapp.py @@ -224,4 +224,4 @@ def _parse_args_run_server_app() -> argparse.ArgumentParser: help="The version of the FAB used in the run.", ) - return parser + return parser \ No newline at end of file diff --git a/src/py/flwr/server/server.py b/src/py/flwr/server/server.py index f1bfb6f0533b..8f87cc8ff32c 100644 --- a/src/py/flwr/server/server.py +++ b/src/py/flwr/server/server.py @@ -501,4 +501,4 @@ def run_fl( # Graceful shutdown server.disconnect_all_clients(timeout=config.round_timeout) - return hist + return hist \ No newline at end of file diff --git a/src/py/flwr/server/server_app.py b/src/py/flwr/server/server_app.py index 43b3bcce3f36..e2c10f371d15 100644 --- a/src/py/flwr/server/server_app.py +++ b/src/py/flwr/server/server_app.py @@ -133,4 +133,4 @@ def main_decorator(main_fn: ServerAppCallable) -> ServerAppCallable: class LoadServerAppError(Exception): - """Error when trying to load `ServerApp`.""" + """Error when trying to load `ServerApp`.""" \ No newline at end of file diff --git a/src/py/flwr/server/server_app_test.py b/src/py/flwr/server/server_app_test.py index 38c0d6240d90..becb269df4af 100644 --- a/src/py/flwr/server/server_app_test.py +++ b/src/py/flwr/server/server_app_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -59,4 +59,4 @@ def test_server_app_exception_when_both_modes() -> None: def custom_main(driver: Driver, context: Context) -> None: pass - # pylint: enable=unused-argument + # pylint: enable=unused-argument \ No newline at end of file diff --git a/src/py/flwr/server/server_config.py b/src/py/flwr/server/server_config.py index c47367eab4c0..a642c1842636 100644 --- a/src/py/flwr/server/server_config.py +++ b/src/py/flwr/server/server_config.py @@ -37,4 +37,4 @@ def __repr__(self) -> str: if self.round_timeout is None else f"round_timeout={self.round_timeout}s" ) - return f"num_rounds={self.num_rounds}, {timeout_string}" + return f"num_rounds={self.num_rounds}, {timeout_string}" \ No newline at end of file diff --git a/src/py/flwr/server/server_test.py b/src/py/flwr/server/server_test.py index f47b5c3d8469..7a3498f1b82c 100644 --- a/src/py/flwr/server/server_test.py +++ b/src/py/flwr/server/server_test.py @@ -266,4 +266,4 @@ def test_setup_client_auth() -> None: # pylint: disable=R0914 ) assert public_key_to_bytes(result[2]) == public_key_to_bytes( expected_public_key - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/strategy/__init__.py b/src/py/flwr/server/strategy/__init__.py index e5bc30009819..045e361b84b4 100644 --- a/src/py/flwr/server/strategy/__init__.py +++ b/src/py/flwr/server/strategy/__init__.py @@ -73,4 +73,4 @@ "Krum", "QFedAvg", "Strategy", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/strategy/aggregate.py b/src/py/flwr/server/strategy/aggregate.py index c668b55eebe6..6900965a7404 100644 --- a/src/py/flwr/server/strategy/aggregate.py +++ b/src/py/flwr/server/strategy/aggregate.py @@ -363,4 +363,4 @@ def _aggregate_n_closest_weights( other_weights_layer_np, indices=indices, axis=0 )[:beta_closest] aggregated_weights.append(np.mean(beta_closest_weights, axis=0)) - return aggregated_weights + return aggregated_weights \ No newline at end of file diff --git a/src/py/flwr/server/strategy/aggregate_test.py b/src/py/flwr/server/strategy/aggregate_test.py index f8b4e3c03b50..8d23c3aa5286 100644 --- a/src/py/flwr/server/strategy/aggregate_test.py +++ b/src/py/flwr/server/strategy/aggregate_test.py @@ -138,4 +138,4 @@ def test_aggregate_n_closest_weights_mean() -> None: np.array_equal(expected, result) for expected, result in zip(expected_averaged, beta_closest_weights) ) - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/strategy/bulyan.py b/src/py/flwr/server/strategy/bulyan.py index 1e4f97530ab7..0d3265a9688d 100644 --- a/src/py/flwr/server/strategy/bulyan.py +++ b/src/py/flwr/server/strategy/bulyan.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -159,4 +159,4 @@ def aggregate_fit( elif server_round == 1: # Only log this warning once log(WARNING, "No fit_metrics_aggregation_fn provided") - return parameters_aggregated, metrics_aggregated + return parameters_aggregated, metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/bulyan_test.py b/src/py/flwr/server/strategy/bulyan_test.py index 299ed49066fb..5b58cc3b19b0 100644 --- a/src/py/flwr/server/strategy/bulyan_test.py +++ b/src/py/flwr/server/strategy/bulyan_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -128,4 +128,4 @@ def test_aggregate_fit() -> None: if actual_aggregated: actual_list = parameters_to_ndarrays(actual_aggregated) actual = actual_list[0] - assert (actual == expected[0]).all() + assert (actual == expected[0]).all() \ No newline at end of file diff --git a/src/py/flwr/server/strategy/dp_adaptive_clipping.py b/src/py/flwr/server/strategy/dp_adaptive_clipping.py index b25e1efdf0e9..dc5254b403e2 100644 --- a/src/py/flwr/server/strategy/dp_adaptive_clipping.py +++ b/src/py/flwr/server/strategy/dp_adaptive_clipping.py @@ -467,4 +467,4 @@ def evaluate( self, server_round: int, parameters: Parameters ) -> Optional[Tuple[float, Dict[str, Scalar]]]: """Evaluate model parameters using an evaluation function from the strategy.""" - return self.strategy.evaluate(server_round, parameters) + return self.strategy.evaluate(server_round, parameters) \ No newline at end of file diff --git a/src/py/flwr/server/strategy/dp_fixed_clipping.py b/src/py/flwr/server/strategy/dp_fixed_clipping.py index 92b2845fd846..37be10b20917 100644 --- a/src/py/flwr/server/strategy/dp_fixed_clipping.py +++ b/src/py/flwr/server/strategy/dp_fixed_clipping.py @@ -358,4 +358,4 @@ def evaluate( self, server_round: int, parameters: Parameters ) -> Optional[Tuple[float, Dict[str, Scalar]]]: """Evaluate model parameters using an evaluation function from the strategy.""" - return self.strategy.evaluate(server_round, parameters) + return self.strategy.evaluate(server_round, parameters) \ No newline at end of file diff --git a/src/py/flwr/server/strategy/dpfedavg_adaptive.py b/src/py/flwr/server/strategy/dpfedavg_adaptive.py index a908679ed668..f49b331c3ad8 100644 --- a/src/py/flwr/server/strategy/dpfedavg_adaptive.py +++ b/src/py/flwr/server/strategy/dpfedavg_adaptive.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -126,4 +126,4 @@ def aggregate_fit( return None, {} new_global_model = super().aggregate_fit(server_round, results, failures) self._update_clip_norm(results) - return new_global_model + return new_global_model \ No newline at end of file diff --git a/src/py/flwr/server/strategy/dpfedavg_fixed.py b/src/py/flwr/server/strategy/dpfedavg_fixed.py index c54379fc7087..552467f281d9 100644 --- a/src/py/flwr/server/strategy/dpfedavg_fixed.py +++ b/src/py/flwr/server/strategy/dpfedavg_fixed.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -178,4 +178,4 @@ def evaluate( self, server_round: int, parameters: Parameters ) -> Optional[Tuple[float, Dict[str, Scalar]]]: """Evaluate model parameters using an evaluation function from the strategy.""" - return self.strategy.evaluate(server_round, parameters) + return self.strategy.evaluate(server_round, parameters) \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fault_tolerant_fedavg.py b/src/py/flwr/server/strategy/fault_tolerant_fedavg.py index 663ac8872c39..acfa13873f46 100644 --- a/src/py/flwr/server/strategy/fault_tolerant_fedavg.py +++ b/src/py/flwr/server/strategy/fault_tolerant_fedavg.py @@ -145,4 +145,4 @@ def aggregate_evaluate( elif server_round == 1: # Only log this warning once log(WARNING, "No evaluate_metrics_aggregation_fn provided") - return loss_aggregated, metrics_aggregated + return loss_aggregated, metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fault_tolerant_fedavg_test.py b/src/py/flwr/server/strategy/fault_tolerant_fedavg_test.py index 98f4cac032cb..25f692bfd793 100644 --- a/src/py/flwr/server/strategy/fault_tolerant_fedavg_test.py +++ b/src/py/flwr/server/strategy/fault_tolerant_fedavg_test.py @@ -251,4 +251,4 @@ def test_aggregate_evaluate_no_failures() -> None: actual, _ = strategy.aggregate_evaluate(1, results, failures) # Assert - assert actual == expected + assert actual == expected \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedadagrad.py b/src/py/flwr/server/strategy/fedadagrad.py index 4a8f52d98e18..e63c092910ea 100644 --- a/src/py/flwr/server/strategy/fedadagrad.py +++ b/src/py/flwr/server/strategy/fedadagrad.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -168,4 +168,4 @@ def aggregate_fit( self.current_weights = new_weights - return ndarrays_to_parameters(self.current_weights), metrics_aggregated + return ndarrays_to_parameters(self.current_weights), metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedadagrad_test.py b/src/py/flwr/server/strategy/fedadagrad_test.py index 0c966442ecaf..9229792de819 100644 --- a/src/py/flwr/server/strategy/fedadagrad_test.py +++ b/src/py/flwr/server/strategy/fedadagrad_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -83,4 +83,4 @@ def test_aggregate_fit() -> None: if actual_aggregated: actual_list = parameters_to_ndarrays(actual_aggregated) actual = actual_list[0] - assert (actual == expected[0]).all() + assert (actual == expected[0]).all() \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedadam.py b/src/py/flwr/server/strategy/fedadam.py index 8a47cf0dd8ac..e1d5eb06c785 100644 --- a/src/py/flwr/server/strategy/fedadam.py +++ b/src/py/flwr/server/strategy/fedadam.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -177,4 +177,4 @@ def aggregate_fit( self.current_weights = new_weights - return ndarrays_to_parameters(self.current_weights), metrics_aggregated + return ndarrays_to_parameters(self.current_weights), metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedavg.py b/src/py/flwr/server/strategy/fedavg.py index 3b9b2640c2b5..35b08e1059b7 100644 --- a/src/py/flwr/server/strategy/fedavg.py +++ b/src/py/flwr/server/strategy/fedavg.py @@ -282,4 +282,4 @@ def aggregate_evaluate( elif server_round == 1: # Only log this warning once log(WARNING, "No evaluate_metrics_aggregation_fn provided") - return loss_aggregated, metrics_aggregated + return loss_aggregated, metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedavg_android.py b/src/py/flwr/server/strategy/fedavg_android.py index 6678b7ced114..04cf6ac1bd85 100644 --- a/src/py/flwr/server/strategy/fedavg_android.py +++ b/src/py/flwr/server/strategy/fedavg_android.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -241,4 +241,4 @@ def ndarray_to_bytes(self, ndarray: NDArray) -> bytes: def bytes_to_ndarray(self, tensor: bytes) -> NDArray: """Deserialize NumPy array from bytes.""" ndarray_deserialized = np.frombuffer(tensor, dtype=np.float32) - return cast(NDArray, ndarray_deserialized) + return cast(NDArray, ndarray_deserialized) \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedavg_test.py b/src/py/flwr/server/strategy/fedavg_test.py index e62eaa5c5832..7b7757a0cdb7 100644 --- a/src/py/flwr/server/strategy/fedavg_test.py +++ b/src/py/flwr/server/strategy/fedavg_test.py @@ -177,4 +177,4 @@ def test_inplace_aggregate_fit_equivalence() -> None: # Assert for ref, inp in zip(reference_np, inplace_np): - assert_allclose(ref, inp) + assert_allclose(ref, inp) \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedavgm.py b/src/py/flwr/server/strategy/fedavgm.py index fb9261abe89d..a20176e7799f 100644 --- a/src/py/flwr/server/strategy/fedavgm.py +++ b/src/py/flwr/server/strategy/fedavgm.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -197,4 +197,4 @@ def aggregate_fit( elif server_round == 1: # Only log this warning once log(WARNING, "No fit_metrics_aggregation_fn provided") - return parameters_aggregated, metrics_aggregated + return parameters_aggregated, metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedavgm_test.py b/src/py/flwr/server/strategy/fedavgm_test.py index a0e942171627..c2aa7324b52e 100644 --- a/src/py/flwr/server/strategy/fedavgm_test.py +++ b/src/py/flwr/server/strategy/fedavgm_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -136,4 +136,4 @@ def test_aggregate_fit_server_learning_rate_and_momentum() -> None: # Assert assert actual for w_act, w_exp in zip(parameters_to_ndarrays(actual), expected): - assert_almost_equal(w_act, w_exp) + assert_almost_equal(w_act, w_exp) \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedmedian.py b/src/py/flwr/server/strategy/fedmedian.py index 17e979d92beb..1012eaf93975 100644 --- a/src/py/flwr/server/strategy/fedmedian.py +++ b/src/py/flwr/server/strategy/fedmedian.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -73,4 +73,4 @@ def aggregate_fit( elif server_round == 1: # Only log this warning once log(WARNING, "No fit_metrics_aggregation_fn provided") - return parameters_aggregated, metrics_aggregated + return parameters_aggregated, metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedmedian_test.py b/src/py/flwr/server/strategy/fedmedian_test.py index 57cf08d8c01d..9c84d58f0df8 100644 --- a/src/py/flwr/server/strategy/fedmedian_test.py +++ b/src/py/flwr/server/strategy/fedmedian_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -197,4 +197,4 @@ def test_aggregate_fit() -> None: if actual_aggregated: actual_list = parameters_to_ndarrays(actual_aggregated) actual = actual_list[0] - assert (actual == expected[0]).all() + assert (actual == expected[0]).all() \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedopt.py b/src/py/flwr/server/strategy/fedopt.py index be5f260d96fa..5ec55004ef3e 100644 --- a/src/py/flwr/server/strategy/fedopt.py +++ b/src/py/flwr/server/strategy/fedopt.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -128,4 +128,4 @@ def __init__( def __repr__(self) -> str: """Compute a string representation of the strategy.""" rep = f"FedOpt(accept_failures={self.accept_failures})" - return rep + return rep \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedprox.py b/src/py/flwr/server/strategy/fedprox.py index d20f578b193d..a6cd638ff726 100644 --- a/src/py/flwr/server/strategy/fedprox.py +++ b/src/py/flwr/server/strategy/fedprox.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -168,4 +168,4 @@ def configure_fit( ), ) for client, fit_ins in client_config_pairs - ] + ] \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedtrimmedavg.py b/src/py/flwr/server/strategy/fedtrimmedavg.py index 96b0d35e7a61..b59366187af9 100644 --- a/src/py/flwr/server/strategy/fedtrimmedavg.py +++ b/src/py/flwr/server/strategy/fedtrimmedavg.py @@ -141,4 +141,4 @@ def aggregate_fit( elif server_round == 1: # Only log this warning once log(WARNING, "No fit_metrics_aggregation_fn provided") - return parameters_aggregated, metrics_aggregated + return parameters_aggregated, metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedxgb_bagging.py b/src/py/flwr/server/strategy/fedxgb_bagging.py index a8e8adddafbb..182682fd695b 100644 --- a/src/py/flwr/server/strategy/fedxgb_bagging.py +++ b/src/py/flwr/server/strategy/fedxgb_bagging.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -166,4 +166,4 @@ def _get_tree_nums(xgb_model_org: bytes) -> Tuple[int, int]: "num_parallel_tree" ] ) - return tree_num, paral_tree_num + return tree_num, paral_tree_num \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedxgb_cyclic.py b/src/py/flwr/server/strategy/fedxgb_cyclic.py index 2605daab29f4..4b7fb837cea9 100644 --- a/src/py/flwr/server/strategy/fedxgb_cyclic.py +++ b/src/py/flwr/server/strategy/fedxgb_cyclic.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -144,4 +144,4 @@ def configure_evaluate( sampled_clients = [clients[sampled_idx]] # Return client/config pairs - return [(client, evaluate_ins) for client in sampled_clients] + return [(client, evaluate_ins) for client in sampled_clients] \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedxgb_nn_avg.py b/src/py/flwr/server/strategy/fedxgb_nn_avg.py index 8dedc925f350..b477cfe0acfc 100644 --- a/src/py/flwr/server/strategy/fedxgb_nn_avg.py +++ b/src/py/flwr/server/strategy/fedxgb_nn_avg.py @@ -1,4 +1,4 @@ -# Copyright 2020 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. @@ -101,4 +101,4 @@ def aggregate_fit( elif server_round == 1: # Only log this warning once log(WARNING, "No fit_metrics_aggregation_fn provided") - return [parameters_aggregated, trees_aggregated], metrics_aggregated + return [parameters_aggregated, trees_aggregated], metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/fedyogi.py b/src/py/flwr/server/strategy/fedyogi.py index 7c77aab7ae73..e30f48c471c0 100644 --- a/src/py/flwr/server/strategy/fedyogi.py +++ b/src/py/flwr/server/strategy/fedyogi.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -177,4 +177,4 @@ def aggregate_fit( self.current_weights = new_weights - return ndarrays_to_parameters(self.current_weights), metrics_aggregated + return ndarrays_to_parameters(self.current_weights), metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/krum.py b/src/py/flwr/server/strategy/krum.py index 16eb5212940e..25764bda0d42 100644 --- a/src/py/flwr/server/strategy/krum.py +++ b/src/py/flwr/server/strategy/krum.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -152,4 +152,4 @@ def aggregate_fit( elif server_round == 1: # Only log this warning once log(WARNING, "No fit_metrics_aggregation_fn provided") - return parameters_aggregated, metrics_aggregated + return parameters_aggregated, metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/krum_test.py b/src/py/flwr/server/strategy/krum_test.py index 653dc9a8475d..e1175c87c3b6 100644 --- a/src/py/flwr/server/strategy/krum_test.py +++ b/src/py/flwr/server/strategy/krum_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -198,4 +198,4 @@ def test_aggregate_fit() -> None: if actual_aggregated: actual_list = parameters_to_ndarrays(actual_aggregated) actual = actual_list[0] - assert (actual == expected[0]).all() + assert (actual == expected[0]).all() \ No newline at end of file diff --git a/src/py/flwr/server/strategy/multikrum_test.py b/src/py/flwr/server/strategy/multikrum_test.py index f874dc2f9800..d19725018f36 100644 --- a/src/py/flwr/server/strategy/multikrum_test.py +++ b/src/py/flwr/server/strategy/multikrum_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2022 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. @@ -97,4 +97,4 @@ def test_aggregate_fit() -> None: if actual_aggregated: actual_list = parameters_to_ndarrays(actual_aggregated) actual = actual_list[0] - assert (actual == expected[0]).all() + assert (actual == expected[0]).all() \ No newline at end of file diff --git a/src/py/flwr/server/strategy/qfedavg.py b/src/py/flwr/server/strategy/qfedavg.py index 758e8e608e9f..114ac548fa79 100644 --- a/src/py/flwr/server/strategy/qfedavg.py +++ b/src/py/flwr/server/strategy/qfedavg.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -255,4 +255,4 @@ def aggregate_evaluate( elif server_round == 1: # Only log this warning once log(WARNING, "No evaluate_metrics_aggregation_fn provided") - return loss_aggregated, metrics_aggregated + return loss_aggregated, metrics_aggregated \ No newline at end of file diff --git a/src/py/flwr/server/strategy/strategy.py b/src/py/flwr/server/strategy/strategy.py index cfdfe2e246c5..08d1f76aef7a 100644 --- a/src/py/flwr/server/strategy/strategy.py +++ b/src/py/flwr/server/strategy/strategy.py @@ -182,4 +182,4 @@ def evaluate( evaluation_result : Optional[Tuple[float, Dict[str, Scalar]]] The evaluation result, usually a Tuple containing loss and a dictionary containing task-specific metrics (e.g., accuracy). - """ + """ \ No newline at end of file diff --git a/src/py/flwr/server/superlink/__init__.py b/src/py/flwr/server/superlink/__init__.py index 94102100de26..2c2bdf394437 100644 --- a/src/py/flwr/server/superlink/__init__.py +++ b/src/py/flwr/server/superlink/__init__.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Flower SuperLink.""" +"""Flower SuperLink.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/driver/__init__.py b/src/py/flwr/server/superlink/driver/__init__.py index 2bfe63e6065f..864a23932f73 100644 --- a/src/py/flwr/server/superlink/driver/__init__.py +++ b/src/py/flwr/server/superlink/driver/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Flower driver service.""" +"""Flower driver service.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/driver/driver_grpc.py b/src/py/flwr/server/superlink/driver/driver_grpc.py index f74000bc59c4..6ec57940fc8d 100644 --- a/src/py/flwr/server/superlink/driver/driver_grpc.py +++ b/src/py/flwr/server/superlink/driver/driver_grpc.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -51,4 +51,4 @@ def run_driver_api_grpc( log(INFO, "Flower ECE: Starting Driver API (gRPC-rere) on %s", address) driver_grpc_server.start() - return driver_grpc_server + return driver_grpc_server \ No newline at end of file diff --git a/src/py/flwr/server/superlink/driver/driver_servicer.py b/src/py/flwr/server/superlink/driver/driver_servicer.py index e808616af778..8ea23da22c15 100644 --- a/src/py/flwr/server/superlink/driver/driver_servicer.py +++ b/src/py/flwr/server/superlink/driver/driver_servicer.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -139,4 +139,4 @@ def GetRun( def _raise_if(validation_error: bool, detail: str) -> None: if validation_error: - raise ValueError(f"Malformed PushTaskInsRequest: {detail}") + raise ValueError(f"Malformed PushTaskInsRequest: {detail}") \ No newline at end of file diff --git a/src/py/flwr/server/superlink/driver/driver_servicer_test.py b/src/py/flwr/server/superlink/driver/driver_servicer_test.py index 99f7cc007a89..5efb03040402 100644 --- a/src/py/flwr/server/superlink/driver/driver_servicer_test.py +++ b/src/py/flwr/server/superlink/driver/driver_servicer_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -53,4 +53,4 @@ def test_raise_if_true() -> None: except ValueError as err: assert str(err) == "Malformed PushTaskInsRequest: test" except Exception as err: - raise AssertionError() from err + raise AssertionError() from err \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/__init__.py b/src/py/flwr/server/superlink/fleet/__init__.py index d3c3ef90163d..b89134921e3e 100644 --- a/src/py/flwr/server/superlink/fleet/__init__.py +++ b/src/py/flwr/server/superlink/fleet/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Flower fleet service.""" +"""Flower fleet service.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_adapter/__init__.py b/src/py/flwr/server/superlink/fleet/grpc_adapter/__init__.py index cf875a1b9666..ae2772f30b87 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_adapter/__init__.py +++ b/src/py/flwr/server/superlink/fleet/grpc_adapter/__init__.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Server-side part of the GrpcAdapter transport layer.""" +"""Server-side part of the GrpcAdapter transport layer.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py b/src/py/flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py index 9325041061ac..1fc2891cc9f9 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py +++ b/src/py/flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py @@ -128,4 +128,4 @@ def _get_run(self, request: GetRunRequest) -> GetRunResponse: return message_handler.get_run( request=request, state=self.state_factory.state(), - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/__init__.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/__init__.py index bae8bc431edd..419402aaef40 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/__init__.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Server-side part of the gRPC transport layer.""" +"""Server-side part of the gRPC transport layer.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py index 6f94ea844e38..66607964fb40 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -145,4 +145,4 @@ def Join( # pylint: disable=invalid-name res_wrapper=ResWrapper(client_message=client_message) ) except StopIteration: - break + break \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer_test.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer_test.py index bd93554a6a32..ff31f1d50b44 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer_test.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -141,4 +141,4 @@ def test_join(self) -> None: if __name__ == "__main__": - unittest.main(verbosity=2) + unittest.main(verbosity=2) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py index d5b4a915c609..13028bc47adc 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -186,4 +186,4 @@ def set_res_wrapper(self, res_wrapper: ResWrapper) -> None: raise ValueError("This should not happen") self._res_wrapper = res_wrapper # Write - self._transition(Status.RES_WRAPPER_AVAILABLE) + self._transition(Status.RES_WRAPPER_AVAILABLE) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge_test.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge_test.py index f7c236acd7a1..12f3abf5ff2d 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge_test.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_bridge_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -176,4 +176,4 @@ def close_bridge_delayed(secs: int) -> None: # Assert assert len(client_messages_received) == 2 - assert isinstance(raised_error, GrpcBridgeClosed) + assert isinstance(raised_error, GrpcBridgeClosed) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py index ac62ad014950..ee80673b868f 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -135,4 +135,4 @@ def reconnect( ) client_msg: ClientMessage = res_wrapper.client_message disconnect = serde.disconnect_res_from_proto(client_msg.disconnect_res) - return disconnect + return disconnect \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy_test.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy_test.py index e7077dfd39ae..5b81c749df5a 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy_test.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -132,4 +132,4 @@ def test_get_properties(self) -> None: ) # Assert - assert value.properties["tensor_type"] == "numpy.ndarray" + assert value.properties["tensor_type"] == "numpy.ndarray" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server.py index 6aeaa7ef413f..84a4928ededd 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -274,4 +274,4 @@ def generic_create_grpc_server( # pylint: disable=too-many-arguments else: server.add_insecure_port(server_address) - return server + return server \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server_test.py b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server_test.py index 8afa37515950..a2d969bfcf98 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server_test.py +++ b/src/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -115,4 +115,4 @@ def test_integration_start_and_shutdown_secure_server() -> None: ) # Teardown - server.stop(1) + server.stop(1) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_rere/__init__.py b/src/py/flwr/server/superlink/fleet/grpc_rere/__init__.py index 61ab71d91400..8e8b89a15cbf 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_rere/__init__.py +++ b/src/py/flwr/server/superlink/fleet/grpc_rere/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Server-side part of the gRPC transport layer using Request-Response.""" +"""Server-side part of the gRPC transport layer using Request-Response.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py b/src/py/flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py index 13e024eb31e4..71498039f5bc 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +++ b/src/py/flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -100,4 +100,4 @@ def GetRun( return message_handler.get_run( request=request, state=self.state_factory.state(), - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_rere/server_interceptor.py b/src/py/flwr/server/superlink/fleet/grpc_rere/server_interceptor.py index 21e9c44907cd..c4ce5336b6fb 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +++ b/src/py/flwr/server/superlink/fleet/grpc_rere/server_interceptor.py @@ -211,4 +211,4 @@ def _create_authenticated_node( # Handle `CreateNode` here instead of calling the default method handler # Note: the innermost `CreateNode` method will never be called node_id = self.state.create_node(request.ping_interval, public_key_bytes) - return CreateNodeResponse(node=Node(node_id=node_id, anonymous=False)) + return CreateNodeResponse(node=Node(node_id=node_id, anonymous=False)) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/grpc_rere/server_interceptor_test.py b/src/py/flwr/server/superlink/fleet/grpc_rere/server_interceptor_test.py index 01499102b7d8..bf8c516224d3 100644 --- a/src/py/flwr/server/superlink/fleet/grpc_rere/server_interceptor_test.py +++ b/src/py/flwr/server/superlink/fleet/grpc_rere/server_interceptor_test.py @@ -497,4 +497,4 @@ def test_successful_restore_node(self) -> None: assert call.initial_metadata()[0] == expected_metadata assert isinstance(response, CreateNodeResponse) - assert response.node.node_id == client_node_id + assert response.node.node_id == client_node_id \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/message_handler/__init__.py b/src/py/flwr/server/superlink/fleet/message_handler/__init__.py index 18b0f11fa6c5..c48f4bcef916 100644 --- a/src/py/flwr/server/superlink/fleet/message_handler/__init__.py +++ b/src/py/flwr/server/superlink/fleet/message_handler/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Shared request-response message handlers.""" +"""Shared request-response message handlers.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/message_handler/message_handler.py b/src/py/flwr/server/superlink/fleet/message_handler/message_handler.py index dceb18cab453..b180f49dc577 100644 --- a/src/py/flwr/server/superlink/fleet/message_handler/message_handler.py +++ b/src/py/flwr/server/superlink/fleet/message_handler/message_handler.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -114,4 +114,4 @@ def get_run( """Get run information.""" run = state.get_run(request.run_id) run_proto = None if run is None else Run(**vars(run)) - return GetRunResponse(run=run_proto) + return GetRunResponse(run=run_proto) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/message_handler/message_handler_test.py b/src/py/flwr/server/superlink/fleet/message_handler/message_handler_test.py index c135f6fb7b61..acdc732e9813 100644 --- a/src/py/flwr/server/superlink/fleet/message_handler/message_handler_test.py +++ b/src/py/flwr/server/superlink/fleet/message_handler/message_handler_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -125,4 +125,4 @@ def test_push_task_res() -> None: state.store_task_ins.assert_not_called() state.get_task_ins.assert_not_called() state.store_task_res.assert_called_once() - state.get_task_res.assert_not_called() + state.get_task_res.assert_not_called() \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/rest_rere/__init__.py b/src/py/flwr/server/superlink/fleet/rest_rere/__init__.py index a926f9ca0bfc..0360ca524b3a 100644 --- a/src/py/flwr/server/superlink/fleet/rest_rere/__init__.py +++ b/src/py/flwr/server/superlink/fleet/rest_rere/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Server-side part of the REST transport layer.""" +"""Server-side part of the REST transport layer.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/rest_rere/rest_api.py b/src/py/flwr/server/superlink/fleet/rest_rere/rest_api.py index c7ff496d39bf..e9bff8fc9869 100644 --- a/src/py/flwr/server/superlink/fleet/rest_rere/rest_api.py +++ b/src/py/flwr/server/superlink/fleet/rest_rere/rest_api.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -232,4 +232,4 @@ def _check_headers(headers: Headers) -> None: if "accept" not in headers: raise HTTPException(status_code=400, detail="Missing header `Accept`") if headers["accept"] != "application/protobuf": - raise HTTPException(status_code=400, detail="Unsupported `Accept`") + raise HTTPException(status_code=400, detail="Unsupported `Accept`") \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/vce/__init__.py b/src/py/flwr/server/superlink/fleet/vce/__init__.py index 57d39688b527..23992c5cbe2f 100644 --- a/src/py/flwr/server/superlink/fleet/vce/__init__.py +++ b/src/py/flwr/server/superlink/fleet/vce/__init__.py @@ -18,4 +18,4 @@ __all__ = [ "start_vce", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/vce/backend/__init__.py b/src/py/flwr/server/superlink/fleet/vce/backend/__init__.py index d751cf4bcae1..3b8e081a2140 100644 --- a/src/py/flwr/server/superlink/fleet/vce/backend/__init__.py +++ b/src/py/flwr/server/superlink/fleet/vce/backend/__init__.py @@ -45,4 +45,4 @@ __all__ = [ "Backend", "BackendConfig", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/vce/backend/backend.py b/src/py/flwr/server/superlink/fleet/vce/backend/backend.py index 1d5e3a6a51ad..42055731229e 100644 --- a/src/py/flwr/server/superlink/fleet/vce/backend/backend.py +++ b/src/py/flwr/server/superlink/fleet/vce/backend/backend.py @@ -64,4 +64,4 @@ async def process_message( message: Message, context: Context, ) -> Tuple[Message, Context]: - """Submit a job to the backend.""" + """Submit a job to the backend.""" \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/vce/backend/raybackend.py b/src/py/flwr/server/superlink/fleet/vce/backend/raybackend.py index 93aca583af9c..1c8d4709eaad 100644 --- a/src/py/flwr/server/superlink/fleet/vce/backend/raybackend.py +++ b/src/py/flwr/server/superlink/fleet/vce/backend/raybackend.py @@ -181,4 +181,4 @@ async def terminate(self) -> None: """Terminate all actors in actor pool.""" await self.pool.terminate_all_actors() ray.shutdown() - log(DEBUG, "Terminated %s", self.__class__.__name__) + log(DEBUG, "Terminated %s", self.__class__.__name__) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/vce/backend/raybackend_test.py b/src/py/flwr/server/superlink/fleet/vce/backend/raybackend_test.py index dcac0b81d666..c9fe91868d8c 100644 --- a/src/py/flwr/server/superlink/fleet/vce/backend/raybackend_test.py +++ b/src/py/flwr/server/superlink/fleet/vce/backend/raybackend_test.py @@ -214,4 +214,4 @@ def test_backend_creation_submit_and_termination_existing_client_app_unsetworkdi client_app_loader=_load_from_module("raybackend_test:client_app"), workdir="/?&%$^#%@$!", ) - self.addAsyncCleanup(self.on_cleanup) + self.addAsyncCleanup(self.on_cleanup) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/vce/vce_api.py b/src/py/flwr/server/superlink/fleet/vce/vce_api.py index 3c9628a6d2a3..475eeeffed3d 100644 --- a/src/py/flwr/server/superlink/fleet/vce/vce_api.py +++ b/src/py/flwr/server/superlink/fleet/vce/vce_api.py @@ -364,4 +364,4 @@ def _load() -> ClientApp: f_stop.set() # set termination event raise loadapp_ex except Exception as ex: - raise ex + raise ex \ No newline at end of file diff --git a/src/py/flwr/server/superlink/fleet/vce/vce_api_test.py b/src/py/flwr/server/superlink/fleet/vce/vce_api_test.py index df9f2cc96f95..65d59a4b9ada 100644 --- a/src/py/flwr/server/superlink/fleet/vce/vce_api_test.py +++ b/src/py/flwr/server/superlink/fleet/vce/vce_api_test.py @@ -274,4 +274,4 @@ def test_start_and_shutdown_with_tasks_in_state(self) -> None: assert ( content.configs_records["getpropertiesres.properties"]["result"] == expected_results[UUID(task_res.task.ancestry[0])] - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/state/__init__.py b/src/py/flwr/server/superlink/state/__init__.py index 7f260d733bbe..2763aa97d1ec 100644 --- a/src/py/flwr/server/superlink/state/__init__.py +++ b/src/py/flwr/server/superlink/state/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -25,4 +25,4 @@ "SqliteState", "State", "StateFactory", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/superlink/state/in_memory_state.py b/src/py/flwr/server/superlink/state/in_memory_state.py index e03260355db9..e4f81c3a9e4b 100644 --- a/src/py/flwr/server/superlink/state/in_memory_state.py +++ b/src/py/flwr/server/superlink/state/in_memory_state.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -336,4 +336,4 @@ def acknowledge_ping(self, node_id: int, ping_interval: float) -> bool: if node_id in self.node_ids: self.node_ids[node_id] = (time.time() + ping_interval, ping_interval) return True - return False + return False \ No newline at end of file diff --git a/src/py/flwr/server/superlink/state/sqlite_state.py b/src/py/flwr/server/superlink/state/sqlite_state.py index b9672757b0e6..919ba149598b 100644 --- a/src/py/flwr/server/superlink/state/sqlite_state.py +++ b/src/py/flwr/server/superlink/state/sqlite_state.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -816,4 +816,4 @@ def dict_to_task_res(task_dict: Dict[str, Any]) -> TaskRes: recordset=recordset, ), ) - return result + return result \ No newline at end of file diff --git a/src/py/flwr/server/superlink/state/sqlite_state_test.py b/src/py/flwr/server/superlink/state/sqlite_state_test.py index 20927df1cf12..e21591da2625 100644 --- a/src/py/flwr/server/superlink/state/sqlite_state_test.py +++ b/src/py/flwr/server/superlink/state/sqlite_state_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -54,4 +54,4 @@ def test_ins_res_to_dict(self) -> None: if __name__ == "__main__": - unittest.main(verbosity=2) + unittest.main(verbosity=2) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/state/state.py b/src/py/flwr/server/superlink/state/state.py index d1fc9465c9f2..cabb8874400a 100644 --- a/src/py/flwr/server/superlink/state/state.py +++ b/src/py/flwr/server/superlink/state/state.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -221,4 +221,4 @@ def acknowledge_ping(self, node_id: int, ping_interval: float) -> bool: ------- is_acknowledged : bool True if the ping is successfully acknowledged; otherwise, False. - """ + """ \ No newline at end of file diff --git a/src/py/flwr/server/superlink/state/state_factory.py b/src/py/flwr/server/superlink/state/state_factory.py index 62a00d910828..d9e4c7fc2e51 100644 --- a/src/py/flwr/server/superlink/state/state_factory.py +++ b/src/py/flwr/server/superlink/state/state_factory.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -45,4 +45,4 @@ def state(self) -> State: state = SqliteState(self.database) state.initialize() log(DEBUG, "Using SqliteState") - return state + return state \ No newline at end of file diff --git a/src/py/flwr/server/superlink/state/state_test.py b/src/py/flwr/server/superlink/state/state_test.py index 81307d938400..e75746137277 100644 --- a/src/py/flwr/server/superlink/state/state_test.py +++ b/src/py/flwr/server/superlink/state/state_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2024 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. @@ -779,4 +779,4 @@ def test_initialize(self) -> None: if __name__ == "__main__": - unittest.main(verbosity=2) + unittest.main(verbosity=2) \ No newline at end of file diff --git a/src/py/flwr/server/superlink/state/utils.py b/src/py/flwr/server/superlink/state/utils.py index 233a90946cc7..95d68d5419bf 100644 --- a/src/py/flwr/server/superlink/state/utils.py +++ b/src/py/flwr/server/superlink/state/utils.py @@ -53,4 +53,4 @@ def make_node_unavailable_taskres(ref_taskins: TaskIns) -> TaskRes: code=ErrorCode.NODE_UNAVAILABLE, reason=NODE_UNAVAILABLE_ERROR_REASON ), ), - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/typing.py b/src/py/flwr/server/typing.py index 01143af74392..b68a927fdb14 100644 --- a/src/py/flwr/server/typing.py +++ b/src/py/flwr/server/typing.py @@ -22,4 +22,4 @@ from .driver import Driver ServerAppCallable = Callable[[Driver, Context], None] -Workflow = Callable[[Driver, Context], None] +Workflow = Callable[[Driver, Context], None] \ No newline at end of file diff --git a/src/py/flwr/server/utils/__init__.py b/src/py/flwr/server/utils/__init__.py index c370716adaac..cf6fcc3ad49b 100644 --- a/src/py/flwr/server/utils/__init__.py +++ b/src/py/flwr/server/utils/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -21,4 +21,4 @@ __all__ = [ "tensorboard", "validate_task_ins_or_res", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/utils/tensorboard.py b/src/py/flwr/server/utils/tensorboard.py index 3e8d1e62411e..468ca8428fd2 100644 --- a/src/py/flwr/server/utils/tensorboard.py +++ b/src/py/flwr/server/utils/tensorboard.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -148,4 +148,4 @@ def aggregate_evaluate( return cast(Strategy, TBWrapper) - return decorator + return decorator \ No newline at end of file diff --git a/src/py/flwr/server/utils/tensorboard_test.py b/src/py/flwr/server/utils/tensorboard_test.py index 1827a42cf6e6..686584301f8c 100644 --- a/src/py/flwr/server/utils/tensorboard_test.py +++ b/src/py/flwr/server/utils/tensorboard_test.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -27,4 +27,4 @@ def test_tensorboard() -> None: my_decorator = tensorboard(tmpdir) # Assert - assert callable(my_decorator) + assert callable(my_decorator) \ No newline at end of file diff --git a/src/py/flwr/server/utils/validator.py b/src/py/flwr/server/utils/validator.py index c0b0ec85761c..de02223d3e7f 100644 --- a/src/py/flwr/server/utils/validator.py +++ b/src/py/flwr/server/utils/validator.py @@ -127,4 +127,4 @@ def validate_task_ins_or_res(tasks_ins_res: Union[TaskIns, TaskRes]) -> List[str if len(tasks_ins_res.task.ancestry) == 0: validation_errors.append("`ancestry` is empty") - return validation_errors + return validation_errors \ No newline at end of file diff --git a/src/py/flwr/server/utils/validator_test.py b/src/py/flwr/server/utils/validator_test.py index 61fe094c23d4..c0363c60ee7e 100644 --- a/src/py/flwr/server/utils/validator_test.py +++ b/src/py/flwr/server/utils/validator_test.py @@ -129,4 +129,4 @@ def create_task_res( ) task_res.task.pushed_at = time.time() - return task_res + return task_res \ No newline at end of file diff --git a/src/py/flwr/server/workflow/__init__.py b/src/py/flwr/server/workflow/__init__.py index 31dee89a185d..754bc33624a5 100644 --- a/src/py/flwr/server/workflow/__init__.py +++ b/src/py/flwr/server/workflow/__init__.py @@ -22,4 +22,4 @@ "DefaultWorkflow", "SecAggPlusWorkflow", "SecAggWorkflow", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/workflow/constant.py b/src/py/flwr/server/workflow/constant.py index 068e05b27e12..5b801ba23522 100644 --- a/src/py/flwr/server/workflow/constant.py +++ b/src/py/flwr/server/workflow/constant.py @@ -29,4 +29,4 @@ class Key: def __new__(cls) -> Key: """Prevent instantiation.""" - raise TypeError(f"{cls.__name__} cannot be instantiated.") + raise TypeError(f"{cls.__name__} cannot be instantiated.") \ No newline at end of file diff --git a/src/py/flwr/server/workflow/default_workflows.py b/src/py/flwr/server/workflow/default_workflows.py index 80759316da84..1f4a422237b8 100644 --- a/src/py/flwr/server/workflow/default_workflows.py +++ b/src/py/flwr/server/workflow/default_workflows.py @@ -386,4 +386,4 @@ def default_evaluate_workflow(driver: Driver, context: Context) -> None: ) context.history.add_metrics_distributed( server_round=current_round, metrics=metrics_aggregated - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/workflow/secure_aggregation/__init__.py b/src/py/flwr/server/workflow/secure_aggregation/__init__.py index 25e2a32da334..1ab533ccdb2d 100644 --- a/src/py/flwr/server/workflow/secure_aggregation/__init__.py +++ b/src/py/flwr/server/workflow/secure_aggregation/__init__.py @@ -21,4 +21,4 @@ __all__ = [ "SecAggPlusWorkflow", "SecAggWorkflow", -] +] \ No newline at end of file diff --git a/src/py/flwr/server/workflow/secure_aggregation/secagg_workflow.py b/src/py/flwr/server/workflow/secure_aggregation/secagg_workflow.py index f56423e4a0d0..7fb557a32586 100644 --- a/src/py/flwr/server/workflow/secure_aggregation/secagg_workflow.py +++ b/src/py/flwr/server/workflow/secure_aggregation/secagg_workflow.py @@ -109,4 +109,4 @@ def __init__( # pylint: disable=R0913 quantization_range=quantization_range, modulus_range=modulus_range, timeout=timeout, - ) + ) \ No newline at end of file diff --git a/src/py/flwr/server/workflow/secure_aggregation/secaggplus_workflow.py b/src/py/flwr/server/workflow/secure_aggregation/secaggplus_workflow.py index d6d97c28f313..be3ad0f66bcc 100644 --- a/src/py/flwr/server/workflow/secure_aggregation/secaggplus_workflow.py +++ b/src/py/flwr/server/workflow/secure_aggregation/secaggplus_workflow.py @@ -666,4 +666,4 @@ def make(nid: int) -> Message: context.history.add_metrics_distributed_fit( server_round=current_round, metrics=metrics_aggregated ) - return True + return True \ No newline at end of file diff --git a/src/py/flwr/simulation/__init__.py b/src/py/flwr/simulation/__init__.py index 3d648b14edba..ed00118a9e2f 100644 --- a/src/py/flwr/simulation/__init__.py +++ b/src/py/flwr/simulation/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -39,4 +39,4 @@ def start_simulation(*args, **kwargs): # type: ignore __all__ = [ "run_simulation", "start_simulation", -] +] \ No newline at end of file diff --git a/src/py/flwr/simulation/app.py b/src/py/flwr/simulation/app.py index 4b4b7249ccd3..401fc0792f19 100644 --- a/src/py/flwr/simulation/app.py +++ b/src/py/flwr/simulation/app.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -363,4 +363,4 @@ def update_resources(f_stop: threading.Event) -> None: f_stop.set() event(EventType.START_SIMULATION_LEAVE) - return hist + return hist \ No newline at end of file diff --git a/src/py/flwr/simulation/ray_transport/__init__.py b/src/py/flwr/simulation/ray_transport/__init__.py index 0e82b75bb4b3..a8dc6ef2028d 100644 --- a/src/py/flwr/simulation/ray_transport/__init__.py +++ b/src/py/flwr/simulation/ray_transport/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Ray-based Flower ClientProxy implementation.""" +"""Ray-based Flower ClientProxy implementation.""" \ No newline at end of file diff --git a/src/py/flwr/simulation/ray_transport/ray_actor.py b/src/py/flwr/simulation/ray_transport/ray_actor.py index 9caf0fc3e6c0..4afcb3249d64 100644 --- a/src/py/flwr/simulation/ray_transport/ray_actor.py +++ b/src/py/flwr/simulation/ray_transport/ray_actor.py @@ -487,4 +487,4 @@ async def fetch_result_and_return_actor_to_pool( # Retrieve result for object store # Instead of doing ray.get(future) we await it _, out_mssg, updated_context = await future - return out_mssg, updated_context + return out_mssg, updated_context \ No newline at end of file diff --git a/src/py/flwr/simulation/ray_transport/ray_client_proxy.py b/src/py/flwr/simulation/ray_transport/ray_client_proxy.py index 5e344eb087ee..a28e9744dc58 100644 --- a/src/py/flwr/simulation/ray_transport/ray_client_proxy.py +++ b/src/py/flwr/simulation/ray_transport/ray_client_proxy.py @@ -1,4 +1,4 @@ -# Copyright 2020 Flower Labs GmbH. All Rights Reserved. +# Copyright 2021 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. @@ -192,4 +192,4 @@ def reconnect( group_id: Optional[int], ) -> common.DisconnectRes: """Disconnect and (optionally) reconnect later.""" - return common.DisconnectRes(reason="") # Nothing to do here (yet) + return common.DisconnectRes(reason="") # Nothing to do here (yet) \ No newline at end of file diff --git a/src/py/flwr/simulation/ray_transport/ray_client_proxy_test.py b/src/py/flwr/simulation/ray_transport/ray_client_proxy_test.py index 9680b3846f1d..7fc2d8debc28 100644 --- a/src/py/flwr/simulation/ray_transport/ray_client_proxy_test.py +++ b/src/py/flwr/simulation/ray_transport/ray_client_proxy_test.py @@ -220,4 +220,4 @@ def _load_app() -> ClientApp: res = recordset_to_getpropertiesres(message_out.content) assert int(cid) * pi == res.properties["result"] - ray.shutdown() + ray.shutdown() \ No newline at end of file diff --git a/src/py/flwr/simulation/ray_transport/utils.py b/src/py/flwr/simulation/ray_transport/utils.py index 3861164998a4..c9bff55f4d2a 100644 --- a/src/py/flwr/simulation/ray_transport/utils.py +++ b/src/py/flwr/simulation/ray_transport/utils.py @@ -58,4 +58,4 @@ def enable_tf_gpu_growth() -> None: # Memory growth must be set before GPUs have been initialized log(ERROR, traceback.format_exc()) log(ERROR, ex) - raise ex + raise ex \ No newline at end of file diff --git a/src/py/flwr/simulation/run_simulation.py b/src/py/flwr/simulation/run_simulation.py index 3532c5a4e877..0a4d527dc8d1 100644 --- a/src/py/flwr/simulation/run_simulation.py +++ b/src/py/flwr/simulation/run_simulation.py @@ -436,4 +436,4 @@ def _parse_args_run_simulation() -> argparse.ArgumentParser: help="Sets the ID of the run started by the Simulation Engine.", ) - return parser + return parser \ No newline at end of file diff --git a/src/py/flwr/superexec/__init__.py b/src/py/flwr/superexec/__init__.py index a510c41f4182..efc89ce397a1 100644 --- a/src/py/flwr/superexec/__init__.py +++ b/src/py/flwr/superexec/__init__.py @@ -18,4 +18,4 @@ __all__ = [ "run_superexec", -] +] \ No newline at end of file diff --git a/src/py/flwr/superexec/app.py b/src/py/flwr/superexec/app.py index fa89e83b5e75..c7c4f8bdb79c 100644 --- a/src/py/flwr/superexec/app.py +++ b/src/py/flwr/superexec/app.py @@ -175,4 +175,4 @@ def _load_executor( class LoadExecutorError(Exception): - """Error when trying to load `Executor`.""" + """Error when trying to load `Executor`.""" \ No newline at end of file diff --git a/src/py/flwr/superexec/exec_grpc.py b/src/py/flwr/superexec/exec_grpc.py index 127d5615dd84..47cb3128dc75 100644 --- a/src/py/flwr/superexec/exec_grpc.py +++ b/src/py/flwr/superexec/exec_grpc.py @@ -48,4 +48,4 @@ def run_superexec_api_grpc( log(INFO, "Flower ECE: Starting SuperExec API (gRPC-rere) on %s", address) superexec_grpc_server.start() - return superexec_grpc_server + return superexec_grpc_server \ No newline at end of file diff --git a/src/py/flwr/superexec/exec_servicer.py b/src/py/flwr/superexec/exec_servicer.py index e5ef2bd59a79..0926c625e3f5 100644 --- a/src/py/flwr/superexec/exec_servicer.py +++ b/src/py/flwr/superexec/exec_servicer.py @@ -62,4 +62,4 @@ def StreamLogs( logs = ["a", "b", "c"] while context.is_active(): for i in range(len(logs)): # pylint: disable=C0200 - yield StreamLogsResponse(log_output=logs[i]) + yield StreamLogsResponse(log_output=logs[i]) \ No newline at end of file diff --git a/src/py/flwr/superexec/exec_servicer_test.py b/src/py/flwr/superexec/exec_servicer_test.py index 41f67b74c48b..6e5f4b094b5d 100644 --- a/src/py/flwr/superexec/exec_servicer_test.py +++ b/src/py/flwr/superexec/exec_servicer_test.py @@ -49,4 +49,4 @@ def test_start_run() -> None: # Execute response = servicer.StartRun(request, context_mock) - assert response.run_id == 10 + assert response.run_id == 10 \ No newline at end of file diff --git a/src/py/flwr/superexec/executor.py b/src/py/flwr/superexec/executor.py index f85ac4c157fc..ec5785cfb174 100644 --- a/src/py/flwr/superexec/executor.py +++ b/src/py/flwr/superexec/executor.py @@ -51,4 +51,4 @@ def start_run( run_id : Optional[RunTracker] The run_id and the associated process of the run created by the SuperLink, or `None` if it fails. - """ + """ \ No newline at end of file