
    g,                     d    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	m
Z
 dZdZ G d d	      Zy)
    N)import_module)ImproperlyConfigured)cached_property)import_stringmodule_has_submoduleappsmodelsc                   n    e Zd ZdZd Zd Zed        Zed        Z	d Z
ed        ZddZdd	Zd
 Zd Zy)	AppConfigz>Class representing a Django application and its configuration.c                    || _         || _        d | _        t        | d      s|j	                  d      d   | _        | j
                  j                         st        d| j
                  z        t        | d      s| j
                  j                         | _	        t        | d      s| j                  |      | _        d | _        d | _        y )Nlabel.   z4The app label '%s' is not a valid Python identifier.verbose_namepath)namemoduler   hasattr
rpartitionr   isidentifierr   titler   _path_from_moduler   models_moduler	   )selfapp_name
app_modules      j/var/www/python.vincentserveurtest.ovh/public_html/venv/lib/python3.12/site-packages/django/apps/config.py__init__zAppConfig.__init__   s    	 ! 	 tW%!,,S1!4DJzz&&(&FS 
 t^, $

 0 0 2D tV$..z:DI
 "     c                 P    d| j                   j                  d| j                  dS )N<z: >)	__class____name__r   r   s    r   __repr__zAppConfig.__repr__:   s    !^^44djjAAr   c                 &    ddl m} |j                  S )Nr   )settings)django.confr(   DEFAULT_AUTO_FIELD)r   r(   s     r   default_auto_fieldzAppConfig.default_auto_field=   s    (***r   c                 N    | j                   j                  t        j                  uS )N)r#   r+   r   r%   s    r   !_is_default_auto_field_overriddenz+AppConfig._is_default_auto_field_overriddenC   s    ~~00	8T8TTTr   c                 <   t        t        |dg             }t        |      dk7  rDt        |dd      }|!t        j                  j                  |      g}nt        t        |            }t        |      dkD  rt        d|d|d      |st        d|z        |d	   S )
z;Attempt to determine app's filesystem path from its module.__path__   __file__NzThe app module z$ has multiple filesystem locations (zX); you must configure this app with an AppConfig subclass with a 'path' class attribute.zThe app module %r has no filesystem location, you must configure this app with an AppConfig subclass with a 'path' class attribute.r   )listgetattrlenosr   dirnamesetr   )r   r   pathsfilenames       r   r   zAppConfig._path_from_moduleG   s    
 WVZ45u:?vz48H#23 SZ(u:>& 5;EC 
 &139: 
 Qxr   c           
         d}d}d}	 t        |      }t        |t              r|dt        }t        |      }t        j                  |t        j
                        D cg c]&  \  }}t        ||       r|| urt        |dd      r||f( }	}}t        |	      dk(  r	|	d   d   }n|	D cg c]  \  }}t        |dd      r||f }	}}t        |	      dkD  r=|	D 
cg c]  \  }}
t        |       }}}
t        |dd	j                  |      d      t        |	      dk(  r|	d   d   }|| }|}	 |	 t        |      }|||j                  d      \  }}
}|r|d   j                         rt        |      }t        j                  |t        j
                        D cg c]   \  }}t        ||       r|| urt        |      " }}}d
|d|d}|r|dd	j                  |      z  z  }t!        |      t        |       t        |t"              st%        d|z        |	 |j&                  }	 t        |      } |||      S c c}}w c c}}w c c}
}w # t        $ r Y .w xY w# t        $ r Y 0w xY wc c}}w # t(        $ r t%        d|z        w xY w# t         $ r* t%        d|d|j*                  d|j,                  d      w xY w)zU
        Factory that creates an app config from an entry in INSTALLED_APPS.
        Nr   defaultTr0   r   Fz+ declares more than one default AppConfig: z, zModule 'z' does not contain a 'z' class.z Choices are: %s.z#'%s' isn't a subclass of AppConfig.z"'%s' must supply a name attribute.zCannot import 'z'. Check that 'z.name' is correct.)r   r   APPS_MODULE_NAMEinspect
getmembersisclass
issubclassr3   r4   reprRuntimeErrorjoin	Exceptionr   r   isupperImportErrorr   r   r   AttributeError
__module____qualname__)clsentryapp_config_classr   r   mod_pathmodr   	candidateapp_configs_
candidatescls_namemsgs                 r   createzAppConfig.createc   sM     
/	!&u-J $J0@A&+-=>#H-
 ,3+=+=c7??+S+Si"9c2%S0#Iy$? 9%+S   {#q('21~a'8$ 0;#/:OD)"9i? y)/:   #
 ;'!+@K%LWT1d4j
%L*%-tyy/DF  [)Q.+6q>!+<(  '#&   ##0#7 
 "2": %*$4$4S$9!HaHQK//1 $H- ,3+=+=c7??+S+Si!)S1is6J J+S    .:1FFFC!#&& e$ *I6&'Lu'TUU Y+00

	&x0J  *55A# &ME  		f   4 " Y*+ORW+WXXY  	& $//$11	 	sS   I !+I+II4I# %I3 I9 -J 	I I #	I0/I09J3Kc                     |r| j                   j                          n| j                   j                          	 | j                  |j	                            S # t
        $ r t        d| j                  d|d      w xY w)z
        Return the model with the given case-insensitive model_name.

        Raise LookupError if no model exists with this name.
        zApp 'z' doesn't have a 'z' model.)r   check_models_readycheck_apps_readyr	   lowerKeyErrorLookupErrorr   )r   
model_namerequire_readys      r   	get_modelzAppConfig.get_model   sl     II((*II&&(	;;z//122 	9=ZP 	s   A &A<c              #      K   | j                   j                          | j                  j                         D ]8  }|j                  j
                  r|s|j                  j                  r|s5| : yw)a  
        Return an iterable of models.

        By default, the following models aren't included:

        - auto-created models for many-to-many relations without
          an explicit intermediate table,
        - models that have been swapped out.

        Set the corresponding keyword argument to True to include such models.
        Keyword arguments aren't documented; they're a private API.
        N)r   rW   r	   values_metaauto_createdswapped)r   include_auto_createdinclude_swappedmodels       r   
get_modelszAppConfig.get_models   sY      			$$&[['')E{{''0D{{""?K *s   A1A3c                     | j                   j                  | j                     | _        t	        | j
                  t              r&| j                  dt        }t        |      | _	        y y )Nr   )
r   
all_modelsr   r	   r   r   MODELS_MODULE_NAMEr   r   r   )r   models_module_names     r   import_modelszAppConfig.import_models  sQ     ii**4::6-?@,0II7I!J!./A!BD Ar   c                      y)zT
        Override this method in subclasses to run code when Django starts.
        N r%   s    r   readyzAppConfig.ready  s    r   N)T)FF)r$   rH   rI   __doc__r   r&   r   r+   propertyr-   r   classmethodrU   r^   rg   rl   ro   rn   r   r   r   r      sl    H(TB + +
 U U8 z6 z6x"*Cr   r   )r=   r5   	importlibr   django.core.exceptionsr   django.utils.functionalr   django.utils.module_loadingr   r   r<   rj   r   rn   r   r   <module>rw      s/     	 # 7 3 K  E Er   