MCPcopy Index your code
hub / github.com/google/earthengine-api / create

Method create

python/ee/customfunction.py:99–127  ·  view source on GitHub ↗

Creates a CustomFunction. The result calls a given native function with the specified return type and argument types and auto-generated argument names. Args: func: The native function to wrap. return_type: The type of the return value, either as a string or a clas

(
      func: Callable[[Any], Any], return_type: Any, arg_types: Any
  )

Source from the content-addressed store, hash-verified

97
98 @staticmethod
99 def create(
100 func: Callable[[Any], Any], return_type: Any, arg_types: Any
101 ) -> CustomFunction:
102 """Creates a CustomFunction.
103
104 The result calls a given native function with the specified return type and
105 argument types and auto-generated argument names.
106
107 Args:
108 func: The native function to wrap.
109 return_type: The type of the return value, either as a string or a
110 class reference.
111 arg_types: The types of the arguments, either as strings or class
112 references.
113
114 Returns:
115 The constructed CustomFunction.
116 """
117
118 def StringifyType(t: Any) -> str:
119 return t if isinstance(t, str) else ee_types.classToName(t)
120
121 args = [{'name': None, 'type': StringifyType(i)} for i in arg_types]
122 signature = {
123 'name': '',
124 'returns': StringifyType(return_type),
125 'args': args
126 }
127 return CustomFunction(signature, func)
128
129 @staticmethod
130 def _resolveNamelessArgs(signature: Any, variables: Any, body: Any) -> Any:

Callers 15

_PromoteFunction · 0.45
getMapIdFunction · 0.45
getFeatureViewTilesKeyFunction · 0.45
getThumbIdFunction · 0.45
getDownloadIdFunction · 0.45
getTableDownloadIdFunction · 0.45
createAssetFunction · 0.45
test_get_map_idMethod · 0.45

Calls 1

CustomFunctionClass · 0.85