Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): OpenAPI spec update via Stainless API #338

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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"),
)


Expand Down
1 change: 1 addition & 0 deletions src/cloudflare/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions src/cloudflare/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]