a
    ¥¹Df®  ã                   @   s4   d Z ddlmZ er0ddlZddlmZ dd„ ZdS )z>
Compatibility functions for scoped and unscoped enum access.
é   )ÚPYQT6é    N)Úsipc           	      C   sŒ   dd„ t | ƒD ƒ}|D ]p}t| |ƒ}t|tjƒs2qdd„ t |ƒD ƒ}|D ]<}t||ƒ}t|tjƒsdqH|j ¡ D ]\}}t	|||ƒ qnqHqdS )a  
        Search enums in the given module and allow unscoped access.

        Taken from:
        https://github.com/pyqtgraph/pyqtgraph/blob/pyqtgraph-0.12.1/pyqtgraph/Qt.py#L331-L377
        and adapted to also copy enum values aliased under different names.

        c                 S   s   g | ]}|  d ¡r|‘qS )ÚQ)Ú
startswith©Ú.0Úname© r
   ú^/nfs/NAS7/SABIOD/METHODE/ermites/ermites_venv/lib/python3.9/site-packages/qtpy/enums_compat.pyÚ
<listcomp>   ó    z!promote_enums.<locals>.<listcomp>c                 S   s   g | ]}|d    ¡ r|‘qS )r   )Úisupperr   r
   r
   r   r   !   r   N)
ÚdirÚgetattrÚ
isinstancer   ZwrappertypeÚenumÚEnumMetaÚ__members__ÚitemsÚsetattr)	ÚmoduleZclass_namesÚ
class_nameÚklassZattrib_namesZattrib_nameÚattribr	   Úvaluer
   r
   r   Úpromote_enums   s    	

r   )Ú__doc__Ú r   r   r   r   r
   r
   r
   r   Ú<module>   s
   