
    Eft                         d Z ddlZddlZddlmZmZ ej        d         dk    Z ej        e	          Z
 G d de          Zd Zd Zd	 Zd
 ZdS )z
    lml.utils
    ~~~~~~~~~~~~~~~~~~~

    json utils for dump plugin info class

    :copyright: (c) 2017-2020 by Onni Software Ltd.
    :license: New BSD License, see LICENSE for more details
    N)JSONEncoderdumps   c                       e Zd ZdZd ZdS )PythonObjectEncoderz-
    Custom object encoder for json dump
    c           	          t           t          t          t          t          t
          t          d           f}t          r|t          fz  }t          ||          rt          j        | |          S dt          |          iS )N_python_object)listdictstrintfloatbooltypePY2unicode
isinstancer   default)selfobja_list_of_typess      K/var/www/ffwdstore.be/apps/py-env/lib/python3.11/site-packages/lml/utils.pyr   zPythonObjectEncoder.default   sf    sCd4jjI 	*z)Oc?++ 	2&tS111 #c((++    N)__name__
__module____qualname____doc__r    r   r   r   r      s-         , , , , ,r   r   c                 .    t          | t                    S )z(
    Dump function keywords in json
    )cls)r   r   )keywordss    r   
json_dumpsr"       s     23333r   c                 v    	 t          |           S # t          $ r t                              d|             w xY w)zdynamically import a modulez"%s is absent or cannot be imported)
_do_importImportErrorlog	exception)plugin_module_names    r   	do_importr)   '   sJ    ,---   :<NOOOs    '8c                     t          |           }d| v r2|                     d          }|dd          D ]}t          ||          }t                              d| z              |S )N.   zfound )
__import__splitgetattrr&   debug)r(   plugin_modulemodulesmodules       r   r$   r$   0   su    122M
   $**3//abbk 	; 	;F#M6::MMIIh++,,,r   c                    	 |                      dd          d         }t          |          }|                     d          }|dd         D ]}t          ||          }|S # t          $ r t
                              d|            w xY w)zdynamically import a classr+   r,   r   NzFailed to import %s)rsplitr-   r.   r/   r%   r&   r'   )plugin_classr(   r1   r2   r3   s        r   do_import_classr7   :   s    	)00a88;"#566$$S))abbk 	; 	;F#M6::MM   +-?@@@s   AA! !'B)r   sysloggingjsonr   r   version_infor   	getLoggerr   r&   r   r"   r)   r$   r7   r   r   r   <module>r=      s     


  # # # # # # # #	qQg!!, , , , ,+ , , ,4 4 4        r   