From 2e4d796e90d4d2f6d9d12f41acacee730d4e67fe Mon Sep 17 00:00:00 2001 From: Lucain Pouget Date: Tue, 27 Feb 2024 14:45:51 +0100 Subject: [PATCH 1/2] Fix Space variable when updatedAt is missing --- src/huggingface_hub/_space_api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/huggingface_hub/_space_api.py b/src/huggingface_hub/_space_api.py index ddfcd041d6..b3a721a046 100644 --- a/src/huggingface_hub/_space_api.py +++ b/src/huggingface_hub/_space_api.py @@ -139,16 +139,17 @@ class SpaceVariable: description (`str` or None): Description of the variable. Example: `"Model Repo ID of the implemented model"`. updatedAt (`datetime`): - datetime of the last update of the variable. + datetime of the last update of the variable (if any). """ key: str value: str description: Optional[str] - updated_at: datetime + updated_at: Optional[datetime] def __init__(self, key: str, values: Dict) -> None: self.key = key self.value = values["value"] self.description = values.get("description") - self.updated_at = parse_datetime(values["updatedAt"]) + updated_at = values.get("updatedAt") + self.updated_at = parse_datetime(updated_at) if updated_at is not None else None From b0a3a3ed601d7ab66076afd9eeac26fabae8ef29 Mon Sep 17 00:00:00 2001 From: Lucain Pouget Date: Tue, 27 Feb 2024 15:11:15 +0100 Subject: [PATCH 2/2] var --- src/huggingface_hub/_space_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/huggingface_hub/_space_api.py b/src/huggingface_hub/_space_api.py index b3a721a046..da70bd05a6 100644 --- a/src/huggingface_hub/_space_api.py +++ b/src/huggingface_hub/_space_api.py @@ -138,8 +138,8 @@ class SpaceVariable: Variable value. Example: `"the_model_repo_id"`. description (`str` or None): Description of the variable. Example: `"Model Repo ID of the implemented model"`. - updatedAt (`datetime`): - datetime of the last update of the variable (if any). + updatedAt (`datetime` or None): + datetime of the last update of the variable (if the variable has been updated at least once). """ key: str