prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Improve docstring for `start_server`
  
  
  </issue>
  <code>
  [start of src/py/flwr/server/app.py]
  1 # Copyright 2020 Adap GmbH. All Rights Reserved.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 # ==============================================================================
  15 """Flower server app."""
  16 
  17 
  18 from logging import INFO
  19 from typing import Dict, Optional
  20 
  21 from flwr.common import GRPC_MAX_MESSAGE_LENGTH
  22 from flwr.common.logger import log
  23 from flwr.server.client_manager import SimpleClientManager
  24 from flwr.server.grpc_server.grpc_server import start_insecure_grpc_server
  25 from flwr.server.server import Server
  26 from flwr.server.strategy import FedAvg, Strategy
  27 
  28 DEFAULT_SERVER_ADDRESS = "[::]:8080"
  29 
  30 
  31 def start_server(
  32     server_address: str = DEFAULT_SERVER_ADDRESS,
  33     server: Optional[Server] = None,
  34     config: Optional[Dict[str, int]] = None,
  35     strategy: Optional[Strategy] = None,
  36     grpc_max_message_length: int = GRPC_MAX_MESSAGE_LENGTH,
  37 ) -> None:
  38     """Start a Flower server using the gRPC transport layer."""
  39 
  40     # Create server instance if none was given
  41     if server is None:
  42         client_manager = SimpleClientManager()
  43         if strategy is None:
  44             strategy = FedAvg()
  45         server = Server(client_manager=client_manager, strategy=strategy)
  46 
  47     # Set default config values
  48     if config is None:
  49         config = {}
  50     if "num_rounds" not in config:
  51         config["num_rounds"] = 1
  52 
  53     # Start gRPC server
  54     grpc_server = start_insecure_grpc_server(
  55         client_manager=server.client_manager(),
  56         server_address=server_address,
  57         max_message_length=grpc_max_message_length,
  58     )
  59     log(INFO, "Flower server running (insecure, %s rounds)", config["num_rounds"])
  60 
  61     # Fit model
  62     hist = server.fit(num_rounds=config["num_rounds"])
  63     log(INFO, "app_fit: losses_distributed %s", str(hist.losses_distributed))
  64     log(INFO, "app_fit: accuracies_distributed %s", str(hist.accuracies_distributed))
  65     log(INFO, "app_fit: losses_centralized %s", str(hist.losses_centralized))
  66     log(INFO, "app_fit: accuracies_centralized %s", str(hist.accuracies_centralized))
  67 
  68     # Temporary workaround to force distributed evaluation
  69     server.strategy.eval_fn = None  # type: ignore
  70 
  71     # Evaluate the final trained model
  72     res = server.evaluate(rnd=-1)
  73     if res is not None:
  74         loss, (results, failures) = res
  75         log(INFO, "app_evaluate: federated loss: %s", str(loss))
  76         log(
  77             INFO,
  78             "app_evaluate: results %s",
  79             str([(res[0].cid, res[1]) for res in results]),
  80         )
  81         log(INFO, "app_evaluate: failures %s", str(failures))
  82     else:
  83         log(INFO, "app_evaluate: no evaluation result")
  84 
  85     # Stop the gRPC server
  86     grpc_server.stop(1)
  87
  [end of src/py/flwr/server/app.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/py/flwr/server/app.py b/src/py/flwr/server/app.py
  --- a/src/py/flwr/server/app.py
  +++ b/src/py/flwr/server/app.py
  @@ -35,7 +35,33 @@
       strategy: Optional[Strategy] = None,
       grpc_max_message_length: int = GRPC_MAX_MESSAGE_LENGTH,
   ) -> None:
  -    """Start a Flower server using the gRPC transport layer."""
  +    """Start a Flower server using the gRPC transport layer.
  +
  +    Arguments:
  +        server_address: Optional[str] (default: `"[::]:8080"`). The IPv6
  +            address of the server.
  +        server: Optional[flwr.server.Server] (default: None). An implementation
  +            of the abstract base class `flwr.server.Server`. If no instance is
  +            provided, then `start_server` will create one.
  +        config: Optional[Dict[str, int]] (default: None). The only currently
  +            supported values is `num_rounds`, so a full configuration object
  +            instructing the server to perform three rounds of federated
  +            learning looks like the following: `{"num_rounds": 3}`.
  +        strategy: Optional[flwr.server.Strategy] (default: None). An
  +            implementation of the abstract base class `flwr.server.Strategy`.
  +            If no strategy is provided, then `start_server` will use
  +            `flwr.server.strategy.FedAvg`.
  +        grpc_max_message_length: int (default: 536_870_912, this equals 512MB).
  +            The maximum length of gRPC messages that can be exchanged with the
  +            Flower clients. The default should be sufficient for most models.
  +            Users who train very large models might need to increase this
  +            value. Note that the Flower clients needs to started with the same
  +            value (see `flwr.client.start_client`), otherwise clients will not
  +            know about the increased limit and block larger messages.
  +
  +    Returns:
  +        None.
  +    """
   
       # Create server instance if none was given
       if server is None:
  
