mirror of
https://github.com/google/earthengine-api.git
synced 2026-02-01 16:00:51 +00:00
encodable.py: Add type annotations.
PiperOrigin-RevId: 772024516
This commit is contained in:
parent
694999d1b9
commit
66a76f80da
@ -1,10 +1,12 @@
|
||||
"""Interfaces implemented by serializable objects."""
|
||||
|
||||
from typing import Any, Callable
|
||||
|
||||
|
||||
class Encodable:
|
||||
"""An interface implemented by objects that can serialize themselves."""
|
||||
|
||||
def encode(self, encoder):
|
||||
def encode(self, encoder: Callable[[Any], Any]) -> Any:
|
||||
"""Encodes the object in a format compatible with Serializer.
|
||||
|
||||
Args:
|
||||
@ -16,7 +18,7 @@ class Encodable:
|
||||
"""
|
||||
raise NotImplementedError('Encodable classes must implement encode().')
|
||||
|
||||
def encode_cloud_value(self, encoder):
|
||||
def encode_cloud_value(self, encoder: Callable[[Any], Any]) -> Any:
|
||||
"""Encodes the object as a ValueNode.
|
||||
|
||||
Args:
|
||||
@ -33,7 +35,7 @@ class Encodable:
|
||||
class EncodableFunction:
|
||||
"""An interface implemented by functions that can serialize themselves."""
|
||||
|
||||
def encode_invocation(self, encoder):
|
||||
def encode_invocation(self, encoder: Callable[[Any], Any]) -> Any:
|
||||
"""Encodes the function in a format compatible with Serializer.
|
||||
|
||||
Args:
|
||||
@ -46,7 +48,7 @@ class EncodableFunction:
|
||||
raise NotImplementedError(
|
||||
'EncodableFunction classes must implement encode_invocation().')
|
||||
|
||||
def encode_cloud_invocation(self, encoder):
|
||||
def encode_cloud_invocation(self, encoder: Callable[[Any], Any]) -> Any:
|
||||
"""Encodes the function as a FunctionInvocation.
|
||||
|
||||
Args:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user