opentf-toolkit-nightly 0.56.0.dev1005__py3-none-any.whl → 0.56.0.dev1007__py3-none-any.whl

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.
@@ -387,26 +387,14 @@ def evaluate_status_function(name: str, contexts) -> bool:
387
387
  """Evaluate job status function.
388
388
 
389
389
  Annotates the contexts[SPECIAL_FUNCTIONS] entry with a `__called__`
390
- sub-entry if appropriate, so that caller can detect status function
391
- usage.
390
+ sub-entry, so that caller can detect status function usage.
392
391
  """
393
- if name not in ('always', 'success', 'failure', 'cancelled'):
392
+ funcs = contexts.get(SPECIAL_FUNCTIONS, {})
393
+ if name not in funcs:
394
394
  raise ValueError(f'Unknown function {name}()')
395
395
  # a status function has been used
396
- if SPECIAL_FUNCTIONS in contexts:
397
- contexts[SPECIAL_FUNCTIONS]['__called__'] = True
398
- if name == 'always':
399
- return True
400
- if external_functions := contexts.get(SPECIAL_FUNCTIONS):
401
- if name in external_functions:
402
- return external_functions[name]
403
- raise ValueError(f'Unknown function {name}()')
404
- if name == 'success':
405
- return contexts['job']['status'] == 'success'
406
- if name == 'failure':
407
- return contexts['job']['status'] == 'failure'
408
- if name == 'cancelled':
409
- return contexts['job']['status'] == 'cancelled'
396
+ funcs['__called__'] = True
397
+ return funcs[name]
410
398
 
411
399
 
412
400
  def _evaluate_identifier(
@@ -648,11 +636,18 @@ def evaluate_bool(expr: str, contexts, special_functions=None) -> bool:
648
636
 
649
637
  `expr` may be surrounded by `${{` and `}}`.
650
638
 
639
+ `special_functions`, if provided, is a dictionary of function names
640
+ to bools.
641
+
651
642
  # Required parameters
652
643
 
653
644
  - expr: a string
654
645
  - contexts: a dictionary
655
646
 
647
+ # Optional parameters
648
+
649
+ - special_functions: a dictionary or None (None by default)
650
+
656
651
  # Returned value
657
652
 
658
653
  A boolean.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opentf-toolkit-nightly
3
- Version: 0.56.0.dev1005
3
+ Version: 0.56.0.dev1007
4
4
  Summary: OpenTestFactory Orchestrator Toolkit
5
5
  Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
6
6
  Author: Martin Lafaix
@@ -2,7 +2,7 @@ opentf/commons/__init__.py,sha256=KRY8ShQw_0ZZ0oEOiKi4-xnWofE_QsFjEe1T8wUxJ-w,21
2
2
  opentf/commons/auth.py,sha256=bM2Z3kxm2Wku1lKXaRAIg37LHvXWAXIZIqjplDfN2P8,15899
3
3
  opentf/commons/config.py,sha256=GmvInVnUsXIwlNfgTQeQ_pPs97GeGTGn2S2QZEFwss8,7828
4
4
  opentf/commons/datasources.py,sha256=4ye-TMtaE88O8GVcWx-FtKXOC8aIZLteR6wfIr7Do8U,25232
5
- opentf/commons/expressions.py,sha256=973wiKlM0jcKf4nQpVRtZ7F0-ORHQn1TY_4rVGtNZXc,20007
5
+ opentf/commons/expressions.py,sha256=jM_YKXVOFhvOE2aE2IuacuvxhIsOYTFs2oQkpcbWR6g,19645
6
6
  opentf/commons/pubsub.py,sha256=7khxAHVZiwJRcwIBJ6MPR-f3xY9144-2eNLROwq5F-4,5894
7
7
  opentf/commons/schemas.py,sha256=YSCvlmqc7satt-OqIoYXnmhOyo9h8wIpNyKaBAY4u9c,4039
8
8
  opentf/commons/selectors.py,sha256=DEpLgRAr5HXSpSYI4liXP2hLUTvOSexFa9Vfa1xIQTk,7134
@@ -49,8 +49,8 @@ opentf/scripts/startup.py,sha256=Da2zo93pBWbdRmj-wgekgLcF94rpNc3ZkbvR8R0w8XY,212
49
49
  opentf/toolkit/__init__.py,sha256=icNo_jz2IfhwddunQpfq6F-0xeKS70S-0Or5zJliEZs,21692
50
50
  opentf/toolkit/channels.py,sha256=6xcVKHUK2FdyVKIQmPQbakngfVuQDzCcD_lInOdKpro,17171
51
51
  opentf/toolkit/core.py,sha256=MvvWUrS4dvo3Qrd_Yl9uND3CllL0qtMi-y1S-Na1uQs,9621
52
- opentf_toolkit_nightly-0.56.0.dev1005.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
53
- opentf_toolkit_nightly-0.56.0.dev1005.dist-info/METADATA,sha256=Q_gf0f6Sl_vQPx2ykXg2s1zGIuLueSg3PfcApGwlh_0,1946
54
- opentf_toolkit_nightly-0.56.0.dev1005.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
55
- opentf_toolkit_nightly-0.56.0.dev1005.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
56
- opentf_toolkit_nightly-0.56.0.dev1005.dist-info/RECORD,,
52
+ opentf_toolkit_nightly-0.56.0.dev1007.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
53
+ opentf_toolkit_nightly-0.56.0.dev1007.dist-info/METADATA,sha256=pLFIB6HPFkbNt6Vt10A2E5yzYss5Wl0TPva-l83VBcg,1946
54
+ opentf_toolkit_nightly-0.56.0.dev1007.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
55
+ opentf_toolkit_nightly-0.56.0.dev1007.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
56
+ opentf_toolkit_nightly-0.56.0.dev1007.dist-info/RECORD,,