Skip to content

Commit

Permalink
Merge branch 'main' into update-flower-server
Browse files Browse the repository at this point in the history
  • Loading branch information
panh99 authored Nov 30, 2023
2 parents a8a1eeb + 094e925 commit f8857c9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/py/flwr/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from typing import Callable, ContextManager, Optional, Tuple, Union

from flwr.client.client import Client
from flwr.client.flower import Bwd, Flower, Fwd
from flwr.client.typing import ClientFn
from flwr.client.flower import Flower
from flwr.client.typing import Bwd, ClientFn, Fwd
from flwr.common import GRPC_MAX_MESSAGE_LENGTH, EventType, event
from flwr.common.address import parse_address
from flwr.common.constant import (
Expand Down
26 changes: 2 additions & 24 deletions src/py/flwr/client/flower.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,10 @@


import importlib
from dataclasses import dataclass
from typing import Callable, cast
from typing import cast

from flwr.client.message_handler.message_handler import handle
from flwr.client.typing import ClientFn
from flwr.client.workload_state import WorkloadState
from flwr.proto.task_pb2 import TaskIns, TaskRes


@dataclass
class Fwd:
"""."""

task_ins: TaskIns
state: WorkloadState


@dataclass
class Bwd:
"""."""

task_res: TaskRes
state: WorkloadState


FlowerCallable = Callable[[Fwd], Bwd]
from flwr.client.typing import Bwd, ClientFn, Fwd


class Flower:
Expand Down
22 changes: 22 additions & 0 deletions src/py/flwr/client/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,30 @@
# ==============================================================================
"""Custom types for Flower clients."""

from dataclasses import dataclass
from typing import Callable

from flwr.client.workload_state import WorkloadState
from flwr.proto.task_pb2 import TaskIns, TaskRes

from .client import Client as Client


@dataclass
class Fwd:
"""."""

task_ins: TaskIns
state: WorkloadState


@dataclass
class Bwd:
"""."""

task_res: TaskRes
state: WorkloadState


FlowerCallable = Callable[[Fwd], Bwd]
ClientFn = Callable[[str], Client]
4 changes: 2 additions & 2 deletions src/py/flwr/flower/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"""Flower callable package."""


from flwr.client.flower import Bwd as Bwd
from flwr.client.flower import Flower as Flower
from flwr.client.flower import Fwd as Fwd
from flwr.client.typing import Bwd as Bwd
from flwr.client.typing import Fwd as Fwd

__all__ = [
"Flower",
Expand Down

0 comments on commit f8857c9

Please sign in to comment.