1818def clean_server_url (func : Callable [_P , None ]) -> Callable [_P , None ]:
1919 """A decorator for fixing common types of malformed 'server_url' arguments.
2020
21- This decorator addresses the common problem of users omitting or using the wrong url scheme and/or
22- adding the '/general/v0/general' path to the 'server_url'.
23- The decorator should be manually applied to the __init__ method of UnstructuredClient after merging
24- a PR from Speakeasy.
21+ This decorator addresses the common problem of users omitting or using the wrong url scheme
22+ and/or adding the '/general/v0/general' path to the 'server_url'. The decorator should be
23+ manually applied to the __init__ method of UnstructuredClient after merging a PR from Speakeasy.
2524 """
2625
2726 @functools .wraps (func )
@@ -52,7 +51,11 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> None:
5251 if url_is_in_kwargs :
5352 kwargs ["server_url" ] = urlunparse (cleaned_url )
5453 else :
55- args = args [:SERVER_URL_ARG_IDX ] + (urlunparse (cleaned_url ),) + args [SERVER_URL_ARG_IDX + 1 :] # type: ignore
54+ args = (
55+ args [:SERVER_URL_ARG_IDX ]
56+ + (urlunparse (cleaned_url ),)
57+ + args [SERVER_URL_ARG_IDX + 1 :]
58+ ) # type: ignore
5659
5760 return func (* args , ** kwargs )
5861
@@ -62,11 +65,14 @@ def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> None:
6265def suggest_defining_url_if_401 (
6366 func : Callable [_P , operations .PartitionResponse ]
6467) -> Callable [_P , operations .PartitionResponse ]:
65- """A decorator to suggest defining the 'server_url' parameter if a 401 Unauthorized error is encountered.
66-
67- This decorator addresses the common problem of users not passing in the 'server_url' when using their paid api key.
68- The decorator should be manually applied to General.partition after merging a PR from Speakeasy.
68+ """A decorator to suggest defining the 'server_url' parameter if a 401 Unauthorized error is
69+ encountered.
70+
71+ This decorator addresses the common problem of users not passing in the 'server_url' when
72+ using their paid api key. The decorator should be manually applied to General.partition after
73+ merging a PR from Speakeasy.
6974 """
75+
7076 @functools .wraps (func )
7177 def wrapper (* args : _P .args , ** kwargs : _P .kwargs ) -> operations .PartitionResponse :
7278 try :
0 commit comments