freeplay 0.3.0a1__tar.gz → 0.3.0a2__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: freeplay
3
- Version: 0.3.0a1
3
+ Version: 0.3.0a2
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: FreePlay Engineering
@@ -15,7 +15,6 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: click (==8.1.7)
17
17
  Requires-Dist: dacite (>=1.8.0,<2.0.0)
18
- Requires-Dist: pydantic (>=2.6.3,<3.0.0)
19
18
  Requires-Dist: pystache (>=0.6.5,<0.7.0)
20
19
  Requires-Dist: requests (>=2.20.0,<3.0.0dev)
21
20
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "freeplay"
3
- version = "0.3.0-alpha.1"
3
+ version = "0.3.0-alpha.2"
4
4
  description = ""
5
5
  authors = ["FreePlay Engineering <engineering@freeplay.ai>"]
6
6
  license = "MIT"
@@ -12,7 +12,6 @@ requests = ">=2.20.0,<3.0.0dev"
12
12
  dacite = "^1.8.0"
13
13
  click = "8.1.7"
14
14
  pystache = "^0.6.5"
15
- pydantic = "^2.6.3"
16
15
 
17
16
  [tool.poetry.group.dev.dependencies]
18
17
  mypy = "^1"
@@ -1,16 +1,8 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import List, Union, Any, Dict, Mapping, TypedDict
3
3
 
4
- from pydantic import RootModel
5
-
6
4
  InputValue = Union[str, int, bool, Dict[str, Any], List[Any]]
7
- InputVariable = RootModel[Union[Dict[str, "InputVariable"], List["InputVariable"], str, int, bool, float]]
8
- InputVariable.model_rebuild()
9
-
10
5
  InputVariables = Mapping[str, InputValue]
11
-
12
- PydanticInputVariables = RootModel[Dict[str, InputVariable]]
13
-
14
6
  TestRunInput = Mapping[str, InputValue]
15
7
 
16
8
 
@@ -1,19 +1,27 @@
1
- from typing import Dict, Union, Optional
1
+ from typing import Dict, Union, Optional, Any
2
2
  import importlib.metadata
3
3
  import platform
4
4
 
5
5
  import pystache # type: ignore
6
- from pydantic import ValidationError
7
6
 
8
7
  from .errors import FreeplayError, FreeplayConfigurationError
9
- from .model import PydanticInputVariables, InputVariables
8
+ from .model import InputVariables
9
+
10
+
11
+ # Validate that the variables are of the correct type, and do not include functions, dates, classes or None values.
12
+ def all_valid(obj: Any) -> bool:
13
+ if isinstance(obj, (int, str, bool)):
14
+ return True
15
+ elif isinstance(obj, list):
16
+ return all(all_valid(item) for item in obj)
17
+ elif isinstance(obj, dict):
18
+ return all(isinstance(key, str) and all_valid(value) for key, value in obj.items())
19
+ else:
20
+ return False
10
21
 
11
22
 
12
23
  def bind_template_variables(template: str, variables: InputVariables) -> str:
13
- # Validate that the variables are of the correct type, and do not include functions or None values.
14
- try:
15
- PydanticInputVariables.model_validate(variables)
16
- except ValidationError as err:
24
+ if not all_valid(variables):
17
25
  raise FreeplayError(
18
26
  'Variables must be a string, number, bool, or a possibly nested'
19
27
  ' list or dict of strings, numbers and booleans.'
File without changes
File without changes