uritools 4.0.2__tar.gz → 4.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {uritools-4.0.2 → uritools-4.0.3}/CHANGELOG.rst +6 -0
- {uritools-4.0.2 → uritools-4.0.3}/LICENSE +1 -1
- {uritools-4.0.2 → uritools-4.0.3}/MANIFEST.in +1 -0
- {uritools-4.0.2/src/uritools.egg-info → uritools-4.0.3}/PKG-INFO +1 -1
- uritools-4.0.3/docs/conf.py +33 -0
- {uritools-4.0.2 → uritools-4.0.3}/setup.cfg +1 -1
- {uritools-4.0.2 → uritools-4.0.3}/src/uritools/__init__.py +1 -1
- {uritools-4.0.2 → uritools-4.0.3/src/uritools.egg-info}/PKG-INFO +1 -1
- {uritools-4.0.2 → uritools-4.0.3}/tests/test_split.py +106 -25
- {uritools-4.0.2 → uritools-4.0.3}/tox.ini +0 -1
- uritools-4.0.2/docs/conf.py +0 -14
- {uritools-4.0.2 → uritools-4.0.3}/README.rst +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/docs/.gitignore +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/docs/Makefile +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/docs/index.rst +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/pyproject.toml +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/setup.py +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/src/uritools.egg-info/SOURCES.txt +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/src/uritools.egg-info/dependency_links.txt +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/src/uritools.egg-info/top_level.txt +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/tests/__init__.py +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/tests/test_classify.py +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/tests/test_compose.py +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/tests/test_defrag.py +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/tests/test_encoding.py +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/tests/test_join.py +0 -0
- {uritools-4.0.2 → uritools-4.0.3}/tests/test_unsplit.py +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
src_directory = (pathlib.Path(__file__).parent.parent / "src").resolve()
|
|
5
|
+
sys.path.insert(0, str(src_directory))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Extract the current version from the source.
|
|
9
|
+
def get_version():
|
|
10
|
+
"""Get the version and release from the source code."""
|
|
11
|
+
|
|
12
|
+
text = (src_directory / "uritools/__init__.py").read_text()
|
|
13
|
+
for line in text.splitlines():
|
|
14
|
+
if not line.strip().startswith("__version__"):
|
|
15
|
+
continue
|
|
16
|
+
full_version = line.partition("=")[2].strip().strip("\"'")
|
|
17
|
+
partial_version = ".".join(full_version.split(".")[:2])
|
|
18
|
+
return full_version, partial_version
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
project = "uritools"
|
|
22
|
+
copyright = "2014-2024 Thomas Kemmer"
|
|
23
|
+
release, version = get_version()
|
|
24
|
+
|
|
25
|
+
extensions = [
|
|
26
|
+
"sphinx.ext.autodoc",
|
|
27
|
+
"sphinx.ext.coverage",
|
|
28
|
+
"sphinx.ext.doctest",
|
|
29
|
+
"sphinx.ext.todo",
|
|
30
|
+
]
|
|
31
|
+
exclude_patterns = ["_build"]
|
|
32
|
+
master_doc = "index"
|
|
33
|
+
html_theme = "classic"
|
|
@@ -5,7 +5,7 @@ url = https://github.com/tkem/uritools/
|
|
|
5
5
|
author = Thomas Kemmer
|
|
6
6
|
author_email = tkemmer@computer.org
|
|
7
7
|
license = MIT
|
|
8
|
-
|
|
8
|
+
license_files = LICENSE
|
|
9
9
|
description = URI parsing, classification and composition
|
|
10
10
|
long_description = file: README.rst
|
|
11
11
|
classifiers =
|
|
@@ -406,52 +406,133 @@ class SplitTest(unittest.TestCase):
|
|
|
406
406
|
"Error parsing query list for %r" % query,
|
|
407
407
|
)
|
|
408
408
|
|
|
409
|
-
def
|
|
409
|
+
def test_ipv4_literal(self):
|
|
410
410
|
cases = [
|
|
411
|
-
("http://
|
|
411
|
+
("http://12.34.56.78/foo/", "12.34.56.78", None),
|
|
412
|
+
("http://12.34.56.78:/foo/", "12.34.56.78", None),
|
|
412
413
|
("http://12.34.56.78:5432/foo/", "12.34.56.78", 5432),
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
(
|
|
414
|
+
]
|
|
415
|
+
for uri, host, port in cases:
|
|
416
|
+
for parts in (urisplit(uri), urisplit(uri.encode("ascii"))):
|
|
417
|
+
self.assertEqual(host, str(parts.gethost()))
|
|
418
|
+
self.assertEqual(port, parts.getport())
|
|
419
|
+
|
|
420
|
+
def test_ipv6_literal(self):
|
|
421
|
+
cases = [
|
|
422
|
+
("http://[::1]:5432/foo/", "0000:0000:0000:0000:0000:0000:0000:0001", 5432),
|
|
423
|
+
(
|
|
424
|
+
"http://[dead:beef::1]:5432/foo/",
|
|
425
|
+
"dead:beef:0000:0000:0000:0000:0000:0001",
|
|
426
|
+
5432,
|
|
427
|
+
),
|
|
428
|
+
(
|
|
429
|
+
"http://[dead:beef::]:5432/foo/",
|
|
430
|
+
"dead:beef:0000:0000:0000:0000:0000:0000",
|
|
431
|
+
5432,
|
|
432
|
+
),
|
|
416
433
|
(
|
|
417
434
|
"http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]:5432/foo/",
|
|
418
435
|
"dead:beef:cafe:5417:affe:8fa3:deaf:feed",
|
|
419
436
|
5432,
|
|
420
437
|
),
|
|
421
|
-
("http://[::
|
|
422
|
-
(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
(
|
|
438
|
+
("http://[::1]/foo/", "0000:0000:0000:0000:0000:0000:0000:0001", None),
|
|
439
|
+
(
|
|
440
|
+
"http://[dead:beef::1]/foo/",
|
|
441
|
+
"dead:beef:0000:0000:0000:0000:0000:0001",
|
|
442
|
+
None,
|
|
443
|
+
),
|
|
444
|
+
(
|
|
445
|
+
"http://[dead:beef::]/foo/",
|
|
446
|
+
"dead:beef:0000:0000:0000:0000:0000:0000",
|
|
447
|
+
None,
|
|
448
|
+
),
|
|
428
449
|
(
|
|
429
450
|
"http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/",
|
|
430
451
|
"dead:beef:cafe:5417:affe:8fa3:deaf:feed",
|
|
431
452
|
None,
|
|
432
453
|
),
|
|
433
|
-
("http://[::
|
|
434
|
-
(
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
(
|
|
454
|
+
("http://[::1]:/foo/", "0000:0000:0000:0000:0000:0000:0000:0001", None),
|
|
455
|
+
(
|
|
456
|
+
"http://[dead:beef::1]:/foo/",
|
|
457
|
+
"dead:beef:0000:0000:0000:0000:0000:0001",
|
|
458
|
+
None,
|
|
459
|
+
),
|
|
460
|
+
(
|
|
461
|
+
"http://[dead:beef::]:/foo/",
|
|
462
|
+
"dead:beef:0000:0000:0000:0000:0000:0000",
|
|
463
|
+
None,
|
|
464
|
+
),
|
|
440
465
|
(
|
|
441
466
|
"http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]:/foo/",
|
|
442
467
|
"dead:beef:cafe:5417:affe:8fa3:deaf:feed",
|
|
443
468
|
None,
|
|
444
469
|
),
|
|
445
|
-
("http://[::12.34.56.78]:/foo/", "::c22:384e", None),
|
|
446
|
-
("http://[::ffff:12.34.56.78]:/foo/", "::ffff:c22:384e", None),
|
|
447
470
|
]
|
|
448
471
|
for uri, host, port in cases:
|
|
472
|
+
for parts in (urisplit(uri), urisplit(uri.encode("ascii"))):
|
|
473
|
+
self.assertEqual(host, parts.gethost().exploded)
|
|
474
|
+
self.assertEqual(port, parts.getport())
|
|
475
|
+
|
|
476
|
+
def test_ipv4_mapped_literal(self):
|
|
477
|
+
# since Python 3.13, the "alternative form" is used for
|
|
478
|
+
# IPv4-mapped addresses, see RFC 4291 2.2 p.3
|
|
479
|
+
cases = [
|
|
480
|
+
(
|
|
481
|
+
"http://[::12.34.56.78]:5432/foo/",
|
|
482
|
+
[
|
|
483
|
+
"0000:0000:0000:0000:0000:0000:0c22:384e",
|
|
484
|
+
"0000:0000:0000:0000:0000:0000:12.34.56.78",
|
|
485
|
+
],
|
|
486
|
+
5432,
|
|
487
|
+
),
|
|
488
|
+
(
|
|
489
|
+
"http://[::ffff:12.34.56.78]:5432/foo/",
|
|
490
|
+
[
|
|
491
|
+
"0000:0000:0000:0000:0000:ffff:0c22:384e",
|
|
492
|
+
"0000:0000:0000:0000:0000:ffff:12.34.56.78",
|
|
493
|
+
],
|
|
494
|
+
5432,
|
|
495
|
+
),
|
|
496
|
+
(
|
|
497
|
+
"http://[::12.34.56.78]/foo/",
|
|
498
|
+
[
|
|
499
|
+
"0000:0000:0000:0000:0000:0000:0c22:384e",
|
|
500
|
+
"0000:0000:0000:0000:0000:0000:12.34.56.78",
|
|
501
|
+
],
|
|
502
|
+
None,
|
|
503
|
+
),
|
|
504
|
+
(
|
|
505
|
+
"http://[::ffff:12.34.56.78]/foo/",
|
|
506
|
+
[
|
|
507
|
+
"0000:0000:0000:0000:0000:ffff:0c22:384e",
|
|
508
|
+
"0000:0000:0000:0000:0000:ffff:12.34.56.78",
|
|
509
|
+
],
|
|
510
|
+
None,
|
|
511
|
+
),
|
|
512
|
+
(
|
|
513
|
+
"http://[::12.34.56.78]:/foo/",
|
|
514
|
+
[
|
|
515
|
+
"0000:0000:0000:0000:0000:0000:0c22:384e",
|
|
516
|
+
"0000:0000:0000:0000:0000:0000:12.34.56.78",
|
|
517
|
+
],
|
|
518
|
+
None,
|
|
519
|
+
),
|
|
520
|
+
(
|
|
521
|
+
"http://[::ffff:12.34.56.78]:/foo/",
|
|
522
|
+
[
|
|
523
|
+
"0000:0000:0000:0000:0000:ffff:0c22:384e",
|
|
524
|
+
"0000:0000:0000:0000:0000:ffff:12.34.56.78",
|
|
525
|
+
],
|
|
526
|
+
None,
|
|
527
|
+
),
|
|
528
|
+
]
|
|
529
|
+
for uri, hosts, port in cases:
|
|
449
530
|
parts = urisplit(uri)
|
|
450
|
-
self.
|
|
451
|
-
self.assertEqual(
|
|
531
|
+
self.assertIn(parts.gethost().exploded, hosts)
|
|
532
|
+
self.assertEqual(parts.getport(), port)
|
|
452
533
|
parts = urisplit(uri.encode("ascii"))
|
|
453
|
-
self.
|
|
454
|
-
self.assertEqual(
|
|
534
|
+
self.assertIn(parts.gethost().exploded, hosts)
|
|
535
|
+
self.assertEqual(parts.getport(), port)
|
|
455
536
|
|
|
456
537
|
def test_invalid_ip_literal(self):
|
|
457
538
|
uris = [
|
uritools-4.0.2/docs/conf.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
project = "uritools"
|
|
2
|
-
copyright = "2014-2023 Thomas Kemmer"
|
|
3
|
-
version = "4.0"
|
|
4
|
-
release = "4.0.2"
|
|
5
|
-
|
|
6
|
-
extensions = [
|
|
7
|
-
"sphinx.ext.autodoc",
|
|
8
|
-
"sphinx.ext.coverage",
|
|
9
|
-
"sphinx.ext.doctest",
|
|
10
|
-
"sphinx.ext.todo",
|
|
11
|
-
]
|
|
12
|
-
exclude_patterns = ["_build"]
|
|
13
|
-
master_doc = "index"
|
|
14
|
-
html_theme = "default"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|