o
    •Û_ÿ  ã                   @   sT   d dl Z d dlZddlmZ d dlmZ d dlmZ ej	 
¡ ZG dd„ dejƒZdS )é    Né   )Úbase)Úcommands)ÚInvalidProfileExceptionc                       s,   e Zd ZdZ‡ fdd„Z‡ fdd„Z‡  ZS )Ú	assertionz¶
	Assertion: compares argument 2 with argument 3. If they don't match
	it logs text from argument 1 and  throws InvalidProfileException. This
	exception will abort profile loading.
	c                    s   t t| ƒ ddd¡ d S )Nr   é   )Úsuperr   Ú__init__)Úself©Ú	__class__© úM/usr/lib/python3/dist-packages/tuned/profiles/functions/function_assertion.pyr	      s   zassertion.__init__c                    sX   t t| ƒ |¡s
d S |d |d kr*t d|d |d |d f ¡ td|d  ƒ‚d S )Nr   é   z#assertion '%s' failed: '%s' != '%s'r   zAssertion '%s' failed.)r   r   ÚexecuteÚlogÚerrorr   )r
   Úargsr   r   r   r      s    zassertion.execute)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r   Ú__classcell__r   r   r   r   r   	   s    r   )ÚosÚ
tuned.logsÚtunedÚ r   Útuned.utils.commandsr   Útuned.profiles.exceptionsr   ÚlogsÚgetr   ÚFunctionr   r   r   r   r   Ú<module>   s    
