hfutils 0.4.3__tar.gz → 0.4.4__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 (76) hide show
  1. {hfutils-0.4.3/hfutils.egg-info → hfutils-0.4.4}/PKG-INFO +1 -1
  2. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/config/meta.py +1 -1
  3. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/repository/__init__.py +1 -0
  4. hfutils-0.4.4/hfutils/repository/url.py +86 -0
  5. {hfutils-0.4.3 → hfutils-0.4.4/hfutils.egg-info}/PKG-INFO +1 -1
  6. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils.egg-info/SOURCES.txt +1 -0
  7. {hfutils-0.4.3 → hfutils-0.4.4}/LICENSE +0 -0
  8. {hfutils-0.4.3 → hfutils-0.4.4}/MANIFEST.in +0 -0
  9. {hfutils-0.4.3 → hfutils-0.4.4}/README.md +0 -0
  10. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/__init__.py +0 -0
  11. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/__main__.py +0 -0
  12. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/archive/__init__.py +0 -0
  13. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/archive/base.py +0 -0
  14. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/archive/rar.py +0 -0
  15. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/archive/sevenz.py +0 -0
  16. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/archive/tar.py +0 -0
  17. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/archive/zip.py +0 -0
  18. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/cache/__init__.py +0 -0
  19. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/cache/delete.py +0 -0
  20. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/config/__init__.py +0 -0
  21. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/__init__.py +0 -0
  22. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/base.py +0 -0
  23. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/cli.py +0 -0
  24. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/clone.py +0 -0
  25. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/dispatch.py +0 -0
  26. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/download.py +0 -0
  27. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/ils.py +0 -0
  28. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/index.py +0 -0
  29. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/ls.py +0 -0
  30. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/ls_repo.py +0 -0
  31. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/rollback.py +0 -0
  32. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/tree.py +0 -0
  33. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/upload.py +0 -0
  34. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/entry/whoami.py +0 -0
  35. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/index/__init__.py +0 -0
  36. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/index/fetch.py +0 -0
  37. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/index/hash.py +0 -0
  38. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/index/local_fetch.py +0 -0
  39. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/index/make.py +0 -0
  40. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/index/validate.py +0 -0
  41. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/operate/__init__.py +0 -0
  42. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/operate/base.py +0 -0
  43. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/operate/download.py +0 -0
  44. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/operate/upload.py +0 -0
  45. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/operate/validate.py +0 -0
  46. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/repository/base.py +0 -0
  47. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/repository/clone.py +0 -0
  48. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/repository/rollback.py +0 -0
  49. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/__init__.py +0 -0
  50. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/archive.py +0 -0
  51. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/binary.py +0 -0
  52. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/data.py +0 -0
  53. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/download.py +0 -0
  54. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/irregular_repo.json +0 -0
  55. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/logging.py +0 -0
  56. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/model.py +0 -0
  57. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/number.py +0 -0
  58. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/path.py +0 -0
  59. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/session.py +0 -0
  60. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/temp.py +0 -0
  61. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/tqdm_.py +0 -0
  62. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/type_.py +0 -0
  63. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils/utils/walk.py +0 -0
  64. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils.egg-info/dependency_links.txt +0 -0
  65. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils.egg-info/entry_points.txt +0 -0
  66. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils.egg-info/requires.txt +0 -0
  67. {hfutils-0.4.3 → hfutils-0.4.4}/hfutils.egg-info/top_level.txt +0 -0
  68. {hfutils-0.4.3 → hfutils-0.4.4}/requirements-7z.txt +0 -0
  69. {hfutils-0.4.3 → hfutils-0.4.4}/requirements-build.txt +0 -0
  70. {hfutils-0.4.3 → hfutils-0.4.4}/requirements-doc.txt +0 -0
  71. {hfutils-0.4.3 → hfutils-0.4.4}/requirements-rar.txt +0 -0
  72. {hfutils-0.4.3 → hfutils-0.4.4}/requirements-test.txt +0 -0
  73. {hfutils-0.4.3 → hfutils-0.4.4}/requirements-transfer.txt +0 -0
  74. {hfutils-0.4.3 → hfutils-0.4.4}/requirements.txt +0 -0
  75. {hfutils-0.4.3 → hfutils-0.4.4}/setup.cfg +0 -0
  76. {hfutils-0.4.3 → hfutils-0.4.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hfutils
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Useful utilities for huggingface
5
5
  Home-page: https://github.com/deepghs/hfutils
6
6
  Author: narugo1992
@@ -7,7 +7,7 @@ Overview:
7
7
  __TITLE__ = 'hfutils'
8
8
 
9
9
  #: Version of this project.
10
- __VERSION__ = '0.4.3'
10
+ __VERSION__ = '0.4.4'
11
11
 
12
12
  #: Short description of the project, will be included in ``setup.py``.
13
13
  __DESCRIPTION__ = 'Useful utilities for huggingface'
@@ -5,3 +5,4 @@ Overview:
5
5
  from .base import hf_hub_repo_url
6
6
  from .clone import hf_hub_clone
7
7
  from .rollback import hf_hub_rollback
8
+ from .url import hf_hub_repo_path_url, hf_hub_repo_file_url
@@ -0,0 +1,86 @@
1
+ """
2
+ This module provides functions for generating URLs related to Hugging Face Hub repositories.
3
+
4
+ It includes functions to create URLs for repository paths and files, which can be useful
5
+ for accessing and referencing resources within Hugging Face Hub repositories.
6
+ """
7
+
8
+ from typing import Optional
9
+ from urllib.parse import quote_plus, urljoin
10
+
11
+ from .base import hf_hub_repo_url
12
+ from ..utils.path import RepoTypeTyping, hf_normpath
13
+
14
+
15
+ def hf_hub_repo_path_url(repo_id: str, path: str, repo_type: RepoTypeTyping = 'dataset',
16
+ revision: str = 'main', endpoint: Optional[str] = None) -> str:
17
+ """
18
+ Generate the URL for a path within a Hugging Face Hub repository.
19
+
20
+ This function constructs a URL that points to a specific path within a Hugging Face Hub repository.
21
+ It's useful for creating links to directories or files in the repository's web interface.
22
+
23
+ :param repo_id: The repository ID (e.g., 'username/repo-name').
24
+ :type repo_id: str
25
+ :param path: The path within the repository to generate the URL for.
26
+ :type path: str
27
+ :param repo_type: The type of the repository. Defaults to 'dataset'.
28
+ :type repo_type: RepoTypeTyping, optional
29
+ :param revision: The revision (branch, tag, or commit) to use. Defaults to 'main'.
30
+ :type revision: str, optional
31
+ :param endpoint: The API endpoint to use. If None, the default endpoint will be used.
32
+ :type endpoint: str, optional
33
+
34
+ :return: The URL for the specified path in the Hugging Face Hub repository.
35
+ :rtype: str
36
+
37
+ :example:
38
+ >>> url = hf_hub_repo_path_url('username/my-dataset', 'data/train.csv')
39
+ >>> print(url)
40
+ https://huggingface.co/datasets/username/my-dataset/tree/main/data/train.csv
41
+ """
42
+ repo_url = hf_hub_repo_url(
43
+ repo_id=repo_id,
44
+ repo_type=repo_type,
45
+ endpoint=endpoint,
46
+ )
47
+ return urljoin(repo_url + '/', hf_normpath(f'tree/{quote_plus(revision)}/{hf_normpath(path)}'))
48
+
49
+
50
+ def hf_hub_repo_file_url(repo_id: str, path: str, repo_type: RepoTypeTyping = 'dataset',
51
+ revision: str = 'main', endpoint: Optional[str] = None) -> str:
52
+ """
53
+ Generate the URL for a file within a Hugging Face Hub repository.
54
+
55
+ This function constructs a URL that points to a specific file within a Hugging Face Hub repository.
56
+ It's useful for creating links to view files in the repository's web interface.
57
+
58
+ :param repo_id: The repository ID (e.g., 'username/repo-name').
59
+ :type repo_id: str
60
+ :param path: The path to the file within the repository.
61
+ :type path: str
62
+ :param repo_type: The type of the repository. Defaults to 'dataset'.
63
+ :type repo_type: RepoTypeTyping, optional
64
+ :param revision: The revision (branch, tag, or commit) to use. Defaults to 'main'.
65
+ :type revision: str, optional
66
+ :param endpoint: The API endpoint to use. If None, the default endpoint will be used.
67
+ :type endpoint: str, optional
68
+
69
+ :return: The URL for the specified file in the Hugging Face Hub repository.
70
+ :rtype: str
71
+
72
+ :example:
73
+ >>> url = hf_hub_repo_file_url('username/my-model', 'config.json')
74
+ >>> print(url)
75
+ https://huggingface.co/username/my-model/blob/main/config.json
76
+
77
+ .. note::
78
+ This is not the downloadable URL of the file in the repository.
79
+ For downloading URLs, use :func:`huggingface_hub.hf_hub_url`.
80
+ """
81
+ repo_url = hf_hub_repo_url(
82
+ repo_id=repo_id,
83
+ repo_type=repo_type,
84
+ endpoint=endpoint,
85
+ )
86
+ return urljoin(repo_url + '/', hf_normpath(f'blob/{quote_plus(revision)}/{hf_normpath(path)}'))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hfutils
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Useful utilities for huggingface
5
5
  Home-page: https://github.com/deepghs/hfutils
6
6
  Author: narugo1992
@@ -56,6 +56,7 @@ hfutils/repository/__init__.py
56
56
  hfutils/repository/base.py
57
57
  hfutils/repository/clone.py
58
58
  hfutils/repository/rollback.py
59
+ hfutils/repository/url.py
59
60
  hfutils/utils/__init__.py
60
61
  hfutils/utils/archive.py
61
62
  hfutils/utils/binary.py
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