Skip to content

Fix PictureField type hints #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 7, 2025
Merged

Fix PictureField type hints #212

merged 2 commits into from
Jul 7, 2025

Conversation

amureki
Copy link
Collaborator

@amureki amureki commented Jul 7, 2025

Greetings!

I just noticed that my editor warns me about wrong types, when I am writing the following code:

image = PictureField(
        file_types=["WEBP", "JPEG"],  # Expected type '[str] | None', got 'list[str]' instead
        aspect_ratios=["3/1", "3/2", "1/1", "15/2", "1.91"],  # Expected type '[str | Fraction | None] | None', got 'list[str]' instead 
    )

I decided to go ahead and mark the types for these args as lists.

Cheers,
Rust

@amureki amureki changed the title Greetings!Fix PictureField type hints Fix PictureField type hints Jul 7, 2025
Copy link

codecov bot commented Jul 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (371e169) to head (db29b31).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #212   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          496       496           
=========================================
  Hits           496       496           
Flag Coverage Δ
celery 85.08% <ø> (ø)
cleanup 88.50% <ø> (ø)
dj5.1 88.50% <ø> (ø)
dj5.2 88.50% <ø> (ø)
django-rq 85.08% <ø> (ø)
dramatiq 85.08% <ø> (ø)
drf 96.37% <ø> (ø)
macos-latest 88.70% <ø> (ø)
py3.10 88.50% <ø> (ø)
py3.12 88.50% <ø> (ø)
py3.13 88.50% <ø> (ø)
py3.9 88.50% <ø> (ø)
ubuntu-latest 88.50% <ø> (ø)
windows-latest 81.76% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@amureki amureki self-assigned this Jul 7, 2025
@amureki amureki requested a review from codingjoe July 7, 2025 07:49
Copy link
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

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

Image

@amureki amureki marked this pull request as ready for review July 7, 2025 09:31
@amureki amureki merged commit 7539aca into codingjoe:main Jul 7, 2025
24 checks passed
@amureki amureki deleted the fix-types branch July 7, 2025 09:39
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