Skip to content
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

Core: fixed typing for conditional expression #8231

Merged

Conversation

cloutierMat
Copy link
Contributor

Motivation

With it's latest release, mypy has improved it's capabilities to Inferring Unions for Conditional Expressions. This created a new issues with mypy and tests failing at the linting step.

Changes

  • Added type annotation to prevent inference at declaration (var = None) conflict with inference in conditional expression (var = "string" if cond() else None) resulting in expression has type "Union[Any, str]", variable has type "None" error.

@cloutierMat cloutierMat mentioned this pull request Oct 15, 2024
1 task
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.54%. Comparing base (7f14f9b) to head (cb47a38).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8231   +/-   ##
=======================================
  Coverage   94.54%   94.54%           
=======================================
  Files        1158     1158           
  Lines      100089   100093    +4     
=======================================
+ Hits        94629    94633    +4     
  Misses       5460     5460           
Flag Coverage Δ
servertests 28.88% <80.00%> (+<0.01%) ⬆️
unittests 94.51% <100.00%> (+<0.01%) ⬆️

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.

@bblommers bblommers changed the title fixed typing for conditional expression Core: fixed typing for conditional expression Oct 15, 2024
Copy link
Collaborator

@bblommers bblommers left a comment

Choose a reason for hiding this comment

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

Great, thanks for fixing this @cloutierMat!

@bblommers bblommers added this to the 5.0.18 milestone Oct 15, 2024
@bblommers bblommers merged commit d0affa8 into getmoto:master Oct 15, 2024
53 checks passed
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