oocana-python-executor 0.16.14__tar.gz → 0.16.15__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.
Files changed (20) hide show
  1. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/PKG-INFO +1 -1
  2. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/pyproject.toml +1 -1
  3. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/credential.py +9 -4
  4. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/tests/test_credential.py +10 -6
  5. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/__init__.py +0 -0
  6. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/block.py +0 -0
  7. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/context.py +0 -0
  8. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/data.py +0 -0
  9. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/executor.py +0 -0
  10. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/hook.py +0 -0
  11. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/logger.py +0 -0
  12. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/matplot/matplotlib_oomol/__init__.py +0 -0
  13. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/matplot/matplotlib_oomol/oomol.py +0 -0
  14. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/matplot/oomol_matplot_helper.py +0 -0
  15. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/secret.py +0 -0
  16. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/service.py +0 -0
  17. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/topic.py +0 -0
  18. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/python_executor/utils.py +0 -0
  19. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/tests/test_cli.py +0 -0
  20. {oocana_python_executor-0.16.14 → oocana_python_executor-0.16.15}/tests/test_secret.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oocana-python-executor
3
- Version: 0.16.14
3
+ Version: 0.16.15
4
4
  Summary: a client subscribe mqtt topic to execute oocana's block
5
5
  Author-Email: l1shen <lishen1635@gmail.com>, yleaf <11785335+leavesster@users.noreply.github.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "oocana-python-executor"
3
- version = "0.16.14"
3
+ version = "0.16.15"
4
4
  authors = [
5
5
  { name = "l1shen", email = "lishen1635@gmail.com" },
6
6
  { name = "yleaf", email = "11785335+leavesster@users.noreply.github.com" },
@@ -1,24 +1,29 @@
1
1
  from typing import Any, Dict
2
2
  from oocana import InputHandleDef
3
3
  class CredentialInput:
4
- def __init__(self, type: str, value: str):
4
+ def __init__(self, type: str, id: str):
5
5
  self.type = type
6
- self.value = value
6
+ self.id = id
7
7
 
8
8
  def generate_credential_input(credential_path: str) -> CredentialInput | None:
9
9
  """Generate a CredentialInput from a credential path string.
10
10
 
11
- The credential path should be in the format `${{OO_CREDENTIAL:type,id}}`. If the format is incorrect,
11
+ The credential path should be in the format `${{OO_CREDENTIAL:type,name,id}}`. If the format is incorrect,
12
12
  the function returns None.
13
13
  """
14
14
 
15
15
  if not (credential_path.startswith("${{OO_CREDENTIAL:") and credential_path.endswith("}}")):
16
+ # logger warning("Credential path format is incorrect. Expected to start with '${{OO_CREDENTIAL:' and end with '}}'.")
17
+ return None
18
+
19
+ if credential_path.count(",") != 2:
20
+ # logger warning("Credential path format is incorrect. Expected exactly two commas.")
16
21
  return None
17
22
 
18
23
  credential_path = credential_path.removeprefix("${{OO_CREDENTIAL:").removesuffix("}}")
19
24
  if credential_path:
20
25
  try:
21
- type, id = credential_path.split(",", maxsplit=1)
26
+ type, _name, id = credential_path.split(",", maxsplit=2)
22
27
  return CredentialInput(type, id)
23
28
  except ValueError:
24
29
  return None
@@ -3,7 +3,7 @@ from python_executor.credential import replace_credential, CredentialInput, gene
3
3
  from oocana import InputHandleDef
4
4
  from typing import cast
5
5
 
6
- ORIGIN_VALUE = "Custom,credential_id"
6
+ ORIGIN_VALUE = "Custom,credential_name,credential_id"
7
7
 
8
8
  class TestCredential(unittest.TestCase):
9
9
 
@@ -33,7 +33,7 @@ class TestCredential(unittest.TestCase):
33
33
  cred_input = v.get("c")
34
34
  self.assertIsInstance(cred_input, CredentialInput)
35
35
  self.assertEqual(cred_input.type, "Custom")
36
- self.assertEqual(cred_input.value, "credential_id")
36
+ self.assertEqual(cred_input.id, "credential_id")
37
37
 
38
38
 
39
39
  def test_credential_without_content_media(self):
@@ -70,20 +70,20 @@ class TestCredential(unittest.TestCase):
70
70
 
71
71
  def test_generate_credential_input_valid(self):
72
72
  """Test valid credential input generation"""
73
- result = generate_credential_input("${{OO_CREDENTIAL:AWS,my_credential_id}}")
73
+ result = generate_credential_input("${{OO_CREDENTIAL:AWS,my_credential_name,my_credential_id}}")
74
74
  self.assertIsInstance(result, CredentialInput)
75
75
  result = cast(CredentialInput, result)
76
76
  self.assertEqual(result.type, "AWS")
77
- self.assertEqual(result.value, "my_credential_id")
77
+ self.assertEqual(result.id, "my_credential_id")
78
78
 
79
79
  def test_generate_credential_input_invalid_format(self):
80
80
  """Test invalid credential input format"""
81
81
  # Missing prefix
82
- result = generate_credential_input("AWS,my_credential_id")
82
+ result = generate_credential_input("AWS,my_credential_name,my_credential_id")
83
83
  self.assertIsNone(result)
84
84
 
85
85
  # Missing suffix
86
- result = generate_credential_input("${{OO_CREDENTIAL:AWS,my_credential_id")
86
+ result = generate_credential_input("${{OO_CREDENTIAL:AWS,my_credential_name,my_credential_id")
87
87
  self.assertIsNone(result)
88
88
 
89
89
  # Wrong prefix
@@ -98,5 +98,9 @@ class TestCredential(unittest.TestCase):
98
98
  result = generate_credential_input("${{OO_CREDENTIAL:AWS}}")
99
99
  self.assertIsNone(result)
100
100
 
101
+ # Only two parameters (missing third)
102
+ result = generate_credential_input("${{OO_CREDENTIAL:AWS,my_credential}}")
103
+ self.assertIsNone(result)
104
+
101
105
  if __name__ == '__main__':
102
106
  unittest.main()