verification_info: {"golden_diff": "diff --git a/src/py/flwr/server/app.py b/src/py/flwr/server/app.py\n--- a/src/py/flwr/server/app.py\n+++ b/src/py/flwr/server/app.py\n@@ -35,7 +35,33 @@\n     strategy: Optional[Strategy] = None,\n     grpc_max_message_length: int = GRPC_MAX_MESSAGE_LENGTH,\n ) -> None:\n-    \"\"\"Start a Flower server using the gRPC transport layer.\"\"\"\n+    \"\"\"Start a Flower server using the gRPC transport layer.\n+\n+    Arguments:\n+        server_address: Optional[str] (default: `\"[::]:8080\"`). The IPv6\n+            address of the server.\n+        server: Optional[flwr.server.Server] (default: None). An implementation\n+            of the abstract base class `flwr.server.Server`. If no instance is\n+            provided, then `start_server` will create one.\n+        config: Optional[Dict[str, int]] (default: None). The only currently\n+            supported values is `num_rounds`, so a full configuration object\n+            instructing the server to perform three rounds of federated\n+            learning looks like the following: `{\"num_rounds\": 3}`.\n+        strategy: Optional[flwr.server.Strategy] (default: None). An\n+            implementation of the abstract base class `flwr.server.Strategy`.\n+            If no strategy is provided, then `start_server` will use\n+            `flwr.server.strategy.FedAvg`.\n+        grpc_max_message_length: int (default: 536_870_912, this equals 512MB).\n+            The maximum length of gRPC messages that can be exchanged with the\n+            Flower clients. The default should be sufficient for most models.\n+            Users who train very large models might need to increase this\n+            value. Note that the Flower clients needs to started with the same\n+            value (see `flwr.client.start_client`), otherwise clients will not\n+            know about the increased limit and block larger messages.\n+\n+    Returns:\n+        None.\n+    \"\"\"\n \n     # Create server instance if none was given\n     if server is None:\n", "issue": "Improve docstring for `start_server`\n\n", "before_files": [{"content": "# Copyright 2020 Adap GmbH. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ==============================================================================\n\"\"\"Flower server app.\"\"\"\n\n\nfrom logging import INFO\nfrom typing import Dict, Optional\n\nfrom flwr.common import GRPC_MAX_MESSAGE_LENGTH\nfrom flwr.common.logger import log\nfrom flwr.server.client_manager import SimpleClientManager\nfrom flwr.server.grpc_server.grpc_server import start_insecure_grpc_server\nfrom flwr.server.server import Server\nfrom flwr.server.strategy import FedAvg, Strategy\n\nDEFAULT_SERVER_ADDRESS = \"[::]:8080\"\n\n\ndef start_server(\n    server_address: str = DEFAULT_SERVER_ADDRESS,\n    server: Optional[Server] = None,\n    config: Optional[Dict[str, int]] = None,\n    strategy: Optional[Strategy] = None,\n    grpc_max_message_length: int = GRPC_MAX_MESSAGE_LENGTH,\n) -> None:\n    \"\"\"Start a Flower server using the gRPC transport layer.\"\"\"\n\n    # Create server instance if none was given\n    if server is None:\n        client_manager = SimpleClientManager()\n        if strategy is None:\n            strategy = FedAvg()\n        server = Server(client_manager=client_manager, strategy=strategy)\n\n    # Set default config values\n    if config is None:\n        config = {}\n    if \"num_rounds\" not in config:\n        config[\"num_rounds\"] = 1\n\n    # Start gRPC server\n    grpc_server = start_insecure_grpc_server(\n        client_manager=server.client_manager(),\n        server_address=server_address,\n        max_message_length=grpc_max_message_length,\n    )\n    log(INFO, \"Flower server running (insecure, %s rounds)\", config[\"num_rounds\"])\n\n    # Fit model\n    hist = server.fit(num_rounds=config[\"num_rounds\"])\n    log(INFO, \"app_fit: losses_distributed %s\", str(hist.losses_distributed))\n    log(INFO, \"app_fit: accuracies_distributed %s\", str(hist.accuracies_distributed))\n    log(INFO, \"app_fit: losses_centralized %s\", str(hist.losses_centralized))\n    log(INFO, \"app_fit: accuracies_centralized %s\", str(hist.accuracies_centralized))\n\n    # Temporary workaround to force distributed evaluation\n    server.strategy.eval_fn = None  # type: ignore\n\n    # Evaluate the final trained model\n    res = server.evaluate(rnd=-1)\n    if res is not None:\n        loss, (results, failures) = res\n        log(INFO, \"app_evaluate: federated loss: %s\", str(loss))\n        log(\n            INFO,\n            \"app_evaluate: results %s\",\n            str([(res[0].cid, res[1]) for res in results]),\n        )\n        log(INFO, \"app_evaluate: failures %s\", str(failures))\n    else:\n        log(INFO, \"app_evaluate: no evaluation result\")\n\n    # Stop the gRPC server\n    grpc_server.stop(1)\n", "path": "src/py/flwr/server/app.py"}]}