1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
from __future__ import annotations
from typing import Literal, Optional, Union, overload
from ._async.functions_client import AsyncFunctionsClient
from ._sync.functions_client import SyncFunctionsClient
from .utils import FunctionRegion
__all__ = ["create_client"]
@overload
def create_client(
url: str, headers: dict[str, str], *, is_async: Literal[True], verify: bool
) -> AsyncFunctionsClient: ...
@overload
def create_client(
url: str, headers: dict[str, str], *, is_async: Literal[False], verify: bool
) -> SyncFunctionsClient: ...
def create_client(
url: str,
headers: dict[str, str],
*,
is_async: bool,
verify: bool = True,
) -> Union[AsyncFunctionsClient, SyncFunctionsClient]:
if is_async:
return AsyncFunctionsClient(url, headers, verify)
else:
return SyncFunctionsClient(url, headers, verify)
|