Skip to main content
Glama

ClickUp Operator

by noah-vh
utils.cpython-312.pyc28.2 kB
� lMg�Y���UddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZddlmZmZmZmZmZmZmZmZddlmZer ddlmZdd lmZd Zed �Z d' d(d �Z! d' d)d �Z"iZ#de$d<d*d�Z%d+d�Z&d,d�Z' d- d.d�Z(d/d�Z)d0d�Z* d1d�Z+d2d�Z, d3 d4d�Z-d5d�Z.d6d�Z/d7d�Z0d8d�Z1d9d�Z2 d: d;d�Z3d<d�Z4 d=d �Z5ejld>d!��Z7 d? d@d"�Z8dAd#�Z9ejldBdCd$��Z:d%�Z;d&�Z<y)D�)� annotationsN)�partial)�md5)�version)�IO� TYPE_CHECKING�Any�Callable�Iterable�Iterator�Sequence�TypeVar)�urlsplit)� TypeGuard)�AbstractFileSystemiP�Tc�|�tjd|�stjd|��d|d�St|�}|jxsd}|jr(dj |j |jg�}n |j }|dk(r+tjd|�}|rd|j�z}|dvr||d�S||d�}|jr�|jjd d �d jd d �d |d<|dvr|d|dz|d<n|d|d<|jr|j|d<|jr|j|d<|jr|j|d<|jr|j|d<|jr|j|d<|r t||�|S)a�Infer storage options from URL path and merge it with existing storage options. Parameters ---------- urlpath: str or unicode Either local absolute file path or URL (hdfs://namenode:8020/file.csv) inherit_storage_options: dict (optional) Its contents will get merged with the inferred information from the given path Returns ------- Storage options dict. Examples -------- >>> infer_storage_options('/mnt/datasets/test.csv') # doctest: +SKIP {"protocol": "file", "path", "/mnt/datasets/test.csv"} >>> infer_storage_options( ... 'hdfs://username:pwd@node:123/mnt/datasets/test.csv?q=1', ... inherit_storage_options={'extra': 'value'}, ... ) # doctest: +SKIP {"protocol": "hdfs", "username": "username", "password": "pwd", "host": "node", "port": 123, "path": "/mnt/datasets/test.csv", "url_query": "q=1", "extra": "value"} z^[a-zA-Z]:[\\/]z^[a-zA-Z0-9]+://�file)�protocol�path�#z^/([a-zA-Z])[:|]([\\/].*)$z%s:%s)�http�https�@�������:r�host)�s3�s3a�gcs�gsr�port�username�password� url_query� url_fragment)�re�matchr�scheme�fragment�joinr�groups�netloc�rsplitr#r$r%�query�update_storage_options)�urlpath�inherit_storage_options� parsed_pathrr� windows_path�optionss �XC:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\fsspec/utils.py�infer_storage_optionsr8%s���@ ���#�W�-� �8�8�'�� 1� 9�"�G�4�4��7�#�K��!�!�+�V�H�����x�x��)�)�;�+?�+?�@�A�������6���x�x� =�t�D� � ��\�0�0�2�2�D��$�$�$�g�6�6�+3�T�B�G����&�,�,�3�3�C��;�B�?�F�F�s�A�N�q�Q���� �1� 1�%�f�o����?�G�F�O�%�f�o�G�F�O� � � �)�.�.�G�F�O� � � �"-�"6�"6�G�J� � � � �"-�"6�"6�G�J� ����*�0�0�� �����"-�"6�"6������w�(?�@� �N�c���|si}t|�t|�z}|r8|D]3}|j|�|j|�k7s�'td|����|j|�y)Nz9Collision between inferred and specified storage option: )�set�get�KeyError�update)r6� inherited� collisions� collisions r7r1r1yso�� �� ��W���I��.�J��#�I��{�{�9�%����y�)A�A�� � )�{�,���$�  �N�N�9�r9zdict[str, str]� compressionsc��tjj|�djd�j �}|t vr t |Sy)aInfer compression, if available, from filename. Infer a named compression type, if registered and available, from filename extension. This includes builtin (gz, bz2, zip) compressions, as well as optional compressions. See fsspec.compression.register_compression. r�.N)�osr�splitext�strip�lowerrB)�filename� extensions r7�infer_compressionrK�sG����� � ��*�2�.�4�4�S�9�?�?�A�I��L� ��I�&�&� r9c���|dz }ttjtj|����d�fd� }|S)a�Returns a function that receives a single integer and returns it as a string padded by enough zero characters to align with maximum possible integer >>> name_f = build_name_function(57) >>> name_f(7) '07' >>> name_f(31) '31' >>> build_name_function(1000)(42) '0042' >>> build_name_function(999)(42) '042' >>> build_name_function(0)(0) '0' g:�0�yE>c�8��t|�j��S�N)�str�zfill)�i� pad_lengths �r7� name_functionz*build_name_function.<locals>.name_function�s����1�v�|�|�J�'�'r9)rQ�int�returnrO)rT�math�ceil�log10)�max_intrSrRs @r7�build_name_functionrZ�s7���& �t�O�G��T�Y�Y�t�z�z�'�2�3�4�J�(� �r9c�v�|j�dk(ryd} |j|�}|sy|r||zn|} ||vrL|j|�}|j|j�t |�|z z t |�z�yt |�|kry |t |� d}��#t t f$rY�!wxYw)a�Seek current file to file start, file end, or byte after delimiter seq. Seeks file to next chunk delimiter, where chunks are defined on file start, a delimiting sequence, and file end. Use file.tell() to see location afterwards. Note that file start is a valid split, so must be at offset > 0 to seek for delimiter. Parameters ---------- file: a file delimiter: bytes a delimiter like ``b'\n'`` or message sentinel, matching file .read() type blocksize: int Number of bytes to read from the file at once. Returns ------- Returns True if a delimiter was found, False if at file start or end. rFNT)�tell�read�index�seek�len�OSError� ValueError)r� delimiter� blocksize�last�current�fullrQs r7�seek_delimiterrh�s���. �y�y�{�a����D� ��)�)�I�&����!%�t�g�~�7�� ��D� ��J�J�y�)��� � �$�)�)�+��T��Q��7�#�i�.�H�I���W�� �)��*� �S��^�O�%�&��! ����$� � � �s�AB&�B&�&B8�7B8c��|r�|j|�t||d�}|�|j�S|j�}|||z z}|j||z�t||d�}|j�}|r|r|t |�z}|r|r|t |�z}|}||z }|j|�|�J�|j|�} | S)a�Read a block of bytes from a file Parameters ---------- f: File Open file offset: int Byte offset to start read length: int Number of bytes to read, read through end of file if None delimiter: bytes (optional) Ensure reading starts and stops at delimiter bytestring split_before: bool (optional) Start/stop read *before* delimiter bytestring. If using the ``delimiter=`` keyword argument we ensure that the read starts and stops at delimiter boundaries that follow the locations ``offset`` and ``offset + length``. If ``offset`` is zero then we start at zero, regardless of delimiter. The bytestring returned WILL include the terminating delimiter string. Examples -------- >>> from io import BytesIO # doctest: +SKIP >>> f = BytesIO(b'Alice, 100\nBob, 200\nCharlie, 300') # doctest: +SKIP >>> read_block(f, 0, 13) # doctest: +SKIP b'Alice, 100\nBo' >>> read_block(f, 0, 13, delimiter=b'\n') # doctest: +SKIP b'Alice, 100\nBob, 200\n' >>> read_block(f, 10, 10, delimiter=b'\n') # doctest: +SKIP b'Bob, 200\nCharlie, 300' i)r_rhr]r\r`) �f�offset�lengthrc� split_before�found_start_delim�start�found_end_delim�end�bs r7� read_blockrs�s���V� ���v��*�1�i��?�� �>��6�6�8�O�������%�&�.� �� ���u�v�~��(��I�u�=���f�f�h�� �� �S��^� #�E� �|� �3�y�>� !�C����u����F�F�6�N� � �� � ���v��A� �Hr9c���|r||fz } tt|�j��}|j �S#t$r6tt|�j�d��}Y|j �SwxYw)z�Deterministic token (modified from dask.base) >>> tokenize([1, 2, '3']) '9d71491b50023b06fc76928e6eddb952' >>> tokenize('Hello') == tokenize('Hello') True F)�usedforsecurity)rrO�encoderb� hexdigest)�args�kwargs�hs r7�tokenizer{2ss��� �� ���;� ��D� � � �"� #�� �;�;�=��� �;� ��D� � � �"�E� :�� �;�;�=��;�s�"<�-A;�:A;c��t|t�r|St|d�r|j�St|d�r |jS|S)a6Attempt to convert a path-like object to a string. Parameters ---------- filepath: object to be converted Returns ------- filepath_str: maybe a string version of the object Notes ----- Objects supporting the fspath protocol are coerced according to its __fspath__ method. For backwards compatibility with older Python version, pathlib.Path objects are specially coerced. Any other object is passed through unchanged, which includes bytes, strings, buffers, or anything else that's not even path-like. � __fspath__r)� isinstancerO�hasattrr}r)�filepaths r7�stringify_pathr�GsE��,�(�C� ��� ��<� (��"�"�$�$� ��6� "��}�}���r9c�6�||i|��}|j�|SrN)�_determine_worker)�clsrxry�insts r7� make_instancer�gs$�� �� �� �D����� �Kr9c����|D�cgc]}|jd���c}�td��D��}d}t|�D]�t��fd��D��}|r�n�|z �dj �dd��Scc}w)z;For a list of paths, find the shortest prefix common to all�/c3�2K�|]}t|����y�wrN)r`)�.0�ps r7� <genexpr>z common_prefix.<locals>.<genexpr>rs����%�u�!�s�1�v�u���rc3�:�K�|]}|��d�k(���y�w)rN�)r�r�rQ�partss ��r7r�z common_prefix.<locals>.<genexpr>us#�����5�u�!�!�A�$�%��(�1�+�%�u�s�N)�split�min�range�allr,)�pathsr��lmaxrqrQr�s @@r7� common_prefixr�os����#(� )�5�a�Q�W�W�S�\�5� )�E� �%�u�%� %�D� �C� �4�[���5�u�5�5��� ����H�A� �8�8�E�!�H�R�a�L� !�!�� *s�A;c ���t|t�r�|jd�}|r4|D�cgc]'}dj||j d�df���)}}|St |�}|r|j dd�d}|s4td�|D��r"|D�cgc]}dj||g���}}|S|D�cgc]}|j||d���}}|St|�t|�k(sJ�|Scc}wcc}wcc}w)a�In bulk file operations, construct a new file tree from a list of files Parameters ---------- paths: list of str The input file tree path2: str or list of str Root to construct the new list in. If this is already a list of str, we just assert it has the right number of elements. exists: bool (optional) For a str destination, it is already exists (and is a dir), files should end up inside. flatten: bool (optional) Whether to flatten the input directory tree structure so that the output files are in the same directory. Returns ------- list of str r�rrrc3�@K�|]}|jd� ���y�w)r�N)� startswith�r��ss r7r�zother_paths.<locals>.<genexpr>�s����C�U��!�,�,�s�"3�3�U�s�) r~rO�rstripr,r�r�r/r��replacer`)r��path2�exists�flattenr��cps r7� other_pathsr�|s��6�%���� � �S�!�� �BG�H�%�Q�S�X�X�u�a�g�g�c�l�2�&6�7�8�%�E�H� �L��u�%�B���Y�Y�s�A�&�q�)���#�C�U�C�C�7<�=�u�!����5�!�*�-�u��=� �L�;@�@�%�Q����2�u�a�0�%��@� �L��5�z�S��Z�'�'�'� �L��I�� >��@s�,C-�C2�4C7c�"�t|t�SrN)r~� BaseException��objs r7� is_exceptionr��s�� �c�=� )�)r9c�,��t�fd�dD��S)Nc3�6�K�|]}t�|����y�wrN)r)r��attrrjs �r7r�zisfilelike.<locals>.<genexpr>�s�����F�,E�D�w�q�$��,E�s�)r]�closer\)r�)rjs`r7� isfileliker��s��� �F�,E�F� F�Fr9c�p�t|�}tjd|d��}t|�dkDr|dSy)Nz (\:\:|\://)r)�maxsplitrr)r�r(r�r`)�urlr�s r7� get_protocolr��s5�� �� �C� �H�H�^�S�1� 5�E� �5�z�A�~��Q�x�� r9c�r�ddlm} t|t|��dd�S#tt f$rYywxYw)z*Can the given URL be used with open_local?r)�get_filesystem_class� local_fileF)�fsspecr��getattrr�rb� ImportError)rr�s r7� can_be_localr��s;��+���+�L��,>�?��u�U�U�� � � $����s �$�6�6c��|tjvr+tj|}t|d�r |jS t |�S#YnxYw ddl}|j |�}|jS#ttf$rYywxYw)aFor given package name, try to find the version without importing it Import and package.__version__ is still the backup here, so an import *might* happen. Returns either the version string, or None if the package or the version was not readily found. � __version__rN) �sys�modulesrr�r� importlib� import_moduler��AttributeError)�name�modr�s r7�"get_package_version_without_importr��s��� �s�{�{���k�k�$��� �3� � &��?�?� "� ��t�}��� � �����%�%�d�+������� �� (����s� A � A� A3�3B�Bc�F�|� |� td��|xstj|�}tj�}tjd�}|j |�|r|j j�|j|�|j|�|S)Nz+Provide either logger object or logger namezD%(asctime)s - %(name)s - %(levelname)s - %(funcName)s -- %(message)s) rb�logging� getLogger� StreamHandler� Formatter� setFormatter�handlers�clear� addHandler�setLevel)�logger� logger_name�levelr��handle� formatters r7� setup_loggingr��s��� �~�+�-��F�G�G� � 5�w�(�(��5�F� � "� "� $�F��!�!�N��I� ��� �"� ������� ���f�� �O�O�E�� �Mr9c�$�|j|�SrN)�unstrip_protocol)r��fss r7�_unstrip_protocolr��s�� � � �t� $�$r9c�&����d�fd� �d��fd� }|S)zqMirror attributes and methods from the given origin_name attribute of the instance to the decorated classc�4��t|��}t||�SrN)r�)�method�self�origin� origin_names �r7� origin_getterz"mirror_from.<locals>.origin_getter�s�����{�+���v�v�&�&r9c�Z���D]$}t�|�}t||t|���&|SrN)r�setattr�property)r�r��wrapped_method�methodsr�s ��r7�wrapperzmirror_from.<locals>.wrappers1����F�$�]�F�;�N� �C���.�!9� :��� r9)r�rOr�r rUr )r��type[T]rUr�r�)r�r�r�r�s`` @r7� mirror_fromr��s���'�� �Nr9c#�K�|��y�wrNr�r�s r7� nullcontextr� s ���� �I�s�c �.�t|t�st�t|t�s|gt|�z}t|t�s|gt|�z}t|�t|�k7st|�t|�k7rt�t|�dkr|||fS|D�cgc]}|xsd�� }}|r'd�t t t |||���D�\}}}|r�|dd}|dd}|dd} tdt|��D]�} || || dz k(r| d��|| || dz k7s|| | dz |kDs|�K|| |dz |kDr=|j|| �|j|| �| j|| ���|| | d<��||| fS|||fScc}w)a}Merge adjacent byte-offset ranges when the inter-range gap is <= `max_gap`, and when the merged byte range does not exceed `max_block` (if specified). By default, this function will re-order the input paths and byte ranges to ensure sorted order. If the user can guarantee that the inputs are already sorted, passing `sort=False` will skip the re-ordering. rrc3�2K�|]}t|����y�wrN)�list)r��vs r7r�z&merge_offset_ranges.<locals>.<genexpr>0s ���� ��� ��G��r�Nr) r~r�� TypeErrorr`rb�zip�sortedr��append) r��starts�ends�max_gap� max_block�sortr�� new_paths� new_starts�new_endsrQs r7�merge_offset_rangesr�s��� �e�T� "��� �f�d� #���C��J�&�� �d�D� !��v��E� �"�� �6�{�c�%�j� �C��I��U��$;��� �6�{�a���f�d�"�"�$� %�f��a�f�1�f�f�F� %� � �����v�t�,��� ���v�t� ��"�1�I� ��B�Q�Z� ����8���q�#�e�*�%�A��Q�x�5��Q��<�'�H�R�L�,@���a��E�!�a�%�L�(��A�Y��"��-��8��)�t�A�w��B��/G�9�.T�� � ��q��*��!�!�&��)�,�����Q��(� $�A�w��� �!&�"�*�h�.�.� �&�$� ���M&s� Fc��|j�} |jdd�|j|�S#|j|�wxYw)z+Find length of any open read-mode file-liker�)r\r_)�filelike�poss r7� file_sizer�Vs9�� �-�-�/�C���}�}�Q��"�� � �c���� � �c��s �5�Ac#��K�tjtjj |�tjj |�dz��\}} t ||�5}|��ddd�tj||�y#1swY� xYw#t$rEtjt�5tj|�ddd��#1swY�xYwwxYw�w)z� A context manager that opens a temporary file next to `path` and, on exit, replaces `path` with the temporary file, thereby updating `path` atomically. �-)�dir�prefixN) �tempfile�mkstemprEr�dirname�basename�openr�r�� contextlib�suppress�FileNotFoundError�unlink)r�mode�fd�fn�fps r7� atomic_writer_s������ � � �G�G�O�O�D� !�"�'�'�*:�*:�4�*@�3�*F��F�B��� �"�d�^�r��H�� � � �2�t���^�� �� � � �!2� 3� �I�I�b�M�4� �4� ���sN�AC(� B�'B �,B�4C(� B�B�"C%�9C� C%�C! �C%�%C(c�`�g}|j}dt|�}}||k�r||}|dz}|dk(r|r|d|u�r�||��n�|dk(r ||��n�|dk(�r�|}||kr ||dk(r|dz}||kr ||dk(r|dz}||kr||dk7r|dz}||kr ||dk7r�||k\r |d ��nq|||} d | vr| jd d �} n�g} ||dk(r|d zn|dz} |jd | |�} | dkrn| j||| �| dz}| dz} �8|||} | r| j| �n | dxxd z cc<t t| �dz dd�D]4} | | dz d| | dkDs�| | dz dd| | ddz| | dz <| | =�6d j d�| D��} t jdd| �} |dz}| s |d�nS| dk(r |d�nE| ddk(r d| ddz} n | ddvrd | z} |d| �d��n|t j|��||kr��||k(sJ�|S)Nrr�*r�?�[�!�]z\[r��\�\\r��c3�`K�|]&}|jdd�jdd����(y�w)rrr�z\-N)r�r�s r7r�z_translate.<locals>.<genexpr>�s,����%�LR�q�� � �$��.�6�6�s�E�B�F�s�,.z([&~|])z\\\1z(?!)rD�^)rr) r�r`r��findr�r,r(�sub�escape) �pat�STAR� QUESTION_MARK�res�addrQ�n�c�j�stuff�chunks�k�chunks r7� _translater*ts����C� �*�*�C� �c�#�h�q�A� �a�%� ��F�� ��E�� ��8��C��G�4�/��D� � �#�X� � � � �#�X��A��1�u��Q��3����E���1�u��Q��3����E���a�%�C��F�c�M���E���a�%�C��F�c�M��A�v��E� ��A�a����e�#�!�M�M�$��6�E��F�!$�Q��3���A��A��E�A���H�H�S�!�Q�/���q�5�!�� � �c�!�A�h�/���E����E�� � ��!�H�E��� � �e�,��r� �c�)� �"�3�v�;��?�A�r�:��!�!�a�%�=��,�v�a�y��|�;�,2�1�q�5�M�#�2�,>����1�2��,N�F�1�q�5�M� &�q� �;�  �H�H�%�LR�%��E����z�7�E�:����E�����K��c�\���H��Q�x�3�� #�e�A�B�i����q��Z�/� $�u� ���!�E�7�!� �%� �� � �!� � �A �a�%�B ��6�M�6� �Jr9c�,�tjjr6tjjtjjz}ntjj}dj t t j|��}t|�dkDrd|�d�n|}d|�d�}|�d�}|�|��}d|�d�}d }g} t j||�} t| �dz } t| �D]�\} } | d k(r| j| | kr|n|��$| d k(r| j| | kr|n|��Bd | vr td ��| r| jt| |�d �|��| | ks�x| j|���dj | �}d |�d�S)zBTranslate a pathname with shell wildcards to a regular expression.�rrrz[^�+z(?:.+z)?z.*rz**z:Invalid pattern: '**' can only be an entire path componentz(?s:z)\Z)rEr�altsep�sepr,�mapr(rr`r�� enumerater�rb�extendr*)r�seps� escaped_seps�any_sep�not_sep�one_last_segment� one_segment� any_segments�any_last_segments�resultsr�� last_part_idx�idx�partr!s r7�glob_translater?�s���  �w�w�~�~��w�w�{�{�R�W�W�^�^�+���w�w�{�{���7�7�3�r�y�y�$�/�0�L�%(��Y��]��,��q�!� �G��<�.��"�G�!��!�}��%�&�w�i�0�K��7�)�2�&�L����G� �H�H�W�c� "�E���J��N�M��u�%� ��T� �3�;� �N�N�#� �*=�;�CS� T� � �4�<� �N�N�3��+>�<�DU� V� � �T�\��L�� � � �N�N�:�d�w�i�q�M�7�C� D� �� � �N�N�7� #�&� �'�'�'� �C��3�%�s� �r9rN)r2rOr3�dict[str, Any] | NonerU�dict[str, Any])r6rAr?r@rU�None)rIrOrU� str | None)rY�floatrUzCallable[[int], str])r� IO[bytes]rc�bytesrdrTrU�bool)NF) rjrErkrTrl� int | Nonercz bytes | NonermrGrUrF)rxr ryr rUrO)r�z%str | os.PathLike[str] | pathlib.PathrUrO)r�zCallable[..., T]rxz Sequence[Any]ryrArUr)r�� Iterable[str]rUrO)FF) r�� list[str]r�zstr | list[str]r�rGr�rGrUrJ)r�r rUrG)rjr rUzTypeGuard[IO[bytes]])r�rOrUrO)rrOrUrG)r�rOrUrC)NN�DEBUGT) r�zlogging.Logger | Noner�rCr�rOr�rGrUzlogging.Logger)r�rOr�rrUrO)r�rOr�rIrUzCallable[[type[T]], type[T]])r�rrUz Iterator[T])rNT)r�rJr��list[int] | intr�rLr�rTr�rHr�rGrUz&tuple[list[str], list[int], list[int]])r�rErUrT)�wb)rrOr rO)=� __future__rrr�rVrE�pathlibr(r�r� functoolsr�hashlibr�importlib.metadatar�typingrrr r r r r r� urllib.parser�typing_extensionsr� fsspec.specr�DEFAULT_BLOCK_SIZErr8r1rB�__annotations__rKrZrhrsr{r�r�r�r�r�r�r�r�r�r�r�r��contextmanagerr�r�r�rr*r?r�r9r7�<module>rZs���"��� � �� � ����&� � � �"��+�.��� �C�L��DH�Q� �Q�+@�Q��Q�jAE� � � �(=� � � �" "� �n�!� ��:.'�j#�� G ��G � �G � �G �� G � � G �  � G �T�*�@� ��!.��8F���� "� �� *� �*� �*� �*�� *� � *�Z*�G����6%)�"��� � !���� �� � � � �*%����,��!��( ������� �� C� �C� �C� �C�� C� � C� � C�,�C�L� ������(G�T#r9

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/noah-vh/mcp-server-clickup'

If you have feedback or need assistance with the MCP directory API, please join our Discord server