
    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y)	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            
           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y)
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   Ncontextconfig_pathrequirementreturnc                 T   t        j                  t        j                  d          g }|j	                  ||      r#t
        j                  j                  ||j                        }|j                  j                         D ]  }	  | ||||xs |j                         |j	                  ||      }
|
s3|r6|j                  rCt        j                  t        j"                  d|        |j%                  t
        j                  j                  ||j                                |r|S t'        |t
        j                  j(                        r|j+                  ||       |	 |dd       g S # t        $ r2}	t        j                  t        j                   d|	        Y d }	~	d }	~	ww xY w)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""7K8 ",!9!9!C!C[--" &2299; *!)!<V__	 !,,W6HI HJJ!,,12D1EF MM"00::.+4 Z55WW %%g{;(c#<=	; ! JJ!//3TUVTW1X s   E,,	F'5'F""F')NF)__name__
__module____qualname____doc__priorityr   r	   ContextInterfacestrr   RequirementInterfacer   r*        r)   r   r      s]     H 8##448 8  --BB	8 
c8r4   r   )r.   loggingr   typingr   volatility3r   volatility3.frameworkr   r   	getLoggerr+   r   	automagicAutomagicInterfacer   r3   r4   r)   <module>r<      sJ   7  
  ! + ,			8	$D
,,?? Dr4   