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

Sweep: Update the docstrings and comments in sdks/python/julep/managers/utils.py to fix any issues and mismatch between the comments present and surrounding code #268

Merged
merged 13 commits into from
Apr 18, 2024
Merged
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
6 changes: 5 additions & 1 deletion sdks/python/julep/managers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def is_valid_uuid4(uuid_to_test: str) -> bool:

Args:
uuid_to_test (str): String to test for valid UUID v4.

This function can also directly check UUID instances to confirm they are version 4.
"""

if isinstance(uuid_to_test, UUID):
Expand All @@ -34,12 +36,14 @@ def is_valid_uuid4(uuid_to_test: str) -> bool:
def rewrap_in_class(cls):
def decorator(func: Callable[..., ResourceCreatedResponse]):
@wraps(func)
# This wrapper is used for asynchronous functions to ensure they are properly awaited and their results are processed by `cls.construct`.
async def async_wrapper(*args, **kwargs):
result = await func(*args, **kwargs)
return cls.construct(**kwargs, **result.dict())

# This wrapper handles synchronous functions, directly calling them and processing their results with `cls.construct`.
def sync_wrapper(*args, **kwargs):
print(kwargs) # Add this line to debug
# Logging at this point might be useful for debugging, but should use a proper logging framework instead of print statements for production code.
result = func(*args, **kwargs)
return cls.construct(**kwargs, **result.dict())

Expand Down
Loading