Skip to content

Commit a2cd7a6

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 91a26b3 commit a2cd7a6

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

examples/async_example.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ async def fetch_user_data(user_id: int) -> dict:
1818
"""Simulate fetching user data from an API."""
1919
print(f" Fetching user {user_id} from API...")
2020
await asyncio.sleep(1) # Simulate network delay
21-
return {
22-
"id": user_id,
23-
"name": f"User{user_id}",
24-
"email": f"user{user_id}@example.com"
25-
}
21+
return {"id": user_id, "name": f"User{user_id}", "email": f"user{user_id}@example.com"}
2622

2723

2824
# Example 2: Async function with memory backend (faster, but not persistent)
@@ -40,12 +36,7 @@ async def get_weather_data(city: str) -> dict:
4036
"""Simulate fetching weather data with automatic refresh when stale."""
4137
print(f" Fetching weather for {city}...")
4238
await asyncio.sleep(0.5)
43-
return {
44-
"city": city,
45-
"temp": 72,
46-
"condition": "sunny",
47-
"timestamp": time.time()
48-
}
39+
return {"city": city, "temp": 72, "condition": "sunny", "timestamp": time.time()}
4940

5041

5142
# Example 4: Real-world HTTP request caching (requires httpx)

tests/test_async_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ async def async_func(x):
737737
@pytest.mark.asyncio
738738
async def test_cachier_verbose_kwarg(self, capsys):
739739
"""Test cachier__verbose keyword argument."""
740+
740741
@cachier(backend="memory")
741742
async def async_func(x):
742743
await asyncio.sleep(0.1)
@@ -916,4 +917,3 @@ async def async_func(x):
916917
assert call_count >= 2
917918

918919
async_func.clear_cache()
919-

0 commit comments

Comments
 (0)