
    j                     p    d dl Z d dlmZ d dlmZ d dl mZ  e j        dd          Z G d d          ZdS )	    N)abstractmethod)MappingProxyType)MappingAnyCloudEvent
CloudEvent)boundc            	          e Zd ZdZedej        e         dej        e	ej
        f         dej        ej
                 defd            Zdee	ej
        f         fdZedej        e	ej
        f         fd            Zedej        ej
                 fd	            Zd
ej
        defdZde	dej
        fdZ	 dde	dej        ej
                 dej        ej
                 fdZdej        ej
                 fdZdefdZde	defdZde	fdZdS )r   z
    The CloudEvent Python wrapper contract exposing generically-available
    properties and APIs.

    Implementations might handle fields and have other APIs exposed but are
    obliged to follow this contract.
    cls
attributesdatareturnc                     t                      )a  
        Creates a new instance of the CloudEvent using supplied `attributes`
        and `data`.

        This method should be preferably used over the constructor to create events
        while custom framework-specific implementations may require or assume
        different arguments.

        :param attributes: The attributes of the CloudEvent instance.
        :param data: The payload of the CloudEvent instance.
        :returns: A new instance of the CloudEvent created from the passed arguments.
        NotImplementedError)r
   r   r   s      e/DATA/AppData/hermes/projects/honcho/.venv/lib/python3.11/site-packages/cloudevents/abstract/event.pycreatezCloudEvent.create    s    $ "###    c                 D    t          |                                           S )z
        Returns a read-only view on the attributes of the event.

        :returns: Read-only view on the attributes of the event.
        )r   _get_attributesselfs    r   get_attributeszCloudEvent.get_attributes4   s       4 4 6 6777r   c                     t                      )a+  
        Returns the attributes of the event.

        The implementation MUST assume that the returned value MAY be mutated.

        Having a function over a property simplifies integration for custom
        framework-specific implementations.

        :returns: Attributes of the event.
        r   r   s    r   r   zCloudEvent._get_attributes<        "###r   c                     t                      )a  
        Returns the data of the event.

        The implementation MUST assume that the returned value MAY be mutated.

        Having a function over a property simplifies integration for custom
        framework-specific implementations.

        :returns: Data of the event.
        r   r   s    r   get_datazCloudEvent.get_dataJ   r   r   otherc                     t          |t                    rX|                                 |                                k    }|                                 |                                k    }|o|S dS )NF)
isinstancer   r   r   )r   r   	same_datasame_attributess       r   __eq__zCloudEvent.__eq__X   sb    eZ(( 	15>>+;+;;I"22448M8M8O8OOO00ur   keyc                 6    |                                  |         S )aE  
        Returns a value of an attribute of the event denoted by the given `key`.

        The `data` of the event should be accessed by the `.data` accessor rather
        than this mapping.

        :param key: The name of the event attribute to retrieve the value for.
        :returns: The event attribute value.
        r   r   r#   s     r   __getitem__zCloudEvent.__getitem___   s     ##%%c**r   Ndefaultc                 R    |                                                      ||          S )aQ  
        Retrieves an event attribute value for the given `key`.

        Returns the `default` value if the attribute for the given key does not exist.

        The implementation MUST NOT throw an error when the key does not exist, but
        rather should return `None` or the configured `default`.

        :param key: The name of the event attribute to retrieve the value for.
        :param default: The default value to be returned when
            no attribute with the given key exists.
        :returns: The event attribute value if exists, default value or None otherwise.
        )r   get)r   r#   r(   s      r   r*   zCloudEvent.getk   s&      ##%%))#w777r   c                 D    t          |                                           S )z@
        Returns an iterator over the event attributes.
        )iterr   r   s    r   __iter__zCloudEvent.__iter__}   s     D((**+++r   c                 D    t          |                                           S )z=
        Returns the number of the event attributes.
        )lenr   r   s    r   __len__zCloudEvent.__len__   s     4''))***r   c                 .    ||                                  v S )zk
        Determines if an attribute with a given `key` is present
        in the event attributes.
        r%   r&   s     r   __contains__zCloudEvent.__contains__   s    
 d**,,,,r   c                 n    t          |                                 |                                 d          S )N)r   r   )strr   r   r   s    r   __repr__zCloudEvent.__repr__   s,    $"6"6"8"8$--//RRSSSr   )N)__name__
__module____qualname____doc__classmethodtypingTyper   r   r4   AnyOptionalr   r   r   Dictr   r   boolr"   r'   r*   Iteratorr-   intr0   r2   r5    r   r   r   r      s         $['$N3
?3$ ofj)$ 
	$ $ $ [$&8VZ 8 8 8 8 8 $S&*_!= $ $ $ ^$ $&/&*5 $ $ $ ^$FJ 4    
+s 
+vz 
+ 
+ 
+ 
+ @D8 88!'!<8		$8 8 8 8$,&/&*5 , , , ,+ + + + +- - - - - -T# T T T T T Tr   )	r;   abcr   typesr   r   TypeVarr   r   rC   r   r   <module>rG      s           " " " " " "      lCCCzT zT zT zT zT zT zT zT zT zTr   