o
    c                     @   s0   d dl mZmZmZmZmZ G dd deZdS )    )KeyDictFloatBytesConstantAnyc                       s.   e Zd ZdZd fdd	Z fddZ  ZS )Messagea
  
    Like L{KeyDict}, but with three predefined keys: C{type}, C{api},
    and C{timestamp}. Of these, C{api} and C{timestamp} are optional.


    @param type: The type of the message. The C{type} key will need to
        match this as a constant.
    @param schema: A dict of additional schema in a format L{KeyDict}
        will accept.
    @param optional: An optional list of keys that should be optional.
    @param api: The server API version needed to send this message,
        if C{None} any version is fine.
    Nc                    sn   || _ || _t |d< tt td |d< t||d< |d ur'|ddg nddg}tt| j	||d d S )N	timestampapitype)optional)
r
   r	   r   r   r   r   extendsuperr   __init__)selfr
   schemar   r	   	__class__ C/usr/lib/python3/dist-packages/landscape/message_schemas/message.pyr      s   
zMessage.__init__c                    s6   t | D ]}|| jvr|| qtt| |S )N)listkeysr   popr   r   coerce)r   valuekr   r   r   r      s
   

zMessage.coerce)NN)__name__
__module____qualname____doc__r   r   __classcell__r   r   r   r   r      s    r   N)landscape.lib.schemar   r   r   r   r   r   r   r   r   r   <module>   s   