o
    Zh                     @   s>   d Z zeZW n ey   eZY nw dd Zdd Ze  dS )a!  Disallowed deserialization of 'arrow.py_extension_type':
storage_type = {storage_type}
serialized = {serialized}
pickle disassembly:
{pickle_disassembly}

Reading of untrusted Parquet or Feather files with a PyExtensionType column
allows arbitrary code execution.
If you trust this file, you can enable reading the extension type by one of:

- upgrading to pyarrow >= 14.0.1, and call `pa.PyExtensionType.set_auto_load(True)`
- disable this error by running `import pyarrow_hotfix; pyarrow_hotfix.uninstall()`

We strongly recommend updating your Parquet/Feather files to use extension types
derived from `pyarrow.ExtensionType` instead, and register this type explicitly.
See https://arrow.apache.org/docs/dev/python/extending_types.html#defining-extension-types-user-defined-types
for more details.
c                  C   s   dd l } zdd l}W n
 ty   Y d S w t|dsd S t|ddr$d S G dd d|j}t|drB|d ||| d nt|j	d	rU|j	
  | |j	j
 n|j	`d
|_d S )N    ExtensionType_hotfix_installedFc                   @   s    e Zd Zdd Zedd ZdS )z'install.<locals>.ForbiddenExtensionTypec                 S   s   dS )N     )selfr   r   N/var/www/html/lang_env/lib/python3.10/site-packages/pyarrow_hotfix/__init__.py__arrow_ext_serialize__/   s   z?install.<locals>.ForbiddenExtensionType.__arrow_ext_serialize__c                 S   s<   dd l }dd l}| }||| ttj||| d)Nr   )storage_type
serializedZpickle_disassembly)iopickletoolsStringIOdisRuntimeError
_ERROR_MSGformatgetvalue)clsr	   r
   r   r   outr   r   r   __arrow_ext_deserialize__2   s   zAinstall.<locals>.ForbiddenExtensionType.__arrow_ext_deserialize__N)__name__
__module____qualname__r   classmethodr   r   r   r   r   ForbiddenExtensionType.   s    r   unregister_extension_typearrow.py_extension_type_unregister_py_extension_typeT)atexitpyarrow_import_errorhasattrgetattrr   r   Zregister_extension_typenulllibr   
unregister_extension_types_initializerr   )r   par   r   r   r   install   s*   




r(   c                  C   s   dd l } zdd l}W n
 ty   Y d S w t|dsd S t|dds$d S t|dr4|d |j  n t|jdrG|j  | |jj	 nt|jdrT|j
 |j_d|_d S )	Nr   r   r   Fr   r   _register_py_extension_type_ExtensionTypesInitializer)r   r   r    r!   r"   r   r$   r)   registerr   r*   r&   r   )r   r'   r   r   r   	uninstallP   s&   




r,   N)r   ModuleNotFoundErrorr    	NameErrorImportErrorr(   r,   r   r   r   r   <module>   s   1
