
    .~ht                         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y)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y)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      R/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/lml/utils.pyr   zPythonObjectEncoder.default   sU    sCd4jIz)Oc?+&&tS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3r   c                 b    	 t        |       S # t        $ r t        j                  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)   '   s5    ,-- :<NOs   
 !.c                     t        |       }d| v r'| j                  d      }|dd  D ]  }t        ||      } t        j	                  d| z          |S )N.   zfound )
__import__splitgetattrr&   debug)r(   plugin_modulemodulesmodules       r   r$   r$   0   s_    12M
  $**3/abk 	;F#M6:M	;IIh++,r   c                     	 | j                  dd      d   }t        |      }| j                  d      }|dd D ]  }t        ||      } |S # t        $ r t
        j                  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;"#56$$S)abk 	;F#M6:M	; +-?@s   AA !A,)r   sysloggingjsonr   r   version_infor   	getLoggerr   r&   r   r"   r)   r$   r7   r   r   r   <module>r=      s\      #	qQg!,+ ,4r   