� J�g� ����ddlmZddlZddlmZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZddl mZddlmZddlmZd d lmZd d lmZd d�Zd!d�Zd"d�Zd#d�Zd$d�ZdS)%�)� annotationsN)� ExitStack)� ModuleType)�Any)�Optional)� exceptions)�Template�)�compat)� CommandError� template_file�str�dest�output_encoding�kwr�return�Nonec ��t|���} |jdi|���|��}t|d��5}|�|��ddd��dS#1swxYwYdS#t jdd���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 ) r rrr�template�output�f�ntf�fnames �d/home/asafur/pinokio/api/open-webui.git/app/env/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 ��}t j|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. �:rr N) �os�path�isabs�splitr�atexit�register�closer �importlib_resources�files� enter_context�as_file)r&�tokens� file_manager�ref�toks r'�coerce_resource_to_filenamer:-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_pathrHFs�����0�0��6�6�I� �w�~�~�i� � �����G�$�$�T�*�*�M�H�c��"�4���� �7�>�>�(�S�.� )� )� "��c�>� !� !� !� "��tr;�dir_rrc��tjdd|��}tj�||��}tj�|��\}}|dkrdtj�|��rt||��}nKt|��}|�td|z���t||��}n|dvrt||��}nJ�|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,�joinrBrA�load_module_pyrH� ImportError)rIr� module_idr,rKrG�module�pyc_paths r'�load_python_filerTWs�����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����u� �Mr;rQc���tj�||��}|sJ�tj�|��}|j�|��|S)N)r>r?�spec_from_file_location�module_from_spec�loader� exec_module)rQr,�specrRs r'rOrOmsR�� �>� 1� 1�)�T� B� B�D� �K�K�4� �^� ,� ,�T� 2� 2�F��K���F�#�#�#� �Mr;) r rrrrrrrrr)r&rrr)r,rrr<)rIrrrrr)rQrr,rrr)� __future__rr/� contextlibrr>�importlib.machinery�importlib.utilr+rLr�typesr�typingrr�makor� mako.templater �r �excr r(r:rHrTrOrr;r'�<module>res]��"�"�"�"�"�"� � � � � � � � � � ������������� � � � � � � � �����������������������������"�"�"�"�"�"�����������������.����2����"����,�����r;
Memory