-
Notifications
You must be signed in to change notification settings - Fork 0
new: Type hints for python module #2
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
779d024
new: Type hints for python module
Rafiot e5875b5
fix: Improve code
Rafiot 2e751e1
new: Add get_domain_without_tld method
Rafiot ce53ac1
fix: Avoid unnecessary clone
Rafiot 141cb77
fix: Make lint happy
Rafiot 9348370
chg: Improve stripping tld
Rafiot 0a30425
new: Add pytest suite
Rafiot b7e1b84
fix: Make sure orig isn't optimized out
Rafiot 4a71a5c
new: add .orig in tests, run mypy in test
Rafiot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| class FaupCompat: | ||
|
|
||
| url: bytes | ||
|
|
||
| def __init__(self, url: str | None=None) -> None: | ||
| ... | ||
|
|
||
| def decode(self, url: str) -> None: | ||
| ... | ||
|
|
||
| def get_credential(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_domain(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_subdomain(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_fragment(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_host(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_resource_path(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_tld(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_query_string(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_scheme(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_domain_without_tld(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_port(self) -> int | None: | ||
| ... | ||
|
|
||
|
|
||
| class Url: | ||
|
|
||
| orig: str | ||
| scheme: str | ||
| username: str | None | ||
| password: str | None | ||
| host: str | ||
| subdomain: str | None | ||
| domain: str | None | ||
| suffix: str | None | ||
| port: int | None | ||
| path: str | None | ||
| query: str | None | ||
| fragment: str | None | ||
|
|
||
| def __init__(self, url: str | None = None) -> None: | ||
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import unittest | ||
|
|
||
| from pyfaup import Url | ||
|
|
||
|
|
||
| class TestPyFaupRR(unittest.TestCase): | ||
|
|
||
| def test_url(self) -> None: | ||
| parsed_url = Url('https://user:pass@sub.example.com:8080/path?query=value#fragment') | ||
|
|
||
| self.assertEqual(parsed_url.orig, 'https://user:pass@sub.example.com:8080/path?query=value#fragment') | ||
|
|
||
| self.assertEqual(parsed_url.scheme, 'https') | ||
| self.assertEqual(parsed_url.username, 'user') | ||
| self.assertEqual(parsed_url.password, 'pass') | ||
| self.assertEqual(parsed_url.host, 'sub.example.com') | ||
| self.assertEqual(parsed_url.subdomain, 'sub') | ||
| self.assertEqual(parsed_url.domain, 'example.com') | ||
| self.assertEqual(parsed_url.suffix, 'com') | ||
| self.assertEqual(parsed_url.port, 8080) | ||
| self.assertEqual(parsed_url.path, '/path') | ||
| self.assertEqual(parsed_url.query, 'query=value') | ||
| self.assertEqual(parsed_url.fragment, 'fragment') |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.