unstructured-platform-plugins 0.0.0__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.
Files changed (34) hide show
  1. test/__init__.py +0 -0
  2. test/assets/__init__.py +0 -0
  3. test/assets/async_typed_dict_response.py +10 -0
  4. test/assets/dataclass_response.py +37 -0
  5. test/assets/empty_input_and_response.py +8 -0
  6. test/assets/hash_function.py +2 -0
  7. test/assets/improper_function.py +2 -0
  8. test/assets/pydantic_response_class_method.py +21 -0
  9. test/assets/simple_hash_class.py +6 -0
  10. test/assets/simple_hash_lambda.py +1 -0
  11. test/assets/simple_hash_value.py +1 -0
  12. test/assets/typed_dict_response.py +17 -0
  13. test/test_schema.py +660 -0
  14. test/test_utils.py +140 -0
  15. unstructured_platform_plugins/__init__.py +0 -0
  16. unstructured_platform_plugins/__version__.py +1 -0
  17. unstructured_platform_plugins/etl_uvicorn/__init__.py +0 -0
  18. unstructured_platform_plugins/etl_uvicorn/api_generator.py +173 -0
  19. unstructured_platform_plugins/etl_uvicorn/main.py +121 -0
  20. unstructured_platform_plugins/etl_uvicorn/utils.py +115 -0
  21. unstructured_platform_plugins/schema/__init__.py +0 -0
  22. unstructured_platform_plugins/schema/json_schema.py +344 -0
  23. unstructured_platform_plugins/schema/model.py +101 -0
  24. unstructured_platform_plugins/schema/usage.py +7 -0
  25. unstructured_platform_plugins/schema/utils.py +31 -0
  26. unstructured_platform_plugins/type_hints.py +106 -0
  27. unstructured_platform_plugins/validate_api.py +110 -0
  28. unstructured_platform_plugins-0.0.0.dist-info/LICENSE +201 -0
  29. unstructured_platform_plugins-0.0.0.dist-info/LICENSE.md +201 -0
  30. unstructured_platform_plugins-0.0.0.dist-info/METADATA +106 -0
  31. unstructured_platform_plugins-0.0.0.dist-info/RECORD +34 -0
  32. unstructured_platform_plugins-0.0.0.dist-info/WHEEL +5 -0
  33. unstructured_platform_plugins-0.0.0.dist-info/entry_points.txt +3 -0
  34. unstructured_platform_plugins-0.0.0.dist-info/top_level.txt +2 -0
test/__init__.py ADDED
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ from typing import Any, TypedDict
2
+
3
+
4
+ class SampleFunctionResponse(TypedDict):
5
+ response: dict[str, Any]
6
+
7
+
8
+ async def async_sample_function(content: dict[str, Any]) -> SampleFunctionResponse:
9
+ resp = {f"{k}_out": v for k, v in content.items()}
10
+ return SampleFunctionResponse(response=resp)
@@ -0,0 +1,37 @@
1
+ from dataclasses import dataclass
2
+ from pathlib import Path
3
+ from typing import Any, Optional, TypedDict
4
+
5
+
6
+ class SampleFunctionResponse(TypedDict):
7
+ response: dict[str, Any]
8
+
9
+
10
+ @dataclass
11
+ class SampleFunctionInput:
12
+ name: str
13
+ value: float
14
+
15
+
16
+ @dataclass
17
+ class SampleFunctionWithPathResponse:
18
+ t: str
19
+ exists: bool
20
+ resolved: str
21
+ b: str
22
+ c: int
23
+
24
+
25
+ def sample_function_with_path(
26
+ b: str, c: int, a: Optional[Path] = None
27
+ ) -> SampleFunctionWithPathResponse:
28
+ s: list[Any] = [type(a).__name__, f"[exists: {a.exists()}]", a.resolve()] if a else []
29
+ s.extend([b, c])
30
+ resp = {
31
+ "t": type(a).__name__,
32
+ "exists": a.exists(),
33
+ "resolved": a.resolve(),
34
+ "b": b,
35
+ "c": c,
36
+ }
37
+ return SampleFunctionWithPathResponse(**resp)
@@ -0,0 +1,8 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass
5
+ class SampleClass:
6
+
7
+ def do_nothing(self) -> None:
8
+ pass
@@ -0,0 +1,2 @@
1
+ def get_hash() -> str:
2
+ return "plugin_id_fn_123"
@@ -0,0 +1,2 @@
1
+ def sample_improper_function(*args, **kwargs):
2
+ pass
@@ -0,0 +1,21 @@
1
+ from typing import Any, TypedDict
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class SampleFunctionResponse(TypedDict):
7
+ response: dict[str, Any]
8
+
9
+
10
+ class SampleClassMethodResponse(BaseModel):
11
+ response: dict[str, Any]
12
+
13
+
14
+ class SampleClass:
15
+
16
+ def sample_method(self, content: dict[str, Any]) -> SampleClassMethodResponse:
17
+ resp = {f"{k}_{self.__class__.__name__}": v for k, v in content.items()}
18
+ return SampleClassMethodResponse(response=resp)
19
+
20
+
21
+ sample_class = SampleClass()
@@ -0,0 +1,6 @@
1
+ class GetHash:
2
+ def my_hash(self) -> str:
3
+ return "plugin_id_class_123"
4
+
5
+
6
+ get_hash_class_instance = GetHash()
@@ -0,0 +1 @@
1
+ hash_lambda_fn = lambda: "plugin_id_hash_123" # noqa: E731
@@ -0,0 +1 @@
1
+ hash_value = "plugin_id_123"
@@ -0,0 +1,17 @@
1
+ from dataclasses import dataclass
2
+ from typing import Any, TypedDict
3
+
4
+
5
+ class SampleFunctionResponse(TypedDict):
6
+ response: dict[str, Any]
7
+
8
+
9
+ @dataclass
10
+ class SampleFunctionInput:
11
+ name: str
12
+ value: float
13
+
14
+
15
+ def sample_function(content: SampleFunctionInput) -> SampleFunctionResponse:
16
+ resp = {f"{k}_out": v for k, v in content.__dict__.items()}
17
+ return SampleFunctionResponse(response=resp)