ClickUp Operator

� �MMg�@��4�UdZddlmZddlZddlmZmZddlmZm Z m Z m Z m Z ddl mZmZddlmZmZmZddlmZmZmZd d lmZd d lmZmZd d lmZej>d<iej@�d di��Gd�d��Z!ej>d<iej@�d di��Gd�d��Z"er3dZ#de$d<dZ%de$d< dZ&de$d< dZ'de$d< e de%��Z(e de&��Z)e dddd � d=d!��Z*e ddddd"� d>d#��Z*d$ed%dd"� d?d&�Z*erge e ege fZ+de$d'< e e ge fZ,de$d(< d)Z-de$d*< e e eege fZ.de$d+< e e ege fZ/de$d,< d-Z0de$d.< d/Z1de$d0<e d1e-��Z2e d2e0��Z3e d@d3��Z4e d%dd4� dAd5��Z4e dd%dd6� dBd7��Z4 dCd$d%ed6� dDd8�Z4e d9�Z5eree5dfZ6yej>d<iej@��Gd:�d;��Z6y)EzEThis module contains related classes and functions for serialization.�)� annotationsN)�partial� partialmethod)� TYPE_CHECKING�Any�Callable�TypeVar�overload)�PydanticUndefined� core_schema)�SerializationInfo�SerializerFunctionWrapHandler�WhenUsed)� Annotated�Literal� TypeAlias�)�PydanticUndefinedAnnotation)� _decorators�_internal_dataclass)�GetCoreSchemaHandler�frozenTc�@�eZdZUdZded<eZded<dZded<d d �Zy ) �PlainSerializeraCPlain serializers use a function to modify the output of serialization. This is particularly helpful when you want to customize the serialization for annotated types. Consider an input of `list`, which will be serialized into a space-delimited string. ```python from typing import List from typing_extensions import Annotated from pydantic import BaseModel, PlainSerializer CustomStr = Annotated[ List, PlainSerializer(lambda x: ' '.join(x), return_type=str) ] class StudentModel(BaseModel): courses: CustomStr student = StudentModel(courses=['Math', 'Chemistry', 'English']) print(student.model_dump()) #> {'courses': 'Math Chemistry English'} ``` Attributes: func: The serializer function. return_type: The return type for the function. If omitted it will be inferred from the type annotation. when_used: Determines when this serializer should be used. Accepts a string with values `'always'`, `'unless-none'`, `'json'`, and `'json-unless-none'`. Defaults to 'always'. zcore_schema.SerializerFunction�funcr� return_type�alwaysr� when_usedc��||�}|j�\}} tj|j|j||��}|turdn|j|�}tj|jtj|jd�||j��|d<|S#t $r}t j|�|�d}~wwxYw)z�Gets the Pydantic core schema. Args: source_type: The source type. handler: The `GetCoreSchemaHandler` instance. Returns: The Pydantic core schema. ��globalns�localnsN�plain��function�info_arg� return_schemar� serialization)�_get_types_namespacer�get_function_return_typerr� NameErrorr�from_name_errorr �generate_schemar �$plain_serializer_function_ser_schema�inspect_annotated_serializerr� �self� source_type�handler�schemar!r"r�er's �kC:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\pydantic/functional_serializers.py�__get_pydantic_core_schema__z,PlainSerializer.__get_pydantic_core_schema__7s�����%��#�8�8�:���'� H�%�>�>�� � �� � �!�� �K�!,�/@� @��g�F]�F]�^i�Fj� �"-�"R�"R��Y�Y� �=�=�d�i�i��Q�'��n�n� # ���� � ��� H�-�=�=�a�@�a� G�� H���-B5�5 C�>C�CN�r2rr3r�returnzcore_schema.CoreSchema� �__name__� __module__� __qualname__�__doc__�__annotations__r rrr7��r6rrs(���> )�(�(�K��(�"�I�x�"�rBrc�@�eZdZUdZded<eZded<dZded<d d �Zy ) �WrapSerializera Wrap serializers receive the raw inputs along with a handler function that applies the standard serialization logic, and can modify the resulting value before returning it as the final output of serialization. For example, here's a scenario in which a wrap serializer transforms timezones to UTC **and** utilizes the existing `datetime` serialization logic. ```python from datetime import datetime, timezone from typing import Any, Dict from typing_extensions import Annotated from pydantic import BaseModel, WrapSerializer class EventDatetime(BaseModel): start: datetime end: datetime def convert_to_utc(value: Any, handler, info) -> Dict[str, datetime]: # Note that `handler` can actually help serialize the `value` for # further custom serialization in case it's a subclass. partial_result = handler(value, info) if info.mode == 'json': return { k: datetime.fromisoformat(v).astimezone(timezone.utc) for k, v in partial_result.items() } return {k: v.astimezone(timezone.utc) for k, v in partial_result.items()} UTCEventDatetime = Annotated[EventDatetime, WrapSerializer(convert_to_utc)] class EventModel(BaseModel): event_datetime: UTCEventDatetime dt = EventDatetime( start='2024-01-01T07:00:00-08:00', end='2024-01-03T20:00:00+06:00' ) event = EventModel(event_datetime=dt) print(event.model_dump()) ''' { 'event_datetime': { 'start': datetime.datetime( 2024, 1, 1, 15, 0, tzinfo=datetime.timezone.utc ), 'end': datetime.datetime( 2024, 1, 3, 14, 0, tzinfo=datetime.timezone.utc ), } } ''' print(event.model_dump_json()) ''' {"event_datetime":{"start":"2024-01-01T15:00:00Z","end":"2024-01-03T14:00:00Z"}} ''' ``` Attributes: func: The serializer function to be wrapped. return_type: The return type for the function. If omitted it will be inferred from the type annotation. when_used: Determines when this serializer should be used. Accepts a string with values `'always'`, `'unless-none'`, `'json'`, and `'json-unless-none'`. Defaults to 'always'. z"core_schema.WrapSerializerFunctionrrrrrrc��||�}|j�\}} tj|j|j||��}|turdn|j|�}tj|jtj|jd�||j��|d<|S#t $r}t j|�|�d}~wwxYw)z�This method is used to get the Pydantic core schema of the class. Args: source_type: Source type. handler: Core schema handler. Returns: The generated core schema of the class. r N�wrapr$r()r)rr*rrr+rr,r r-r �#wrap_serializer_function_ser_schemar/rr0s r6r7z+WrapSerializer.__get_pydantic_core_schema__�s�����%��#�8�8�:���'� H�%�>�>�� � �� � �!�� �K�!,�/@� @��g�F]�F]�^i�Fj� �"-�"Q�"Q��Y�Y� �=�=�d�i�i��P�'��n�n� # ���� � ��� H�-�=�=�a�@�a� G�� H�r8Nr9r;rArBr6rDrDVs)��>�@ -�,�(�K��(�"�I�x�"�rBrDz!partial[Any] | partialmethod[Any]r�_Partialz)core_schema.SerializerFunction | _Partial�FieldPlainSerializerz-core_schema.WrapSerializerFunction | _Partial�FieldWrapSerializerz*FieldPlainSerializer | FieldWrapSerializer�FieldSerializer�_FieldPlainSerializerT)�bound�_FieldWrapSerializerT.)rr� check_fieldsc��y�NrA��field�moderrrO�fieldss r6�field_serializerrV�s ��@CrB)rTrrrOc��yrQrArRs r6rVrV�s ��BErBr#rc�$������d�����fd� }|S)aDecorator that enables custom field serialization. In the below example, a field of type `set` is used to mitigate duplication. A `field_serializer` is used to serialize the data as a sorted list. ```python from typing import Set from pydantic import BaseModel, field_serializer class StudentModel(BaseModel): name: str = 'Jane' courses: Set[str] @field_serializer('courses', when_used='json') def serialize_courses_in_order(self, courses: Set[str]): return sorted(courses) student = StudentModel(courses={'Math', 'Chemistry', 'English'}) print(student.model_dump_json()) #> {"name":"Jane","courses":["Chemistry","English","Math"]} ``` See [Custom serializers](../concepts/serialization.md#custom-serializers) for more information. Four signatures are supported: - `(self, value: Any, info: FieldSerializationInfo)` - `(self, value: Any, nxt: SerializerFunctionWrapHandler, info: FieldSerializationInfo)` - `(value: Any, info: SerializationInfo)` - `(value: Any, nxt: SerializerFunctionWrapHandler, info: SerializationInfo)` Args: fields: Which field(s) the method should be called on. mode: The serialization mode. - `plain` means the function will be called instead of the default serialization logic, - `wrap` means the function will be called with an argument to optionally call the default serialization logic. return_type: Optional return type for the function, if omitted it will be inferred from the type annotation. when_used: Determines the serializer will be used for serialization. check_fields: Whether to check that the fields actually exist on the model. Returns: The decorator function. c�d��tj�������}tj||�S)N)rUrTrrrO)r�FieldSerializerDecoratorInfo�PydanticDescriptorProxy)�f�dec_inforOrUrTrrs �����r6�deczfield_serializer.<locals>.decs7����;�;���#��%�  ���2�2�1�h�?�?rB)r\rKr:�(_decorators.PydanticDescriptorProxy[Any]rA)rTrrrOrUr^s````` r6rVrV�s���p@�@� �JrB�ModelPlainSerializerWithInfo�ModelPlainSerializerWithoutInfoz>ModelPlainSerializerWithInfo | ModelPlainSerializerWithoutInfo�ModelPlainSerializer�ModelWrapSerializerWithInfo�ModelWrapSerializerWithoutInfoz<ModelWrapSerializerWithInfo | ModelWrapSerializerWithoutInfo�ModelWrapSerializerz*ModelPlainSerializer | ModelWrapSerializer�ModelSerializer�_ModelPlainSerializerT�_ModelWrapSerializerTc��yrQrA)r\s r6�model_serializerrjCs��NQrB)rrc��yrQrA�rTrrs r6rjrjGs ��@CrBrlc��yrQrArls r6rjrjMs �� BErBc�0����d���fd� }|�|S||�S)a#Decorator that enables custom model serialization. This is useful when a model need to be serialized in a customized manner, allowing for flexibility beyond just specific fields. An example would be to serialize temperature to the same temperature scale, such as degrees Celsius. ```python from typing import Literal from pydantic import BaseModel, model_serializer class TemperatureModel(BaseModel): unit: Literal['C', 'F'] value: int @model_serializer() def serialize_model(self): if self.unit == 'F': return {'unit': 'C', 'value': int((self.value - 32) / 1.8)} return {'unit': self.unit, 'value': self.value} temperature = TemperatureModel(unit='F', value=212) print(temperature.model_dump()) #> {'unit': 'C', 'value': 100} ``` Two signatures are supported for `mode='plain'`, which is the default: - `(self)` - `(self, info: SerializationInfo)` And two other signatures for `mode='wrap'`: - `(self, nxt: SerializerFunctionWrapHandler)` - `(self, nxt: SerializerFunctionWrapHandler, info: SerializationInfo)` See [Custom serializers](../concepts/serialization.md#custom-serializers) for more information. Args: f: The function to be decorated. mode: The serialization mode. - `'plain'` means the function will be called instead of the default serialization logic - `'wrap'` means the function will be called with an argument to optionally call the default serialization logic. when_used: Determines when this serializer should be used. return_type: The return type for the function. If omitted it will be inferred from the type annotation. Returns: The decorator function. c�`��tj�����}tj||�S)N)rTrr)r�ModelSerializerDecoratorInfor[)r\r]rTrrs ���r6r^zmodel_serializer.<locals>.dec�s,����;�;��S^�js�t���2�2�1�h�?�?rB)r\rfr:r_rA)r\rTrrr^s ``` r6rjrjVs���@@� �y�� ��1�v� rB�AnyTypec�@�eZdZdd�Z dd�Zej Zy)�SerializeAsAnyc�(�t|t�fSrQ)rrs)�cls�items r6�__class_getitem__z SerializeAsAny.__class_getitem__�s���T�>�#3�3�4� 4rBc���||�}|}|ddk(r|j�}|d}|ddk(r�tjd�tj���|d<|S)N�type� definitionsr4c��||�SrQrA)�x�hs r6�<lambda>z=SerializeAsAny.__get_pydantic_core_schema__.<locals>.<lambda>�s��Q�q�TrB)r4r()�copyr rG� any_schema)r1r2r3r4�schema_to_updates r6r7z+SerializeAsAny.__get_pydantic_core_schema__�sw���[�)�F�%� �"�6�*�m�;�#3�#8�#8�#:� �#3�H�#=� �#�6�*�m�;�1<�0_�0_�!�+�*@�*@�*B�1� �_� -��MrBN)rvrr:rr9)r<r=r>rwr7�object�__hash__rArBr6rsrs�s/�� 5� �"� �-A� � #� ��?�?�rBrsrA)rS�strrUr�rT�Literal['wrap']rrrrrO� bool | Noner:z8Callable[[_FieldWrapSerializerT], _FieldWrapSerializerT])rSr�rUr�rT�Literal['plain']rrrrrOr�r:z:Callable[[_FieldPlainSerializerT], _FieldPlainSerializerT]) rUr�rT�Literal['plain', 'wrap']rrrrrOr�r:zuCallable[[_FieldWrapSerializerT], _FieldWrapSerializerT] | Callable[[_FieldPlainSerializerT], _FieldPlainSerializerT])r\rgr:rg)rTr�rrrrr:z8Callable[[_ModelWrapSerializerT], _ModelWrapSerializerT])rTr�rrrrr:z:Callable[[_ModelPlainSerializerT], _ModelPlainSerializerT]rQ) r\z5_ModelPlainSerializerT | _ModelWrapSerializerT | NonerTr�rrrrr:z�_ModelPlainSerializerT | Callable[[_ModelWrapSerializerT], _ModelWrapSerializerT] | Callable[[_ModelPlainSerializerT], _ModelPlainSerializerT])7r?� __future__r� dataclasses� functoolsrr�typingrrrr r � pydantic_corer r �pydantic_core.core_schemar rr�typing_extensionsrrr�r� _internalrr�annotated_handlersr� dataclass� slots_truerrDrHr@rIrJrKrLrNrVr`rarbrcrdrerfrgrhrjrqrsrArBr6�<module>r�s2��K�"��,�B�B�8�`�`�;�;�)�7�4�����E�,�7�7�E��E�@�@�F�@�F����E�,�7�7�E��E�a�a�F�a�H�=�H�i�=�&Q��)�Q�@�%T���T�?�!M�O�Y�M�0�$�%=�EY�Z��#�$;�CV�W�� � �� #�C� �C��C� � C� � C� � C��C�>�C� �C� � !��� #�E� �E��E� � E� � E� � E��E�@�E� �E�&-�(�"� $� B� �B� "�B��B�� B� � B�A�B�J�/7��=N�7O�QT�7T�.U� �)�U�N�19�3�%��*�1E�#�Y�E�Q�&f��)�f�4�-5�s�<Y�[l�6m�or�6r�-s���s�M�08�#�?\�9]�_b�9b�0c�"�I�c�P�%c���c�3�!M�O�Y�M�$�%=�EY�Z��#�$;�CV�W�� �Q� �Q� �4<�QT�C� �C�)1�C�KN�C�=�C� �C�  �!�"�� E� �E��E�� E� @� E� �E�@D�G�&-�"�(� G�<�G� #� G� � G� � G�A�G�T �)� ����w��|�,�N���[���<�0�;�;�<�#�#�=�#rB