opentf-toolkit-nightly 0.62.0.dev1330__py3-none-any.whl → 0.62.0.dev1333__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.
@@ -830,14 +830,17 @@ def validate_inputs(
830
830
  declaration: Dict[str, Dict[str, Any]],
831
831
  inputs: Dict[str, Any],
832
832
  additional_inputs: bool = False,
833
+ normalize: bool = True,
833
834
  ) -> None:
834
835
  """Validate inputs.
835
836
 
836
837
  Default values are filled in `inputs` as appropriate.
837
838
 
838
- Input names are normalized to use hyphens instead of underscores.
839
+ Input names are normalized to use hyphens instead of underscores
840
+ by default (declaration is expected to be normalized).
839
841
 
840
- Non-normalized inputs are removed from the dictionary.
842
+ If `normalize` is set, non-normalized inputs are removed from the
843
+ dictionary.
841
844
 
842
845
  Choices values are validated. Types are not checked.
843
846
 
@@ -849,16 +852,14 @@ def validate_inputs(
849
852
  # Optional parameters
850
853
 
851
854
  - additional_inputs: a boolean (False by default)
855
+ - normalize: a boolean (True by default)
852
856
 
853
857
  # Raised exceptions
854
858
 
855
859
  A _ValueError_ exception is raised if inputs do not match
856
860
  declaration.
857
861
  """
858
- for key in declaration:
859
- if key.startswith('{'): # Skip template entries
860
- break
861
- else:
862
+ if normalize and not any(key.startswith('{') for key in declaration):
862
863
  _normalize_inputs(inputs)
863
864
 
864
865
  for key, definition in declaration.items():
@@ -868,6 +869,7 @@ def validate_inputs(
868
869
  if definition.get('required', False):
869
870
  raise ValueError(f'Mandatory input "{key}" not provided.')
870
871
  _set_default(inputs, key, definition)
872
+ continue
871
873
  if definition.get('type') == 'choice':
872
874
  if (val := inputs.get(key)) not in definition['options']:
873
875
  allowed = '", "'.join(sorted(definition['options']))
@@ -878,9 +880,9 @@ def validate_inputs(
878
880
  if additional_inputs:
879
881
  return
880
882
 
881
- for key in inputs:
882
- if key not in declaration and key.replace('_', '-') not in declaration:
883
- allowed = '", "'.join(sorted(declaration))
884
- raise ValueError(
885
- f'Unexpected input "{key}" found. Allowed inputs: "{allowed}".'
886
- )
883
+ if unexpected := set(inputs) - set(declaration):
884
+ allowed = '", "'.join(sorted(declaration))
885
+ unexpected = '", "'.join(sorted(unexpected))
886
+ raise ValueError(
887
+ f'Unexpected inputs "{unexpected}" found. Allowed inputs: "{allowed}".'
888
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opentf-toolkit-nightly
3
- Version: 0.62.0.dev1330
3
+ Version: 0.62.0.dev1333
4
4
  Summary: OpenTestFactory Orchestrator Toolkit
5
5
  Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
6
6
  Author: Martin Lafaix
@@ -1,4 +1,4 @@
1
- opentf/commons/__init__.py,sha256=zyXR1ivlO_PZipQzRA2156qPMA0z7SpeFOOalQ7EG0Y,27075
1
+ opentf/commons/__init__.py,sha256=sa_sDz-XnbmJTqe9E_o6orixV9RoMLm-bqm-A3BRvvc,27210
2
2
  opentf/commons/auth.py,sha256=gXRp_0Tf3bfd65F4QiQmh6C6vR9y3ugag_0DSvozJFk,15898
3
3
  opentf/commons/config.py,sha256=RVSSdQhMle4oCo_z_AR2EQ4U6sUjSxw-qVBtjKuJVfo,10219
4
4
  opentf/commons/exceptions.py,sha256=7dhUXO8iyAbqVwlUKxZhgRzGqVcb7LkG39hFlm-VxIA,2407
@@ -59,8 +59,8 @@ opentf/scripts/startup.py,sha256=AcVXU2auPvqMb_6OpGzkVqrpgYV6vz7x_Rnv8YbAEkk,231
59
59
  opentf/toolkit/__init__.py,sha256=7MGAfKb5V9ckzWE8ozfj0PcC7g0a-0VfdyrClkWTk38,22319
60
60
  opentf/toolkit/channels.py,sha256=6qKSsAgq_oJpuDRiKqVUz-EAjdfikcCG3SFAGmKZdhQ,25551
61
61
  opentf/toolkit/core.py,sha256=fqnGgaYnuVcd4fyeNIwpc0QtyUo7jsKeVgdkBfY3iqo,9443
62
- opentf_toolkit_nightly-0.62.0.dev1330.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
- opentf_toolkit_nightly-0.62.0.dev1330.dist-info/METADATA,sha256=IN0fv6k0RErVnPzp5ZrrjdNSvDoyP2vKQIODmDm_dVc,2214
64
- opentf_toolkit_nightly-0.62.0.dev1330.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
65
- opentf_toolkit_nightly-0.62.0.dev1330.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
66
- opentf_toolkit_nightly-0.62.0.dev1330.dist-info/RECORD,,
62
+ opentf_toolkit_nightly-0.62.0.dev1333.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
63
+ opentf_toolkit_nightly-0.62.0.dev1333.dist-info/METADATA,sha256=Fw7qG9XcomeHvCOAz_zt_HxYs3nfs1ObRWYkYLV3ntA,2214
64
+ opentf_toolkit_nightly-0.62.0.dev1333.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
65
+ opentf_toolkit_nightly-0.62.0.dev1333.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
66
+ opentf_toolkit_nightly-0.62.0.dev1333.dist-info/RECORD,,