o
    ix                     @  s   d Z ddlmZ ddlmZmZmZmZmZ ddl	m
Z
 ddlZddlZddlZede
def dZed	d
dZeeeeeef ef  ZeefZddddZdddZG dd
 d
eeef ejZedkrpddlZe  dS dS )zThis module contains miscellaneous helpers.

It is not considered part of the public ufoLib API. It does, however,
define the :py:obj:`.deprecated` decorator that is used elsewhere in
the module.
    )annotations)OptionalTypeTypeVarUnioncast)CallableNF.)boundFormatVersionBaseFormatVersion msgstrreturnCallable[[F], F]c                   s   d fdd}|S )a@  Decorator factory to mark functions as deprecated with given message.

    >>> @deprecated("Enough!")
    ... def some_function():
    ...    "I just print 'hello world'."
    ...    print("hello world")
    >>> some_function()
    hello world
    >>> some_function.__doc__ == "I just print 'hello world'."
    True
    funcr	   r   c                   s"   t   fdd}tt|S )Nc                    s*   t j j d tdd  | i |S )Nz function is a deprecated.    )category
stacklevel)warningswarn__name__DeprecationWarning)argskwargs)r   r    e/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/fontTools/ufoLib/utils.pywrapper%   s   z9deprecated.<locals>.deprecated_decorator.<locals>.wrapper)	functoolswrapsr   r	   )r   r   r   )r   r   deprecated_decorator$   s   
z(deprecated.<locals>.deprecated_decoratorN)r   r	   r   r	   r   )r   r"   r   r!   r   
deprecated   s   r#   valueFormatVersionInputclsType[FormatVersion]c                 C  s`   | d u r|  S t| |r| S t| tr|| dfS t| tr)t| dkr)|| S td| )Nr   r   zUnsupported format version: )default
isinstanceinttuplelen
ValueError)r$   r&   r   r   r   normalizeFormatVersion3   s   

r.   c                      sx   e Zd ZU ded< d fddZedd	d
ZedddZedddZ	dddZ
edddZedddZ  ZS )r   tuple[int, int]r$   r&   r'   r   c                   s   t  | |S N)super__new__r&   r$   	__class__r   r   r2   F   s   zBaseFormatVersion.__new__r*   c                 C  
   | j d S )Nr   r$   selfr   r   r   majorI      
zBaseFormatVersion.majorc                 C  r6   )N   r7   r8   r   r   r   minorM   r;   zBaseFormatVersion.minorobjectc                 C  s:   t |tr| |dfS |d u r|  S t|d| j )Nr   z is not a valid )r)   r*   r(   r-   r   r3   r   r   r   	_missing_Q   s
   
zBaseFormatVersion._missing_r   c                 C  s   | j  d| j S )N.)r:   r=   r8   r   r   r   __str__[   s   zBaseFormatVersion.__str__r   c                 C     t | j S r0   )max__members__valuesr&   r   r   r   r(   ^   s   zBaseFormatVersion.defaultfrozenset[FormatVersion]c                 C  rB   r0   )	frozensetrD   rE   rF   r   r   r   supported_versionsc   s   z$BaseFormatVersion.supported_versions)r&   r'   r$   r/   r   r   )r   r*   )r$   r>   r   r   )r   r   )r&   r'   r   r   )r&   r'   r   rG   )r   
__module____qualname____annotations__r2   propertyr:   r=   classmethodr?   rA   r(   rI   __classcell__r   r   r4   r   r   C   s   
 
	__main__)r   )r   r   r   r   )r$   r%   r&   r'   r   r   )__doc__
__future__r   typingr   r   r   r   r   collections.abcr   enumr   r   r>   r	   r   r*   r+   r%   floatZnumberTypesr#   r.   Enumr   r   doctesttestmodr   r   r   r   <module>   s$    
%