o
    xij                     @   sL  d dl mZ d dlmZ G dd deZG dd deZG dd deZG d	d
 d
eZG dd deZ	G dd deZ
G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd  d eZG d!d" d"eZG d#d$ d$eZG d%d& d&eZG d'd( d(eZd)S )*    )List)	constantsc                   @      e Zd ZdS )PraatioExceptionN__name__
__module____qualname__ r
   r
   [/home/ubuntu/maya3_transcribe/venv/lib/python3.10/site-packages/praatio/utilities/errors.pyr          r   c                   @   r   )SafeZipExceptionNr   r
   r
   r
   r   r   
   r   r   c                       s*   e Zd Zdef fddZdd Z  ZS )FileNotFoundfullPathc                       t t|   || _d S N)superr   __init__r   )selfr   	__class__r
   r   r         
zFileNotFound.__init__c                 C   s
   d| j  S )NzFile not found:
%s)r   r   r
   r
   r   __str__   s   
zFileNotFound.__str__)r   r   r	   strr   r   __classcell__r
   r
   r   r   r      s    r   c                   @   r   )ParsingErrorNr   r
   r
   r
   r   r      r   r   c                   @   r   )ArgumentErrorNr   r
   r
   r
   r   r      r   r   c                   @   r   )UnexpectedErrorNr   r
   r
   r
   r   r      r   r   c                   @   s.   e Zd Zdededee fddZdd ZdS )	WrongOptionargumentName
givenValueavailableOptionsc                 C   s   || _ || _|| _d S r   )r    r!   r"   )r   r    r!   r"   r
   r
   r   r   $   s   
zWrongOption.__init__c                 C   s$   d| j  d| j dd| j dS )NzFor argument 'z' was given the value 'z'. However, expected one of [z, ])r    r!   joinr"   r   r
   r
   r   r   )   s   
zWrongOption.__str__N)r   r   r	   r   r   r   r   r
   r
   r
   r   r   #   s    r   c                   @   r   )TextgridExceptionNr   r
   r
   r
   r   r%   0   r   r%   c                   @   r   )DuplicateTierNameNr   r
   r
   r
   r   r&   4   r   r&   c                   @   r   )OutOfBoundsNr   r
   r
   r
   r   r'   8   r   r'   c                   @   r   )CollisionErrorNr   r
   r
   r
   r   r(   <   r   r(   c                   @      e Zd Zdd ZdS )TimelessTextgridTierExceptionc                 C   s   dS )Nz3All textgrid tiers much have a min and max durationr
   r   r
   r
   r   r   A   s   z%TimelessTextgridTierException.__str__Nr   r   r	   r   r
   r
   r
   r   r*   @       r*   c                   @   r   )TextgridStateAutoModifiedNr   r
   r
   r
   r   r-   H   r   r-   c                   @   r   )TextgridStateErrorNr   r
   r
   r
   r   r.   L   r   r.   c                   @   r   )TierNameExistsErrorNr   r
   r
   r
   r   r/   P   r   r/   c                       s$   e Zd Z fddZdd Z  ZS )IncompatibleTierErrorc                    s:   t t|   || _| jjtjkrtj| _d S tj| _d S r   )	r   r0   r   tiertierTyper   INTERVAL_TIER
POINT_TIERotherTierType)r   r1   r   r
   r   r   U   s
   zIncompatibleTierError.__init__c                 C   s    d| j j d| j j d| j S )Nz(Incompatible tier type.  Tier with name z	 has typez but expected )r1   namer2   r5   r   r
   r
   r   r   ]   s   zIncompatibleTierError.__str__)r   r   r	   r   r   r   r
   r
   r   r   r0   T   s    r0   c                       s.   e Zd Zdee f fddZdd Z  ZS )PraatExecutionFailedcmdListc                    r   r   )r   r7   r   r8   )r   r8   r   r
   r   r   e   r   zPraatExecutionFailed.__init__c                 C   s   d}d | j}|| S )Nay  
Praat Execution Failed.  Please check the following:
- Praat exists in the location specified
- Praat script can execute ok outside of praat
- script arguments are correct

If you can't locate the problem, I recommend using absolute paths rather than relative paths and using paths without spaces in any folder or file names

Here is the command that python attempted to run:
 )r$   r8   )r   errorStrcmdTxtr
   r
   r   r   i   s   zPraatExecutionFailed.__str__)r   r   r	   r   r   r   r   r   r
   r
   r   r   r7   d   s    r7   c                       s.   e Zd Zdedef fddZdd Z  ZS )FindZeroCrossingError	startTimeendTimec                    s   t t|   || _|| _d S r   )r   r<   r   r=   r>   )r   r=   r>   r   r
   r   r   z   s   
zFindZeroCrossingError.__init__c                 C   s   d}|| j | jf S )Nz(No zero crossing found between %f and %f)r=   r>   )r   	retStringr
   r
   r   r      s   zFindZeroCrossingError.__str__)r   r   r	   floatr   r   r   r
   r
   r   r   r<   y   s    r<   c                   @   r)   )NormalizationExceptionc                 C   s   	 dS )Na  Local normalization will nullify the effect of global normalization. Local normalization should be used to examine local phenomena (e.g. max pitch in a segment of running speech).Global normalization should be used to examine global phenomena (e.g. the pitch range of a speaker).r
   r   r
   r
   r   r      s   zNormalizationException.__str__Nr+   r
   r
   r
   r   rA      r,   rA   N)typingr   praatio.utilitiesr   	Exceptionr   r   r   r   r   r   r   r%   r&   r'   r(   r*   r-   r.   r/   r0   r7   r<   rA   r
   r
   r
   r   <module>   s*    	