
    Mf
                     X    d dl Z d dlZd dlZddlmZmZmZmZ ddlm	Z	 d Z
d
dZdd	ZdS )    N   )generate_class_filegenerate_importsgenerate_classes_filesgenerate_class)ComponentRegistryc                     t          | d          5 }|                                }t          j        t          j                                      |          }d d d            n# 1 swxY w Y   |S )Nzutf-8)encoding)object_pairs_hook)openreadjsonJSONDecodercollectionsOrderedDictdecode)metadata_path	data_filejson_stringdatas       `/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/dash/development/component_loader.py_get_metadatar      s    	mg	.	.	. 
)nn&&+2IJJJQQ
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 

 Ks   AA%%A),A)default_namespacec                 h   t           j                            |           g }t          |           }|D ]~}||         }|                    d                                                              d          d         }t          ||d         |d         |d          }|                    |           |S )a  Load React component metadata into a format Dash can parse.

    Usage: load_components('../../component-suites/lib/metadata.json')

    Keyword arguments:
    metadata_path -- a path to a JSON file created by
    [`react-docgen`](https://github.com/reactjs/react-docgen).

    Returns:
    components -- a list of component objects with keys
    `type`, `valid_kwargs`, and `setup`.
    /.r   propsdescriptionN)r   registryaddr   splitpopr   append)r   	namespace
componentsr   componentPathcomponentDataname	components           r   load_componentsr*      s     ""9---J''D  % %]+ ""3''++--33C88;"-(-*F	SW
 
	 	)$$$$    lib/metadata.jsonc                    t          |          }t          j                            | d          }t          j                            |          rt          j        |           t          | |t                    }t          | |           dS )ag  Load React component metadata into a format Dash can parse, then create
    Python class files.

    Usage: generate_classes()

    Keyword arguments:
    namespace -- name of the generated Python package (also output dir)

    metadata_path -- a path to a JSON file created by
    [`react-docgen`](https://github.com/reactjs/react-docgen).

    Returns:
    z_imports_.pyN)	r   ospathjoinexistsremover   r   r   )r$   r   r   imports_pathr%   s        r   generate_classesr4   ?   sx     ''D7<<	>::L 
w~~l##  
	,'	49LMMJ Y
+++++r+   )r   )r,   )r   r   r.   _py_components_generationr   r   r   r   base_componentr   r   r*   r4    r+   r   <module>r8      s         				            . - - - - -  $ $ $ $N, , , , , ,r+   