diff --git a/src/huggingface_hub/hf_api.py b/src/huggingface_hub/hf_api.py index d979155d16e..7d548657163 100644 --- a/src/huggingface_hub/hf_api.py +++ b/src/huggingface_hub/hf_api.py @@ -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, @@ -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() @@ -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(