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.
Files changed (27) hide show
  1. {uritools-4.0.2 → uritools-4.0.3}/CHANGELOG.rst +6 -0
  2. {uritools-4.0.2 → uritools-4.0.3}/LICENSE +1 -1
  3. {uritools-4.0.2 → uritools-4.0.3}/MANIFEST.in +1 -0
  4. {uritools-4.0.2/src/uritools.egg-info → uritools-4.0.3}/PKG-INFO +1 -1
  5. uritools-4.0.3/docs/conf.py +33 -0
  6. {uritools-4.0.2 → uritools-4.0.3}/setup.cfg +1 -1
  7. {uritools-4.0.2 → uritools-4.0.3}/src/uritools/__init__.py +1 -1
  8. {uritools-4.0.2 → uritools-4.0.3/src/uritools.egg-info}/PKG-INFO +1 -1
  9. {uritools-4.0.2 → uritools-4.0.3}/tests/test_split.py +106 -25
  10. {uritools-4.0.2 → uritools-4.0.3}/tox.ini +0 -1
  11. uritools-4.0.2/docs/conf.py +0 -14
  12. {uritools-4.0.2 → uritools-4.0.3}/README.rst +0 -0
  13. {uritools-4.0.2 → uritools-4.0.3}/docs/.gitignore +0 -0
  14. {uritools-4.0.2 → uritools-4.0.3}/docs/Makefile +0 -0
  15. {uritools-4.0.2 → uritools-4.0.3}/docs/index.rst +0 -0
  16. {uritools-4.0.2 → uritools-4.0.3}/pyproject.toml +0 -0
  17. {uritools-4.0.2 → uritools-4.0.3}/setup.py +0 -0
  18. {uritools-4.0.2 → uritools-4.0.3}/src/uritools.egg-info/SOURCES.txt +0 -0
  19. {uritools-4.0.2 → uritools-4.0.3}/src/uritools.egg-info/dependency_links.txt +0 -0
  20. {uritools-4.0.2 → uritools-4.0.3}/src/uritools.egg-info/top_level.txt +0 -0
  21. {uritools-4.0.2 → uritools-4.0.3}/tests/__init__.py +0 -0
  22. {uritools-4.0.2 → uritools-4.0.3}/tests/test_classify.py +0 -0
  23. {uritools-4.0.2 → uritools-4.0.3}/tests/test_compose.py +0 -0
  24. {uritools-4.0.2 → uritools-4.0.3}/tests/test_defrag.py +0 -0
  25. {uritools-4.0.2 → uritools-4.0.3}/tests/test_encoding.py +0 -0
  26. {uritools-4.0.2 → uritools-4.0.3}/tests/test_join.py +0 -0
  27. {uritools-4.0.2 → uritools-4.0.3}/tests/test_unsplit.py +0 -0
@@ -1,3 +1,9 @@
1
+ v4.0.3 (2024-05-28)
2
+ ===================
3
+
4
+ - Prepare for Python 3.13.
5
+
6
+
1
7
  v4.0.2 (2023-08-30)
2
8
  ===================
3
9
 
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2022 Thomas Kemmer
3
+ Copyright (c) 2014-2024 Thomas Kemmer
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
@@ -3,6 +3,7 @@ include LICENSE
3
3
  include MANIFEST.in
4
4
  include README.rst
5
5
  include tox.ini
6
+ exclude .readthedocs.yaml
6
7
 
7
8
  recursive-include docs *
8
9
  prune docs/_build
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uritools
3
- Version: 4.0.2
3
+ Version: 4.0.3
4
4
  Summary: URI parsing, classification and composition
5
5
  Home-page: https://github.com/tkem/uritools/
6
6
  Author: Thomas Kemmer
@@ -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
- license_file = LICENSE
8
+ license_files = LICENSE
9
9
  description = URI parsing, classification and composition
10
10
  long_description = file: README.rst
11
11
  classifiers =
@@ -34,7 +34,7 @@ __all__ = (
34
34
  "uriunsplit",
35
35
  )
36
36
 
37
- __version__ = "4.0.2"
37
+ __version__ = "4.0.3"
38
38
 
39
39
 
40
40
  # RFC 3986 2.2. Reserved Characters
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uritools
3
- Version: 4.0.2
3
+ Version: 4.0.3
4
4
  Summary: URI parsing, classification and composition
5
5
  Home-page: https://github.com/tkem/uritools/
6
6
  Author: Thomas Kemmer
@@ -406,52 +406,133 @@ class SplitTest(unittest.TestCase):
406
406
  "Error parsing query list for %r" % query,
407
407
  )
408
408
 
409
- def test_ip_literal(self):
409
+ def test_ipv4_literal(self):
410
410
  cases = [
411
- ("http://Test.python.org:5432/foo/", "test.python.org", 5432),
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
- ("http://[::1]:5432/foo/", "::1", 5432),
414
- ("http://[dead:beef::1]:5432/foo/", "dead:beef::1", 5432),
415
- ("http://[dead:beef::]:5432/foo/", "dead:beef::", 5432),
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://[::12.34.56.78]:5432/foo/", "::c22:384e", 5432),
422
- ("http://[::ffff:12.34.56.78]:5432/foo/", "::ffff:c22:384e", 5432),
423
- ("http://Test.python.org/foo/", "test.python.org", None),
424
- ("http://12.34.56.78/foo/", "12.34.56.78", None),
425
- ("http://[::1]/foo/", "::1", None),
426
- ("http://[dead:beef::1]/foo/", "dead:beef::1", None),
427
- ("http://[dead:beef::]/foo/", "dead:beef::", None),
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://[::12.34.56.78]/foo/", "::c22:384e", None),
434
- ("http://[::ffff:12.34.56.78]/foo/", "::ffff:c22:384e", None),
435
- ("http://Test.python.org:/foo/", "test.python.org", None),
436
- ("http://12.34.56.78:/foo/", "12.34.56.78", None),
437
- ("http://[::1]:/foo/", "::1", None),
438
- ("http://[dead:beef::1]:/foo/", "dead:beef::1", None),
439
- ("http://[dead:beef::]:/foo/", "dead:beef::", None),
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.assertEqual(host, str(parts.gethost()))
451
- self.assertEqual(port, parts.getport())
531
+ self.assertIn(parts.gethost().exploded, hosts)
532
+ self.assertEqual(parts.getport(), port)
452
533
  parts = urisplit(uri.encode("ascii"))
453
- self.assertEqual(host, str(parts.gethost()))
454
- self.assertEqual(port, parts.getport())
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 = [
@@ -3,7 +3,6 @@ envlist = check-manifest,docs,doctest,flake8,py
3
3
 
4
4
  [testenv]
5
5
  deps =
6
- coverage
7
6
  pytest
8
7
  pytest-cov
9
8
  commands =
@@ -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