hfutils 0.3.0__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.
Files changed (67) hide show
  1. {hfutils-0.3.0/hfutils.egg-info → hfutils-0.3.2}/PKG-INFO +24 -24
  2. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/config/meta.py +1 -1
  3. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/__init__.py +1 -0
  4. hfutils-0.3.2/hfutils/utils/number.py +46 -0
  5. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/path.py +1 -1
  6. {hfutils-0.3.0 → hfutils-0.3.2/hfutils.egg-info}/PKG-INFO +24 -24
  7. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils.egg-info/SOURCES.txt +1 -0
  8. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils.egg-info/requires.txt +1 -1
  9. {hfutils-0.3.0 → hfutils-0.3.2}/requirements.txt +1 -1
  10. {hfutils-0.3.0 → hfutils-0.3.2}/LICENSE +0 -0
  11. {hfutils-0.3.0 → hfutils-0.3.2}/MANIFEST.in +0 -0
  12. {hfutils-0.3.0 → hfutils-0.3.2}/README.md +0 -0
  13. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/__init__.py +0 -0
  14. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/__main__.py +0 -0
  15. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/archive/__init__.py +0 -0
  16. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/archive/base.py +0 -0
  17. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/archive/rar.py +0 -0
  18. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/archive/sevenz.py +0 -0
  19. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/archive/tar.py +0 -0
  20. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/archive/zip.py +0 -0
  21. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/cache/__init__.py +0 -0
  22. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/cache/delete.py +0 -0
  23. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/config/__init__.py +0 -0
  24. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/__init__.py +0 -0
  25. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/base.py +0 -0
  26. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/cli.py +0 -0
  27. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/clone.py +0 -0
  28. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/dispatch.py +0 -0
  29. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/download.py +0 -0
  30. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/index.py +0 -0
  31. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/ls.py +0 -0
  32. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/ls_repo.py +0 -0
  33. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/rollback.py +0 -0
  34. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/upload.py +0 -0
  35. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/entry/whoami.py +0 -0
  36. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/index/__init__.py +0 -0
  37. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/index/fetch.py +0 -0
  38. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/index/hash.py +0 -0
  39. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/index/make.py +0 -0
  40. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/index/validate.py +0 -0
  41. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/operate/__init__.py +0 -0
  42. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/operate/base.py +0 -0
  43. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/operate/download.py +0 -0
  44. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/operate/upload.py +0 -0
  45. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/operate/validate.py +0 -0
  46. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/repository/__init__.py +0 -0
  47. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/repository/base.py +0 -0
  48. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/repository/clone.py +0 -0
  49. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/repository/rollback.py +0 -0
  50. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/binary.py +0 -0
  51. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/download.py +0 -0
  52. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/irregular_repo.json +0 -0
  53. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/logging.py +0 -0
  54. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/temp.py +0 -0
  55. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/tqdm_.py +0 -0
  56. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils/utils/walk.py +0 -0
  57. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils.egg-info/dependency_links.txt +0 -0
  58. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils.egg-info/entry_points.txt +0 -0
  59. {hfutils-0.3.0 → hfutils-0.3.2}/hfutils.egg-info/top_level.txt +0 -0
  60. {hfutils-0.3.0 → hfutils-0.3.2}/requirements-7z.txt +0 -0
  61. {hfutils-0.3.0 → hfutils-0.3.2}/requirements-build.txt +0 -0
  62. {hfutils-0.3.0 → hfutils-0.3.2}/requirements-doc.txt +0 -0
  63. {hfutils-0.3.0 → hfutils-0.3.2}/requirements-rar.txt +0 -0
  64. {hfutils-0.3.0 → hfutils-0.3.2}/requirements-test.txt +0 -0
  65. {hfutils-0.3.0 → hfutils-0.3.2}/requirements-transfer.txt +0 -0
  66. {hfutils-0.3.0 → hfutils-0.3.2}/setup.cfg +0 -0
  67. {hfutils-0.3.0 → 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.0
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
@@ -21,13 +21,35 @@ Requires-Python: >=3.8
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
23
  Requires-Dist: hbutils>=0.10.0
24
- Requires-Dist: huggingface_hub>=0.23
24
+ Requires-Dist: huggingface_hub!=0.24.0,!=0.24.1,>=0.23
25
25
  Requires-Dist: tqdm
26
26
  Requires-Dist: requests
27
27
  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
 
@@ -7,7 +7,7 @@ Overview:
7
7
  __TITLE__ = 'hfutils'
8
8
 
9
9
  #: Version of this project.
10
- __VERSION__ = '0.3.0'
10
+ __VERSION__ = '0.3.2'
11
11
 
12
12
  #: Short description of the project, will be included in ``setup.py``.
13
13
  __DESCRIPTION__ = 'Useful utilities for huggingface'
@@ -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}')
@@ -80,7 +80,7 @@ def _irregular_repos() -> Dict[RepoTypeTyping, Set[str]]:
80
80
  _RE_IR_PATH = re.compile(
81
81
  r'^(?P<repo_id>[^@/]+)(@(?P<revision>[^@/]+))?(/(?P<filename>[\s\S]+))?$')
82
82
  _RE_PATH = re.compile(
83
- r'^(?P<repo_id>[^@/]+/[^@/]+)(@(?P<revision>[^@/]+))?(/(?P<filename>[\s\S]+))?$')
83
+ r'^(?P<repo_id>[^@/]+/[^@/]+)(@(?P<revision>(refs/pr/\d+|[^@/]+)))?(/(?P<filename>[\s\S]+))?$')
84
84
 
85
85
 
86
86
  @dataclass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hfutils
3
- Version: 0.3.0
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
@@ -21,13 +21,35 @@ Requires-Python: >=3.8
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
23
  Requires-Dist: hbutils>=0.10.0
24
- Requires-Dist: huggingface_hub>=0.23
24
+ Requires-Dist: huggingface_hub!=0.24.0,!=0.24.1,>=0.23
25
25
  Requires-Dist: tqdm
26
26
  Requires-Dist: requests
27
27
  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
 
@@ -58,6 +58,7 @@ hfutils/utils/binary.py
58
58
  hfutils/utils/download.py
59
59
  hfutils/utils/irregular_repo.json
60
60
  hfutils/utils/logging.py
61
+ hfutils/utils/number.py
61
62
  hfutils/utils/path.py
62
63
  hfutils/utils/temp.py
63
64
  hfutils/utils/tqdm_.py
@@ -1,5 +1,5 @@
1
1
  hbutils>=0.10.0
2
- huggingface_hub>=0.23
2
+ huggingface_hub!=0.24.0,!=0.24.1,>=0.23
3
3
  tqdm
4
4
  requests
5
5
  click>=7
@@ -1,5 +1,5 @@
1
1
  hbutils>=0.10.0
2
- huggingface_hub>=0.23
2
+ huggingface_hub>=0.23,!=0.24.0,!=0.24.1
3
3
  tqdm
4
4
  requests
5
5
  click>=7
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