Skip to content

Commit

Permalink
Update type annotations for BuildingBlocks.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 557272126
  • Loading branch information
michaelreneer authored and tensorflow-copybara committed Aug 15, 2023
1 parent 82ed3e4 commit 495567a
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions tensorflow_federated/python/core/impl/compiler/building_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ class ComputationBuildingBlock(typed_object.TypedObject, metaclass=abc.ABCMeta):

@classmethod
def from_proto(
cls: type['ComputationBuildingBlock'],
computation_proto: pb.Computation,
cls, computation_proto: pb.Computation
) -> 'ComputationBuildingBlock':
"""Returns an instance of a derived class based on 'computation_proto'.
Expand Down Expand Up @@ -307,10 +306,7 @@ class Selection(ComputationBuildingBlock):
"""

@classmethod
def from_proto(
cls: type['Selection'],
computation_proto: pb.Computation,
) -> 'Selection':
def from_proto(cls, computation_proto: pb.Computation) -> 'Selection':
_check_computation_oneof(computation_proto, 'selection')
selection = ComputationBuildingBlock.from_proto(
computation_proto.selection.source
Expand Down Expand Up @@ -435,10 +431,7 @@ class Struct(ComputationBuildingBlock, structure.Struct):
"""

@classmethod
def from_proto(
cls: type['Struct'],
computation_proto: pb.Computation,
) -> 'Struct':
def from_proto(cls, computation_proto: pb.Computation) -> 'Struct':
_check_computation_oneof(computation_proto, 'struct')

def _element(
Expand Down Expand Up @@ -548,10 +541,7 @@ class Call(ComputationBuildingBlock):
"""

@classmethod
def from_proto(
cls: type['Call'],
computation_proto: pb.Computation,
) -> 'Call':
def from_proto(cls, computation_proto: pb.Computation) -> 'Call':
_check_computation_oneof(computation_proto, 'call')
fn = ComputationBuildingBlock.from_proto(computation_proto.call.function)
arg_proto = computation_proto.call.argument
Expand Down

0 comments on commit 495567a

Please sign in to comment.