????

Your IP : 18.218.229.244


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/alembic/util/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/alembic/util/__pycache__/pyfiles.cpython-311.pyc

�

�A�D7����ddlmZddlZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlmZddlmZdd	lmZdd�Zdd�Zdd�Zdd�Zdd�ZdS) �)�annotationsN)�	ExitStack)�Optional)�
exceptions)�Template�)�compat)�CommandError�
template_file�str�dest�output_encoding�return�Nonec��t|���}	|jdi|���|��}t|d��5}|�|��ddd��dS#1swxYwYdS#tjdd���5}|�tj������|����|j	}ddd��n#1swxYwYtd|z���xYw)N)�filename�wbz.txtF)�suffix�deletezDTemplate rendering failed; see %s for a template-oriented traceback.�)r�render_unicode�encode�open�write�tempfile�NamedTemporaryFiler�text_error_template�namer
)	rr
r�kw�template�output�f�ntf�fnames	         �e/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/alembic/util/pyfiles.py�template_to_filer&s�����/�/�/�H��(��(�.�.�2�.�.�5�5�o�F�F���$��
�
�	��
�G�G�F�O�O�O�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	��
�
�
(��u�
E�
E�
E�	���I�I��.�0�0���!�!����(�(�
�
�
�
�H�E�
	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��
+�-2�
3�
�
�	
���sB� A2�A%�%A)�,A)�2D�
AC)�D�)C-	�-D�0C-	�1Dr$c��tj�|��s�d|vr�|�d��}t	��}tj|j��tj	�
|d��}|dd�D]}||z}�|�tj	�|����}|S)z�Interpret a filename as either a filesystem location or as a package
    resource.

    Names that are non absolute paths and contain a colon
    are interpreted as resources and coerced to a file location.

    �:rrN)
�os�path�isabs�splitr�atexit�register�closer	�importlib_resources�files�
enter_context�as_file)r$�tokens�file_manager�ref�toks     r%�coerce_resource_to_filenamer8+s����7�=�=����
�C�5�L�L����S�!�!��!�{�{�����*�+�+�+��(�.�.�v�a�y�9�9���!�"�"�:�	�	�C���)�C�C��*�*��&�.�.�s�3�3�
�
���L�r*�
Optional[str]c�D�tj�|��}tj�|��r|Stj�|��\}}tjjD]+}tj�||z��r||zcS�,dS)z,Given a python source path, locate the .pyc.N)	�	importlib�util�cache_from_sourcer)r*�exists�splitext�	machinery�BYTECODE_SUFFIXES)r*�	candidate�filepath�exts    r%�pyc_file_from_pathrFEs�����0�0��6�6�I�	�w�~�~�i� � �����G�$�$�T�*�*�M�H�c��"�4����
�7�>�>�(�S�.�)�)�	"��c�>�!�!�!�	"��tr9�dir_rc��tjdd|��}tj�||��}tj�|��\}}|dkrdtj�|��rt||��}nHt|��}|�td|z���t||��}n|dvrt||��}|S)z3Load a file from the given path as a Python module.z\W�_z.pyNzCan't find Python file %s)z.pycz.pyo)
�re�subr)r*�joinr@r?�load_module_pyrF�ImportError)rGr�	module_idr*rIrE�module�pyc_paths        r%�load_python_filerRVs�����u�c�8�,�,�I�
�7�<�<��h�'�'�D�
�W�
�
�h�
'�
'�F�A�s�
�e�|�|�
�7�>�>�$���	=�#�I�t�4�4�F�F�)�$�/�/�H���!�"=��"D�E�E�E�'�	�8�<�<���	� �	 �	 ��	�4�0�0���Mr9rOc��tj�||��}|sJ�tj�|��}|j�|��|S)N)r<r=�spec_from_file_location�module_from_spec�loader�exec_module)rOr*�specrPs    r%rMrMjsR���>�1�1�)�T�B�B�D��K�K�4�
�^�
,�
,�T�
2�
2�F��K���F�#�#�#��Mr9)rrr
rrrrr)r$rrr)r*rrr:)rGrrr)rOrr*r)�
__future__rr-�
contextlibrr<�importlib.machinery�importlib.utilr)rJr�typingr�makor�
mako.templater�r	�excr
r&r8rFrRrMrr9r%�<module>rbs9��"�"�"�"�"�"�
�
�
�
� � � � � � �������������	�	�	�	�	�	�	�	�����������������"�"�"�"�"�"�����������������.����4����"����(�����r9