tldextract 5.1.0__tar.gz → 5.1.1__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.
- tldextract-5.1.1/.github/workflows/ci.yml +40 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/CHANGELOG.md +6 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/PKG-INFO +3 -2
- {tldextract-5.1.0 → tldextract-5.1.1}/README.md +1 -1
- {tldextract-5.1.0 → tldextract-5.1.1}/pyproject.toml +1 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/custom_suffix_test.py +7 -3
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/test_cache.py +5 -6
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/test_parallel.py +18 -3
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/_version.py +2 -2
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/cache.py +8 -8
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/PKG-INFO +3 -2
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/SOURCES.txt +1 -1
- {tldextract-5.1.0 → tldextract-5.1.1}/tox.ini +1 -1
- tldextract-5.1.0/.travis.yml +0 -23
- {tldextract-5.1.0 → tldextract-5.1.1}/.github/FUNDING.yml +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/.gitignore +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/LICENSE +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/setup.cfg +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/__init__.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/cli_test.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/conftest.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/fixtures/fake_suffix_list_fixture.dat +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/integration_test.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/main_test.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tests/test_trie.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/.tld_set_snapshot +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/__init__.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/__main__.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/cli.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/py.typed +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/remote.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/suffix_list.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/tldextract.py +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/dependency_links.txt +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/entry_points.txt +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/requires.txt +0 -0
- {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/top_level.txt +0 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
name: build
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
strategy:
|
6
|
+
fail-fast: false
|
7
|
+
matrix:
|
8
|
+
os: [macos-latest, windows-latest, ubuntu-latest]
|
9
|
+
language:
|
10
|
+
[
|
11
|
+
{python-version: "3.8", toxenv: "py38"},
|
12
|
+
{python-version: "3.9", toxenv: "py39"},
|
13
|
+
{python-version: "3.10", toxenv: "py310"},
|
14
|
+
{python-version: "3.11", toxenv: "py311"},
|
15
|
+
{python-version: "3.12", toxenv: "py312"},
|
16
|
+
{python-version: "pypy3.8", toxenv: "pypy38"},
|
17
|
+
]
|
18
|
+
include:
|
19
|
+
- os: ubuntu-latest
|
20
|
+
language: {python-version: "3.8", toxenv: "codestyle"}
|
21
|
+
- os: ubuntu-latest
|
22
|
+
language: {python-version: "3.8", toxenv: "lint"}
|
23
|
+
- os: ubuntu-latest
|
24
|
+
language: {python-version: "3.8", toxenv: "typecheck"}
|
25
|
+
runs-on: ${{ matrix.os }}
|
26
|
+
steps:
|
27
|
+
- name: Check out repository
|
28
|
+
uses: actions/checkout@v4
|
29
|
+
- name: Setup Python
|
30
|
+
uses: actions/setup-python@v4
|
31
|
+
with:
|
32
|
+
python-version: ${{ matrix.language.python-version }}
|
33
|
+
- name: Install Python requirements
|
34
|
+
run: |
|
35
|
+
pip install --upgrade pip
|
36
|
+
pip install --upgrade --editable '.[testing]'
|
37
|
+
- name: Test
|
38
|
+
run: tox
|
39
|
+
env:
|
40
|
+
TOXENV: ${{ matrix.language.toxenv }}
|
@@ -3,6 +3,12 @@
|
|
3
3
|
After upgrading, update your cache file by deleting it or via `tldextract
|
4
4
|
--update`.
|
5
5
|
|
6
|
+
## 5.1.1 (2023-11-16)
|
7
|
+
|
8
|
+
* Bugfixes
|
9
|
+
* Fix path join on Windows ([#314](https://github.com/john-kurkowski/tldextract/issues/314))
|
10
|
+
* Support Python 3.12
|
11
|
+
|
6
12
|
## 5.1.0 (2023-11-05)
|
7
13
|
|
8
14
|
* Features
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tldextract
|
3
|
-
Version: 5.1.
|
3
|
+
Version: 5.1.1
|
4
4
|
Summary: Accurately separates a URL's subdomain, domain, and public suffix, using the Public Suffix List (PSL). By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well.
|
5
5
|
Author-email: John Kurkowski <john.kurkowski@gmail.com>
|
6
6
|
License: BSD-3-Clause
|
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.9
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
17
18
|
Requires-Python: >=3.8
|
18
19
|
Description-Content-Type: text/markdown
|
19
20
|
License-File: LICENSE
|
@@ -33,7 +34,7 @@ Requires-Dist: tox; extra == "testing"
|
|
33
34
|
Requires-Dist: types-filelock; extra == "testing"
|
34
35
|
Requires-Dist: types-requests; extra == "testing"
|
35
36
|
|
36
|
-
# tldextract [](https://badge.fury.io/py/tldextract) [](https://badge.fury.io/py/tldextract) [](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml)
|
37
38
|
|
38
39
|
`tldextract` accurately separates a URL's subdomain, domain, and public suffix,
|
39
40
|
using [the Public Suffix List (PSL)](https://publicsuffix.org).
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# tldextract [](https://badge.fury.io/py/tldextract) [](https://badge.fury.io/py/tldextract) [](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml)
|
2
2
|
|
3
3
|
`tldextract` accurately separates a URL's subdomain, domain, and public suffix,
|
4
4
|
using [the Public Suffix List (PSL)](https://publicsuffix.org).
|
@@ -2,13 +2,17 @@
|
|
2
2
|
|
3
3
|
import os
|
4
4
|
import tempfile
|
5
|
+
from pathlib import Path
|
5
6
|
|
6
7
|
import tldextract
|
7
8
|
from tldextract.tldextract import ExtractResult
|
8
9
|
|
9
|
-
FAKE_SUFFIX_LIST_URL =
|
10
|
-
os.path.dirname(os.path.abspath(__file__)),
|
11
|
-
|
10
|
+
FAKE_SUFFIX_LIST_URL = Path(
|
11
|
+
os.path.dirname(os.path.abspath(__file__)),
|
12
|
+
"fixtures",
|
13
|
+
"fake_suffix_list_fixture.dat",
|
14
|
+
).as_uri()
|
15
|
+
|
12
16
|
EXTRA_SUFFIXES = ["foo1", "bar1", "baz1"]
|
13
17
|
|
14
18
|
extract_using_fake_suffix_list = tldextract.TLDExtract(
|
@@ -1,7 +1,6 @@
|
|
1
1
|
"""Test the caching functionality."""
|
2
2
|
from __future__ import annotations
|
3
3
|
|
4
|
-
import os.path
|
5
4
|
import sys
|
6
5
|
import types
|
7
6
|
from collections.abc import Hashable
|
@@ -56,14 +55,14 @@ def test_get_cache_dir(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
56
55
|
monkeypatch.delenv("HOME", raising=False)
|
57
56
|
monkeypatch.delenv("XDG_CACHE_HOME", raising=False)
|
58
57
|
monkeypatch.delenv("TLDEXTRACT_CACHE", raising=False)
|
59
|
-
assert get_cache_dir().endswith("tldextract
|
58
|
+
assert get_cache_dir().endswith(str(Path("tldextract", ".suffix_cache")))
|
60
59
|
|
61
60
|
# with home set, but not anything else specified, use XDG_CACHE_HOME default
|
62
61
|
monkeypatch.setenv("HOME", "/home/john")
|
63
62
|
monkeypatch.delenv("XDG_CACHE_HOME", raising=False)
|
64
63
|
monkeypatch.delenv("TLDEXTRACT_CACHE", raising=False)
|
65
|
-
assert get_cache_dir() ==
|
66
|
-
"/home/john", ".cache/python-tldextract", pkg_identifier
|
64
|
+
assert get_cache_dir() == str(
|
65
|
+
Path("/home/john", ".cache/python-tldextract", pkg_identifier)
|
67
66
|
)
|
68
67
|
|
69
68
|
# if XDG_CACHE_HOME is set, use it
|
@@ -71,8 +70,8 @@ def test_get_cache_dir(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
71
70
|
monkeypatch.setenv("XDG_CACHE_HOME", "/my/alt/cache")
|
72
71
|
monkeypatch.delenv("TLDEXTRACT_CACHE", raising=False)
|
73
72
|
|
74
|
-
assert get_cache_dir() ==
|
75
|
-
"/my/alt/cache/python-tldextract", pkg_identifier
|
73
|
+
assert get_cache_dir() == str(
|
74
|
+
Path("/my/alt/cache/python-tldextract", pkg_identifier)
|
76
75
|
)
|
77
76
|
|
78
77
|
# if TLDEXTRACT_CACHE is set, use it
|
@@ -1,7 +1,8 @@
|
|
1
1
|
"""Test ability to run in parallel with shared cache."""
|
2
2
|
|
3
|
+
from __future__ import annotations
|
4
|
+
|
3
5
|
import os
|
4
|
-
import os.path
|
5
6
|
from multiprocessing import Pool
|
6
7
|
from pathlib import Path
|
7
8
|
|
@@ -43,9 +44,23 @@ def test_cache_cleared_by_other_process(
|
|
43
44
|
extract("google.com")
|
44
45
|
orig_unlink = os.unlink
|
45
46
|
|
46
|
-
def
|
47
|
+
def is_relative_to(path: Path, other_path: str | Path) -> bool:
|
48
|
+
"""Return True if path is relative to other_path or False.
|
49
|
+
|
50
|
+
Taken from the Python 3.9 standard library.
|
51
|
+
Reference: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.is_relative_to
|
52
|
+
"""
|
53
|
+
try:
|
54
|
+
path.relative_to(other_path)
|
55
|
+
return True
|
56
|
+
except ValueError:
|
57
|
+
return False
|
58
|
+
|
59
|
+
def evil_unlink(filename: str | Path) -> None:
|
47
60
|
"""Simulate someone deletes the file right before we try to."""
|
48
|
-
if filename.startswith(cache_dir)
|
61
|
+
if (isinstance(filename, str) and filename.startswith(cache_dir)) or (
|
62
|
+
isinstance(filename, Path) and is_relative_to(filename, cache_dir)
|
63
|
+
):
|
49
64
|
orig_unlink(filename)
|
50
65
|
orig_unlink(filename)
|
51
66
|
|
@@ -6,9 +6,9 @@ import hashlib
|
|
6
6
|
import json
|
7
7
|
import logging
|
8
8
|
import os
|
9
|
-
import os.path
|
10
9
|
import sys
|
11
10
|
from collections.abc import Callable, Hashable, Iterable
|
11
|
+
from pathlib import Path
|
12
12
|
from typing import (
|
13
13
|
TypeVar,
|
14
14
|
cast,
|
@@ -79,15 +79,15 @@ def get_cache_dir() -> str:
|
|
79
79
|
if xdg_cache_home is None:
|
80
80
|
user_home = os.getenv("HOME", None)
|
81
81
|
if user_home:
|
82
|
-
xdg_cache_home =
|
82
|
+
xdg_cache_home = str(Path(user_home, ".cache"))
|
83
83
|
|
84
84
|
if xdg_cache_home is not None:
|
85
|
-
return
|
86
|
-
xdg_cache_home, "python-tldextract", get_pkg_unique_identifier()
|
85
|
+
return str(
|
86
|
+
Path(xdg_cache_home, "python-tldextract", get_pkg_unique_identifier())
|
87
87
|
)
|
88
88
|
|
89
89
|
# fallback to trying to use package directory itself
|
90
|
-
return
|
90
|
+
return str(Path(os.path.dirname(__file__), ".suffix_cache"))
|
91
91
|
|
92
92
|
|
93
93
|
class DiskCache:
|
@@ -153,7 +153,7 @@ class DiskCache:
|
|
153
153
|
self.file_ext + ".lock"
|
154
154
|
):
|
155
155
|
try:
|
156
|
-
os.unlink(
|
156
|
+
os.unlink(str(Path(root, filename)))
|
157
157
|
except FileNotFoundError:
|
158
158
|
pass
|
159
159
|
except OSError as exc:
|
@@ -165,10 +165,10 @@ class DiskCache:
|
|
165
165
|
def _key_to_cachefile_path(
|
166
166
|
self, namespace: str, key: str | dict[str, Hashable]
|
167
167
|
) -> str:
|
168
|
-
namespace_path =
|
168
|
+
namespace_path = str(Path(self.cache_dir, namespace))
|
169
169
|
hashed_key = _make_cache_key(key)
|
170
170
|
|
171
|
-
cache_path =
|
171
|
+
cache_path = str(Path(namespace_path, hashed_key + self.file_ext))
|
172
172
|
|
173
173
|
return cache_path
|
174
174
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tldextract
|
3
|
-
Version: 5.1.
|
3
|
+
Version: 5.1.1
|
4
4
|
Summary: Accurately separates a URL's subdomain, domain, and public suffix, using the Public Suffix List (PSL). By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well.
|
5
5
|
Author-email: John Kurkowski <john.kurkowski@gmail.com>
|
6
6
|
License: BSD-3-Clause
|
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.9
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
17
18
|
Requires-Python: >=3.8
|
18
19
|
Description-Content-Type: text/markdown
|
19
20
|
License-File: LICENSE
|
@@ -33,7 +34,7 @@ Requires-Dist: tox; extra == "testing"
|
|
33
34
|
Requires-Dist: types-filelock; extra == "testing"
|
34
35
|
Requires-Dist: types-requests; extra == "testing"
|
35
36
|
|
36
|
-
# tldextract [](https://badge.fury.io/py/tldextract) [](https://badge.fury.io/py/tldextract) [](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml)
|
37
38
|
|
38
39
|
`tldextract` accurately separates a URL's subdomain, domain, and public suffix,
|
39
40
|
using [the Public Suffix List (PSL)](https://publicsuffix.org).
|
tldextract-5.1.0/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
dist: focal
|
2
|
-
language: python
|
3
|
-
matrix:
|
4
|
-
include:
|
5
|
-
- python: "3.8"
|
6
|
-
env: TOXENV=py38
|
7
|
-
- python: "3.9"
|
8
|
-
env: TOXENV=py39
|
9
|
-
- python: "3.10"
|
10
|
-
env: TOXENV=py310
|
11
|
-
- python: "3.11"
|
12
|
-
env: TOXENV=py311
|
13
|
-
- python: pypy3.8-7.3.9
|
14
|
-
dist: xenial
|
15
|
-
env: TOXENV=pypy3
|
16
|
-
- env: TOXENV=codestyle
|
17
|
-
- env: TOXENV=lint
|
18
|
-
- env: TOXENV=typecheck
|
19
|
-
python: "3.10"
|
20
|
-
install:
|
21
|
-
- pip install --upgrade pip
|
22
|
-
- pip install --upgrade --editable '.[testing]'
|
23
|
-
script: tox
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|