�
lMg�� � � � d dl Z d dlZd dlmZ d dlmZmZmZmZm Z m
Z
d dlZd dlZd dl
mZ d dlmZ d dlmZmZmZmZmZmZmZ d dlmZmZmZ dd lmZ dd
lm Z ddl!m"Z"m#Z#m$Z$ e#jJ e&� Z' ee(� jR dz d
z Z* ee(� jR dz dz Z+ ejX d� Z- G d� d� Z. G d� de.� Z/ G d� de.� Z0 G d� de.� Z1de2ded fd�Z3de
e2ef dee fd�Z4de
e2ef deddfd�Z5dd ddddd!�d"e2d#e2d$e2d%e2d&e2d'ed(e2d)e2d*ee2 d+e6d,ee2 d-ee2 d.ee2 d/ee2 defd0�Z7e$dd ddddd dd1�d2e2d3ed4ee2 d5e6d6ee2 d7ee2 d8ee2 d9ee2 d:e6d;ee2 de2fd<�� Z8y)=� N)�Path)�Any�Dict�Literal�Optional�Type�Union)�hf_hub_download)�upload_file)�CardData�DatasetCardData�
EvalResult�
ModelCardData�
SpaceCardData�eval_results_to_model_index�model_index_to_eval_results)�get_session�is_jinja_available� yaml_dump� )� constants)�EntryNotFoundError)�SoftTemporaryDirectory�logging�validate_hf_hub_args� templateszmodelcard_template.mdzdatasetcard_template.mdz1^(\s*---[\r\n]+)([\S\s]*?)([\r\n]+---(\r\n|\n|$))c �f � e Zd ZeZeZdZddede fd�Z
ed� � Zej defd�� Zd� Zdeeef fd �Ze ddeeef dee d
ee de fd�� Zddee fd�Z dded
ee dee dee dee dee dee dee fd�Ze ddedee dee fd�� Zy
) �RepoCard�model�content�ignore_metadata_errorsc � � || _ || _ y)a� Initialize a RepoCard from string content. The content should be a
Markdown file with a YAML block at the beginning and a Markdown body.
Args:
content (`str`): The content of the Markdown file.
Example:
```python
>>> from huggingface_hub.repocard import RepoCard
>>> text = '''
... ---
... language: en
... license: mit
... ---
...
... # My repo
... '''
>>> card = RepoCard(text)
>>> card.data.to_dict()
{'language': 'en', 'license': 'mit'}
>>> card.text
'\n# My repo\n'
```
<Tip>
Raises the following error:
- [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
when the content of the repo card metadata is not a dictionary.
</Tip>
N)r! r )�selfr r! s �dC:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\huggingface_hub/repocard.py�__init__zRepoCard.__init__+ s � �H '=��#���� c � � t | j � xs d}d|� | j j || j �� � |� d|� | j
� �S )zLThe content of the RepoCard, including the YAML block and the Markdown body.�
�---)�
line_break�original_order)�_detect_line_ending�_content�data�to_yaml�_original_order�text)r# r* s r$ r zRepoCard.contentR s} � � )����7�?�4�
��Z�L����!2�!2�j�Y]�Ym�Ym�!2�!n� o�pz�o{�{~� @J� K� LP� LU� LU� KV� W� Wr&