omnata-plugin-runtime 0.5.7a135__tar.gz → 0.5.7a136__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.5.7a135
3
+ Version: 0.5.7a136
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "omnata-plugin-runtime"
3
- version = "0.5.7-a135"
3
+ version = "0.5.7-a136"
4
4
  description = "Classes and common runtime components for building and running Omnata Plugins"
5
5
  authors = ["James Weakley <james.weakley@omnata.com>"]
6
6
  readme = "README.md"
@@ -2254,7 +2254,8 @@ def consumer_udtf(
2254
2254
  original_process = getattr(cls, 'process')
2255
2255
  sig = signature(original_process)
2256
2256
  params = sig.parameters
2257
-
2257
+ if len(params) < 2:
2258
+ raise ValueError("The function must have the self parameter, plus at least the mandatory 'connection_parameters' parameter.")
2258
2259
  # Ensure the first argument is mandatory and positional
2259
2260
  if list(params.keys())[0] != 'self':
2260
2261
  raise ValueError("The first argument should be 'self' for class methods.")
@@ -2262,8 +2263,8 @@ def consumer_udtf(
2262
2263
  if list(params.keys())[1] != 'connection_parameters':
2263
2264
  raise ValueError("The second argument should be 'connection_parameters'.")
2264
2265
 
2265
- if params[list(params.keys())[1]].annotation != Dict:
2266
- raise ValueError("The second argument must be a dict.")
2266
+ if params[list(params.keys())[1]].annotation != ConnectionConfigurationParameters:
2267
+ raise ValueError("The second argument must be a ConnectionConfigurationParameters.")
2267
2268
 
2268
2269
  @wraps(original_process)
2269
2270
  def wrapped_process(self, connection_parameters, *args, **kwargs):
@@ -2321,12 +2322,13 @@ def consumer_udf(
2321
2322
  def decorator(func):
2322
2323
  sig = signature(func)
2323
2324
  params = sig.parameters
2324
-
2325
+ if len(params) == 0:
2326
+ raise ValueError("The function must have at least one parameter.")
2325
2327
  # Ensure the first argument is mandatory and positional
2326
2328
  if list(params.keys())[0] != 'connection_parameters':
2327
2329
  raise ValueError("The first argument should be 'connection_parameters'.")
2328
- if params[list(params.keys())[0]].annotation != Dict:
2329
- raise ValueError("The first argument must be a dict.")
2330
+ if params[list(params.keys())[0]].annotation != ConnectionConfigurationParameters:
2331
+ raise ValueError("The first argument must be a ConnectionConfigurationParameters.")
2330
2332
 
2331
2333
  @wraps(func)
2332
2334
  def wrapper(self, connection_parameters, *args, **kwargs):