← Back
Editing: module_loading.cpython-311.pyc
� �|�e � �F � d dl Z d dlZd dlmZ d dlmZ d� Zd� Zd� Z d� Z dS )� N)� import_module)� find_specc � � | � dd� � \ }}n%# t $ r}t d| z � � |�d}~ww xY wt |� � } t ||� � S # t $ r}t d|�d|�d�� � |�d}~ww xY w)z� Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImportError if the import failed. �.� z"%s doesn't look like a module pathNzModule "z" does not define a "z" attribute/class)�rsplit� ValueError�ImportErrorr �getattr�AttributeError)�dotted_path�module_path� class_name�err�modules �=/usr/lib/python3/dist-packages/django/utils/module_loading.py� import_stringr s� � � W�"-�"4�"4�S�!�"<�"<���Z�Z��� W� W� W��>��L�M�M�SV�V�����W���� �;� '� '�F���v�z�*�*�*��� � � ��k��K�K����%� � �� ��������s( � � >�9�>�A! �! B�+B�Bc �< � ddl m} |� d� � }|� � � D ]k}| D ]f} |rt j |j � � }t |j �d|��� � �8# t $ r" |r||_ t |j |� � r� Y �cw xY w�ldS )aL Auto-discover INSTALLED_APPS modules and fail silently when not present. This forces an import on them to register any admin bits they may want. You may provide a register_to keyword parameter as a way to access a registry. This register_to object must have a _registry instance variable to access it. r )�apps�register_tor N)�django.appsr �get�get_app_configs�copy� _registryr �name� Exception�module_has_submoduler )�args�kwargsr r � app_config�module_to_search�before_import_registrys r �autodiscover_modulesr$ s� � � !� � � � � ��*�*�]�+�+�K��*�*�,�,� � � � $� � �� �� N�-1�Y�{�7L�-M�-M�*������:J�:J�K�L�L�L�L��� � � � � C�,B�K�)� (� �(9�;K�L�L� ��� � ���� �� s �4A,�,)B�Bc � � | j }| j }n# t $ r Y dS w xY w|dz |z } t ||� � duS # t t f$ r Y dS w xY w)z See if 'module' is in 'package'.Fr N)�__name__�__path__r �importlib_find�ModuleNotFoundError)�package�module_name�package_name�package_path�full_module_names r r r ? s� � ���'���'����� � � ��u�u����� $�c�)�K�7����.��=�=�T�I�I����0� � � � �u�u� ���s � � ��= �A�Ac � � t t | dg � � � � }t |� � dk r|d S t | dd� � }|�t j � |� � S t d| z � � �)z� Find the name of the directory that contains a module, if possible. Raise ValueError otherwise, e.g. for namespace packages that are split over several directories. r'