Mini Shell

Direktori : /usr/lib/python3.6/site-packages/enchant/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/enchant/__pycache__/_enchant.cpython-36.pyc

3

��]o-�;@s�dZddlZddlZddlZddlTddlmZddlmZddl	Tddl
mZdZdd�Z
ejd	k�rdZyejd
�ZWn@eefk
r�yejd�ZWneefk
r�YnXYnXedk	�reee�s�eeej��ZejjZdZeede�Ze�se��eeed
�Zedk�r�ejdk�r�yejd�ZWneefk
�rLYnrXee�ZyLejjejje��Zeee��r�ej ej��Ze!e"�j#ed�Z$e"e�e$_%Wne&k
�r�dZYnXedk�rxBe
�D]8Zedk	�r�ye'j(e�ZWne)k
�rYnXP�q�Wedk�r"dZ*ee*��dd�Z+e+de"e"e"e,�Z-e+de"e"e"e"e,�Z.e,Z/e,Z0ej1Z2ge2_3e/e2_4ej5Z6e/ge6_3de6_4ej7Z8e/e"ge8_3e0e8_4ej9Z:e/e"ge:_3e0e:_4ej;Z<e/e0ge<_3de<_4ej=Z>e/e"ge>_3e?e<_4ej@ZAe/e"e"geA_3deA_4ejBZCe/geC_3e"eC_4ejDZEe/e-e,geE_3deE_4dd�ZFejGZHe/e.e,geH_3deH_4dd�ZIy
ejJZKWne&k
�rfdd�ZKYnXe/e"geK_3e"eK_4y
ejLZMWne&k
�r�dd�ZMYnXe/e"e"geM_3deM_4y
ejNZOWne&k
�r�dd�ZOYnXgeO_3e"eO_4ejPZQe0e"eRgeQ_3e?eQ_4dd�ZSejTZUe0e"eRe!eR�geU_3e!e"�eU_4d d!�ZVejWZXe0e"eRgeX_3deX_4d"d#�ZYejWZZe0e"eRgeZ_3deZ_4d$d%�Z[ej\Z]e0e"eRge]_3de]_4d&d'�Z^ej_Z`e0e"eRge`_3de`_4d(d)�ZaejbZce0e"eRgec_3e?ec_4d*d+�ZdejeZfe0e"eRgef_3e?ef_4d,d-�ZgejhZie0e"eRgei_3e?ei_4d.d/�ZjejkZle0e"eRe"eRgel_3del_4d0d1�ZmejnZoe0e!e"�geo_3deo_4ejpZqe0geq_3e"eq_4ejrZse0e.e,ges_3des_4d2d3�ZtdS)4a

    enchant._enchant:  ctypes-based wrapper for enchant C library

    This module implements the low-level interface to the underlying
    C library for enchant.  The interface is based on ctypes and tries 
    to do as little as possible while making the higher-level components
    easier to write.

    The following conveniences are provided that differ from the underlying
    C API:

        * the "enchant" prefix has been removed from all functions, since
          python has a proper module system
        * callback functions do not take a user_data argument, since
          python has proper closures that can manage this internally
        * string lengths are not passed into functions such as dict_check,
          since python strings know how long they are

�N)�*)�find_library)�utils)�unicodeccs\tjjd�Vtjdkr*dVdVdVtd�Vtd�Vtd	�VtjdkrXd
VdS)
z=Generator yielding possible locations of the enchant library.ZPYENCHANT_LIBRARY_PATH�win32�darwinzlibenchant.so.1.6.0zlibenchant.so.1z
libenchant.so�enchantZ
libenchantzlibenchant-1z/opt/local/lib/libenchant.dylibN)rr)�os�environ�get�sys�platformr�rr�/usr/lib/python3.6/_enchant.py�_e_path_possibilities@s




