Skip to content

Conversation

JGynther
Copy link
Contributor

@JGynther JGynther commented Jun 6, 2025

What do these changes do?

Fixes the return type signature of DNSResolver query to not lie to users about what is returned. Properly reflects what Pycares actually returns for each query type.

Are there changes in behavior for the user?

Return type signature now matches reality of what is returned

Related issue number

Fixes #161

Checklist

  • I think the code is well written
  • [] Unit tests for the changes exist
  • [] Documentation reflects the changes

Change does not change library functionality.

Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

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

@bdraco can you also take a quick look?

Copy link
Member

@Dreamsorcerer Dreamsorcerer left a comment

Choose a reason for hiding this comment

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

Looks good. Hopefully we can replace the Any someday with a base class is pycares.

Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.85%. Comparing base (c7a5c24) to head (9bbc6ca).
Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #162   +/-   ##
=======================================
  Coverage   93.85%   93.85%           
=======================================
  Files           3        3           
  Lines         374      374           
  Branches       29       29           
=======================================
  Hits          351      351           
  Misses         14       14           
  Partials        9        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JGynther
Copy link
Contributor Author

JGynther commented Jun 6, 2025

If we wanted to be more specific than Any I think we could make something like this, though the Any is probably fine enough. I am not familiar enough with intrinsics of overload

QueryResult = Union[
    asyncio.Future[list[pycares.ares_query_a_result]],
    asyncio.Future[list[pycares.ares_query_aaaa_result]],
    asyncio.Future[list[pycares.ares_query_caa_result]],
    asyncio.Future[pycares.ares_query_cname_result],
    asyncio.Future[list[pycares.ares_query_mx_result]],
    asyncio.Future[list[pycares.ares_query_naptr_result]],
    asyncio.Future[list[pycares.ares_query_ns_result]],
    asyncio.Future[list[pycares.ares_query_ptr_result]],
    asyncio.Future[pycares.ares_query_soa_result],
    asyncio.Future[list[pycares.ares_query_srv_result]],
    asyncio.Future[list[pycares.ares_query_txt_result]],
]

@Dreamsorcerer
Copy link
Member

If we wanted to be more specific than Any I think we could make something like this

Technically, yes, but it'd be cleaner to define a base class in pycares with the common parts.

@Dreamsorcerer Dreamsorcerer merged commit cc628cb into aio-libs:master Jun 7, 2025
21 checks passed
@bdraco bdraco mentioned this pull request Jun 13, 2025
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.

Incorrect return type signature in DNSResolver query
3 participants