
    Xf                         d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlm	Z	  ej
        e          Z G d de	j        j                  ZdS )	zAn automagic module to use configuration data to configure and then
construct classes that fulfill the descendants of a :class:`~volatility3.framewo
rk.interfaces.configuration.ConfigurableInterface`.    N)List)	framework)	constants)
interfacesc            
       h    e Zd ZdZdZ	 	 d
dej        j        dedej	        j
        dee         fd	ZdS )ConstructionMagica  Constructs underlying layers.

    Class to run through the requirement tree of the :class:`~volatility3.framework.interfaces.configuration.ConfigurableInterface`
    and from the bottom of the tree upwards, attempt to construct all
    :class:`~volatility3.framework.interfaces.configuration.ConstructableRequirementInterface` based classes.

    :warning: This `automagic` should run first to allow existing configurations to have been constructed for use by later automagic
    r   NFcontextconfig_pathrequirementreturnc                 @   t          j        t          j        d                    g }|                    ||          rRt
          j                            ||j                  }|j	        
                                D ]}	  | ||||p|j                   n?# t          $ r2}	t                              t          j        d|	            Y d }	~	nd }	~	ww xY w|                    ||          }
|
ri|sg|j        s`t                              t          j        d|            |                    t
          j                            ||j                             |r|S t'          |t
          j        j                  r|                    ||           | |dd           g S )Nzvolatility3.framework.layers)optionalz!Construction Exception occurred: zFailed on requirement: d   zReconstruction finished)r   import_filessysmodulesunsatisfiedr   configuration	path_joinnamerequirementsvaluesr   	Exceptionvolloglogr   LOGLEVEL_VVVV
LOGLEVEL_Vappend
isinstance!ConstructableRequirementInterface	construct)selfr	   r
   r   progress_callbackr   resultsubreq_config_pathsubreqeinvalids              b/home/panchajanya/Development/work/volatility3/volatility3/framework/automagic/construct_layers.py__call__zConstructionMagic.__call__   s    	s{+IJKKK""7K88 '	< ",!9!C!C[-" " &299;;  D*!)!<V_	     !   JJ!/1XUV1X1X       
 !,,W6HII  	H 	 	JJ!,F2DFF   MM"0::.   
  <Z5W  < %%g{;;;(c#<===	s   ?B
C (CC)NF)__name__
__module____qualname____doc__priorityr   r	   ContextInterfacestrr   RequirementInterfacer   r*        r)   r   r      s|          H 8 8#48 8  -B	8 
c8 8 8 8 8 8r4   r   )r.   loggingr   typingr   volatility3r   volatility3.frameworkr   r   	getLoggerr+   r   	automagicAutomagicInterfacer   r3   r4   r)   <module>r<      s   7 7  



       ! ! ! ! ! ! + + + + + + , , , , , ,		8	$	$D D D D D
,? D D D D Dr4   