%PDF- %PDF-
Direktori : /lib/python3/dist-packages/click/__pycache__/ |
Current File : //lib/python3/dist-packages/click/__pycache__/utils.cpython-312.pyc |
� D�dJO � �r � d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm Z ddl mZ ddl mZ ddl m Z dd l mZ dd l mZ ddl mZ ddl mZ dd l mZ ddl mZ ddl mZ ddlmZ ej. rd dlZ ej4 d� Z ej8 d� Zdedefd�ZdCd�Z dejB defd�Z"dDdede#defd�Z$ G d� d� Z% G d� d� Z& dEd!ejN ejB d"ejN ejP ejB d#e)d$e)d%ejN e) ddfd&�Z*dd'dejV fd(�Z, dFdd'd)ejN e d*ejN e dejZ fd+�Z. dGd,ed-ed)ejN e d*ejN e d.e)d/e)dejP ejB fd0�Z/ dHd,d1d2e)defd3�Z0dId4ed5e)d6e)defd7�Z1 G d8� d9� Z2 dJd:ejN e d;ejN e defd<�Z3d d d d=�d>ejh e d?e)d@e)dAe)dejj e f dB�Z6y)K� N)�update_wrapper)� ModuleType)� TracebackType� )�_default_text_stderr)�_default_text_stdout)�_find_binary_writer)�auto_wrap_for_ansi)�binary_streams)�open_stream)�should_strip_ansi)� strip_ansi)�text_streams)�WIN)�resolve_color_default�P�R�name�returnc �\ � dj | j � � j � S )N�-)�join�split�lower)r s �-/usr/lib/python3/dist-packages/click/utils.py� _posixifyr s � ��8�8�D�J�J�L�!�'�'�)�)� c �^ � � dddddt j t f� fd�}t |� � S )z0Wraps a function so that it swallows exceptions.�argszP.args�kwargszP.kwargsr c �4 �� �| i |��S # t $ r Y y w xY w�N)� Exception)r r �funcs �r �wrapperzsafecall.<locals>.wrapper$ s- �� � ���(��(�(��� ��� �s � � �)�t�Optionalr r )r$ r% s ` r �safecallr( ! s4 �� ��x� �:� �!�*�*�Q�-� � �'�4�(�(r �valuec �� � t | t � r$ | j t j � � S t | � S # t $ r | j dd� cY S w xY w)z%Converts a value into a valid string.�utf-8�replace)� isinstance�bytes�decode�sys�getfilesystemencoding�UnicodeError�str)r) s r �make_strr4 . sW � ��%��� 4��<�<�� 9� 9� ;�<�<� �u�:��� � 4��<�<���3�3� 4�s �"A � A�A�help� max_lengthc � � | j d� }|dk7 r| d| } | j � }|sy|d dk( r|dd }d}t |� dz }t |� D ]N \ }}|t |� |dkD z z }||kD r nA|d dk( rd j |d|dz � c S ||k( s�H||k7 s�N n d j |� S |t d � z }|dkD r(|t || � |dkD z z }||k rn|dz }|dkD r�(d j |d| � d z S )z+Returns a condensed version of help string.z ���N� r �r �.� z...)�findr �len� enumerater )r5 r6 � paragraph_end�words�total_length� last_index�i�words r �make_default_short_helprF 8 sP � � �I�I�f�%�M�����N�]�#�� �J�J�L�E��� �Q�x�4���a�b� ���L��U��a��J��U�#� ���4���D� �Q��U�+�+���*�$����8�s�?��8�8�E�'�A��E�N�+�+��:�%�!�z�/��� �x�x���� �C��J��L� �a�%���E�!�H� ��Q��/�/���:�%�� �Q��� �a�%� �8�8�E�"�1�I���&�&r c �� � e Zd ZdZ ddej edf dedej e dej e def d �Z d edej fd�Zdefd �Zdej ej fd�Zdd�Zdd�Zdd�Zdej ej$ e dej e dej e ddfd�Zdej, ej. fd�Zy)�LazyFilez�A lazy file works like a regular file but it does not fully open the file but it does perform some basic checks early to see if the filename parameter does make sense. This is useful for safely opening files for writing. N�filenamezos.PathLike[str]�mode�encoding�errors�atomicc �& � t j |� | _ || _ || _ || _ || _ | | | j dk( rt ||||� \ | _ | _ y d|v rt ||� j � d | _ d| _ y )Nr �rT)�os�fspathr rJ rK rL rM r �_f�should_close�open�close)�selfrI rJ rK rL rM s r �__init__zLazyFile.__init__q s� � � ���8�,�� ��� � �� ����������9�9���)4�X�t�X�v�)V�&�D�G�T�&��d�{� �X�t�$�*�*�,��D�G� $�D�r r r c �6 � t | j � |� S r"