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.
- test/__init__.py +0 -0
- test/assets/__init__.py +0 -0
- test/assets/async_typed_dict_response.py +10 -0
- test/assets/dataclass_response.py +37 -0
- test/assets/empty_input_and_response.py +8 -0
- test/assets/hash_function.py +2 -0
- test/assets/improper_function.py +2 -0
- test/assets/pydantic_response_class_method.py +21 -0
- test/assets/simple_hash_class.py +6 -0
- test/assets/simple_hash_lambda.py +1 -0
- test/assets/simple_hash_value.py +1 -0
- test/assets/typed_dict_response.py +17 -0
- test/test_schema.py +660 -0
- test/test_utils.py +140 -0
- unstructured_platform_plugins/__init__.py +0 -0
- unstructured_platform_plugins/__version__.py +1 -0
- unstructured_platform_plugins/etl_uvicorn/__init__.py +0 -0
- unstructured_platform_plugins/etl_uvicorn/api_generator.py +173 -0
- unstructured_platform_plugins/etl_uvicorn/main.py +121 -0
- unstructured_platform_plugins/etl_uvicorn/utils.py +115 -0
- unstructured_platform_plugins/schema/__init__.py +0 -0
- unstructured_platform_plugins/schema/json_schema.py +344 -0
- unstructured_platform_plugins/schema/model.py +101 -0
- unstructured_platform_plugins/schema/usage.py +7 -0
- unstructured_platform_plugins/schema/utils.py +31 -0
- unstructured_platform_plugins/type_hints.py +106 -0
- unstructured_platform_plugins/validate_api.py +110 -0
- unstructured_platform_plugins-0.0.0.dist-info/LICENSE +201 -0
- unstructured_platform_plugins-0.0.0.dist-info/LICENSE.md +201 -0
- unstructured_platform_plugins-0.0.0.dist-info/METADATA +106 -0
- unstructured_platform_plugins-0.0.0.dist-info/RECORD +34 -0
- unstructured_platform_plugins-0.0.0.dist-info/WHEEL +5 -0
- unstructured_platform_plugins-0.0.0.dist-info/entry_points.txt +3 -0
- unstructured_platform_plugins-0.0.0.dist-info/top_level.txt +2 -0
test/__init__.py
ADDED
|
File without changes
|
test/assets/__init__.py
ADDED
|
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,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 @@
|
|
|
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)
|