Ë
    èlÖiƒ  ã                  ód   — d dl mZ d dlZd dlZd dlmZ d dlmZmZ d dl	m
Z
 d„ Zd„ Zd
d„Zd
d	„Zy)é    )ÚannotationsN)ÚMapping)ÚfieldsÚis_dataclass)ÚHashableBaseModelc                ó"   — t        | t        «      S )N)Ú
isinstancer   ©Úobjs    úi/var/www/html/strategist-ai/venv_dbt/lib/python3.12/site-packages/dbt_semantic_interfaces/pretty_print.pyÚis_hashable_base_modelr      s   € Ü�cÔ,Ó-Ð-ó    c                ó  — | €yt        | t        t        t        f«      r| S t        | t        t
        f«      rRg }| D ]  }|j                  t        |«      «       Œ t        | t        «      r|S t        | t
        «      rt        |«      S J ‚t        | t        «      r3i }| j                  «       D ]  \  }}t        |«      |t        |«      <   Œ |S t        | «      rUdt        | «      j                  i}t        | «      D ].  }t        t        | |j                  «      «      ||j                  <   Œ0 |S t!        | «      rMdt        | «      j                  i}| j#                  «       j                  «       D ]  \  }}t        |«      ||<   Œ |S | S )an  Convert the object that will look nicely when fed into the PrettyPrinter.

    Main change is that dataclasses will have a field with the class name. In Python 3.10, the pretty printer class will
    support dataclasses, so we can remove this once we're on 3.10. Also tried the prettyprint package with dataclasses,
    but that prints full names for the classes e.g. a.b.MyClass and it also always added line breaks, even if an object
    could fit on one line, so preferred to not use that.

    e.g.
    metricflow.specs.DimensionSpec(
        element_name='country',
        entity_links=()
    ),

    Instead, the below will print something like:

    {'class': 'DimensionSpec',
     'element_name': 'country_latest',
     'entity_links': ({'class': 'EntitySpec',
                           'element_name': 'listing',
                           'entity_links': ()},)}
    NÚclass)r	   ÚstrÚintÚfloatÚlistÚtupleÚappendÚ_to_pretty_printable_objectr   Úitemsr   ÚtypeÚ__name__r   ÚgetattrÚnamer   Údict)r   ÚresultÚitemÚkeyÚvalueÚfieldÚ
field_names          r   r   r      su  € ð, €{Øä	�Cœ#œs¤EÐ*Ô	+Øˆ
ä	�Cœ$¤˜Ô	'ØˆØò 	=ˆDØ�M‰MÔ5°dÓ;Õ<ð	=ô �cœ4Ô ØˆMÜ˜œUÔ#Ü˜“=Ð àˆuä	�CœÔ	!ØˆØŸ)™)›+ò 	Z‰JˆC�Ü7RÐSXÓ7YˆFÔ.¨sÓ3Ò4ð	Zàˆä	�cÔ	Øœ4 ›9×-Ñ-Ð.ˆä˜C“[ò 	WˆEÜ!<¼WÀSÈ%Ï*É*Ó=UÓ!VˆF�5—:‘:Òð	WàˆÜ	 Ô	$Øœ4 ›9×-Ñ-Ð.ˆà!$§¡£×!1Ñ!1Ó!3ò 	DÑˆJ˜Ü!<¸UÓ!CˆF�:Òð	Dàˆð €Jr   c                óh   — t        | t        «      r| S t        j                  t	        | «      dd¬«      S )z0Return the object as a string that looks pretty.éP   F)ÚwidthÚ
sort_dicts)r	   r   ÚpprintÚpformatr   r
   s    r   Úpretty_formatr*   N   s+   € ä�#”sÔØˆ
Ü�>‰>Ô5°cÓ:À"ÐQVÔWÐWr   c                 ó   — g }| D ]  }|j                  t        |«      «       Œ |j                  «       D ]H  \  }}|j                  |› d�«       |j                  t        j                  t        |«      d¬«      «       ŒJ dj                  |«      S )aö  Prints a series of objects with many fields in a pretty way.

    See _to_pretty_printable_object() for more context on this format. Looks like:

    measure_recipe:
    {'class': 'MeasureRecipe',
     'measure_node': ReadSqlSourceNode(node_id=rss_140),
     'required_local_linkable_specs': ({'class': 'DimensionSpec',
                                        'element_name': 'is_instant',
                                        'entity_links': ()},),
     'join_linkable_instances_recipes': ()}

    ú:z    )Úprefixú
)r   r*   r   ÚtextwrapÚindentÚjoin)ÚargsÚkwargsr   Úargr    r!   s         r   Úpformat_big_objectsr5   U   sƒ   € ð €EØò )ˆØ�‰”] 3Ó'Õ(ð)à—l‘l“nò K‰
ˆˆUØ�‰˜�u˜A�YÔØ�‰”X—_‘_¤]°5Ó%9À&ÔIÕJðKð �9‰9�UÓÐr   )Úreturnr   )Ú
__future__r   r(   r/   Úcollections.abcr   Údataclassesr   r   Ú,dbt_semantic_interfaces.implementations.baser   r   r   r*   r5   © r   r   ú<module>r<      s-   ðÝ "ã Û Ý #ß ,å Jò.ò<ó~Xôr   