Skip to content

Commit

Permalink
v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kenballus committed Nov 21, 2023
1 parent 554c220 commit 6ce4bb2
Show file tree
Hide file tree
Showing 7 changed files with 1,472 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is a rewrite of large portions of urllib.parse.
- Performance is worse. (~2x worse with caching, ~5x worse without caching)
- All deprecated and undocumented components are removed.
- There are new functions that allow you to parse only URIs, IRIs, relative-refs, or irelative-refs.
- NFKC normalization is no longer applied before parsing. The standard recommends that it is the IRI producer's responsibility to do this, not ours.
- NFKC normalization is no longer applied before parsing. The standard recommends that this be the IRI producer's responsibility to do this, not ours.
- Hosts and schemes are normalized to lowercase.
- Percent-encoded bytes are normalized to uppercase.
- `urlsplit` no longer strips garbage bytes from the beginning and end of its input.
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[project]
name = "nurllib"
version = "0.1"
5 changes: 5 additions & 0 deletions src/nurllib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
A urllib.parse rewrite that aims for strict RFC3986 compliance.
"""

__version__: str = "0.1"
3 changes: 3 additions & 0 deletions src/nurllib/parse/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__version__ = "0.1"

from .parse import DefragResult, DefragResultBytes, NURL, ParseResult, ParseResultBytes, Result, ResultBytes, SplitResult, SplitResultBytes, non_hierarchical, parse_irelative_ref, parse_iri, parse_iri_reference, parse_qs, parse_qsl, parse_relative_ref, parse_uri, parse_uri_reference, quote, quote_from_bytes, quote_plus, scheme_chars, unquote_to_bytes, urldefrag, urlencode, urljoin, urlparse, urlsplit, urlunparse, urlunsplit, uses_fragment, uses_netloc, uses_params, uses_query, uses_relative
File renamed without changes.
4 changes: 1 addition & 3 deletions get_tests.sh → tests/get_tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Delete anything lying around
rm -f test_urlparse.py
# Grab a fresh copy of the tests
wget https://raw.githubusercontent.com/python/cpython/13104f3b7412dce9bf7cfd09bf2d6dad1f3cc2ed/Lib/test/test_urlparse.py
wget 'https://raw.githubusercontent.com/python/cpython/13104f3b7412dce9bf7cfd09bf2d6dad1f3cc2ed/Lib/test/test_urlparse.py'
# Rename the module
sed -i 's/import urllib\.parse/import parse as parse_module/g' test_urlparse.py
sed -i 's/urllib\.parse/parse_module/g' test_urlparse.py
Expand All @@ -20,8 +20,6 @@ printf ', UrlParseTestCase.test_port_casting_failure_message' >> test_urlparse.p
printf ', UrlParseTestCase.test_attributes_bad_scheme' >> test_urlparse.py
# Because __all__ is changing.
printf ', UrlParseTestCase.test_all' >> test_urlparse.py
# Because we don't have _encoded_counterpart and _decoded_counterpart anymore.
sed -i 's/def _check_result_type(self, str_type):/def _check_result_type(self, str_type):\n return/g' test_urlparse.py
# Because we use the RFC 6874 syntax for scoped IPv6.
printf ', UrlParseTestCase.test_urlsplit_scoped_IPv6' >> test_urlparse.py
# Because urlsplit no longer strips junk from the end of URLs.
Expand Down
1,459 changes: 1,459 additions & 0 deletions tests/test_urlparse.py

Large diffs are not rendered by default.

0 comments on commit 6ce4bb2

Please sign in to comment.