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

Typing Part 3. #502

Merged
merged 1 commit into from Jul 11, 2021
Merged

Typing Part 3. #502

merged 1 commit into from Jul 11, 2021

Conversation

jwag956
Copy link
Member

@jwag956 jwag956 commented Jul 11, 2021

This adds types to the Security constructor and init_app. This required major refactoring of how initialization happened since prior to this
all arguments were added to kwargs (including default forms, config variables, etc) then set as attributes on the instance. Not easy to provide types for each one.
We remove all that, remove the _SecurityState class and concept.

Furthermore - in many places - we change from using _securyty.attr and use config_value("xxx").

Improve performance of config_value - no reason to create a dictonary every time - just query the key!

Add typing to more tests and views to help verify the types make sense.

Fix view responses - the types should be flask.ResponsValue - not Response

Fix 'within' and 'grace' typing - then can take floats.

closes: #140

This adds types to the Security constructor and init_app. This required major refactoring of how initialization happened since prior to this
all arguments were added to kwargs (including default forms, config variables, etc) then set as attributes on the instance. Not easy to provide types for each one.
We remove all that, remove the _SecurityState class and concept.

Furthermore - in many places - we change from using _securyty.attr and use config_value("xxx").

Improve performance of config_value - no reason to create a dictonary every time - just query the key!

Add typing to more tests and views to help verify the types make sense.

Fix view responses - the types should be flask.ResponsValue - not Response

Fix 'within' and 'grace' typing - then can take floats.

closes: #140
@codecov
Copy link

codecov bot commented Jul 11, 2021

Codecov Report

Merging #502 (c2b6c47) into master (e52eb16) will increase coverage by 0.15%.
The diff coverage is 99.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #502      +/-   ##
==========================================
+ Coverage   97.87%   98.03%   +0.15%     
==========================================
  Files          25       25              
  Lines        3204     3252      +48     
==========================================
+ Hits         3136     3188      +52     
+ Misses         68       64       -4     
Impacted Files Coverage Δ
flask_security/decorators.py 95.37% <ø> (ø)
flask_security/proxies.py 100.00% <ø> (ø)
flask_security/core.py 98.20% <99.42%> (+1.18%) ⬆️
flask_security/unified_signin.py 98.67% <100.00%> (+<0.01%) ⬆️
flask_security/utils.py 97.30% <100.00%> (+0.01%) ⬆️
flask_security/views.py 98.31% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e52eb16...c2b6c47. Read the comment docs.

@jwag956 jwag956 merged commit efe98c8 into master Jul 11, 2021
@jwag956 jwag956 deleted the rstate branch July 11, 2021 01:48
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.

Providing type hints for IDEs and linters
1 participant