ruff
This commit is contained in:
parent
8dc358da39
commit
7ebe8563c5
1 changed files with 10 additions and 9 deletions
|
|
@ -288,12 +288,13 @@ if __name__ == "__main__":
|
||||||
self.id = user_id
|
self.id = user_id
|
||||||
|
|
||||||
@log_usage(function_name="example_with_user", log_type="example")
|
@log_usage(function_name="example_with_user", log_type="example")
|
||||||
async def example_with_user(data: str, user: MockUser, wrong_param=datetime.utcnow().isoformat()):
|
async def example_with_user(
|
||||||
|
data: str, user: MockUser, wrong_param=datetime.utcnow().isoformat()
|
||||||
|
):
|
||||||
"""Example function with user parameter."""
|
"""Example function with user parameter."""
|
||||||
await asyncio.sleep(0.05)
|
await asyncio.sleep(0.05)
|
||||||
return float("nan")
|
return float("nan")
|
||||||
|
|
||||||
|
|
||||||
@log_usage(function_name="returns_cycle", log_type="function")
|
@log_usage(function_name="returns_cycle", log_type="function")
|
||||||
async def returns_cycle():
|
async def returns_cycle():
|
||||||
a = []
|
a = []
|
||||||
|
|
@ -314,7 +315,9 @@ if __name__ == "__main__":
|
||||||
# Example 2: Function with user
|
# Example 2: Function with user
|
||||||
print("\n2. Running example function with user:")
|
print("\n2. Running example function with user:")
|
||||||
mock_user = MockUser("example-user-123")
|
mock_user = MockUser("example-user-123")
|
||||||
result2 = await example_with_user("sample_data", user=mock_user, wrong_param=datetime.utcnow().isoformat())
|
result2 = await example_with_user(
|
||||||
|
"sample_data", user=mock_user, wrong_param=datetime.utcnow().isoformat()
|
||||||
|
)
|
||||||
result3 = await example_with_user("sample_data", user=mock_user)
|
result3 = await example_with_user("sample_data", user=mock_user)
|
||||||
|
|
||||||
print(f" Result: {result2}")
|
print(f" Result: {result2}")
|
||||||
|
|
@ -353,7 +356,5 @@ if __name__ == "__main__":
|
||||||
print(" - CACHE_HOST=localhost")
|
print(" - CACHE_HOST=localhost")
|
||||||
print(" - CACHE_PORT=6379")
|
print(" - CACHE_PORT=6379")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Run the example
|
# Run the example
|
||||||
asyncio.run(run_example())
|
asyncio.run(run_example())
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue