diff --git a/src/py/flwr/__init__.py b/src/py/flwr/__init__.py index cfe1fc3c006a..ccaf07c6012f 100644 --- a/src/py/flwr/__init__.py +++ b/src/py/flwr/__init__.py @@ -26,4 +26,4 @@ "simulation", ] -__version__ = _package_version \ No newline at end of file +__version__ = _package_version diff --git a/src/py/flwr/__init___test.py b/src/py/flwr/__init___test.py index 6e1d710d6e33..61785d093b2d 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__) \ No newline at end of file + semver.VersionInfo.parse(__version__) diff --git a/src/py/flwr/cli/__init__.py b/src/py/flwr/cli/__init__.py index ce55f0dff98a..d4d3b8ac4d48 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.""" \ No newline at end of file +"""Flower command line interface.""" diff --git a/src/py/flwr/cli/app.py b/src/py/flwr/cli/app.py index 97631de03592..477b990bf1da 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() \ No newline at end of file + app() diff --git a/src/py/flwr/cli/build.py b/src/py/flwr/cli/build.py index 639d8767a703..2981eacf925d 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) \ No newline at end of file + return pathspec.PathSpec.from_lines("gitwildmatch", patterns) diff --git a/src/py/flwr/cli/config_utils.py b/src/py/flwr/cli/config_utils.py index 55d51b5832cc..d06a1d6dba96 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 \ No newline at end of file + return None diff --git a/src/py/flwr/cli/config_utils_test.py b/src/py/flwr/cli/config_utils_test.py index 4d84cf390b15..b24425cd08f4 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 \ No newline at end of file + assert len(warnings) == 0 diff --git a/src/py/flwr/cli/example.py b/src/py/flwr/cli/example.py index 0bd5422abfb1..4790e72d48bf 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)}") \ No newline at end of file + print(f"Example ready to use in {os.path.join(os.getcwd(), example_name)}") diff --git a/src/py/flwr/cli/install.py b/src/py/flwr/cli/install.py index dc549f1dff73..de9227bee450 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 \ No newline at end of file + return True diff --git a/src/py/flwr/cli/new/__init__.py b/src/py/flwr/cli/new/__init__.py index 32d8ce816fc5..a973f47021c3 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 3ac78ccab53f..9bbc016de1a8 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 17fff7e2ebd6..33ad745efa93 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) \ No newline at end of file + os.chdir(origin) diff --git a/src/py/flwr/cli/new/templates/__init__.py b/src/py/flwr/cli/new/templates/__init__.py index aec0cea648f0..7a951c2da1a2 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.""" \ No newline at end of file +"""Flower CLI `new` command templates.""" diff --git a/src/py/flwr/cli/new/templates/app/__init__.py b/src/py/flwr/cli/new/templates/app/__init__.py index fe43d55c73ad..617628fc9138 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.""" \ No newline at end of file +"""Flower CLI `new` command app templates.""" 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 37d3c1172445..7f1a0e9f4fa2 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.""" \ No newline at end of file +"""Flower CLI `new` command app / code templates.""" diff --git a/src/py/flwr/cli/run/__init__.py b/src/py/flwr/cli/run/__init__.py index 27a37ea99506..43523c215d3e 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 79757f4076ac..7577d9efbd8c 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) \ No newline at end of file + stub.StartRun(req) diff --git a/src/py/flwr/cli/utils.py b/src/py/flwr/cli/utils.py index 045f039e2fbb..2f5a8831fa7c 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() \ No newline at end of file + return sha256.hexdigest() diff --git a/src/py/flwr/client/__init__.py b/src/py/flwr/client/__init__.py index 797a83765981..58fd94448586 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 7c9a6bd29c4b..cdb7b25cbf6b 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) \ No newline at end of file + signal.signal(signal.SIGTERM, signal_handler) diff --git a/src/py/flwr/client/app_test.py b/src/py/flwr/client/app_test.py index 0fe75cf49a19..56d6308a0fe2 100644 --- a/src/py/flwr/client/app_test.py +++ b/src/py/flwr/client/app_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + pass diff --git a/src/py/flwr/client/client.py b/src/py/flwr/client/client.py index 9a6918431c76..23a3755f3efe 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) \ No newline at end of file + return client.evaluate(evaluate_ins) diff --git a/src/py/flwr/client/client_app.py b/src/py/flwr/client/client_app.py index 1458f119945b..82539834eaad 100644 --- a/src/py/flwr/client/client_app.py +++ b/src/py/flwr/client/client_app.py @@ -1,4 +1,4 @@ -# Copyright 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2023 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 f92bc6a07713..373c676e5edc 100644 --- a/src/py/flwr/client/client_test.py +++ b/src/py/flwr/client/client_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + assert actual.status.code == Code.EVALUATE_NOT_IMPLEMENTED diff --git a/src/py/flwr/client/dpfedavg_numpy_client.py b/src/py/flwr/client/dpfedavg_numpy_client.py index 95ee6df72fbc..ab31a289d29b 100644 --- a/src/py/flwr/client/dpfedavg_numpy_client.py +++ b/src/py/flwr/client/dpfedavg_numpy_client.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + return self.client.evaluate(parameters, config) diff --git a/src/py/flwr/client/grpc_adapter_client/__init__.py b/src/py/flwr/client/grpc_adapter_client/__init__.py index bb134b63c2f8..5900e2dc2d06 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.""" \ No newline at end of file +"""Client-side part of the GrpcAdapter transport layer.""" diff --git a/src/py/flwr/client/grpc_adapter_client/connection.py b/src/py/flwr/client/grpc_adapter_client/connection.py index fc9b58f0870d..e4e32b3accd0 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 \ No newline at end of file + yield conn diff --git a/src/py/flwr/client/grpc_client/__init__.py b/src/py/flwr/client/grpc_client/__init__.py index c4e7400831d0..9e987e86b254 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.""" \ No newline at end of file +"""Client-side part of the gRPC transport layer.""" diff --git a/src/py/flwr/client/grpc_client/connection.py b/src/py/flwr/client/grpc_client/connection.py index cec7ccf5f5e8..8c049861c672 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") \ No newline at end of file + log(DEBUG, "gRPC channel closed") diff --git a/src/py/flwr/client/grpc_client/connection_test.py b/src/py/flwr/client/grpc_client/connection_test.py index 14b7e717fafc..da7800b26639 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) \ No newline at end of file + server.stop(1) diff --git a/src/py/flwr/client/grpc_rere_client/__init__.py b/src/py/flwr/client/grpc_rere_client/__init__.py index fe9580e6823b..93903e725776 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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.""" \ No newline at end of file +"""Client-side part of the gRPC request-response transport layer.""" 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 e5d4b6715546..d2dded8a73d9 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 \ No newline at end of file + return response 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 441b82dd7b0f..cc35ffef46db 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -372,4 +372,4 @@ def test_client_auth_get_run(self) -> None: if __name__ == "__main__": - unittest.main(verbosity=2) \ No newline at end of file + unittest.main(verbosity=2) diff --git a/src/py/flwr/client/grpc_rere_client/connection.py b/src/py/flwr/client/grpc_rere_client/connection.py index 474f89c8ee6d..b1c268d51d55 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + log(ERROR, exc) 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 bc781c58c57a..77c3d601020d 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) \ No newline at end of file + return self._send_and_receive(request, GetRunResponse, **kwargs) 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 131f8a91c7b5..e62111e084bc 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) \ No newline at end of file + assert expected_methods.issubset(methods) diff --git a/src/py/flwr/client/heartbeat.py b/src/py/flwr/client/heartbeat.py index 39d67693a2ad..b68e6163cc01 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 \ No newline at end of file + return thread diff --git a/src/py/flwr/client/heartbeat_test.py b/src/py/flwr/client/heartbeat_test.py index 19d517d34ccb..286429e075b1 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()) \ No newline at end of file + self.assertFalse(thread.is_alive()) diff --git a/src/py/flwr/client/message_handler/__init__.py b/src/py/flwr/client/message_handler/__init__.py index 07b452d420ab..653563963de5 100644 --- a/src/py/flwr/client/message_handler/__init__.py +++ b/src/py/flwr/client/message_handler/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Client-side message handling.""" \ No newline at end of file +"""Client-side message handling.""" diff --git a/src/py/flwr/client/message_handler/message_handler.py b/src/py/flwr/client/message_handler/message_handler.py index 7cdf6cc64b55..e5acbe0cc9d0 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 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return False 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 91d54c9d715a..8a2db1804e4a 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 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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)) \ No newline at end of file + self.assertFalse(validate_out_message(msg, self.in_metadata)) diff --git a/src/py/flwr/client/message_handler/task_handler.py b/src/py/flwr/client/message_handler/task_handler.py index 816c2b074624..7f515a30fe5a 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 \ No newline at end of file + return task_ins 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 6f156133e2c7..c8b9e14737ff 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 \ No newline at end of file + assert actual_task_ins == expected_task_ins diff --git a/src/py/flwr/client/mod/__init__.py b/src/py/flwr/client/mod/__init__.py index e039f134c0a8..0b4cf6488421 100644 --- a/src/py/flwr/client/mod/__init__.py +++ b/src/py/flwr/client/mod/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2023 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 f2b6288efd3e..e6276ccf2245 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 \ No newline at end of file + return out_msg diff --git a/src/py/flwr/client/mod/comms_mods.py b/src/py/flwr/client/mod/comms_mods.py index e7a3cd4abdf6..058fd6a70001 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) \ No newline at end of file + return call_next(msg, ctxt) diff --git a/src/py/flwr/client/mod/localdp_mod.py b/src/py/flwr/client/mod/localdp_mod.py index 611f3a12cf0a..fe369ad1c7e6 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 \ No newline at end of file + return out_msg diff --git a/src/py/flwr/client/mod/secure_aggregation/__init__.py b/src/py/flwr/client/mod/secure_aggregation/__init__.py index 77a4705ad7b9..8892d8c03935 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2023 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 4fc3acb6be4f..d87af59a4e6e 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) \ No newline at end of file + return secaggplus_mod(msg, ctxt, call_next) 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 39d7c39bf4b6..5b196ad84321 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} \ No newline at end of file + return {Key.NODE_ID_LIST: all_nids, Key.SHARE_LIST: shares} 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 a7a2e3beb95e..36844a2983a1 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) \ No newline at end of file + handler(invalid_configs) diff --git a/src/py/flwr/client/mod/utils.py b/src/py/flwr/client/mod/utils.py index 3dac3b6f7aee..4c3c32944f01 100644 --- a/src/py/flwr/client/mod/utils.py +++ b/src/py/flwr/client/mod/utils.py @@ -1,4 +1,4 @@ -# Copyright 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2023 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,4 +33,4 @@ def new_ffn(message: Message, context: Context) -> Message: for mod in reversed(mods): ffn = wrap_ffn(ffn, mod) - return ffn \ No newline at end of file + return ffn diff --git a/src/py/flwr/client/mod/utils_test.py b/src/py/flwr/client/mod/utils_test.py index 23d8d6e184f3..4676a2c02c4b 100644 --- a/src/py/flwr/client/mod/utils_test.py +++ b/src/py/flwr/client/mod/utils_test.py @@ -1,4 +1,4 @@ -# Copyright 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2023 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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") \ No newline at end of file + self.assertEqual(list(out_message.content.configs_records.keys())[0], "filter") diff --git a/src/py/flwr/client/node_state.py b/src/py/flwr/client/node_state.py index 7a0c0360cbf7..71681b783419 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 \ No newline at end of file + self.run_contexts[run_id] = context diff --git a/src/py/flwr/client/node_state_tests.py b/src/py/flwr/client/node_state_tests.py index 6160cdba748f..193f52661579 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 2f27423ae5c5..0247958d88a9 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 \ No newline at end of file + return wrapper_class(numpy_client=client) # type: ignore diff --git a/src/py/flwr/client/numpy_client_test.py b/src/py/flwr/client/numpy_client_test.py index 4f5f9aab6ddb..526098798e45 100644 --- a/src/py/flwr/client/numpy_client_test.py +++ b/src/py/flwr/client/numpy_client_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -157,4 +157,4 @@ def test_has_evaluate_false() -> None: actual = has_evaluate(client=client) # Assert - assert actual == expected \ No newline at end of file + assert actual == expected diff --git a/src/py/flwr/client/rest_client/__init__.py b/src/py/flwr/client/rest_client/__init__.py index c9f7ae1eb1a8..c3485483ad35 100644 --- a/src/py/flwr/client/rest_client/__init__.py +++ b/src/py/flwr/client/rest_client/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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.""" \ No newline at end of file +"""Client-side part of the REST transport layer.""" diff --git a/src/py/flwr/client/rest_client/connection.py b/src/py/flwr/client/rest_client/connection.py index eddecf9810ff..5f5e153f9d8d 100644 --- a/src/py/flwr/client/rest_client/connection.py +++ b/src/py/flwr/client/rest_client/connection.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + log(ERROR, exc) diff --git a/src/py/flwr/client/supernode/__init__.py b/src/py/flwr/client/supernode/__init__.py index cf895d36ce70..bc505f693875 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 0b7da7986a26..362b09c5d5b5 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 00c2ba1ca81e..956ac7a15c05 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] \ No newline at end of file +Mod = Callable[[Message, Context, ClientAppCallable], Message] diff --git a/src/py/flwr/common/__init__.py b/src/py/flwr/common/__init__.py index 0534ea32862d..bbdf48425e0a 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 fbff6bb2b2fa..71b6d684597f 100644 --- a/src/py/flwr/common/address.py +++ b/src/py/flwr/common/address.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -56,4 +56,4 @@ def parse_address(address: str) -> Optional[Tuple[str, int, Optional[bool]]]: return host, port, version except ValueError: - return None \ No newline at end of file + return None diff --git a/src/py/flwr/common/address_test.py b/src/py/flwr/common/address_test.py index 5c137e538d9e..420b89871d69 100644 --- a/src/py/flwr/common/address_test.py +++ b/src/py/flwr/common/address_test.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -139,4 +139,4 @@ def test_domain_incorrect() -> None: actual = parse_address(address) # Assert - assert actual is None \ No newline at end of file + assert actual is None diff --git a/src/py/flwr/common/config.py b/src/py/flwr/common/config.py index 39b000cf57e1..95bf8ce31c45 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 \ No newline at end of file + return config diff --git a/src/py/flwr/common/constant.py b/src/py/flwr/common/constant.py index 8438915c323b..ac35549d2051 100644 --- a/src/py/flwr/common/constant.py +++ b/src/py/flwr/common/constant.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -98,4 +98,4 @@ class ErrorCode: def __new__(cls) -> ErrorCode: """Prevent instantiation.""" - raise TypeError(f"{cls.__name__} cannot be instantiated.") \ No newline at end of file + raise TypeError(f"{cls.__name__} cannot be instantiated.") diff --git a/src/py/flwr/common/context.py b/src/py/flwr/common/context.py index 350ac4d164b6..b6349307d150 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 \ No newline at end of file + state: RecordSet diff --git a/src/py/flwr/common/date.py b/src/py/flwr/common/date.py index d9d80d30b6b1..f47ad5470106 100644 --- a/src/py/flwr/common/date.py +++ b/src/py/flwr/common/date.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + return datetime.now(tz=timezone.utc) diff --git a/src/py/flwr/common/differential_privacy.py b/src/py/flwr/common/differential_privacy.py index 29d92f6736aa..85dc198ef8a0 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) \ No newline at end of file + return ndarrays_to_parameters(model_params_ndarrays) diff --git a/src/py/flwr/common/differential_privacy_constants.py b/src/py/flwr/common/differential_privacy_constants.py index 760018c64fd2..415759dfdf0b 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 29a6f325a3ba..ea2e193df2f3 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) \ No newline at end of file + assert np.isclose(result[1], temp_value, rtol=1e-6) diff --git a/src/py/flwr/common/dp.py b/src/py/flwr/common/dp.py index cdf0e2b00830..83a72b8ce749 100644 --- a/src/py/flwr/common/dp.py +++ b/src/py/flwr/common/dp.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + return update_clipped, (scaling_factor < 1) diff --git a/src/py/flwr/common/exit_handlers.py b/src/py/flwr/common/exit_handlers.py index 2def2b7c38db..30750c28a450 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 01321d60284d..ead0329ca79c 100644 --- a/src/py/flwr/common/grpc.py +++ b/src/py/flwr/common/grpc.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -61,4 +61,4 @@ def create_channel( if interceptors is not None: channel = grpc.intercept_channel(channel, interceptors) - return channel \ No newline at end of file + return channel diff --git a/src/py/flwr/common/logger.py b/src/py/flwr/common/logger.py index 9516d3860cfd..7225b0663ae7 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 \ No newline at end of file + return child_logger diff --git a/src/py/flwr/common/message.py b/src/py/flwr/common/message.py index c958c01673b9..7f7a0e4dd995 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 1681eff19a08..19f8aeb1eb63 100644 --- a/src/py/flwr/common/message_test.py +++ b/src/py/flwr/common/message_test.py @@ -1,4 +1,4 @@ -# Copyright 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -202,4 +202,4 @@ def test_repr(cls: type, kwargs: Dict[str, Any]) -> None: actual = cls(**kwargs) # Assert - assert str(actual) == str(expected) \ No newline at end of file + assert str(actual) == str(expected) diff --git a/src/py/flwr/common/object_ref.py b/src/py/flwr/common/object_ref.py index 9a6eaeaac9c1..ac52be160c2e 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 \ No newline at end of file + return False diff --git a/src/py/flwr/common/object_ref_test.py b/src/py/flwr/common/object_ref_test.py index c22ee6c33ed3..f4513a4319ab 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 b2c1d614ffd7..eefd7abc19a8 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) \ No newline at end of file + return cast(NDArray, ndarray_deserialized) diff --git a/src/py/flwr/common/parameter_test.py b/src/py/flwr/common/parameter_test.py index 92d67ce2bbef..965038ead6d2 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))) \ No newline at end of file + np.testing.assert_equal(arr_deserialized, np.ones((3, 2))) diff --git a/src/py/flwr/common/pyproject.py b/src/py/flwr/common/pyproject.py index 6a1ba7f96b28..66585e422397 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 \ No newline at end of file + return True diff --git a/src/py/flwr/common/pyproject_test.py b/src/py/flwr/common/pyproject_test.py index b006e5ebbd43..88a945054b83 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" \ No newline at end of file +# 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" diff --git a/src/py/flwr/common/record/__init__.py b/src/py/flwr/common/record/__init__.py index c6c0e2f7fea1..88eef5f7aea1 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 85776ac1d7f5..471c85f0b961 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 \ No newline at end of file + return num_bytes diff --git a/src/py/flwr/common/record/conversion_utils.py b/src/py/flwr/common/record/conversion_utils.py index 3b8ec88e66f2..7cc0b04283e9 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 325e6578430d..84be37fda4a3 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) \ No newline at end of file + np.testing.assert_array_equal(deserialized_array, original_array) diff --git a/src/py/flwr/common/record/metricsrecord.py b/src/py/flwr/common/record/metricsrecord.py index 40d1f33fe475..2b6e584be390 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 \ No newline at end of file + return num_bytes diff --git a/src/py/flwr/common/record/parametersrecord.py b/src/py/flwr/common/record/parametersrecord.py index 80178ceb5c31..93db6d387b53 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 \ No newline at end of file + return num_bytes diff --git a/src/py/flwr/common/record/parametersrecord_test.py b/src/py/flwr/common/record/parametersrecord_test.py index b95a3c4a2d04..e840e5e266e4 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() \ No newline at end of file + assert len(buff) + len(key_name) == p_record.count_bytes() diff --git a/src/py/flwr/common/record/recordset.py b/src/py/flwr/common/record/recordset.py index 60aba5607d0a..74eed46ad86f 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__ \ No newline at end of file + return self.__dict__ == other.__dict__ diff --git a/src/py/flwr/common/record/recordset_test.py b/src/py/flwr/common/record/recordset_test.py index a1523b907183..01260793cb41 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) \ No newline at end of file + assert str(rs) == str(expected) diff --git a/src/py/flwr/common/record/typeddict.py b/src/py/flwr/common/record/typeddict.py index fd4f2c3ac763..23d70dc4f7e8 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() \ No newline at end of file + self._data.clear() diff --git a/src/py/flwr/common/recordset_compat.py b/src/py/flwr/common/recordset_compat.py index afb10924d9d4..1b0bf52d8277 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 \ No newline at end of file + return recordset diff --git a/src/py/flwr/common/recordset_compat_test.py b/src/py/flwr/common/recordset_compat_test.py index f9e1fab71dbd..e0ac7f216af9 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 1495c919df42..d12124b89840 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 \ No newline at end of file + return ret diff --git a/src/py/flwr/common/retry_invoker_test.py b/src/py/flwr/common/retry_invoker_test.py index 7629fe0978a9..2259ae47ded4 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) \ No newline at end of file + invoker.invoke(failing_function) diff --git a/src/py/flwr/common/secure_aggregation/__init__.py b/src/py/flwr/common/secure_aggregation/__init__.py index fef36721f323..b4e0acc0c148 100644 --- a/src/py/flwr/common/secure_aggregation/__init__.py +++ b/src/py/flwr/common/secure_aggregation/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Utility functions for Secure Aggregation.""" \ No newline at end of file +"""Utility functions for Secure Aggregation.""" diff --git a/src/py/flwr/common/secure_aggregation/crypto/__init__.py b/src/py/flwr/common/secure_aggregation/crypto/__init__.py index 39728ad59fd1..2cb34493f7d0 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Cryptographic primitives for Secure Aggregation.""" \ No newline at end of file +"""Cryptographic primitives for Secure Aggregation.""" diff --git a/src/py/flwr/common/secure_aggregation/crypto/shamir.py b/src/py/flwr/common/secure_aggregation/crypto/shamir.py index 2bffcdcb79b8..e56e21b89371 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + return Shamir.combine(shares, ssss=False) 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 baa9d2f0f0ba..1d004a398ea8 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return False 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 374d6c2a15c6..f62276b63ff3 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 \ No newline at end of file + assert verify_hmac(server_shared_secret, message, client_compute_hmac) is False diff --git a/src/py/flwr/common/secure_aggregation/ndarrays_arithmetic.py b/src/py/flwr/common/secure_aggregation/ndarrays_arithmetic.py index 5a0be09eb12b..e926a9531bea 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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))] \ No newline at end of file + return [parameters[idx] / divisor for idx in range(len(parameters))] diff --git a/src/py/flwr/common/secure_aggregation/quantization.py b/src/py/flwr/common/secure_aggregation/quantization.py index b0a81c9b30da..56c25e2bd59c 100644 --- a/src/py/flwr/common/secure_aggregation/quantization.py +++ b/src/py/flwr/common/secure_aggregation/quantization.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return reverse_quantized_list diff --git a/src/py/flwr/common/secure_aggregation/secaggplus_constants.py b/src/py/flwr/common/secure_aggregation/secaggplus_constants.py index 0d3eff67678d..8a15908c13c5 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -66,4 +66,4 @@ class Key: def __new__(cls) -> Key: """Prevent instantiation.""" - raise TypeError(f"{cls.__name__} cannot be instantiated.") \ No newline at end of file + raise TypeError(f"{cls.__name__} cannot be instantiated.") diff --git a/src/py/flwr/common/secure_aggregation/secaggplus_utils.py b/src/py/flwr/common/secure_aggregation/secaggplus_utils.py index 8a120a50646c..c373573477b9 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -99,4 +99,4 @@ def pseudo_rand_gen( else: arr = gen.randint(0, num_range - 1, dimension) output.append(arr) - return output \ No newline at end of file + return output diff --git a/src/py/flwr/common/serde.py b/src/py/flwr/common/serde.py index e7f808102876..84932b806aff 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 \ No newline at end of file + return message diff --git a/src/py/flwr/common/serde_test.py b/src/py/flwr/common/serde_test.py index 77ef5548c0c3..f9969426fc36 100644 --- a/src/py/flwr/common/serde_test.py +++ b/src/py/flwr/common/serde_test.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + assert metadata == deserialized.metadata diff --git a/src/py/flwr/common/telemetry.py b/src/py/flwr/common/telemetry.py index 91fadc276d81..eeb255e8d6eb 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" \ No newline at end of file + return "disabled" diff --git a/src/py/flwr/common/telemetry_test.py b/src/py/flwr/common/telemetry_test.py index 1091194d6ac2..a5eea48443b5 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) \ No newline at end of file + self.assertEqual(source_id, except_value) diff --git a/src/py/flwr/common/typing.py b/src/py/flwr/common/typing.py index 9f50b36c7feb..f51830955679 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 \ No newline at end of file + fab_version: str diff --git a/src/py/flwr/common/version.py b/src/py/flwr/common/version.py index 9725bf2aee67..6808c66606b1 100644 --- a/src/py/flwr/common/version.py +++ b/src/py/flwr/common/version.py @@ -1,17 +1,3 @@ -# 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 @@ -39,4 +25,4 @@ def _version() -> Tuple[str, str]: return ("unknown", "unknown") -package_name, package_version = _version() \ No newline at end of file +package_name, package_version = _version() diff --git a/src/py/flwr/server/__init__.py b/src/py/flwr/server/__init__.py index 47a462384e85..546ce263e2d5 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 15eec8d7bbe3..1574ec46f968 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 c5e4cf449d01..7956e282bd2c 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] \ No newline at end of file + return [self.clients[cid] for cid in sampled_cids] diff --git a/src/py/flwr/server/client_manager_test.py b/src/py/flwr/server/client_manager_test.py index 0acc137bab73..5820881b6aad 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 \ No newline at end of file + assert len(client_manager) == 0 diff --git a/src/py/flwr/server/client_proxy.py b/src/py/flwr/server/client_proxy.py index 1ff57c5ff6ef..951e4ae992da 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.""" \ No newline at end of file + """Disconnect and (optionally) reconnect later.""" diff --git a/src/py/flwr/server/client_proxy_test.py b/src/py/flwr/server/client_proxy_test.py index ce6507ea5ffd..685698558e3a 100644 --- a/src/py/flwr/server/client_proxy_test.py +++ b/src/py/flwr/server/client_proxy_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -116,4 +116,4 @@ def test_properties_are_empty() -> None: actual_properties = client_proxy.properties # Assert - assert not actual_properties \ No newline at end of file + assert not actual_properties diff --git a/src/py/flwr/server/compat/__init__.py b/src/py/flwr/server/compat/__init__.py index e494e32a7054..7bae196ddb65 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 73942d65ae6e..4bb23b846ab7 100644 --- a/src/py/flwr/server/compat/app.py +++ b/src/py/flwr/server/compat/app.py @@ -1,4 +1,4 @@ -# Copyright 2024 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. @@ -98,4 +98,4 @@ def start_driver( # pylint: disable=too-many-arguments, too-many-locals event(EventType.START_SERVER_LEAVE) - return hist \ No newline at end of file + return hist diff --git a/src/py/flwr/server/compat/app_utils.py b/src/py/flwr/server/compat/app_utils.py index 8f8e19173bc4..1cdf1efbffb9 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) \ No newline at end of file + f_stop.wait(3) diff --git a/src/py/flwr/server/compat/app_utils_test.py b/src/py/flwr/server/compat/app_utils_test.py index b1dc96a6f3b5..023d65b0dc72 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() \ No newline at end of file + thread.join() diff --git a/src/py/flwr/server/compat/driver_client_proxy.py b/src/py/flwr/server/compat/driver_client_proxy.py index a6b94855ffa3..150803786f98 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + time.sleep(SLEEP_TIME) 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 9ffc2f8af299..d9e3d3bc0824 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 26b4d5cfeb0c..0b00c98bb16d 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) \ No newline at end of file + super().__init__(state) diff --git a/src/py/flwr/server/criterion.py b/src/py/flwr/server/criterion.py index 2b4f0bfbe6d3..199a609104cb 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.""" \ No newline at end of file + """Decide whether a client should be eligible for sampling or not.""" diff --git a/src/py/flwr/server/criterion_test.py b/src/py/flwr/server/criterion_test.py index 08d8919e5e15..f678825f064e 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 \ No newline at end of file + assert client4 in sampled_clients diff --git a/src/py/flwr/server/driver/__init__.py b/src/py/flwr/server/driver/__init__.py index c9eabc58e998..deaddff77702 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 8fef9c2ea564..b95cec95ab47 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 2bd34d9716f3..d339f1b232f9 100644 --- a/src/py/flwr/server/driver/grpc_driver.py +++ b/src/py/flwr/server/driver/grpc_driver.py @@ -1,4 +1,4 @@ -# Copyright 2024 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. @@ -312,4 +312,4 @@ def close(self) -> None: if self.driver_helper is None: return # Disconnect - self.driver_helper.disconnect() \ No newline at end of file + self.driver_helper.disconnect() diff --git a/src/py/flwr/server/driver/grpc_driver_test.py b/src/py/flwr/server/driver/grpc_driver_test.py index 4c55c4790003..fbead0e3043d 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 2024 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. @@ -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() \ No newline at end of file + self.mock_grpc_driver_helper.disconnect.assert_not_called() diff --git a/src/py/flwr/server/driver/inmemory_driver.py b/src/py/flwr/server/driver/inmemory_driver.py index 99a234750b3b..8c71b1067293 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 \ No newline at end of file + return ret diff --git a/src/py/flwr/server/driver/inmemory_driver_test.py b/src/py/flwr/server/driver/inmemory_driver_test.py index 86cb3318a602..95c2a0b277af 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 2024 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. @@ -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 \ No newline at end of file + self.assertEqual(len(self.driver.state.task_ins_store), 0) # type: ignore diff --git a/src/py/flwr/server/history.py b/src/py/flwr/server/history.py index 57d61c9004bd..291974a4323c 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 \ No newline at end of file + return rep diff --git a/src/py/flwr/server/history_test.py b/src/py/flwr/server/history_test.py index f1721bb2d255..adb9d697e409 100644 --- a/src/py/flwr/server/history_test.py +++ b/src/py/flwr/server/history_test.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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] \ No newline at end of file + assert (0, 0.9) == history.metrics_centralized["acc"][0] diff --git a/src/py/flwr/server/run_serverapp.py b/src/py/flwr/server/run_serverapp.py index c2a710071525..efd3f6846264 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 \ No newline at end of file + return parser diff --git a/src/py/flwr/server/server.py b/src/py/flwr/server/server.py index 8f87cc8ff32c..f1bfb6f0533b 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 \ No newline at end of file + return hist diff --git a/src/py/flwr/server/server_app.py b/src/py/flwr/server/server_app.py index e2c10f371d15..43b3bcce3f36 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`.""" \ No newline at end of file + """Error when trying to load `ServerApp`.""" diff --git a/src/py/flwr/server/server_app_test.py b/src/py/flwr/server/server_app_test.py index becb269df4af..38c0d6240d90 100644 --- a/src/py/flwr/server/server_app_test.py +++ b/src/py/flwr/server/server_app_test.py @@ -1,4 +1,4 @@ -# Copyright 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + # pylint: enable=unused-argument diff --git a/src/py/flwr/server/server_config.py b/src/py/flwr/server/server_config.py index a642c1842636..c47367eab4c0 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}" \ No newline at end of file + return f"num_rounds={self.num_rounds}, {timeout_string}" diff --git a/src/py/flwr/server/server_test.py b/src/py/flwr/server/server_test.py index 7a3498f1b82c..f47b5c3d8469 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 045e361b84b4..e5bc30009819 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 6900965a7404..c668b55eebe6 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 \ No newline at end of file + return aggregated_weights diff --git a/src/py/flwr/server/strategy/aggregate_test.py b/src/py/flwr/server/strategy/aggregate_test.py index 8d23c3aa5286..f8b4e3c03b50 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 0d3265a9688d..1e4f97530ab7 100644 --- a/src/py/flwr/server/strategy/bulyan.py +++ b/src/py/flwr/server/strategy/bulyan.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return parameters_aggregated, metrics_aggregated diff --git a/src/py/flwr/server/strategy/bulyan_test.py b/src/py/flwr/server/strategy/bulyan_test.py index 5b58cc3b19b0..299ed49066fb 100644 --- a/src/py/flwr/server/strategy/bulyan_test.py +++ b/src/py/flwr/server/strategy/bulyan_test.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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() \ No newline at end of file + assert (actual == expected[0]).all() diff --git a/src/py/flwr/server/strategy/dp_adaptive_clipping.py b/src/py/flwr/server/strategy/dp_adaptive_clipping.py index dc5254b403e2..b25e1efdf0e9 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) \ No newline at end of file + return self.strategy.evaluate(server_round, parameters) diff --git a/src/py/flwr/server/strategy/dp_fixed_clipping.py b/src/py/flwr/server/strategy/dp_fixed_clipping.py index 37be10b20917..92b2845fd846 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) \ No newline at end of file + return self.strategy.evaluate(server_round, parameters) diff --git a/src/py/flwr/server/strategy/dpfedavg_adaptive.py b/src/py/flwr/server/strategy/dpfedavg_adaptive.py index f49b331c3ad8..a908679ed668 100644 --- a/src/py/flwr/server/strategy/dpfedavg_adaptive.py +++ b/src/py/flwr/server/strategy/dpfedavg_adaptive.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return new_global_model diff --git a/src/py/flwr/server/strategy/dpfedavg_fixed.py b/src/py/flwr/server/strategy/dpfedavg_fixed.py index 552467f281d9..c54379fc7087 100644 --- a/src/py/flwr/server/strategy/dpfedavg_fixed.py +++ b/src/py/flwr/server/strategy/dpfedavg_fixed.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + return self.strategy.evaluate(server_round, parameters) diff --git a/src/py/flwr/server/strategy/fault_tolerant_fedavg.py b/src/py/flwr/server/strategy/fault_tolerant_fedavg.py index acfa13873f46..663ac8872c39 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 \ No newline at end of file + return loss_aggregated, metrics_aggregated 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 25f692bfd793..98f4cac032cb 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 \ No newline at end of file + assert actual == expected diff --git a/src/py/flwr/server/strategy/fedadagrad.py b/src/py/flwr/server/strategy/fedadagrad.py index e63c092910ea..4a8f52d98e18 100644 --- a/src/py/flwr/server/strategy/fedadagrad.py +++ b/src/py/flwr/server/strategy/fedadagrad.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -168,4 +168,4 @@ def aggregate_fit( self.current_weights = new_weights - return ndarrays_to_parameters(self.current_weights), metrics_aggregated \ No newline at end of file + return ndarrays_to_parameters(self.current_weights), metrics_aggregated diff --git a/src/py/flwr/server/strategy/fedadagrad_test.py b/src/py/flwr/server/strategy/fedadagrad_test.py index 9229792de819..0c966442ecaf 100644 --- a/src/py/flwr/server/strategy/fedadagrad_test.py +++ b/src/py/flwr/server/strategy/fedadagrad_test.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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() \ No newline at end of file + assert (actual == expected[0]).all() diff --git a/src/py/flwr/server/strategy/fedadam.py b/src/py/flwr/server/strategy/fedadam.py index e1d5eb06c785..8a47cf0dd8ac 100644 --- a/src/py/flwr/server/strategy/fedadam.py +++ b/src/py/flwr/server/strategy/fedadam.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -177,4 +177,4 @@ def aggregate_fit( self.current_weights = new_weights - return ndarrays_to_parameters(self.current_weights), metrics_aggregated \ No newline at end of file + return ndarrays_to_parameters(self.current_weights), metrics_aggregated diff --git a/src/py/flwr/server/strategy/fedavg.py b/src/py/flwr/server/strategy/fedavg.py index 35b08e1059b7..3b9b2640c2b5 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 \ No newline at end of file + return loss_aggregated, metrics_aggregated diff --git a/src/py/flwr/server/strategy/fedavg_android.py b/src/py/flwr/server/strategy/fedavg_android.py index 04cf6ac1bd85..6678b7ced114 100644 --- a/src/py/flwr/server/strategy/fedavg_android.py +++ b/src/py/flwr/server/strategy/fedavg_android.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + return cast(NDArray, ndarray_deserialized) diff --git a/src/py/flwr/server/strategy/fedavg_test.py b/src/py/flwr/server/strategy/fedavg_test.py index 7b7757a0cdb7..e62eaa5c5832 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) \ No newline at end of file + assert_allclose(ref, inp) diff --git a/src/py/flwr/server/strategy/fedavgm.py b/src/py/flwr/server/strategy/fedavgm.py index a20176e7799f..fb9261abe89d 100644 --- a/src/py/flwr/server/strategy/fedavgm.py +++ b/src/py/flwr/server/strategy/fedavgm.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return parameters_aggregated, metrics_aggregated diff --git a/src/py/flwr/server/strategy/fedavgm_test.py b/src/py/flwr/server/strategy/fedavgm_test.py index c2aa7324b52e..a0e942171627 100644 --- a/src/py/flwr/server/strategy/fedavgm_test.py +++ b/src/py/flwr/server/strategy/fedavgm_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + assert_almost_equal(w_act, w_exp) diff --git a/src/py/flwr/server/strategy/fedmedian.py b/src/py/flwr/server/strategy/fedmedian.py index 1012eaf93975..17e979d92beb 100644 --- a/src/py/flwr/server/strategy/fedmedian.py +++ b/src/py/flwr/server/strategy/fedmedian.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return parameters_aggregated, metrics_aggregated diff --git a/src/py/flwr/server/strategy/fedmedian_test.py b/src/py/flwr/server/strategy/fedmedian_test.py index 9c84d58f0df8..57cf08d8c01d 100644 --- a/src/py/flwr/server/strategy/fedmedian_test.py +++ b/src/py/flwr/server/strategy/fedmedian_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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() \ No newline at end of file + assert (actual == expected[0]).all() diff --git a/src/py/flwr/server/strategy/fedopt.py b/src/py/flwr/server/strategy/fedopt.py index 5ec55004ef3e..be5f260d96fa 100644 --- a/src/py/flwr/server/strategy/fedopt.py +++ b/src/py/flwr/server/strategy/fedopt.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return rep diff --git a/src/py/flwr/server/strategy/fedprox.py b/src/py/flwr/server/strategy/fedprox.py index a6cd638ff726..d20f578b193d 100644 --- a/src/py/flwr/server/strategy/fedprox.py +++ b/src/py/flwr/server/strategy/fedprox.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 b59366187af9..96b0d35e7a61 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 \ No newline at end of file + return parameters_aggregated, metrics_aggregated diff --git a/src/py/flwr/server/strategy/fedxgb_bagging.py b/src/py/flwr/server/strategy/fedxgb_bagging.py index 182682fd695b..a8e8adddafbb 100644 --- a/src/py/flwr/server/strategy/fedxgb_bagging.py +++ b/src/py/flwr/server/strategy/fedxgb_bagging.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -166,4 +166,4 @@ def _get_tree_nums(xgb_model_org: bytes) -> Tuple[int, int]: "num_parallel_tree" ] ) - return tree_num, paral_tree_num \ No newline at end of file + return tree_num, paral_tree_num diff --git a/src/py/flwr/server/strategy/fedxgb_cyclic.py b/src/py/flwr/server/strategy/fedxgb_cyclic.py index 4b7fb837cea9..2605daab29f4 100644 --- a/src/py/flwr/server/strategy/fedxgb_cyclic.py +++ b/src/py/flwr/server/strategy/fedxgb_cyclic.py @@ -1,4 +1,4 @@ -# Copyright 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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] \ No newline at end of file + return [(client, evaluate_ins) for client in sampled_clients] diff --git a/src/py/flwr/server/strategy/fedxgb_nn_avg.py b/src/py/flwr/server/strategy/fedxgb_nn_avg.py index b477cfe0acfc..8dedc925f350 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 2023 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return [parameters_aggregated, trees_aggregated], metrics_aggregated diff --git a/src/py/flwr/server/strategy/fedyogi.py b/src/py/flwr/server/strategy/fedyogi.py index e30f48c471c0..7c77aab7ae73 100644 --- a/src/py/flwr/server/strategy/fedyogi.py +++ b/src/py/flwr/server/strategy/fedyogi.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -177,4 +177,4 @@ def aggregate_fit( self.current_weights = new_weights - return ndarrays_to_parameters(self.current_weights), metrics_aggregated \ No newline at end of file + return ndarrays_to_parameters(self.current_weights), metrics_aggregated diff --git a/src/py/flwr/server/strategy/krum.py b/src/py/flwr/server/strategy/krum.py index 25764bda0d42..16eb5212940e 100644 --- a/src/py/flwr/server/strategy/krum.py +++ b/src/py/flwr/server/strategy/krum.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return parameters_aggregated, metrics_aggregated diff --git a/src/py/flwr/server/strategy/krum_test.py b/src/py/flwr/server/strategy/krum_test.py index e1175c87c3b6..653dc9a8475d 100644 --- a/src/py/flwr/server/strategy/krum_test.py +++ b/src/py/flwr/server/strategy/krum_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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() \ No newline at end of file + assert (actual == expected[0]).all() diff --git a/src/py/flwr/server/strategy/multikrum_test.py b/src/py/flwr/server/strategy/multikrum_test.py index d19725018f36..f874dc2f9800 100644 --- a/src/py/flwr/server/strategy/multikrum_test.py +++ b/src/py/flwr/server/strategy/multikrum_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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() \ No newline at end of file + assert (actual == expected[0]).all() diff --git a/src/py/flwr/server/strategy/qfedavg.py b/src/py/flwr/server/strategy/qfedavg.py index 114ac548fa79..758e8e608e9f 100644 --- a/src/py/flwr/server/strategy/qfedavg.py +++ b/src/py/flwr/server/strategy/qfedavg.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return loss_aggregated, metrics_aggregated diff --git a/src/py/flwr/server/strategy/strategy.py b/src/py/flwr/server/strategy/strategy.py index 08d1f76aef7a..cfdfe2e246c5 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 2c2bdf394437..94102100de26 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.""" \ No newline at end of file +"""Flower SuperLink.""" diff --git a/src/py/flwr/server/superlink/driver/__init__.py b/src/py/flwr/server/superlink/driver/__init__.py index 864a23932f73..2bfe63e6065f 100644 --- a/src/py/flwr/server/superlink/driver/__init__.py +++ b/src/py/flwr/server/superlink/driver/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2024 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. # ============================================================================== -"""Flower driver service.""" \ No newline at end of file +"""Flower driver service.""" diff --git a/src/py/flwr/server/superlink/driver/driver_grpc.py b/src/py/flwr/server/superlink/driver/driver_grpc.py index 6ec57940fc8d..f74000bc59c4 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return driver_grpc_server diff --git a/src/py/flwr/server/superlink/driver/driver_servicer.py b/src/py/flwr/server/superlink/driver/driver_servicer.py index 8ea23da22c15..e808616af778 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -139,4 +139,4 @@ def GetRun( def _raise_if(validation_error: bool, detail: str) -> None: if validation_error: - raise ValueError(f"Malformed PushTaskInsRequest: {detail}") \ No newline at end of file + raise ValueError(f"Malformed PushTaskInsRequest: {detail}") 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 5efb03040402..99f7cc007a89 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 2024 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. @@ -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 \ No newline at end of file + raise AssertionError() from err diff --git a/src/py/flwr/server/superlink/fleet/__init__.py b/src/py/flwr/server/superlink/fleet/__init__.py index b89134921e3e..d3c3ef90163d 100644 --- a/src/py/flwr/server/superlink/fleet/__init__.py +++ b/src/py/flwr/server/superlink/fleet/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2024 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. # ============================================================================== -"""Flower fleet service.""" \ No newline at end of file +"""Flower fleet service.""" 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 ae2772f30b87..cf875a1b9666 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.""" \ No newline at end of file +"""Server-side part of the GrpcAdapter transport layer.""" 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 1fc2891cc9f9..9325041061ac 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 419402aaef40..bae8bc431edd 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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.""" \ No newline at end of file +"""Server-side part of the gRPC transport layer.""" 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 66607964fb40..6f94ea844e38 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -145,4 +145,4 @@ def Join( # pylint: disable=invalid-name res_wrapper=ResWrapper(client_message=client_message) ) except StopIteration: - break \ No newline at end of file + break 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 ff31f1d50b44..bd93554a6a32 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -141,4 +141,4 @@ def test_join(self) -> None: if __name__ == "__main__": - unittest.main(verbosity=2) \ No newline at end of file + unittest.main(verbosity=2) 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 13028bc47adc..d5b4a915c609 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + self._transition(Status.RES_WRAPPER_AVAILABLE) 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 12f3abf5ff2d..f7c236acd7a1 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -176,4 +176,4 @@ def close_bridge_delayed(secs: int) -> None: # Assert assert len(client_messages_received) == 2 - assert isinstance(raised_error, GrpcBridgeClosed) \ No newline at end of file + assert isinstance(raised_error, GrpcBridgeClosed) 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 ee80673b868f..ac62ad014950 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return disconnect 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 5b81c749df5a..e7077dfd39ae 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -132,4 +132,4 @@ def test_get_properties(self) -> None: ) # Assert - assert value.properties["tensor_type"] == "numpy.ndarray" \ No newline at end of file + assert value.properties["tensor_type"] == "numpy.ndarray" 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 84a4928ededd..6aeaa7ef413f 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -274,4 +274,4 @@ def generic_create_grpc_server( # pylint: disable=too-many-arguments else: server.add_insecure_port(server_address) - return server \ No newline at end of file + return server 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 a2d969bfcf98..8afa37515950 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -115,4 +115,4 @@ def test_integration_start_and_shutdown_secure_server() -> None: ) # Teardown - server.stop(1) \ No newline at end of file + server.stop(1) 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 8e8b89a15cbf..61ab71d91400 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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.""" \ No newline at end of file +"""Server-side part of the gRPC transport layer using Request-Response.""" 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 71498039f5bc..13e024eb31e4 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 c4ce5336b6fb..21e9c44907cd 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)) \ No newline at end of file + return CreateNodeResponse(node=Node(node_id=node_id, anonymous=False)) 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 bf8c516224d3..01499102b7d8 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 \ No newline at end of file + assert response.node.node_id == client_node_id 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 c48f4bcef916..18b0f11fa6c5 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Shared request-response message handlers.""" \ No newline at end of file +"""Shared request-response message handlers.""" 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 b180f49dc577..dceb18cab453 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + return GetRunResponse(run=run_proto) 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 acdc732e9813..c135f6fb7b61 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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() \ No newline at end of file + state.get_task_res.assert_not_called() 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 0360ca524b3a..a926f9ca0bfc 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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.""" \ No newline at end of file +"""Server-side part of the REST transport layer.""" 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 e9bff8fc9869..c7ff496d39bf 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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`") \ No newline at end of file + raise HTTPException(status_code=400, detail="Unsupported `Accept`") diff --git a/src/py/flwr/server/superlink/fleet/vce/__init__.py b/src/py/flwr/server/superlink/fleet/vce/__init__.py index 23992c5cbe2f..57d39688b527 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 3b8e081a2140..d751cf4bcae1 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 42055731229e..1d5e3a6a51ad 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.""" \ No newline at end of file + """Submit a job to the backend.""" 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 1c8d4709eaad..93aca583af9c 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__) \ No newline at end of file + log(DEBUG, "Terminated %s", self.__class__.__name__) 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 c9fe91868d8c..dcac0b81d666 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) \ No newline at end of file + self.addAsyncCleanup(self.on_cleanup) 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 475eeeffed3d..3c9628a6d2a3 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 \ No newline at end of file + raise ex 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 65d59a4b9ada..df9f2cc96f95 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 2763aa97d1ec..7f260d733bbe 100644 --- a/src/py/flwr/server/superlink/state/__init__.py +++ b/src/py/flwr/server/superlink/state/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2023 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 e4f81c3a9e4b..e03260355db9 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2023 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 \ No newline at end of file + return False diff --git a/src/py/flwr/server/superlink/state/sqlite_state.py b/src/py/flwr/server/superlink/state/sqlite_state.py index 919ba149598b..b9672757b0e6 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2023 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -816,4 +816,4 @@ def dict_to_task_res(task_dict: Dict[str, Any]) -> TaskRes: recordset=recordset, ), ) - return result \ No newline at end of file + return result 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 e21591da2625..20927df1cf12 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -54,4 +54,4 @@ def test_ins_res_to_dict(self) -> None: if __name__ == "__main__": - unittest.main(verbosity=2) \ No newline at end of file + unittest.main(verbosity=2) diff --git a/src/py/flwr/server/superlink/state/state.py b/src/py/flwr/server/superlink/state/state.py index cabb8874400a..d1fc9465c9f2 100644 --- a/src/py/flwr/server/superlink/state/state.py +++ b/src/py/flwr/server/superlink/state/state.py @@ -1,4 +1,4 @@ -# Copyright 2024 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. @@ -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 d9e4c7fc2e51..62a00d910828 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 2024 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. @@ -45,4 +45,4 @@ def state(self) -> State: state = SqliteState(self.database) state.initialize() log(DEBUG, "Using SqliteState") - return state \ No newline at end of file + return state diff --git a/src/py/flwr/server/superlink/state/state_test.py b/src/py/flwr/server/superlink/state/state_test.py index e75746137277..81307d938400 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 2024 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -779,4 +779,4 @@ def test_initialize(self) -> None: if __name__ == "__main__": - unittest.main(verbosity=2) \ No newline at end of file + unittest.main(verbosity=2) diff --git a/src/py/flwr/server/superlink/state/utils.py b/src/py/flwr/server/superlink/state/utils.py index 95d68d5419bf..233a90946cc7 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 b68a927fdb14..01143af74392 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] \ No newline at end of file +Workflow = Callable[[Driver, Context], None] diff --git a/src/py/flwr/server/utils/__init__.py b/src/py/flwr/server/utils/__init__.py index cf6fcc3ad49b..c370716adaac 100644 --- a/src/py/flwr/server/utils/__init__.py +++ b/src/py/flwr/server/utils/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 468ca8428fd2..3e8d1e62411e 100644 --- a/src/py/flwr/server/utils/tensorboard.py +++ b/src/py/flwr/server/utils/tensorboard.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -148,4 +148,4 @@ def aggregate_evaluate( return cast(Strategy, TBWrapper) - return decorator \ No newline at end of file + return decorator diff --git a/src/py/flwr/server/utils/tensorboard_test.py b/src/py/flwr/server/utils/tensorboard_test.py index 686584301f8c..1827a42cf6e6 100644 --- a/src/py/flwr/server/utils/tensorboard_test.py +++ b/src/py/flwr/server/utils/tensorboard_test.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,4 +27,4 @@ def test_tensorboard() -> None: my_decorator = tensorboard(tmpdir) # Assert - assert callable(my_decorator) \ No newline at end of file + assert callable(my_decorator) diff --git a/src/py/flwr/server/utils/validator.py b/src/py/flwr/server/utils/validator.py index de02223d3e7f..c0b0ec85761c 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 \ No newline at end of file + return validation_errors diff --git a/src/py/flwr/server/utils/validator_test.py b/src/py/flwr/server/utils/validator_test.py index c0363c60ee7e..61fe094c23d4 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 \ No newline at end of file + return task_res diff --git a/src/py/flwr/server/workflow/__init__.py b/src/py/flwr/server/workflow/__init__.py index 754bc33624a5..31dee89a185d 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 5b801ba23522..068e05b27e12 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.") \ No newline at end of file + raise TypeError(f"{cls.__name__} cannot be instantiated.") diff --git a/src/py/flwr/server/workflow/default_workflows.py b/src/py/flwr/server/workflow/default_workflows.py index 1f4a422237b8..80759316da84 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 1ab533ccdb2d..25e2a32da334 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 7fb557a32586..f56423e4a0d0 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 be3ad0f66bcc..d6d97c28f313 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 \ No newline at end of file + return True diff --git a/src/py/flwr/simulation/__init__.py b/src/py/flwr/simulation/__init__.py index ed00118a9e2f..3d648b14edba 100644 --- a/src/py/flwr/simulation/__init__.py +++ b/src/py/flwr/simulation/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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 401fc0792f19..4b4b7249ccd3 100644 --- a/src/py/flwr/simulation/app.py +++ b/src/py/flwr/simulation/app.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -363,4 +363,4 @@ def update_resources(f_stop: threading.Event) -> None: f_stop.set() event(EventType.START_SIMULATION_LEAVE) - return hist \ No newline at end of file + return hist diff --git a/src/py/flwr/simulation/ray_transport/__init__.py b/src/py/flwr/simulation/ray_transport/__init__.py index a8dc6ef2028d..0e82b75bb4b3 100644 --- a/src/py/flwr/simulation/ray_transport/__init__.py +++ b/src/py/flwr/simulation/ray_transport/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Ray-based Flower ClientProxy implementation.""" \ No newline at end of file +"""Ray-based Flower ClientProxy implementation.""" diff --git a/src/py/flwr/simulation/ray_transport/ray_actor.py b/src/py/flwr/simulation/ray_transport/ray_actor.py index 4afcb3249d64..9caf0fc3e6c0 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 \ No newline at end of file + return out_mssg, updated_context 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 a28e9744dc58..5e344eb087ee 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 2021 Flower Labs GmbH. All Rights Reserved. +# Copyright 2020 Flower Labs GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -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) \ No newline at end of file + return common.DisconnectRes(reason="") # Nothing to do here (yet) 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 7fc2d8debc28..9680b3846f1d 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() \ No newline at end of file + ray.shutdown() diff --git a/src/py/flwr/simulation/ray_transport/utils.py b/src/py/flwr/simulation/ray_transport/utils.py index c9bff55f4d2a..3861164998a4 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 \ No newline at end of file + raise ex diff --git a/src/py/flwr/simulation/run_simulation.py b/src/py/flwr/simulation/run_simulation.py index 0a4d527dc8d1..3532c5a4e877 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 \ No newline at end of file + return parser diff --git a/src/py/flwr/superexec/__init__.py b/src/py/flwr/superexec/__init__.py index efc89ce397a1..a510c41f4182 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 c7c4f8bdb79c..fa89e83b5e75 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`.""" \ No newline at end of file + """Error when trying to load `Executor`.""" diff --git a/src/py/flwr/superexec/exec_grpc.py b/src/py/flwr/superexec/exec_grpc.py index 47cb3128dc75..127d5615dd84 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 \ No newline at end of file + return superexec_grpc_server diff --git a/src/py/flwr/superexec/exec_servicer.py b/src/py/flwr/superexec/exec_servicer.py index 0926c625e3f5..e5ef2bd59a79 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]) \ No newline at end of file + yield StreamLogsResponse(log_output=logs[i]) diff --git a/src/py/flwr/superexec/exec_servicer_test.py b/src/py/flwr/superexec/exec_servicer_test.py index 6e5f4b094b5d..41f67b74c48b 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 \ No newline at end of file + assert response.run_id == 10 diff --git a/src/py/flwr/superexec/executor.py b/src/py/flwr/superexec/executor.py index ec5785cfb174..f85ac4c157fc 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 + """ diff --git a/src/py/flwr_tool/fix_copyright.py b/src/py/flwr_tool/fix_copyright.py index 5d8995383607..c5c9eb42bf18 100755 --- a/src/py/flwr_tool/fix_copyright.py +++ b/src/py/flwr_tool/fix_copyright.py @@ -34,7 +34,7 @@ def _insert_or_edit_copyright(py_file: Path) -> None: lines = lines[end_index:] lines.insert(0, expected_copyright) - py_file.write_text("\n".join(lines), newline="\n") + py_file.write_text("\n".join(lines) + "\n") def _fix_copyright(dir_list: List[str]) -> None: