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

Addencoded_string() method to the URL types#11580

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

YassinNouh21
Copy link
Contributor

@YassinNouh21YassinNouh21 commentedMar 18, 2025
edited by Viicos
Loading

Change Summary

This PR introduces a newencoded property to theUrl class inpydantic/networks.py. Theencoded property returns the punycode-encoded host version of the URL as a string. Additionally, a new test case has been added totests/test_networks.py to verify the functionality of theencoded property.

Related issue number

fixes#11551

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog

  • Unit tests for the changes exist

  • Tests pass on CI

  • Documentation reflects the changes where applicable

  • My PR is ready to review,please add a comment including the phrase "please review" to assign reviewers

nairb774 reacted with heart emoji
@codspeed-hqCodSpeed HQ
Copy link

codspeed-hqbot commentedMar 18, 2025
edited
Loading

CodSpeed Performance Report

Merging#11580 willnot alter performance

ComparingYassinNouh21:feature/11551-encoded-url-property (3f67a86) withmain (a2846da)

Summary

✅ 46 untouched benchmarks

@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commentedMar 19, 2025
edited
Loading

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  networks.py
Project Total 

This report was generated bypython-coverage-comment-action

Copy link
Member

@ViicosViicos left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. Theencoded() method needs to be added on_BaseMultiHostUrl as well.

@@ -330,6 +330,7 @@ class Model(BaseModel):
# https://www.xudongz.com/blog/2017/idn-phishing/ accepted but converted
('https://www.аррӏе.com/', 'https://www.xn--80ak6aa92e.com/'),
('https://exampl£e.org', 'https://xn--example-gia.org/'),
('http://puny£code.com', 'http://xn--punycode-eja.com/'),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
('http://puny£code.com', 'http://xn--punycode-eja.com/'),

@YassinNouh21
Copy link
ContributorAuthor

@Viicos can u take a look on the new _BaseMultiHostUrl test that I have added

@ViicosViicos changed the titlefeat(url): add encoded property returning punycode-encoded host stringAddencoded_string() method to the URL typesMar 19, 2025
Copy link
Member

@ViicosViicos left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution

YassinNouh21 reacted with heart emoji
@ViicosViicos merged commit87cb27f intopydantic:mainMar 19, 2025
60 checks passed
@YassinNouh21YassinNouh21 deleted the feature/11551-encoded-url-property branchMarch 19, 2025 21:10
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ViicosViicosViicos approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

BaseUrl: Provide a property or method to access the encoded URL string.
2 participants
@YassinNouh21@Viicos

[8]ページ先頭

©2009-2025 Movatter.jp