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

♻️ Move duplicated code portion to a static method in theAPIKeyBase super class#3142

Merged
tiangolo merged 8 commits intofastapi:masterfrom
ShahriyarR:apikey-duplicated-code-refactoring
Jan 30, 2025
Merged

♻️ Move duplicated code portion to a static method in theAPIKeyBase super class#3142
tiangolo merged 8 commits intofastapi:masterfrom
ShahriyarR:apikey-duplicated-code-refactoring

Conversation

@ShahriyarR
Copy link
Contributor

The code block below was used 3 times:

        if not api_key:            if auto_error:                raise HTTPException(                    status_code=HTTP_403_FORBIDDEN, detail="Not authenticated"                )            else:                return None        return api_key

I have moved this portion to thestaticmethod into the super class as it will be shared by inheritance to all 3 subclasses.

andreygaag, TheHormat, and mmzeynalli reacted with thumbs up emoji
@github-actions
Copy link
Contributor

📝 Docs preview for commit4a80d02 at:https://608d27c61facd91cca0729bf--fastapi.netlify.app

@codecov
Copy link

codecovbot commentedMay 13, 2022
edited
Loading

Codecov Report

Merging#3142 (8ce0578) intomaster (ce0ec06) willnot change coverage.
The diff coverage is100.00%.

@@             Coverage Diff             @@##            master     #3142     +/-   ##===========================================  Coverage   100.00%   100.00%             ===========================================  Files          243       531    +288       Lines         7419     13623   +6204     ===========================================+ Hits          7419     13623   +6204
Impacted FilesCoverage Δ
fastapi/security/api_key.py100.00% <100.00%> (ø)
fastapi/params.py100.00% <0.00%> (ø)
fastapi/routing.py100.00% <0.00%> (ø)
fastapi/encoders.py100.00% <0.00%> (ø)
fastapi/responses.py100.00% <0.00%> (ø)
fastapi/exceptions.py100.00% <0.00%> (ø)
fastapi/concurrency.py100.00% <0.00%> (ø)
fastapi/applications.py100.00% <0.00%> (ø)
fastapi/openapi/docs.py100.00% <0.00%> (ø)
tests/test_ws_router.py100.00% <0.00%> (ø)
... and318 more

Continue to review full report at Codecov.

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

@github-actions
Copy link
Contributor

📝 Docs preview for commit8ce0578 at:https://627e2fec25b877508f6395dc--fastapi.netlify.app

Copy link
Contributor

@patrick91patrick91 left a comment

Choose a reason for hiding this comment

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

Nice!

@svlandeg
Copy link
Member

svlandeg commentedAug 14, 2024
edited
Loading

@patrick91 : could you have another look at this PR, as it's not succeeding the linting step? 🙏

[Update]: I've gone in and fixed it 😉

ShahriyarR reacted with hooray emoji

@svlandegsvlandeg self-assigned thisSep 3, 2024
@svlandegsvlandeg changed the titleMoved duplicated code portion to the staticmethod in the super class♻️ Move duplicated code portion to a static method in theAPIKeyBase super classSep 3, 2024
@svlandegsvlandeg removed their assignmentSep 3, 2024
Copy link
Member

@tiangolotiangolo left a comment

Choose a reason for hiding this comment

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

Nice, thank you! 🚀

And thanks for the reviews and help! ☕

@tiangolotiangolo merged commit30b270b intofastapi:masterJan 30, 2025
26 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@patrick91patrick91patrick91 approved these changes

@tiangolotiangolotiangolo approved these changes

@svlandegsvlandegsvlandeg approved these changes

+3 more reviewers

@cikaycikaycikay requested changes

@BilalAlpaslanBilalAlpaslanBilalAlpaslan approved these changes

@yezz123yezz123yezz123 approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@ShahriyarR@svlandeg@patrick91@tiangolo@cikay@BilalAlpaslan@yezz123

Comments


[8]ページ先頭

©2009-2026 Movatter.jp