hfutils 0.3.1__tar.gz → 0.3.2__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.
- {hfutils-0.3.1/hfutils.egg-info → hfutils-0.3.2}/PKG-INFO +23 -23
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/config/meta.py +1 -1
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/__init__.py +1 -0
- hfutils-0.3.2/hfutils/utils/number.py +46 -0
- {hfutils-0.3.1 → hfutils-0.3.2/hfutils.egg-info}/PKG-INFO +23 -23
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils.egg-info/SOURCES.txt +1 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/LICENSE +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/MANIFEST.in +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/README.md +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/__init__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/__main__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/archive/__init__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/archive/base.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/archive/rar.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/archive/sevenz.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/archive/tar.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/archive/zip.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/cache/__init__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/cache/delete.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/config/__init__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/__init__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/base.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/cli.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/clone.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/dispatch.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/download.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/index.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/ls.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/ls_repo.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/rollback.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/upload.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/entry/whoami.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/index/__init__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/index/fetch.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/index/hash.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/index/make.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/index/validate.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/operate/__init__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/operate/base.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/operate/download.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/operate/upload.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/operate/validate.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/repository/__init__.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/repository/base.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/repository/clone.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/repository/rollback.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/binary.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/download.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/irregular_repo.json +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/logging.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/path.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/temp.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/tqdm_.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils/utils/walk.py +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils.egg-info/dependency_links.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils.egg-info/entry_points.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils.egg-info/requires.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/hfutils.egg-info/top_level.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/requirements-7z.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/requirements-build.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/requirements-doc.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/requirements-rar.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/requirements-test.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/requirements-transfer.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/requirements.txt +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/setup.cfg +0 -0
- {hfutils-0.3.1 → hfutils-0.3.2}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hfutils
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Useful utilities for huggingface
|
|
5
5
|
Home-page: https://github.com/deepghs/hfutils
|
|
6
6
|
Author: narugo1992
|
|
@@ -28,6 +28,28 @@ Requires-Dist: click>=7
|
|
|
28
28
|
Requires-Dist: tzlocal
|
|
29
29
|
Requires-Dist: natsort
|
|
30
30
|
Requires-Dist: urlobject
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: coverage>=5; extra == "test"
|
|
33
|
+
Requires-Dist: mock>=4.0.3; extra == "test"
|
|
34
|
+
Requires-Dist: flake8~=3.5; extra == "test"
|
|
35
|
+
Requires-Dist: testfixtures>=6.18.5; extra == "test"
|
|
36
|
+
Requires-Dist: pytest~=6.2.5; extra == "test"
|
|
37
|
+
Requires-Dist: pytest-cov~=3.0.0; extra == "test"
|
|
38
|
+
Requires-Dist: pytest-mock~=3.6.1; extra == "test"
|
|
39
|
+
Requires-Dist: pytest-xdist>=1.34.0; extra == "test"
|
|
40
|
+
Requires-Dist: pytest-rerunfailures~=10.2; extra == "test"
|
|
41
|
+
Requires-Dist: pytest-timeout~=2.0.2; extra == "test"
|
|
42
|
+
Requires-Dist: pytest-benchmark~=3.4.0; extra == "test"
|
|
43
|
+
Requires-Dist: easydict<2,>=1.7; extra == "test"
|
|
44
|
+
Requires-Dist: testtools>=2; extra == "test"
|
|
45
|
+
Requires-Dist: where>=1.0.2; extra == "test"
|
|
46
|
+
Requires-Dist: responses>=0.20.0; extra == "test"
|
|
47
|
+
Requires-Dist: natsort; extra == "test"
|
|
48
|
+
Provides-Extra: 7z
|
|
49
|
+
Requires-Dist: py7zr; extra == "7z"
|
|
50
|
+
Provides-Extra: build
|
|
51
|
+
Requires-Dist: pyinstaller<5,>=4.7; extra == "build"
|
|
52
|
+
Requires-Dist: setuptools<70; extra == "build"
|
|
31
53
|
Provides-Extra: doc
|
|
32
54
|
Requires-Dist: Jinja2>=3.0.0; extra == "doc"
|
|
33
55
|
Requires-Dist: sphinx>=3.2.0; extra == "doc"
|
|
@@ -52,28 +74,6 @@ Provides-Extra: transfer
|
|
|
52
74
|
Requires-Dist: hf-transfer; extra == "transfer"
|
|
53
75
|
Provides-Extra: rar
|
|
54
76
|
Requires-Dist: rarfile; extra == "rar"
|
|
55
|
-
Provides-Extra: 7z
|
|
56
|
-
Requires-Dist: py7zr; extra == "7z"
|
|
57
|
-
Provides-Extra: build
|
|
58
|
-
Requires-Dist: pyinstaller<5,>=4.7; extra == "build"
|
|
59
|
-
Requires-Dist: setuptools<70; extra == "build"
|
|
60
|
-
Provides-Extra: test
|
|
61
|
-
Requires-Dist: coverage>=5; extra == "test"
|
|
62
|
-
Requires-Dist: mock>=4.0.3; extra == "test"
|
|
63
|
-
Requires-Dist: flake8~=3.5; extra == "test"
|
|
64
|
-
Requires-Dist: testfixtures>=6.18.5; extra == "test"
|
|
65
|
-
Requires-Dist: pytest~=6.2.5; extra == "test"
|
|
66
|
-
Requires-Dist: pytest-cov~=3.0.0; extra == "test"
|
|
67
|
-
Requires-Dist: pytest-mock~=3.6.1; extra == "test"
|
|
68
|
-
Requires-Dist: pytest-xdist>=1.34.0; extra == "test"
|
|
69
|
-
Requires-Dist: pytest-rerunfailures~=10.2; extra == "test"
|
|
70
|
-
Requires-Dist: pytest-timeout~=2.0.2; extra == "test"
|
|
71
|
-
Requires-Dist: pytest-benchmark~=3.4.0; extra == "test"
|
|
72
|
-
Requires-Dist: easydict<2,>=1.7; extra == "test"
|
|
73
|
-
Requires-Dist: testtools>=2; extra == "test"
|
|
74
|
-
Requires-Dist: where>=1.0.2; extra == "test"
|
|
75
|
-
Requires-Dist: responses>=0.20.0; extra == "test"
|
|
76
|
-
Requires-Dist: natsort; extra == "test"
|
|
77
77
|
|
|
78
78
|
# hfutils
|
|
79
79
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from .binary import is_binary_file
|
|
2
2
|
from .download import download_file
|
|
3
3
|
from .logging import ColoredFormatter
|
|
4
|
+
from .number import number_to_tag
|
|
4
5
|
from .path import hf_normpath, hf_fs_path, parse_hf_fs_path, HfFileSystemPath
|
|
5
6
|
from .temp import TemporaryDirectory
|
|
6
7
|
from .tqdm_ import tqdm
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
_NUM_TAGS = [
|
|
2
|
+
('n<1K', 0, 1_000),
|
|
3
|
+
('1K<n<10K', 1_000, 10_000),
|
|
4
|
+
('10K<n<100K', 10_000, 100_000),
|
|
5
|
+
('100K<n<1M', 100_000, 1_000_000),
|
|
6
|
+
('1M<n<10M', 1_000_000, 10_000_000),
|
|
7
|
+
('10M<n<100M', 10_000_000, 100_000_000),
|
|
8
|
+
('100M<n<1B', 100_000_000, 1_000_000_000),
|
|
9
|
+
('1B<n<10B', 1_000_000_000, 10_000_000_000),
|
|
10
|
+
('10B<n<100B', 10_000_000_000, 100_000_000_000),
|
|
11
|
+
('100B<n<1T', 100_000_000_000, 1_000_000_000_000),
|
|
12
|
+
('n>1T', 1_000_000_000_000, None),
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def number_to_tag(v):
|
|
17
|
+
"""
|
|
18
|
+
Categorize a number into a predefined range and return the corresponding tag for HuggingFace repository metadata.
|
|
19
|
+
|
|
20
|
+
:param v: The number to categorize.
|
|
21
|
+
:type v: int or float
|
|
22
|
+
|
|
23
|
+
:return: A string tag representing the range in which the number falls.
|
|
24
|
+
:rtype: str
|
|
25
|
+
|
|
26
|
+
:raises ValueError: If no matching tag is found for the given number.
|
|
27
|
+
:raises TypeError: If the input value is not numeric type.
|
|
28
|
+
|
|
29
|
+
Examples:
|
|
30
|
+
|
|
31
|
+
>>> number_to_tag(500)
|
|
32
|
+
'n<1K'
|
|
33
|
+
>>> number_to_tag(5000)
|
|
34
|
+
'1K<n<10K'
|
|
35
|
+
>>> number_to_tag(1000000000000)
|
|
36
|
+
'n>1T'
|
|
37
|
+
"""
|
|
38
|
+
if not isinstance(v, (int, float)):
|
|
39
|
+
raise TypeError(f'Invalid type, only numeric types are supported - {v!r}')
|
|
40
|
+
|
|
41
|
+
for tag, min_, max_ in _NUM_TAGS:
|
|
42
|
+
if (max_ is not None and min_ <= v < max_) or \
|
|
43
|
+
(max_ is None and min_ <= v):
|
|
44
|
+
return tag
|
|
45
|
+
|
|
46
|
+
raise ValueError(f'No tags found for {v!r}')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hfutils
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Useful utilities for huggingface
|
|
5
5
|
Home-page: https://github.com/deepghs/hfutils
|
|
6
6
|
Author: narugo1992
|
|
@@ -28,6 +28,28 @@ Requires-Dist: click>=7
|
|
|
28
28
|
Requires-Dist: tzlocal
|
|
29
29
|
Requires-Dist: natsort
|
|
30
30
|
Requires-Dist: urlobject
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: coverage>=5; extra == "test"
|
|
33
|
+
Requires-Dist: mock>=4.0.3; extra == "test"
|
|
34
|
+
Requires-Dist: flake8~=3.5; extra == "test"
|
|
35
|
+
Requires-Dist: testfixtures>=6.18.5; extra == "test"
|
|
36
|
+
Requires-Dist: pytest~=6.2.5; extra == "test"
|
|
37
|
+
Requires-Dist: pytest-cov~=3.0.0; extra == "test"
|
|
38
|
+
Requires-Dist: pytest-mock~=3.6.1; extra == "test"
|
|
39
|
+
Requires-Dist: pytest-xdist>=1.34.0; extra == "test"
|
|
40
|
+
Requires-Dist: pytest-rerunfailures~=10.2; extra == "test"
|
|
41
|
+
Requires-Dist: pytest-timeout~=2.0.2; extra == "test"
|
|
42
|
+
Requires-Dist: pytest-benchmark~=3.4.0; extra == "test"
|
|
43
|
+
Requires-Dist: easydict<2,>=1.7; extra == "test"
|
|
44
|
+
Requires-Dist: testtools>=2; extra == "test"
|
|
45
|
+
Requires-Dist: where>=1.0.2; extra == "test"
|
|
46
|
+
Requires-Dist: responses>=0.20.0; extra == "test"
|
|
47
|
+
Requires-Dist: natsort; extra == "test"
|
|
48
|
+
Provides-Extra: 7z
|
|
49
|
+
Requires-Dist: py7zr; extra == "7z"
|
|
50
|
+
Provides-Extra: build
|
|
51
|
+
Requires-Dist: pyinstaller<5,>=4.7; extra == "build"
|
|
52
|
+
Requires-Dist: setuptools<70; extra == "build"
|
|
31
53
|
Provides-Extra: doc
|
|
32
54
|
Requires-Dist: Jinja2>=3.0.0; extra == "doc"
|
|
33
55
|
Requires-Dist: sphinx>=3.2.0; extra == "doc"
|
|
@@ -52,28 +74,6 @@ Provides-Extra: transfer
|
|
|
52
74
|
Requires-Dist: hf-transfer; extra == "transfer"
|
|
53
75
|
Provides-Extra: rar
|
|
54
76
|
Requires-Dist: rarfile; extra == "rar"
|
|
55
|
-
Provides-Extra: 7z
|
|
56
|
-
Requires-Dist: py7zr; extra == "7z"
|
|
57
|
-
Provides-Extra: build
|
|
58
|
-
Requires-Dist: pyinstaller<5,>=4.7; extra == "build"
|
|
59
|
-
Requires-Dist: setuptools<70; extra == "build"
|
|
60
|
-
Provides-Extra: test
|
|
61
|
-
Requires-Dist: coverage>=5; extra == "test"
|
|
62
|
-
Requires-Dist: mock>=4.0.3; extra == "test"
|
|
63
|
-
Requires-Dist: flake8~=3.5; extra == "test"
|
|
64
|
-
Requires-Dist: testfixtures>=6.18.5; extra == "test"
|
|
65
|
-
Requires-Dist: pytest~=6.2.5; extra == "test"
|
|
66
|
-
Requires-Dist: pytest-cov~=3.0.0; extra == "test"
|
|
67
|
-
Requires-Dist: pytest-mock~=3.6.1; extra == "test"
|
|
68
|
-
Requires-Dist: pytest-xdist>=1.34.0; extra == "test"
|
|
69
|
-
Requires-Dist: pytest-rerunfailures~=10.2; extra == "test"
|
|
70
|
-
Requires-Dist: pytest-timeout~=2.0.2; extra == "test"
|
|
71
|
-
Requires-Dist: pytest-benchmark~=3.4.0; extra == "test"
|
|
72
|
-
Requires-Dist: easydict<2,>=1.7; extra == "test"
|
|
73
|
-
Requires-Dist: testtools>=2; extra == "test"
|
|
74
|
-
Requires-Dist: where>=1.0.2; extra == "test"
|
|
75
|
-
Requires-Dist: responses>=0.20.0; extra == "test"
|
|
76
|
-
Requires-Dist: natsort; extra == "test"
|
|
77
77
|
|
|
78
78
|
# hfutils
|
|
79
79
|
|
|
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
|
|
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
|
|
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
|