Skip to content

Fix pyright errors for requests#530

Merged
joverlee521 merged 2 commits into
masterfrom
fix-pyright-requests
May 13, 2026
Merged

Fix pyright errors for requests#530
joverlee521 merged 2 commits into
masterfrom
fix-pyright-requests

Conversation

@joverlee521
Copy link
Copy Markdown
Contributor

@joverlee521 joverlee521 commented May 12, 2026

Description of proposed changes

requests v2.34.0 includes inline type annotations that cause pyright errors. This commit attempts to fix and/or ignore those errors as appropriate.

Related issue(s)

Resolves #529

Checklist

  • Checks pass
  • Update changelog

requests v2.34.0 includes inline type annotations that cause pyright
errors. This commit attempts to fix and/or ignore those errors as
appropriate.

Resolves #529
Comment thread nextstrain/cli/remote/nextstrain_dot_org.py Outdated
Comment thread nextstrain/cli/pathogens.py Outdated
Comment thread nextstrain/cli/pathogens.py Outdated
Based on suggestions from @victorlin in review of
#530

1. Assert value instead of type to be consistent with other assertions
in the repo.
2. Use type narrowing instead of coercion
3. nextstrain_dot_org/download: Always write raw bytes
`iter_content` can potentially return bytes if the `response.encoding`
is None,¹ so just always write raw bytes.

¹ <https://github.com/psf/requests/blob/6404f345e562d962abe6700a1c357ec1e7e18232/src/requests/utils.py#L599-L600>
@joverlee521 joverlee521 merged commit dd2bc45 into master May 13, 2026
52 checks passed
@joverlee521 joverlee521 deleted the fix-pyright-requests branch May 13, 2026 17:58
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.

CI: pyright errors for requests

2 participants