Skip to content

Improve type annotations in Flask-Cors stubs - #12596

Merged
srittau merged 3 commits into
python:mainfrom
ashm-dev:flask-cors
Aug 27, 2024
Merged

srittau merged 3 commits into
python:mainfrom
ashm-dev:flask-cors

Conversation

@ashm-dev

Copy link
Copy Markdown
Contributor

@srittau As promised, I have added the constants.

@github-actions

This comment has been minimized.

Comment thread stubs/Flask-Cors/flask_cors/core.pyi Outdated
RegexObject: type[Pattern[str]]
DEFAULT_OPTIONS: _Options

ACL_ORIGIN: Final[str] = "Access-Control-Allow-Origin"

@srittau srittau Aug 26, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: If you have a default, you don't need to specify the type:

ACL_ORIGIN: Final = "Access-Control-Allow-Origin"

(Here and below.)

We should really have a flake8 warning for that. I filed PyCQA/flake8-pyi#499.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, everything will be fine now!

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@ashm-dev
ashm-dev requested a review from srittau August 27, 2024 08:01

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@srittau
srittau merged commit f58dac1 into python:main Aug 27, 2024
@ashm-dev
ashm-dev deleted the flask-cors branch August 27, 2024 08:48
max-muoto pushed a commit to max-muoto/typeshed that referenced this pull request Sep 8, 2024
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