From 830bee66f58b1160eb15dc96676b4bc40cc01522 Mon Sep 17 00:00:00 2001 From: Austin Walker Date: Thu, 19 Sep 2024 17:21:26 -0400 Subject: [PATCH] Revert our custom patch changes --- Makefile | 4 --- _custom_code.patch | 29 ------------------- .../integration/test_decorators.py | 2 +- .../unit/test_custom_hooks.py | 4 +-- src/unstructured_client/general.py | 4 +-- .../models/operations/partition.py | 3 -- 6 files changed, 5 insertions(+), 41 deletions(-) delete mode 100644 _custom_code.patch diff --git a/Makefile b/Makefile index d5d24882..8f97a22b 100644 --- a/Makefile +++ b/Makefile @@ -68,10 +68,6 @@ client-generate-local: speakeasy overlay apply -s ./openapi.json -o ./overlay_client.yaml > ./openapi_client.json speakeasy generate sdk -s ./openapi_client.json -o ./ -l python -.PHONY: patch-custom-code -patch-custom-code: - git apply _custom_code.patch - .PHONY: publish publish: ./scripts/publish.sh diff --git a/_custom_code.patch b/_custom_code.patch deleted file mode 100644 index 05eda4b7..00000000 --- a/_custom_code.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/src/unstructured_client/general.py b/src/unstructured_client/general.py -index 3b8af5f..05f0962 100644 ---- a/src/unstructured_client/general.py -+++ b/src/unstructured_client/general.py -@@ -11,8 +11,9 @@ class General(BaseSDK): - - - def partition( -- self, *, -+ self, - request: Union[operations.PartitionRequest, operations.PartitionRequestTypedDict], -+ *, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, -diff --git a/src/unstructured_client/models/operations/partition.py b/src/unstructured_client/models/operations/partition.py -index 465bc3a..a537a13 100644 ---- a/src/unstructured_client/models/operations/partition.py -+++ b/src/unstructured_client/models/operations/partition.py -@@ -19,6 +19,9 @@ class PartitionRequestTypedDict(TypedDict): - class PartitionRequest(BaseModel): - partition_parameters: Annotated[shared_partition_parameters.PartitionParameters, FieldMetadata(request=RequestMetadata(media_type="multipart/form-data"))] - unstructured_api_key: Annotated[OptionalNullable[str], pydantic.Field(alias="unstructured-api-key"), FieldMetadata(header=HeaderMetadata(style="simple", explode=False))] = UNSET -+ -+ def __init__(self, partition_parameters, **kwargs): -+ BaseModel.__init__(self, partition_parameters=partition_parameters, **kwargs) - - @model_serializer(mode="wrap") - def serialize_model(self, handler): diff --git a/_test_unstructured_client/integration/test_decorators.py b/_test_unstructured_client/integration/test_decorators.py index 4ef40ad7..c21fa587 100644 --- a/_test_unstructured_client/integration/test_decorators.py +++ b/_test_unstructured_client/integration/test_decorators.py @@ -356,7 +356,7 @@ async def mock_send(_, request: httpx.Request, **kwargs): ) req = operations.PartitionRequest( - shared.PartitionParameters( + partition_parameters=shared.PartitionParameters( files=files, split_pdf_page=True, split_pdf_allow_failed=False, diff --git a/_test_unstructured_client/unit/test_custom_hooks.py b/_test_unstructured_client/unit/test_custom_hooks.py index fd5ea40f..8c0b7a40 100644 --- a/_test_unstructured_client/unit/test_custom_hooks.py +++ b/_test_unstructured_client/unit/test_custom_hooks.py @@ -122,11 +122,11 @@ def mock_post(request): files = shared.Files(content=f.read(), file_name=filename) req = operations.PartitionRequest( - shared.PartitionParameters(files=files) + partition_parameters=shared.PartitionParameters(files=files) ) with pytest.raises(Exception, match=f"Status {status_code}"): - session.general.partition(req, retries=retries) + session.general.partition(request=req, retries=retries) if expect_retry: assert number_of_requests[0] > 1 diff --git a/src/unstructured_client/general.py b/src/unstructured_client/general.py index b6ba578a..f7019d57 100644 --- a/src/unstructured_client/general.py +++ b/src/unstructured_client/general.py @@ -11,10 +11,10 @@ class General(BaseSDK): def partition( self, + *, request: Union[ operations.PartitionRequest, operations.PartitionRequestTypedDict ], - *, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -116,10 +116,10 @@ def partition( async def partition_async( self, + *, request: Union[ operations.PartitionRequest, operations.PartitionRequestTypedDict ], - *, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, diff --git a/src/unstructured_client/models/operations/partition.py b/src/unstructured_client/models/operations/partition.py index aa8bcc74..ce6ab779 100644 --- a/src/unstructured_client/models/operations/partition.py +++ b/src/unstructured_client/models/operations/partition.py @@ -25,9 +25,6 @@ class PartitionRequestTypedDict(TypedDict): class PartitionRequest(BaseModel): - def __init__(self, partition_parameters, **kwargs): - BaseModel.__init__(self, partition_parameters=partition_parameters, **kwargs) - partition_parameters: Annotated[ shared_partition_parameters.PartitionParameters, FieldMetadata(request=RequestMetadata(media_type="multipart/form-data")),