
    3~h=                     h    d dl Z d dlmZ ddlmZ  G d de      Z G d de      Z G d	 d
e      Z	y)    N)ImproperlyConfigured   )import_attributec                        e Zd ZddZd Zd Zy)AppConfOptionsNc                     || _         t        |dd      | _        t        | j                        | _        t        |dd      | _        t        |dg       | _        i | _        y )Nholderzdjango.conf.settingsproxyFrequired)prefixgetattrholder_pathr   r	   r
   r   configured_data)selfmetar   s      U/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/appconf/base.py__init__zAppConfOptions.__init__
   sU    "43IJ&t'7'78T7E2
j"5!    c                     |j                  | j                  j                               r|S | j                  j                         d|j                         S )N_)
startswithr   upperr   names     r   prefixed_namezAppConfOptions.prefixed_name   s>    ??4;;,,./K++++-tzz|<<r   c                 .    | |_         i | _        i | _        y N)_metanamesdefaults)r   clsr   s      r   contribute_to_classz"AppConfOptions.contribute_to_class   s    	
r   r   )__name__
__module____qualname__r   r   r"    r   r   r   r      s    "=
r   r   c                   *     e Zd Z fdZd Zd Z xZS )AppConfMetaClassc           	         t         t        | 
  }|D cg c]  }t        |t              s| }}|s || |||      S |j	                  d      } || ||d|i      }|j	                  dd       }	|	r|	}
nt        dt        fi       }	t        |dd       }
t        |
dt        |
dd             }|;t        j                  |j                     }|j                  j                  d      d   }|j                  dt        |
|             |j                  d|	       |d d d   D ]  }t        |d      s|j                   j"                  j%                  |j                   j"                         |j                   j&                  j%                  |j                   j&                         |j                   j(                  j%                  |j                   j(                          t+        t,        j.                  t1        |j3                                     D ]^  }|j                   j5                  |      }||j                   j"                  |<   |j	                  |      |j                   j&                  |<   ` |j7                         D ]  \  }}|j                  ||        |j9                          |j                   j(                  j7                         D ]S  \  }}|j                   j5                  |      }t;        |j                   j<                  ||       |j                  ||       U |j                   j>                  D ]K  }|j                   j5                  |      }t        |j                   j<                  |      r?tA        d	|z         |S c c}w )
Nr$   Metar   	app_label.r   z#The required setting %s is missing.)!superr(   __new__
isinstancepoptypeobjectr   sysmodulesr$   r#   splitadd_to_classr   hasattrr   r   updater    r   filterstrisupperlistkeysr   items
_configuresetattrr	   r   r   )r!   r   basesattrs	super_newbparentsmodule	new_class	attr_metar   r   model_moduleparentr   value	__class__s                   r   r0   zAppConfMetaClass.__new__   s   *C8	#Gz!5E'F1GGS$u55 <(c4v0FG	IIfd+	DVfY3I9fd3Dx{D)IJ> ;;y';';<L!**005b9FwtV(DEvy1ddm 	2Fvw'%%,,V\\-?-?@((//0E0EF//66LL002		2 3;;UZZ\(:; 	FD%OO99$?M*7IOO!!$'6;iioIOO$$]3	F !;;= 	0KD%""4/	0 	$??::@@B 	0KD%%OO99$?MIOO**M5A""4/	0 OO,, 	HD%OO99$?M9??11=A* ,79F,G H H	H k Hs
   NNc                 \    t        |d      r|j                  | |       y t        | ||       y )Nr"   )r9   r"   rB   )r!   r   rM   s      r   r8   zAppConfMetaClass.add_to_classX   s)    5/0%%c40Cu%r   c                     |        }|j                   j                  j                         D ]  \  }}|j                   j                  j	                  |      }t        |j                   j                  ||      }t        |d|j                         z  d       }t        |      r ||      }|| j                   j                  |<    |j                         | j                   _	        y )Nzconfigure_%s)r   r   r@   r    getr   r	   lowercallabler   	configure)r!   objr   r   default_valuerM   callbacks          r   rA   zAppConfMetaClass._configure^   s    e#&99??#8#8#: 	4D-II..22=AMCII,,m]KEsNTZZ\$A4HH! .3CII%%d+	4 %(MMO		!r   )r#   r$   r%   r0   r8   rA   __classcell__)rN   s   @r   r(   r(      s    7r&
4r   r(   c                   >    e Zd ZdZd Zd Zed        Zd Zd Z	d Z
y)	AppConfz~
    An app setting object to be used for handling app setting defaults
    gracefully and providing a nice API for them.
    c                 N    |j                         D ]  \  }}t        | ||        y r   )r@   rB   )r   kwargsr   rM   s       r   r   zAppConf.__init__p   s'    !<<> 	'KD%D$&	'r   c                 n    t        t        | j                  j                  j	                                     S r   )sortedsetr   r   r?   r   s    r   __dir__zAppConf.__dir__t   s%    c$****//1233r   c                 .    | j                   j                  S r   )r   r   r`   s    r   r   zAppConf.configured_datax   s    zz)))r   c                     | j                   j                  r t        | j                   j                  |      S t	        |d| j                   j
                  d      )Nz not found. Use 'z
' instead.)r   r
   r   r	   AttributeErrorr   r   s     r   __getattr__zAppConf.__getattr__|   sG    ::4::,,d33"DJJ$:$:< = 	=r   c                     ||j                         k(  r:t        | j                  j                  | j                  j	                  |      |       t
        j                  | ||       y r   )r   rB   r   r	   r   r4   __setattr__)r   r   rM   s      r   rg   zAppConf.__setattr__   sJ    4::<DJJ%%JJ,,T2E;4u-r   c                     | j                   S )zx
        Hook for doing any extra configuration, returning a dictionary
        containing the configured data.
        )r   r`   s    r   rT   zAppConf.configure   s    
 ###r   N)r#   r$   r%   __doc__r   ra   propertyr   re   rg   rT   r&   r   r   rZ   rZ   k   s4    '4 * *=.$r   rZ   )	metaclass)
r5   django.core.exceptionsr   utilsr   r4   r   r3   r(   rZ   r&   r   r   <module>rn      s6    
 7 #V *K4t K4\"$( "$r   