o
    -g
                     @   sD   d dl Z d dlZd dlmZ d dlmZ dd Zdd Zdd	 ZdS )
    N)OrderedDict)Repoc                  C   s   d} d}dd |ddd |ddd	 |dd
}tj|r't| t| | D ] \}}td ||d  t	j
|d |d dd}|j|  q0d S )Nz31.0.1z../raw_dataz3https://github.com/unicode-cldr/cldr-dates-full.gitz{}/cldr_dates_full/)urldirz-https://github.com/unicode-cldr/cldr-core.gitz{}/cldr_core/z-https://github.com/unicode-cldr/cldr-rbnf.gitz{}/cldr_rbnf/)
dates_fullcorerbnfzClonning "{}" from: {}r   r   master)branch)formatospathisdirshutilrmtreemkdiritemsprintr   
clone_fromgitco)cldr_versionraw_data_directory	cldr_datanamedatarepo r   Y/var/www/html/django-vendor/venv/lib/python3.10/site-packages/dateparser_scripts/utils.pyget_raw_data   s(   

r   c                 C   s   t  }| D ]7\}}| |}d }|s|}n!t|tr'tt|t| }nt|tr2t||}n||kr8|}|r>|||< q|S )N)	r   r   get
isinstancelistsortedsetdictget_dict_difference)parent_dict
child_dictdifference_dictkeychild_valueparent_valuechild_specific_valuer   r   r   r&   &   s    


r&   c                    s   t  }  D ]2\}}||v r3t|tr|||  ||< qt|tr,t||| ||< q|| ||< q | ||< q fdd| D }|D ]}|| ||< qG|S )Nc                    s   g | ]
}|   vr|qS r   )keys).0r*   primary_dictr   r   
<listcomp>D   s    z!combine_dicts.<locals>.<listcomp>)r   r   r!   r"   r%   combine_dictsr.   )r1   supplementary_dictcombined_dictr*   valueremaining_keysr   r0   r   r3   8   s   


r3   )	r   r   collectionsr   r   r   r   r&   r3   r   r   r   r   <module>   s    