omnata-plugin-runtime 0.5.7a138__py3-none-any.whl → 0.5.7a140__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -2232,22 +2232,36 @@ def get_nested_value(nested_dict:Dict, keys:List[str]):
2232
2232
 
2233
2233
  @dataclass
2234
2234
  class SnowflakeFunctionParameter:
2235
+ """
2236
+ Represents a parameter for a Snowflake UDF or UDTF
2237
+ """
2235
2238
  name: str
2236
2239
  description: str
2237
2240
  data_type: str
2238
- has_default_value: bool = False
2239
2241
  default_value_clause: Optional[str] = None
2240
2242
 
2243
+ def __str__(self):
2244
+ if self.default_value_clause:
2245
+ return f"{self.name} {self.data_type} default {self.default_value_clause}"
2246
+ return f"{self.name} {self.data_type}"
2247
+
2241
2248
  @dataclass
2242
2249
  class SnowflakeUDTFResultColumn:
2250
+ """
2251
+ Represents a result column for a Snowflake UDTF
2252
+ """
2243
2253
  name: str
2244
2254
  data_type: str
2245
2255
  description: str
2246
2256
 
2247
2257
  def consumer_udtf(
2258
+ name:str,
2248
2259
  description: str,
2249
2260
  params: List[SnowflakeFunctionParameter],
2250
2261
  result_columns: List[SnowflakeUDTFResultColumn]):
2262
+ """
2263
+ A decorator for a class which should be automatically exposed to the consumer as a UDTF
2264
+ """
2251
2265
  def class_decorator(cls):
2252
2266
  # Get the original 'process' method from the class
2253
2267
  original_process = getattr(cls, 'process')
@@ -2295,6 +2309,7 @@ def consumer_udtf(
2295
2309
  # Replace the original 'process' method with the wrapped version
2296
2310
  setattr(cls, 'process', wrapped_process)
2297
2311
  cls._is_omnata_consumer_udtf = True
2312
+ cls._omnata_consumer_udtf_name = name
2298
2313
  cls._omnata_consumer_udtf_description = description
2299
2314
  cls._omnata_consumer_udtf_params = params
2300
2315
  cls._omnata_consumer_udtf_result_columns = result_columns
@@ -2303,6 +2318,9 @@ def consumer_udtf(
2303
2318
  return class_decorator
2304
2319
 
2305
2320
  def find_consumer_udtf_classes(path:str = '.'):
2321
+ """
2322
+ Finds all classes in the specified directory which have the 'consumer_udtf' decorator applied
2323
+ """
2306
2324
  # Get the directory's absolute path
2307
2325
  current_dir = os.path.abspath(path)
2308
2326
 
@@ -2323,9 +2341,13 @@ def find_consumer_udtf_classes(path:str = '.'):
2323
2341
 
2324
2342
 
2325
2343
  def consumer_udf(
2344
+ name: str,
2326
2345
  description: str,
2327
2346
  params: List[SnowflakeFunctionParameter],
2328
2347
  result_data_type: str):
2348
+ """
2349
+ A decorator for a function which should be automatically exposed to the consumer as a UDF
2350
+ """
2329
2351
  def decorator(func):
2330
2352
  sig = signature(func)
2331
2353
  function_params = sig.parameters
@@ -2363,6 +2385,7 @@ def consumer_udf(
2363
2385
  return func(parameters, *args, **kwargs)
2364
2386
 
2365
2387
  wrapper._is_omnata_consumer_udf = True
2388
+ wrapper._omnata_consumer_udf_name = name
2366
2389
  wrapper._omnata_consumer_udf_description = description
2367
2390
  wrapper._omnata_consumer_udf_params = params
2368
2391
  wrapper._omnata_consumer_udf_result_data_type = result_data_type
@@ -2371,6 +2394,9 @@ def consumer_udf(
2371
2394
  return decorator
2372
2395
 
2373
2396
  def find_consumer_udf_functions(path:str = '.'):
2397
+ """
2398
+ Finds all functions in the specified directory which have the 'consumer_udf' decorator applied
2399
+ """
2374
2400
  # Get the current directory's absolute path
2375
2401
  current_dir = os.path.abspath(path)
2376
2402
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.5.7a138
3
+ Version: 0.5.7a140
4
4
  Summary: Classes and common runtime components for building and running Omnata Plugins
5
5
  Author: James Weakley
6
6
  Author-email: james.weakley@omnata.com
@@ -3,10 +3,10 @@ omnata_plugin_runtime/api.py,sha256=FxzTqri4no8ClkOm7vZADG8aD47jcGBCTTQDEORmOJM,
3
3
  omnata_plugin_runtime/configuration.py,sha256=TI6GaVFhewVawBCaYN34GujY57qEP6q2nik4YpSEk5s,38100
4
4
  omnata_plugin_runtime/forms.py,sha256=GzSPEwcijsoPCXEO1mHiE8ylvX_KSE5TkhwqkymA2Ss,19755
5
5
  omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
6
- omnata_plugin_runtime/omnata_plugin.py,sha256=oMQDljO8zgE8k5HlSCZ4hGFRYcuE8QWjYyKttCsZNVs,119224
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=nPCJ6b2cYFS-Gh_UmLUaJvfjgI8v1-DVZWFYWSuj2j8,120102
7
7
  omnata_plugin_runtime/plugin_entrypoints.py,sha256=PFSLsYEVnWHVvSoOYTtTK2JY6pp6_8_eYP53WqLRiPE,27975
8
8
  omnata_plugin_runtime/rate_limiting.py,sha256=DVQ_bc-mVLBkrU1PTns1MWXhHiLpSB5HkWCcdePtJ2A,25611
9
- omnata_plugin_runtime-0.5.7a138.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.5.7a138.dist-info/METADATA,sha256=CMc5dTHMT90TAlp6ZE6bRibqDN6hRwaxjClZFlYzBDs,1985
11
- omnata_plugin_runtime-0.5.7a138.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- omnata_plugin_runtime-0.5.7a138.dist-info/RECORD,,
9
+ omnata_plugin_runtime-0.5.7a140.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
+ omnata_plugin_runtime-0.5.7a140.dist-info/METADATA,sha256=-ohRghA5Z5Z1hblZCVo0qLLniQhM9DmC0N-NJWlwsXM,1985
11
+ omnata_plugin_runtime-0.5.7a140.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ omnata_plugin_runtime-0.5.7a140.dist-info/RECORD,,