Ë
    èlÖi  ã                   ó4   — d dl Z d dlZd dlmZ d dlmZ dd„Zy)é    N)ÚOrderedDict)ÚStringIOc                 óV  — |s…t         j                  j                  |«      st        j                  |«       | j	                  «       D ]=  \  }}t         j                  j                  |d|z  «      } |j                  |fd|i|¤Ž Œ? y	d}t        «       }	| j	                  «       D ]N  \  }}t        «       }
 |j                  |
fi |¤Ž t        j                  |
j                  «       t        ¬«      |	|<   ŒP t        |d«      r|}d}nat         j                  j                  |«      }|r4t         j                  j                  |«      st        j                  |«       t        |d«      }d|dœ}|j                  |«       t        j                   |	|fi |¤Ž |r|�|j#                  «        y	y	y	)
as  
    Write :class:`TableSet` to either a set of JSON files for each table or
    a single nested JSON file.

    See :meth:`.Table.to_json` for additional details.

    :param path:
        Path to the directory to write the JSON file(s) to. If nested is
        `True`, this should be a file path or file-like object to write to.
    :param nested:
        If `True`, the output will be a single nested JSON file with each
        Table's key paired with a list of row objects. Otherwise, the output
        will be a set of files for each table. Defaults to `False`.
    :param indent:
        See :meth:`Table.to_json`.
    z%s.jsonÚindentT)Úobject_pairs_hookÚwriteFÚw)Úensure_asciir   N)ÚosÚpathÚexistsÚmakedirsÚitemsÚjoinÚto_jsonr   r   ÚjsonÚloadsÚgetvalueÚhasattrÚdirnameÚopenÚupdateÚdumpÚclose)Úselfr   Únestedr   ÚkwargsÚnameÚtableÚfilepathr   Útableset_dictÚoutputÚfÚdirpathÚjson_kwargss                 ú[/var/www/html/strategist-ai/venv_dbt/lib/python3.12/site-packages/agate/tableset/to_json.pyr   r      s`  € ñ" Ü�w‰w�~‰~˜dÔ#Ü�K‰K˜ÔàŸ:™:›<ò 	=‰KˆD�%Ü—w‘w—|‘| D¨)°dÑ*:Ó;ˆHàˆE�M‰M˜(Ñ<¨6Ð<°VÓ<ñ	=ð
 ˆÜ#›ˆàŸ:™:›<ò 	_‰KˆD�%Ü“ZˆFØˆE�M‰M˜&Ñ+ FÒ+Ü"&§*¡*¨V¯_©_Ó->ÔR]Ô"^ˆM˜$Òð	_ô
 �4˜Ô!ØˆAØ‰Eä—g‘g—o‘o dÓ+ˆGáœrŸw™wŸ~™~¨gÔ6Ü—‘˜GÔ$ä�T˜3“ˆAà',¸Ñ?ˆà×Ñ˜6Ô"Ü�	‰	�- Ñ2 kÒ2á�Q�]Ø�G‰G�Ið #ˆ5ó    )FN)r   r   Úcollectionsr   Úior   r   © r'   r&   ú<module>r+      s   ðÛ Û 	Ý #Ý ô3r'   