U
    qh$                     @  s8   d dl mZ d dlZd dlmZ dZG dd deZdS )    )annotationsN)OpRun)UOc                   @  s   e Zd ZdddZdS )RegexFullMatchNc              
     s   zdd l }W n, tk
r8 } ztd|W 5 d }~X Y nX |jjtkrVtd|j z|| W n4 |jk
r } ztd||W 5 d }~X Y nX t	j
 fddt	jgd}||fS )Nr   zXre2 must be installed to use the reference implementation of the RegexFullMatch operatorz,Input must be string tensor, received dtype zInvalid regex pattern c                   s     | d k	S )N)	fullmatch)xregex J/tmp/pip-unpacked-wheel-xnis5xre/onnx/reference/ops/op_regex_full_match.py<lambda>       z%RegexFullMatch._run.<locals>.<lambda>)Zotypes)re2ImportErrorZdtypekind_acceptable_str_dtypes	TypeErrorcompileerror
ValueErrornpZ	vectorizeZbool_)selfr   patternr   eZfullmatch_funcr   r	   r   _run   s&    "
 zRegexFullMatch._run)N)__name__
__module____qualname__r   r   r   r   r   r      s   r   )
__future__r   Znumpyr   Zonnx.reference.op_runr   r   r   r   r   r   r   <module>   s   