From 8aa19d4eb56567851b667fedaa5991d5349d1032 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 21:46:41 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#338) --- README.md | 4 ++++ src/cloudflare/_utils/__init__.py | 1 + src/cloudflare/_utils/_utils.py | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index e3eae44f288..b906c8581bf 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ from cloudflare import Cloudflare client = Cloudflare( # This is the default and can be omitted api_email=os.environ.get("CLOUDFLARE_EMAIL"), + # This is the default and can be omitted + api_key=os.environ.get("CLOUDFLARE_API_KEY"), ) zone = client.zones.create( @@ -57,6 +59,8 @@ from cloudflare import AsyncCloudflare client = AsyncCloudflare( # This is the default and can be omitted api_email=os.environ.get("CLOUDFLARE_EMAIL"), + # This is the default and can be omitted + api_key=os.environ.get("CLOUDFLARE_API_KEY"), ) diff --git a/src/cloudflare/_utils/__init__.py b/src/cloudflare/_utils/__init__.py index 5697894192b..31b5b22799e 100644 --- a/src/cloudflare/_utils/__init__.py +++ b/src/cloudflare/_utils/__init__.py @@ -6,6 +6,7 @@ is_list as is_list, is_given as is_given, is_tuple as is_tuple, + lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, parse_date as parse_date, diff --git a/src/cloudflare/_utils/_utils.py b/src/cloudflare/_utils/_utils.py index 93c95517a94..5123a230f1d 100644 --- a/src/cloudflare/_utils/_utils.py +++ b/src/cloudflare/_utils/_utils.py @@ -389,3 +389,11 @@ def get_async_library() -> str: return sniffio.current_async_library() except Exception: return "false" + + +def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]: + """A version of functools.lru_cache that retains the type signature + for the wrapped function arguments. + """ + wrapper = functools.lru_cache(maxsize=maxsize) + return cast(Any, wrapper) # type: ignore[no-any-return]