Skip to content

Conversation

gyandeeps-hh
Copy link
Contributor

Changes

  • Updated the return type of the retry decorator.
  • Ran ruff check and fixed code
  • Ran run format which updated __utils file

Example

from uuid import UUID
from pydantic import BaseModel
import httpx
from retryhttp._retry import retry

class Payload(BaseModel):
    uuid: UUID
    id: int
    user_id: int
    user_uuid: UUID

@retry()
def get_example() -> Payload:
    response = httpx.get("https://example.com/")
    response.raise_for_status()

    return Payload(**response.json())

get_example().user_uuid

Without the code change, you will not get a type hint for user_uuid on the last line (get_example().user_uuid). With this change, it maintains the return type of the original function.

Copy link
Contributor Author

@gyandeeps-hh gyandeeps-hh Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ruff format changes in this file only

@austind
Copy link
Owner

austind commented Feb 4, 2025

Good catch, thank you!

@austind austind merged commit 6fddb47 into austind:main Feb 4, 2025
1 check passed
@gyandeeps-hh gyandeeps-hh deleted the types branch February 4, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants