Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update type annotations for BuildingBlocks. #4070

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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