Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
LysandreJik committed Mar 31, 2022
1 parent b1dd936 commit 0616aaf
Showing 1 changed file with 55 additions and 19 deletions.
74 changes: 55 additions & 19 deletions src/huggingface_hub/hf_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,30 +256,28 @@ class SpaceInfo:
This is a "dataclass" like container that just sets on itself
any attribute passed by the server.
Args:
id (Optional[str]):
id of space
sha (Optional[str]):
repo sha at this particular revision
lastModified (Optional[str]):
date of last commit to repo
siblings (Optional[List[Dict]]):
list of files that constitute the Space
private (Optional[bool]):
is the repo private
author (Optional[str]):
repo author
Args:
id (`str`, *optional*):
id of space
sha (`str`, *optional*):
repo sha at this particular revision
lastModified (`str`, *optional*):
date of last commit to repo
siblings (`List[Dict]`, *optional*):
list of files that constitute the Space
private (`bool`, *optional*):
is the repo private
author (`str`, *optional*):
repo author
"""

def __init__(
self,
*,
id: Optional[str] = None, # id of space
sha: Optional[str] = None, # commit sha at the specified revision
lastModified: Optional[str] = None, # date of last commit to repo
siblings: Optional[
List[Dict]
] = None, # list of files that constitute the Space
id: Optional[str] = None,
sha: Optional[str] = None,
lastModified: Optional[str] = None,
siblings: Optional[List[Dict]] = None,
private: Optional[bool] = None,
author: Optional[str] = None,
**kwargs,
Expand Down Expand Up @@ -1048,6 +1046,25 @@ def space_info(
Get info on one specific Space on huggingface.co
Space can be private if you pass an acceptable token.
Args:
repo_id (`str`):
A namespace (user or an organization) and a repo name separated
by a `/`.
revision (`str`, *optional*):
The revision of the space repository from which to get the
information.
token (`str`, *optional*):
An authentication token [1]_.
timeout (`float`, *optional*):
Whether to set a timeout for the request to the Hub.
Returns:
[`SpaceInfo`]: The space repository information.
References:
- [1] https://huggingface.co/settings/tokens
"""
if token is None:
token = HfFolder.get_token()
Expand All @@ -1074,6 +1091,25 @@ def repo_info(
) -> Union[ModelInfo, DatasetInfo, SpaceInfo]:
"""
Get the info object for a given repo of a given type.
Args:
repo_id (`str`):
A namespace (user or an organization) and a repo name separated
by a `/`.
revision (`str`, *optional*):
The revision of the repository from which to get the
information.
token (`str`, *optional*):
An authentication token [1]_.
timeout (`float`, *optional*):
Whether to set a timeout for the request to the Hub.
Returns:
`Union[SpaceInfo, DatasetInfo, ModelInfo]`: The repository information.
References:
- [1] https://huggingface.co/settings/tokens
"""
if repo_type is None or repo_type == "model":
return self.model_info(
Expand Down

0 comments on commit 0616aaf

Please sign in to comment.