rrzlibenchant.dllzlibenchant-1.dll�)Zhandlerzlib/libenchant.1.dylibZenchant_prefix_dir_pz�The 'enchant' C library was not found. Please install it via your OS package manager, or use a pre-built binary wheel from PyPI.cGst|f|��S)z�Factory for generating callback function prototypes.

    This is factored into a factory so I can easily change the definition
    for experimentation or debugging.
    )Z	CFUNCTYPE)�restype�argtypesrrr�CALLBACK�srcs �fdd�}t|t|�d�dS)Ncs�|dd��dS)N����r)�args)�cbfuncrr�cbfunc1�sz broker_describe.<locals>.cbfunc1)�broker_describe1�t_broker_desc_func)�brokerrrr)rr�broker_describe�srcs �fdd�}t|t|�d�dS)Ncs�|dd��dS)Nrrr)r)rrrr�sz"broker_list_dicts.<locals>.cbfunc1)�broker_list_dicts1�t_dict_desc_func)rrrr)rr�broker_list_dicts�sr cCs
tj|�S)N)�e�enchant_broker_get_param)r�
param_namerrr�broker_get_param�sr$cCs
tj|�S)N)r!�enchant_broker_set_param)rr#rrr�broker_set_param�sr&cCstj�S)N)r!�enchant_get_versionrrrr�get_version�sr(cCst||t|��S)N)�dict_check1�len)�dict�wordrrr�
dict_check�sr-cCshttd��}t||t|�|�}g}d}x&||jjkrL|j||�|d}q(W|jjdkrdt||�|S)Nrr)Zpointer�c_size_t�
dict_suggest1r*�contents�value�append�dict_free_string_list)r+r,Z	numSuggsPZsuggs_cZsuggs�nrrr�dict_suggests
r5cCst||t|��S)N)�	dict_add1r*)r+r,rrr�dict_addsr7cCst||t|��S)N)�dict_add_to_pwl1r*)r+r,rrr�dict_add_to_pwlsr9cCst||t|��S)N)�dict_add_to_session1r*)r+r,rrr�dict_add_to_sessionsr;cCst||t|��S)N)�dict_remove1r*)r+r,rrr�dict_remove#sr=cCst||t|��S)N)�dict_remove_from_session1r*)r+r,rrr�dict_remove_from_session)sr?cCst||t|��S)N)�dict_is_added1r*)r+r,rrr�
dict_is_added/srAcCst||t|��S)N)�dict_is_removed1r*)r+r,rrr�dict_is_removed5srCcCst||t|�|t|��S)N)�dict_store_replacement1r*)r+ZmisZcorrrr�dict_store_replacement;srEcs �fdd�}t|t|�d�dS)Ncs�||||�dS)Nr)�tag�nameZdesc�file�data)rrrrJszdict_describe.<locals>.cbfunc1)�dict_describe1r)r+rrr)rr�
dict_describeIsrK)u�__doc__rr	Zos.pathZctypesZctypes.utilrrrZenchant.errorsZ
enchant.utilsrr!rr
Ze_pathZget_resource_filename�Error�ImportError�
isinstance�getfilesystemencodingZwindllZkernel32ZLoadLibraryExWZ
LoadLibraryExZLOAD_WITH_ALTERED_SEARCH_PATHZe_handleZWinErrorZCDLL�path�dirnameZe_dir�encodeZPOINTERZc_char_pZin_dllZ
prefix_dirr0�AttributeErrorZcdllZLoadLibrary�OSError�msgrZc_void_prrZt_brokerZt_dictZenchant_broker_initZbroker_initrrZenchant_broker_freeZbroker_freeZenchant_broker_request_dictZbroker_request_dictZenchant_broker_request_pwl_dictZbroker_request_pwl_dictZenchant_broker_free_dictZbroker_free_dictZenchant_broker_dict_existsZbroker_dict_existsZc_intZenchant_broker_set_orderingZbroker_set_orderingZenchant_broker_get_errorZbroker_get_errorZenchant_broker_describerrZenchant_broker_list_dictsrr r"r$r%r&r'r(Zenchant_dict_checkr)r.r-Zenchant_dict_suggestr/r5Zenchant_dict_addr6r7r8r9Zenchant_dict_add_to_sessionr:r;Zenchant_dict_remover<r=Z enchant_dict_remove_from_sessionr>r?Zenchant_dict_is_addedr@rAZenchant_dict_is_removedrBrCZenchant_dict_store_replacementrDrEZenchant_dict_free_string_listr3Zenchant_dict_get_errorZdict_get_errorZenchant_dict_describerJrKrrrr�<module>1s8