Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

♻ Simplify internal RegEx infastapi/utils.py#5057

Merged
tiangolo merged 2 commits intofastapi:masterfrom
pylounge:pylounge-utils
Aug 26, 2022
Merged

♻ Simplify internal RegEx infastapi/utils.py#5057
tiangolo merged 2 commits intofastapi:masterfrom
pylounge:pylounge-utils

Conversation

@pylounge
Copy link
Contributor

Replace regex for simple

xfenix reacted with thumbs up emoji
@codecov
Copy link

codecovbot commentedJun 20, 2022
edited
Loading

Codecov Report

Merging#5057 (9786b7f) intomaster (1876ebc) willnot change coverage.
The diff coverage is100.00%.

@@            Coverage Diff            @@##            master     #5057   +/-   ##=========================================  Coverage   100.00%   100.00%           =========================================  Files          532       532             Lines        13672     13672           =========================================  Hits         13672     13672
Impacted FilesCoverage Δ
fastapi/utils.py100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update1876ebc...9786b7f. Read thecomment docs.

@github-actions
Copy link
Contributor

📝 Docs preview for commit9786b7f at:https://62afeb41aa8c7445d0b7c931--fastapi.netlify.app

Copy link
Contributor

@JarroVGITJarroVGIT left a comment

Choose a reason for hiding this comment

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

Agree,\W is the equivalent of[^a-zA-Z0-9_] and is more elegant.

tiangolo reacted with thumbs up emoji
@lucaswiman
Copy link
Contributor

Agree,\W is the equivalent of[^a-zA-Z0-9_] and is more elegant.

No, that's not true. It's equivalent to[^\w], which is a wider range of characters that just those. For example:

>>>importre>>>re.match(r'\W','ü')>>>re.match(r'\w','ü')<re.Matchobject;span=(0,1),match='ü'>

This change may lead to better support for languages with non-ASCII characters, but it's not precisely equivalent to the old code.

@JarroVGIT
Copy link
Contributor

Agree,\W is the equivalent of[^a-zA-Z0-9_] and is more elegant.

No, that's not true. It's equivalent to[^\w], which is a wider range of characters that just those. For example:

>>>importre>>>re.match(r'\W','ü')>>>re.match(r'\w','ü')<re.Matchobject;span=(0,1),match='ü'>

This change may lead to better support for languages with non-ASCII characters, but it's not precisely equivalent to the old code.

I stand corrected. I took my information from regex101.com, and you are completely right.

If this changes the behaviour, then I would expect a test case that would illustrate the exact intended behaviour.

@tiangolotiangolo changed the titleReplace regex♻ Simplify internal RegEx infastapi/utils.pyAug 26, 2022
@tiangolo
Copy link
Member

Great, thanks@pylounge! 🍰

@tiangolotiangolo merged commitdc10b81 intofastapi:masterAug 26, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@JarroVGITJarroVGITJarroVGIT approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@pylounge@lucaswiman@JarroVGIT@tiangolo

Comments


[8]ページ先頭

©2009-2026 Movatter.jp