[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.221.25.133: ~ $
�

>�Dg������ddlZddlZddlZddlZddlZddlTddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZdd
lmZ	ddlmZmZmZmZmZmZmZmZmZmZmZdZn
#e$rdZYnwxYwejddkre Z!dZ"dZ#e�ej$dd�dkrdndZ%ndZ%dZ&Gd�de'��Z(Gd�de(��Z)Gd�de'��Z*Gd�de+��Z,Gd�d e��Z-Gd!�d"e.��Z/Gd#�d$e0��Z1Gd%�d&e2��Z3Gd'�d(e4��Z5Gd)�d*e5��Z6Gd+�d,e6��Z7d-Z8e9d.��e9e8��ze9e8�:����ze9e;d/��f��zZ<e9d0�e=d1��D����Z>[8[<ej?d2��Z@Gd3�d4e6��ZA		dNd5�ZBGd6�d7e5��ZCd8e
_Dd9�ZEGd:�d;eF��ZGer@dZHd<ZId=ZJdZKdZLd>ZMd?ZNd@ZOdAZPdBZQdZRd<ZSd=ZTdZUdZVd>ZWd?ZXd@ZYdAZZdBZ[dCZ\dOdD�Z]dPdE�Z^GdF�dGeG��Z_dH�Z`dI�ZadJ�ZbdK�ZcdL�ZddM�ZedS)Q�N)�*)�
ColumnBase)�EnclosedNodeList)�Entity)�
Expression)�Insert)�Node)�NodeList)�OP)�VirtualField)�
merge_dict)�sqlite3)�backup�backup_to_file�Blob�ConnectionHelper�register_bloomfilter�register_hash_functions�register_rank_functions�sqlite_get_db_status�sqlite_get_status�
TableFunction�ZeroBlobTF��pcx�pcnalx)r��r)r�	rc�.��eZdZdZdxZxZZ�fd�Z�xZS)�
RowIDFieldT�rowidc���||jkr'tt|���d|j�d����tt|��j||g|�R�dS)Nz must be named "z".)�
required_name�
ValueError�type�superr!�bind)�self�model�name�args�	__class__s    ��K/opt/imunify360/venv/lib64/python3.11/site-packages/playhouse/sqlite_ext.pyr(zRowIDField.bind8sm����4�%�%�%��"�4�j�j�j�j�$�*<�*<�*<�>�?�?�
?�$��j�$���$�U�D�8�4�8�8�8�8�8�8�)	�__name__�
__module__�__qualname__�auto_increment�column_namer+r$r(�
__classcell__�r-s@r.r!r!4sL��������N�)0�0�K�0�$��9�9�9�9�9�9�9�9�9r/r!c��eZdZdxZxZZdS)�
DocIDField�docidN)r0r1r2r4r+r$�r/r.r8r8?s������)0�0�K�0�$���r/r8c���eZdZ�fd�Z�xZS)�AutoIncrementFieldc���tt|���|��}t|t	d��f��S)N�
AUTOINCREMENT)r'r<�ddlr
�SQL)r)�ctx�	node_listr-s   �r.r?zAutoIncrementField.ddlDs<����,�d�3�3�7�7��<�<�	���C��$8�$8�9�:�:�:r/)r0r1r2r?r5r6s@r.r<r<Cs8�������;�;�;�;�;�;�;�;�;r/r<c��eZdZdZd�ZdS)�
TDecimalField�TEXTc��dS�Nr:�r)s r.�
get_modifierszTDecimalField.get_modifiersKs���r/N)r0r1r2�
field_typerIr:r/r.rDrDIs�������J�!�!�!�!�!r/rDc���eZdZd�fd�	Zed���Zd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Z�xZS)�JSONPathNc�v��tt|�����||_|pd|_dS�Nr:)r'rL�__init__�_field�_path)r)�field�pathr-s   �r.rOzJSONPath.__init__Os5���
�h����&�&�(�(�(�����Z�R��
�
�
r/c�V�tdd�|j��z��S)Nz$%s�)�Value�joinrQrHs r.rSz
JSONPath.pathTs#���U�R�W�W�T�Z�0�0�0�1�1�1r/c��t|t��s|dkrd|z}nd|z}t|j|j|fz��S)N�#z[%s]z.%s)�
isinstance�intrLrPrQ)r)�idx�items   r.�__getitem__zJSONPath.__getitem__XsK���c�3���	�3�#�:�:��C�<�D�D��3�;�D����T�Z�4�'�%9�:�:�:r/c��|st|ttf��r2t�|j�|����}t�|j|dj|��S)NrY)	rZ�list�dict�fn�jsonrP�_json_dumps�json_setrS�r)�value�as_jsons   r.�appendzJSONPath.append_s^���	<�j���t��5�5�	<��G�G�D�K�3�3�E�:�:�;�;�E��{�{�4�;��S�	���>�>�>r/c���|st|ttf��r2t�|j�|����}||j|j|��SrG)rZr`rarbrcrPrdrS)r)�funcrgrhs    r.�_json_operationzJSONPath._json_operationdsX���	<�j���t��5�5�	<��G�G�D�K�3�3�E�:�:�;�;�E��t�D�K���E�2�2�2r/c�D�|�tj||��SrG)rlrb�json_insertrfs   r.�insertzJSONPath.insertis���#�#�B�N�E�7�C�C�Cr/c�D�|�tj||��SrG)rlrbrerfs   r.�setzJSONPath.setls���#�#�B�K���@�@�@r/c�D�|�tj||��SrG)rlrb�json_replacerfs   r.�replacezJSONPath.replaceos���#�#�B�O�U�G�D�D�Dr/c��|�t�||j�|������SrG)rqrb�
json_patchrPrd�r)rgs  r.�updatezJSONPath.updaters2���x�x��
�
�d�D�K�,C�,C�E�,J�,J�K�K�L�L�Lr/c�L�t�|j|j��SrG)rb�json_removerPrSrHs r.�removezJSONPath.removeus���~�~�d�k�4�9�5�5�5r/c�L�t�|j|j��SrG)rb�	json_typerPrSrHs r.r}zJSONPath.json_typex����|�|�D�K���3�3�3r/c�L�t�|j|j��SrG)rb�json_array_lengthrPrSrHs r.�lengthzJSONPath.length{s���#�#�D�K���;�;�;r/c�L�t�|j|j��SrG)rb�	json_eachrPrSrHs r.�childrenzJSONPath.children~r~r/c�L�t�|j|j��SrG)rb�	json_treerPrSrHs r.�treez
JSONPath.tree�r~r/c��|�|jr%t�|j|j��n|j��SrG)�sqlrQrb�json_extractrPrS)r)rAs  r.�__sql__zJSONPath.__sql__�s>���w�w��*�6�r���t�{�D�I�>�>�>�*.�+�7�7�	7r/rG)r0r1r2rO�propertyrSr^rirlrorqrtrxr{r}r�r�r�r�r5r6s@r.rLrLNsC������� � � � � � �
�2�2��X�2�;�;�;�?�?�?�?�
3�3�3�3�
D�D�D�D�A�A�A�A�E�E�E�E�M�M�M�6�6�6�4�4�4�<�<�<�4�4�4�4�4�4�7�7�7�7�7�7�7r/rLc�f��eZdZdZdZd�fd�	Zd�Zd�Zd�Zee	j
��Zee	j��Z
ee	j��Zee	j��Zee	j��Zee	j��ZejZd�Zd	�Zd
�Zd�Zdd�Zdd
�Zdd�Zdd�Zd�Z d�Z!d�Z"dd�Z#d�Z$d�Z%�xZ&S)�	JSONField�JSONFNc���|ptj|_|ptj|_tt|��jdi|��dSrN)rc�dumpsrd�loads�_json_loadsr'r�rO)r)�
json_dumps�
json_loads�kwargsr-s    �r.rOzJSONField.__init__�sJ���%�3�����%�3�����'��i����'�1�1�&�1�1�1�1�1r/c�h�|�/	|�|��S#ttf$r|cYSwxYwdSrG)r��	TypeErrorr%rws  r.�python_valuezJSONField.python_value�sR����
��'�'��.�.�.���z�*�
�
�
�����
�����s��/�/c��|�Dt|t��s-t�|�|����}|SdSrG)rZr	rbrcrdrws  r.�db_valuezJSONField.db_value�sF�����e�T�*�*�
9����� 0� 0�� 7� 7�8�8���L��r/c����fd�}|S)Nc���t|ttf��rt||jd���}t|�|��S)NF)�	converter�unpack)rZr`rarVr�r)r)�rhs�ops  �r.�innerzJSONField._e.<locals>.inner�sB����#��d�|�,�,�
H��C�4�=��G�G�G���d�B��,�,�,r/r:)r�r�s` r.�_ezJSONField._e�s#���	-�	-�	-�	-�	-��r/c�,�t|��|SrG)rL)r)r]s  r.r^zJSONField.__getitem__�s����~�~�d�#�#r/c�>�d�|D��}tj|g|�R�S)Nc�0�g|]}t|d�����S)F�r�)rV��.0�ps  r.�
<listcomp>z%JSONField.extract.<locals>.<listcomp>�s%��:�:�:�q��q�E�*�*�*�:�:�:r/)rbr��r)�pathss  r.�extractzJSONField.extract�s-��:�:�E�:�:�:����t�,�e�,�,�,�,r/c�B�t|dt|d�����S)Nz->Fr��rrV�r)rSs  r.�extract_jsonzJSONField.extract_json�s!���$��e�D�E�&B�&B�&B�C�C�Cr/c�B�t|dt|d�����S)Nz->>Fr�r�r�s  r.�extract_textzJSONField.extract_text�s!���$��u�T�U�'C�'C�'C�D�D�Dr/c�H�t|���||��SrG)rLrirfs   r.rizJSONField.append������~�~�$�$�U�G�4�4�4r/c�H�t|���||��SrG)rLrorfs   r.rozJSONField.insert�r�r/c�H�t|���||��SrG)rLrqrfs   r.rqz
JSONField.set�s����~�~�!�!�%��1�1�1r/c�H�t|���||��SrG)rLrtrfs   r.rtzJSONField.replace�s����~�~�%�%�e�W�5�5�5r/c�F�t|���|��SrG)rLrx)r)�datas  r.rxzJSONField.update�s����~�~�$�$�T�*�*�*r/c�l�|s!t|�����Stj|g|�R�SrG)rLr{rbrzr�s  r.r{zJSONField.remove�s:���	+��D�>�>�(�(�*�*�*��~�d�+�U�+�+�+�+r/c�6�t�|��SrG)rbr}rHs r.r}zJSONField.json_type�����|�|�D�!�!�!r/c�0�|r||fn|f}tj|�SrG)rbr�)r)rSr,s   r.r�zJSONField.length�s$��#�0��d�|�|�$����#�T�*�*r/c�6�t�|��S)a?
        Schema of `json_each` and `json_tree`:

        key,
        value,
        type TEXT (object, array, string, etc),
        atom (value for primitive/scalar types, NULL for array and object)
        id INTEGER (unique identifier for element)
        parent INTEGER (unique identifier of parent element or NULL)
        fullkey TEXT (full path describing element)
        path TEXT (path to the container of the current element)
        json JSON hidden (1st input parameter to function)
        root TEXT hidden (2nd input parameter, path at which to start)
        )rbr�rHs r.r�zJSONField.children�s���|�|�D�!�!�!r/c�6�t�|��SrG)rbr�rHs r.r�zJSONField.tree�r�r/)NNrG)'r0r1r2rJr�rOr�r�r�r�EQ�__eq__�NE�__ne__�GT�__gt__�GTE�__ge__�LT�__lt__�LTE�__le__�Field�__hash__r^r�r�r�rirorqrtrxr{r}r�r�r�r5r6s@r.r�r��s���������J�
�F�2�2�2�2�2�2�
����������R���Y�Y�F�
�R���Y�Y�F�
�R���Y�Y�F�
�R���Z�Z�F�
�R���Y�Y�F�
�R���Z�Z�F��~�H�$�$�$�-�-�-�D�D�D�E�E�E�5�5�5�5�5�5�5�5�2�2�2�2�6�6�6�6�+�+�+�,�,�,�
"�"�"�+�+�+�+�"�"�"�""�"�"�"�"�"�"r/r�c�J��eZdZd
�fd�	Zd�Zed���Zd�Zdd	�Z�xZ	S)�SearchFieldFNc���|rtdt|��z���tt|���||d���dS)Nz8SearchField does not accept these keyword arguments: %s.T)�	unindexedr4�null)r%�sortedr'r�rO)r)r�r4�kr-s    �r.rOzSearchField.__init__�sm����	;��.�06�q�	�	�:�;�;�
;�
�k�4� � �)�)�I�6A��	*�	N�	N�	N�	N�	Nr/c�"�t||��SrG)�match)r)�terms  r.r�zSearchField.match�s���T�4� � � r/c��t|d��s:d�|jjjD��}|�|j��|_|jS)N�_fts_column_indexc�F�g|]}t|t���|j��Sr:)rZr�r+)r��fs  r.r�z0SearchField.fts_column_index.<locals>.<listcomp>�s8��<�<�<�� *�1�k� :� :�<�Q�V�<�<�<r/)�hasattrr*�_meta�
sorted_fields�indexr+r�)r)�
search_fieldss  r.�fts_column_indexzSearchField.fts_column_index�s\���t�0�1�1�	D�<�<�T�Z�-=�-K�<�<�<�M�%2�%8�%8���%C�%C�D�"��%�%r/c�h�|j}t�|jjj|||��SrG)r�rb�	highlightr*r��entity)r)�left�right�
column_idxs    r.r�zSearchField.highlight�s*���*�
��|�|�D�J�,�3�Z��u�M�M�Mr/�...�c��d|cxkrdksntd���|j}t�|jjj|||||��S)Nr�Az/max_tokens must be between 1 and 64 (inclusive))r%r�rb�snippetr*r�r�)r)r�r��over_length�
max_tokensr�s      r.r�zSearchField.snippet�sc���J�#�#�#�#��#�#�#�#��N�O�O�O��*�
��z�z�$�*�*�1�:�t�U�%�z�3�3�	3r/)FN)r�r�)
r0r1r2rOr�r�r�r�r�r5r6s@r.r�r��s��������N�N�N�N�N�N�!�!�!��&�&��X�&�N�N�N�3�3�3�3�3�3�3�3r/r�c�(��eZdZdd�Zd�fd�	Z�xZS)�VirtualTableSchemaManagerTc��|j�t|jjj|����}|���}|�d��|r|�d��|�|j���d��|jjj}t|t��r|�|��S|�t|�����d��g}|jj}|jr$|�
d�|jD����|jD]}t|t��s|jr�t#|j��g}|jr"|�td����|�t+|������|jr$|�
d�|jD����|r(|�
|�|����|�t1|����S)NzCREATE VIRTUAL TABLE zIF NOT EXISTS z USING � c�,�g|]}t|����Sr:�r@�r��as  r.r�zCVirtualTableSchemaManager._create_virtual_table.<locals>.<listcomp>!s��D�D�D��c�!�f�f�D�D�Dr/�	UNINDEXEDc�,�g|]}t|����Sr:r�r�s  r.r�zCVirtualTableSchemaManager._create_virtual_table.<locals>.<listcomp>-s��=�=�=��c�!�f�f�=�=�=r/)r*�
clean_optionsr
r��options�_create_context�literalr��extension_modulerZr	r@�prefix_arguments�extendr�r!�_hiddenrr4r�rir
�	arguments�_create_table_option_sqlr)	r)�safer�rA�
ext_moduler�metarR�	field_defs	         r.�_create_virtual_tablez/VirtualTableSchemaManager._create_virtual_tables&���*�*�*��t�z�'�/��9�9�;�;���"�"�$�$�����+�,�,�,��	*��K�K�(�)�)�)�	�

�#�d�j�/�/�
�'�)�
�
�
��Z�%�6�
��j�$�'�'�	'��7�7�:�&�&�&�����J��� � �(�(��-�-�-��	��z���� �	F����D�D�d�.C�D�D�D�E�E�E��'�	2�	2�E��%�*�.�.�
�%�-�
���� 1�2�2�3�I���
3�� � ��[�!1�!1�2�2�2����X�i�0�0�1�1�1�1��>�	?����=�=�d�n�=�=�=�>�>�>��	E����T�:�:�7�C�C�D�D�D��w�w�'�	�2�2�3�3�3r/c���t|jt��r|j|fi|��St	t
|��j|fi|��SrG)�
issubclassr*�VirtualModelr	r'r��
_create_table)r)rr�r-s   �r.r
z'VirtualTableSchemaManager._create_table3sd����d�j�,�/�/�	?�-�4�-�d�>�>�g�>�>�>�C�u�.��5�5�C�������	r/�T)r0r1r2r	r
r5r6s@r.r�r�sR�������)4�)4�)4�)4�V���������r/r�c�>�eZdZGd�d��Zed���ZdS)rc�"�eZdZdZdZdZdZeZdS)�VirtualModel.MetaNF)	r0r1r2rr�r�primary_keyr��schema_manager_classr:r/r.�Metar<s,�������	�������8���r/rc��|SrGr:)�clsr�s  r.r�zVirtualModel.clean_optionsCs���r/N)r0r1r2r�classmethodr�r:r/r.rr;sW������9�9�9�9�9�9�9�9�����[���r/rc�$�eZdZed���ZdS)�BaseFTSModelc�F�|�d��}|�d��}|�d��}t|t��r|dkrd|d<n<t|t��r't	|jjj|j��|d<|rVt|ttf��rd�d�|D����}d|�d	��z|d<|r*|jj
���d
krd|z|d<|S)N�content�prefix�tokenizerUz''�,c�,�g|]}t|����Sr:)�str)r��is  r.r�z.BaseFTSModel.clean_options.<locals>.<listcomp>Ys��":�":�":�a�3�q�6�6�":�":�":r/z'%s'z' �fts5�"%s")�getrZ�
basestringr�rr*r��
table_namer4r`�tuplerW�stripr��lower)rr�rrrs     r.r�zBaseFTSModel.clean_optionsIs&���+�+�i�(�(�����X�&�&���;�;�z�*�*���g�z�*�*�	=�w�"�}�}�!%�G�I���
���
'�
'�	=�!'��
�(;�(F�(/�(;�"=�"=�G�I���	<��&�4��-�0�0�
<����":�":�6�":�":�":�;�;�� &����d�);�);� ;�G�H���	4��	�2�8�8�:�:�f�D�D�#)�8�"3�G�J���r/N)r0r1r2rr�r:r/r.rrHs-����������[���r/rc��eZdZdZe��ZGd�d��Zed���Zed���Z	ed���Z
ed���Zedd
���Zedd���Z
ed
���Zed���Zed���Zed���Zed���Zed���Ze		dd���Ze		dd���Ze		dd���Ze		dd���ZdS)�FTSModelz�
    VirtualModel class for creating tables that use either the FTS3 or FTS4
    search extensions. Peewee automatically determines which version of the
    FTS extension is supported and will use FTS4 if possible.
    c��eZdZdezZdS)�
FTSModel.MetazFTS%sN)r0r1r2�FTS_VERSIONr�r:r/r.rr-ms������"�[�0���r/rc	��|jj}|jj�d|�d|�d|�d���}|���S)NzINSERT INTO �(z
) VALUES('z');)r�r&�database�execute_sql�fetchone)r�cmd�tbl�ress    r.�_fts_cmdzFTSModel._fts_cmdpsO���i�"���i� �,�,�,�25�#�#�s�s�s�C�C�C�@�B�B���|�|�~�~�r/c�,�|�d��S�N�optimize�r7�rs r.r:zFTSModel.optimizew����|�|�J�'�'�'r/c�,�|�d��S�N�rebuildr;r<s r.r@zFTSModel.rebuild{����|�|�I�&�&�&r/c�,�|�d��S)N�integrity-checkr;r<s r.�integrity_checkzFTSModel.integrity_checks���|�|�-�.�.�.r/���c�8�|�d|�d|����S)Nzmerge=rr;)r�blocks�segmentss   r.�mergezFTSModel.merge�s!���|�|�|�V�V�V�X�X�>�?�?�?r/Tc�:�|�d|rdpdz��S)Nzautomerge=%s�1�0r;)r�states  r.�	automergezFTSModel.automerge�s"���|�|�N�e�m��.B�s�C�D�D�Dr/c�6�t|jj|��S�zU
        Generate a `MATCH` expression appropriate for searching this table.
        �r�r�r��rr�s  r.r�zFTSModel.match����
�S�Y�%�t�,�,�,r/c�z�t�|jjt��}tj|g|�R�SrG)rb�	matchinfor�r��FTS3_MATCHINFO�fts_rank)r�weightsrVs   r.�rankz
FTSModel.rank�s2���L�L���!1�>�B�B�	��{�9�/�w�/�/�/�/r/c�z�t�|jjt��}tj|g|�R�SrG)rbrVr�r��FTS4_MATCHINFO�fts_bm25�rrY�
match_infos   r.�bm25z
FTSModel.bm25�s2���\�\�#�)�"2�N�C�C�
��{�:�0��0�0�0�0r/c�z�t�|jjt��}tj|g|�R�SrG)rbrVr�r�r\�	fts_bm25fr^s   r.�bm25fzFTSModel.bm25f�s2���\�\�#�)�"2�N�C�C�
��|�J�1��1�1�1�1r/c�z�t�|jjt��}tj|g|�R�SrG)rbrVr�r�r\�
fts_lucener^s   r.�lucenezFTSModel.lucene�s2���\�\�#�)�"2�N�C�C�
��}�Z�2�'�2�2�2�2r/c���|s|��}nut|t��r[g}|jjD]F}	|�|	|�|	jd����}
|�|
���G||�}n||�}d}|}|r||�|��f}|r|st|��}|j	|��
|�|�����|��S)N��?r:)
rZrar�r�r$r+ri�aliasr@�select�wherer��order_by)
rr�rY�
with_score�score_alias�score_fn�explicit_orderingrZ�weight_argsrR�field_weight�	selectionrls
             r.�_searchzFTSModel._search�s���	&��8�:�:�D�D�
���
&�
&�		&��K���0�
1�
1�� '�{�{�5�'�+�+�e�j�#�2N�2N�O�O���"�"�<�0�0�0�0��8�[�)�D�D��8�W�%�D��	����	7��d�j�j��5�5�6�I��	(�/�	(��;�'�'�H�����$���s�y�y����'�'���(�#�#�	%r/NF�scorec�@�|�|||||j|��S��'Full-text search using selected `term`.)rtrZ�rr�rYrmrnrps      r.�searchzFTSModel.search��.���{�{������H��
��	r/c�@�|�|||||j|��S�z:Full-text search for selected `term` using BM25 algorithm.)rtr`rys      r.�search_bm25zFTSModel.search_bm25�r{r/c�@�|�|||||j|��Sr})rtrcrys      r.�search_bm25fzFTSModel.search_bm25f�s.���{�{������I��
��	r/c�@�|�|||||j|��Sr})rtrfrys      r.�
search_lucenezFTSModel.search_lucene�s.���{�{������J��
��	r/)rErFr�NFruF)r0r1r2�__doc__r8r9rrr7r:r@rDrJrOr�rZr`rcrfrtrzr~r�r�r:r/r.r+r+dsA��������
�J�L�L�E�1�1�1�1�1�1�1�1�����[���(�(��[�(��'�'��[�'��/�/��[�/��@�@�@��[�@��E�E�E��[�E��-�-��[�-��0�0��[�0��1�1��[�1��2�2��[�2��3�3��[�3��%�%��[�%�6�FM�!&�	�	�	��[�	��8=�;@�	�	�	��[�	��9>�<A�	�	�	��[�	��:?�=B�	�	�	��[�	�	�	r/r+�abcdefghijklmnopqrstuvwxyzz	 ,"(){}*:_+0123456789�c#�`K�|])}t|��tv�t|��V��*dSrG)�chr�	_alphanumr�s  r.�	<genexpr>r��s8����K�K��3�q�6�6��3J�3J�S��V�V�3J�3J�3J�3J�K�Kr/�z(?:[^\s"]|"(?:\\.|[^"])*")+c�*�eZdZdZe��ZGd�d��Zdddd�Zed���Z	ed	���Z
ed
���Zee
d��fd���Zed
���Zed���Zed���Ze		d"d���Ze		d"d���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed#d���Zed$d!���ZdS)%�	FTS5Modelan
    Requires SQLite >= 3.9.0.

    Table options:

    content: table name of external content, or empty string for "contentless"
    content_rowid: column name of external content primary key
    prefix: integer(s). Ex: '2' or '2 3 4'
    tokenize: porter, unicode61, ascii. Ex: 'porter unicode61'

    The unicode tokenizer supports the following parameters:

    * remove_diacritics (1 or 0, default is 1)
    * tokenchars (string of characters, e.g. '-_'
    * separators (string of characters)

    Parameters are passed as alternating parameter name and value, so:

    {'tokenize': "unicode61 remove_diacritics 0 tokenchars '-_'"}

    Content-less tables:

    If you don't need the full-text content in it's original form, you can
    specify a content-less table. Searches and auxiliary functions will work
    as usual, but the only values returned when SELECT-ing can be rowid. Also
    content-less tables do not support UPDATE or DELETE.

    External content tables:

    You can set up triggers to sync these, e.g.

    -- Create a table. And an external content fts5 table to index it.
    CREATE TABLE tbl(a INTEGER PRIMARY KEY, b);
    CREATE VIRTUAL TABLE ft USING fts5(b, content='tbl', content_rowid='a');

    -- Triggers to keep the FTS index up to date.
    CREATE TRIGGER tbl_ai AFTER INSERT ON tbl BEGIN
      INSERT INTO ft(rowid, b) VALUES (new.a, new.b);
    END;
    CREATE TRIGGER tbl_ad AFTER DELETE ON tbl BEGIN
      INSERT INTO ft(fts_idx, rowid, b) VALUES('delete', old.a, old.b);
    END;
    CREATE TRIGGER tbl_au AFTER UPDATE ON tbl BEGIN
      INSERT INTO ft(fts_idx, rowid, b) VALUES('delete', old.a, old.b);
      INSERT INTO ft(rowid, b) VALUES (new.a, new.b);
    END;

    Built-in auxiliary functions:

    * bm25(tbl[, weight_0, ... weight_n])
    * highlight(tbl, col_idx, prefix, suffix)
    * snippet(tbl, col_idx, prefix, suffix, ?, max_tokens)
    c��eZdZdZdS)�FTS5Model.Metar"N�r0r1r2r�r:r/r.rr�8s������!���r/rzQBesides the implicit `rowid` column, all columns must be instances of SearchFieldz3Secondary indexes are not supported for FTS5 modelsz4FTS5 models must use the default `rowid` primary key)rJr��pkc�^�|jjjdkrt|jd���|jj���D]8}t|ttf��st|jd����9|jj
rt|jd���dS)Nr"r�rJr�)r�rr+�ImproperlyConfigured�_error_messages�fields�valuesrZr�r!�indexes)rrRs  r.�validate_modelzFTS5Model.validate_modelBs����9� �%��0�0�&�s�':�4�'@�A�A�A��Y�%�,�,�.�.�	N�	N�E��e�k�:�%>�?�?�
N�*�3�+>�|�+L�M�M�M�
N��9��	E�&�s�':�7�'C�D�D�D�	E�	Er/c���tjdd�tkrdStjd��}	|�d��no#	|�d��|�d��|jj�d��n#YY|�	��dSxYwYnxYw|�	��n#|�	��wxYwdS)NrFz:memory:z0CREATE VIRTUAL TABLE fts5test USING fts5 (data);Tr")
r�sqlite_version_info�FTS5_MIN_SQLITE_VERSION�connect�execute�enable_load_extension�load_extensionr�r1�close)r�tmp_dbs  r.�fts5_installedzFTS5Model.fts5_installedMs����&�r��r�*�-D�D�D��5����,�,��	��N�N�M�N�N�N�N��	:�
:��,�,�T�2�2�2��%�%�f�-�-�-��	�"�1�1�&�9�9�9�9��
��u�
�L�L�N�N�N�N�N����:�9�����L�L�N�N�N�N��F�L�L�N�N�N�N�����tsA�A�
C�B7�*B�8 B7�B2�B7�C�2B7�5C�C%c���t�|��}|D]G}|�d��r|�d��r�-t	|��t
zrdS�HdS)z�
        Simple helper function to indicate whether a search query is a
        valid FTS5 query. Note: this simply looks at the characters being
        used, and is not guaranteed to catch all problematic queries.
        �"FT)�	_quote_re�findall�
startswith�endswithrq�_invalid_ascii)�query�tokens�tokens   r.�validate_queryzFTS5Model.validate_querycsv���"�"�5�)�)���	�	�E�����$�$�
�����)<�)<�
���5�z�z�N�*�
��u�u�
��tr/r�c��g}d}t�|��}|D]�}|�d��r+|�d��r|�|���Bt|��}|tz}|rd}|D]}|�||��}�|�|����|rd�|��S|S)z2
        Clean a query of invalid tokens.
        Fr�Tr�)	r�r�r�r�rirqr�rtrW)	r�rt�accum�any_invalidr�r��	token_set�invalid_for_token�cs	         r.�clean_queryzFTS5Model.clean_queryrs���
�����"�"�5�)�)���
	 �
	 �E�����$�$�
�����)<�)<�
����U�#�#�#���E�
�
�I� )�N� :�� �
6�"��*�6�6�A�!�M�M�!�W�5�5�E�E��L�L�������	#��8�8�E�?�?�"��r/c�6�t|jj|��SrQrRrSs  r.r�zFTS5Model.match�rTr/c�8�|r
|j|�ntd��S)NrZ)r`r@)rr,s  r.rZzFTS5Model.rank�s��"&�7�x�s�x����C��K�K�7r/c�:�tj|jjg|�R�SrG)rbr`r�r�)rrYs  r.r`zFTS5Model.bm25�s���w�s�y�'�2�'�2�2�2�2r/NFruc�d�|�t�|��||||��Srw)r~r�r�rys      r.rzzFTS5Model.search�s7������!�!�$�'�'�������	r/c
��|std��}n�t|t��r�g}|jjD]`}t|t
��rI|jsB|�|�||�|j	d�������atj|jjg|�R�}ntj|jjg|�R�}d}	|}
|r||�
|��f}	|r|st|��}
|j|	��|�t"�|�������|
��S)rxrZrhr:)r@rZrar�r�r�r�rir$r+rbr`r�rirjrkr�r�r�rl)rr�rYrmrnrprZrqrRrsrls           r.r~zFTS5Model.search_bm25�si���
	7��v�;�;�D�D�
���
&�
&�	7��K���0�
J�
J���e�[�1�1�J�%�/�J��&�&����E�7�;�;�u�z�3�+G�+G�H�H�J�J�J���7�3�9�+�:�k�:�:�:�D�D��7�3�9�+�6�g�6�6�6�D��	����	7��d�j�j��5�5�6�I��	(�/�	(��;�'�'�H�����$���s�y�y��!6�!6�t�!<�!<�=�=�>�>���(�#�#�	%r/c	�l�|jj}|g}|g}|���D]<\}}|�t	|����|�|���=tt
d��|jjt|��t
d��t|��f��S)NzINSERT INTO�VALUES)r�r��itemsrirr
r@r)rr4�extra_paramsr5�columnsr��keyrgs        r.�_fts_cmd_sqlzFTS5Model._fts_cmd_sql�s����i����%�����&�,�,�.�.�	!�	!�J�C���N�N�6�#�;�;�'�'�'��M�M�%� � � � ���
����I���W�%�%���M�M��V�$�$�&�'�'�	'r/c�\�|j|fi|��}|jj�|��SrG)r�r�r1r�)rr4r�r�s    r.r7zFTS5Model._fts_cmd�s5�� �� ��5�5��5�5���y�!�)�)�%�0�0�0r/c�l�d|cxkrdksntd���|�d|���S)Nrr�zlevel must be between 0 and 16rO�rZ)r%r7)r�levels  r.rOzFTS5Model.automerge�sF���U� � � � �b� � � � ��=�>�>�>��|�|�K�e�|�4�4�4r/c�0�|�d|���S)NrJr�r;)r�npagess  r.rJzFTS5Model.merge�s���|�|�G�&�|�1�1�1r/c�,�|�d��Sr9r;r<s r.r:zFTS5Model.optimize�r=r/c�,�|�d��Sr?r;r<s r.r@zFTS5Model.rebuild�rAr/c�0�|�d|���S)N�pgszr�r;)rr�s  r.�set_pgszzFTS5Model.set_pgsz�s���|�|�F��|�.�.�.r/c�0�|�d|���S)NrZr�r;)r�rank_expressions  r.�set_rankzFTS5Model.set_rank�s���|�|�F��|�9�9�9r/c�,�|�d��S)Nz
delete-allr;r<s r.�
delete_allzFTS5Model.delete_all�s���|�|�L�)�)�)r/rc�0�|�d|���S)NrCr�r;)rrZs  r.rDzFTS5Model.integrity_check�s���|�|�-�D�|�9�9�9r/�rowc	�������dvrtd���d�z}t�|��s�G���fd�d��}tt��t	��t	��t��|d�}�dkrtt��|d<n�dkrtt��|d	<d
�jz}t�|t|tf|����t�|��S)N)r��col�instancez5table_type must be either "row", "col" or "instance".z_vocab_model_%sc���eZdZ�jjZ�p�jjdzZe��jje	�����Z
dS)�"FTS5Model.VocabModel.<locals>.Meta�_vN)r0r1r2r�r1r&rb�	fts5vocabr�r@r�)r�table�
table_types���r.rr�sV��������9�-��"�A�c�i�&:�T�&A�
�#%�<�<��I�$��C�
�O�O�$%�$%� � � r/r)r��doc�cntr"rr�r��offsetz%sVocab)r%r�r�	TextField�IntegerFieldr!r0�setattrr&r�getattr)rr�r��attrr�attrs�
class_names```    r.�
VocabModelzFTS5Model.VocabModel�s,������7�7�7��+�,�,�
,�!�:�-���s�D�!�!�	I�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�%�Y�/�/�#�~�~�#�~�~�#������E��U�"�"�+�I�6�6��e����z�)�)�".�|�"<�"<��h��"�S�\�1�J��C��t�J����G�G�H�H�H��s�D�!�!�!r/r�)r)r�N)r0r1r2r�r!r"rr�rr�r��staticmethodr�r�r�r�rZr`rzr~r�r7rOrJr:r@r�r�r�rDr�r:r/r.r�r��s�������4�4�n
�J�L�L�E�"�"�"�"�"�"�"�"�5�F�D�	��O��E�E��[�E�����[��*����\���#&�3�r�7�7�����\��.�-�-��[�-��8�8��[�8��3�3��[�3��FM�!&�����[���8=�;@�%�%�%��[�%�6�
'�
'��[�
'��1�1��[�1��5�5��[�5�
�2�2��[�2��(�(��[�(��'�'��[�'��/�/��[�/��:�:��[�:��*�*��[�*��:�:�:��[�:��"�"�"��[�"�"�"r/r�c�������������+�jjD]}|j�ur|�n�td����jj�����G�����fd�dt
��}G���fd�d��}d�jz}t||fd|i��S)z3Model factory for the transitive closure extension.Nz,Unable to find self-referential foreign key.c���eZdZee��Zee��Zee��Zee��Z	ee��Z
ee��ZGd�d��Ze
d��fd�	��Ze
d��fd�	��Ze
d	�����fd�	��ZdS)
�&ClosureTable.<locals>.BaseClosureTablec��eZdZdZdS)�+ClosureTable.<locals>.BaseClosureTable.Meta�transitive_closureNr�r:r/r.rr�3s������3���r/rNFc�~�����|j�d�����|�|jk����|j|k�����}|�|�|j|k��}n |s|�|jdk��}|S�N�depth��onr)rjr�rirW�idrk�root�objects�r�noder��include_noder��model_class�
source_keys     ��r.�descendantsz2ClosureTable.<locals>.BaseClosureTable.descendants6s���� ��f�[�#�)�/�/�'�*B�*B�C�C��d�3�J�#�&�$8�d�:�:��e�C�H��,�-�-��g�i�i�	
�
� ����C�I��$6�7�7���!�
3����C�I��M�2�2���Lr/c�~�����|j�d�����|�|jk����|j|k�����}|r|�|j|k��}n |s|�|jdk��}|Sr�)rjr�rirWr�rkr�r�r�s     ��r.�	ancestorsz0ClosureTable.<locals>.BaseClosureTable.ancestorsCs���� ��f�[�#�)�/�/�'�*B�*B�C�C��d�3�J�#�(�$:�d�<�<��e�C�F�d�N�+�+��g�i�i�	
�
�
3����C�I��$6�7�7���!�
3����C�I��M�2�2���Lr/c�
����urK|j��j��}������|k��}n����	���|�|jk����|j|k|jdkz��}������
|z���	��}|s|��
|k��}|S)Nr��)
�__data__r$r+rjrkrWr�r�r�r�)rr�r��fk_valuer��siblings�foreign_keyr��referencing_class�referencing_keyr�s      �����r.rz/ClosureTable.<locals>.BaseClosureTable.siblingsPs���� �K�/�/��=�,�,�[�-=�>�>��#�*�*�,�,�2�2�;�(�3J�K�K���.�#�V�O�4�4�!�T�#�;�#�(�+B�T�D�D�"�U�C�F�d�N�s�y�A�~�#F�G�G��%� �&�(�(��%�
�h� 6�7�7�!�'�)�)��
 �
8����J�$�$6�7�7���Lr/�NF�F)r0r1r2rr�r�r�r��idcolumn�parentcolumnr��	tablenamerrr�r�r)rr�rrr�s�����r.�BaseClosureTabler�+s3���������\�*�*��
�\�,�
'�
'���<�	�*�*��#�|�I�.�.���|�L�)�)�� �L��+�+�	�	4�	4�	4�	4�	4�	4�	4�	4�
�
	�
	�
	�
	�
	�
	�
��
	�
�
	�
	�
	�
	�
	�
	�
��
	�
�	�	�	�	�	�	�	�	�	�
��	�	�	r/rc�`��eZdZ�jjZ�jj�j�jd�ZdZdS)�ClosureTable.<locals>.Meta)r
rr	FN)	r0r1r2r�r1r&r4r�r)rrrs���r.rr
hsB�������$�*�3��*�0�;�'�3�'�3�5�5�����r/rz	%sClosure)r��refs�	rel_modelr%rrr0r&)	r�rrr�	field_objrrr+r�s	````    @r.�ClosureTablers$�������� �'����$�*�/�	M�	M�I��"�k�1�1�'����2��K�L�L�L��"�.�J���$��;�;�;�;�;�;�;�;�;�;�;�<�;�;�;�z��������������-�-�D���'�)�F�D�>�:�:�:r/c���eZdZGd�d��Zed���Zedd���Zed���Zed���Z	ed���Z
ed	���Zed
���ZdS)
�LSMTablec��eZdZdZdZdS)�
LSMTable.Meta�lsm1N)r0r1r2r��filenamer:r/r.rrus������!�����r/rc��|jj}|std���t|��dkr|ddkrd|z}|jjstd���|jj}t|t��rtd���t|tttf��std���d	|_
t|t��rd
}nt|t��rd}nd}|d|jz|g|j_t|jj
��dkr|jj
d
|j_nd|j_|S)NzILSM1 extension requires that you specify a filename for the LSM database.�rr�r#z-LSM1 models must specify a primary-key field.z8LSM1 models must explicitly declare a primary key field.z9LSM1 key must be a TextField, BlobField, or IntegerField.T�UINT�BLOBrEr�)r�rr%�lenrrZ�	AutoFieldr��	BlobFieldr�rr+rr��_value_field)rr�rr��	data_types     r.r�zLSMTable.clean_optionsysl���9�%���	-��>�?�?�
?��8�}�}��!�!�h�q�k�S�&8�&8�!�H�,���y�$�	N��L�M�M�M��i�#���c�9�%�%�	+��*�+�+�
+��#�	�9�l�C�D�D�	.��-�.�.�
.�����c�<�(�(�	��I�I�
��Y�
'�
'�	��I�I��I�&.����0A�9�%M��	�"��s�y�&�'�'�1�,�,�%(�Y�%<�Q�%?�C�I�"�"�%)�C�I�"��r/�lsm.soc�D�|jj�|��dSrG)r�r1r�)rrSs  r.r�zLSMTable.load_extension�s!���	��)�)�$�/�/�/�/�/r/c��|j�'|j� |�|j|j��S|j�||jkS|j�||jkSdSrG)�start�stop�between)r�r\s  r.�
slice_to_exprzLSMTable.slice_to_expr�sZ���9� �S�X�%9��;�;�s�y�#�(�3�3�3�
�Y�
"��#�)�#�#�
�X�
!��#�(�?�"�"�
!r/c�&�t|t��r6t�||��}|�|�|��}|dfSt|t
��r|�|��dfS|�||k��dfS�NFT)rZ�slicerr'rkr)r�r��lookup�exprs    r.�_apply_lookup_to_queryzLSMTable._apply_lookup_to_query�s����f�e�$�$�	4��)�)�#�v�6�6�D������D�)�)���%�<��
��
�
+�
+�	4��;�;�v�&�&��-�-��;�;�s�f�}�-�-�t�3�3r/c���|�|������|jj|��\}}|r*|���}|jj�|dn|S|S�Nr�)r-rj�namedtuplesr�rr$r)rr�r��	is_singler�s     r.�	get_by_idzLSMTable.get_by_id�sr���5�5��J�J�L�L�$�$�&�&��I�!������y�
�	��)�)�+�+�C� �Y�3�?�3�q�6�6�S�H��Lr/c��|jj�|jj|i}ntt|t��r0i}t	|jjdd�|��D]
\}}|||<�n/t|t��r|}nt||��r|j}|||jj<|�	|���
��dSr/)r�rrZr'�zipr�ra�__dict__rrtr�)rr�rgr�rR�fvals      r.�	set_by_idzLSMTable.set_by_id�s����9�!�-��I�*�E�2�D�D�
��u�
%�
%�	"��D�"�3�9�#:�1�2�2�#>��F�F�
#�
#���t�"��U���
#�
��t�
$�
$�	"��D�D�
��s�
#�
#�	"��>�D�&)��S�Y�
"�#����D���!�!�#�#�#�#�#r/c��|�|���|jj|��\}}|���SrG)r-�deleter�rr�)rr�r�r1s    r.�delete_by_idzLSMTable.delete_by_id�sB���5�5��J�J�L�L��I�!������y��}�}���r/N)r!)
r0r1r2rrr�r�r�r'r-r2r7r:r:r/r.rrts����������������!�!��[�!�F�0�0�0��[�0��#�#��\�#��	4�	4��\�	4��
�
��[�
��$�$��[�$�����[���r/r�MATCHc�0�tj||��duSrG)�rerz)�regexrgs  r.�_sqlite_regexpr?�s��
�9�U�E�"�"�$�.�.r/c�6��eZdZ			d�fd�	Z�fd�Zd�Z�xZS)�SqliteExtDatabaseNTFc���tt|��j|g|�Ri|	��d|_|rtstd���to|du}
|r~|
rt
|��nl|�td��|�td��|�td��|�td��|r |
std���t|��|r|�tdd	��|r |
std
���t|��|r|�td��|
|_dS)NzRSqliteExtDatabase initialized with C extensions, but shared library was not found!Fr]rXrbrez0C extension required to register hash functions.�regexprz(C extension required to use bloomfilter.�
json_contains)r'rArO�_row_factory�CYTHON_SQLITE_EXTENSIONSr�r�register_functionr`rZr%rr?r�_json_contains�
_c_extensions)r)r1�c_extensions�rank_functions�hash_functions�regexp_function�bloomfilterrDr,r��prefer_cr-s           �r.rOzSqliteExtDatabase.__init__�s����	0����&�&�/��J�4�J�J�J�6�J�J�J� ����	5� 8�	5�&�(4�5�5�
5�,�K��U�1J���	;��
;�'��-�-�-�-��&�&�t�Z�8�8�8��&�&�t�Z�8�8�8��&�&�t�[�9�9�9��&�&�t�\�:�:�:��	*��
/� �".�/�/�/�#�D�)�)�)��	@��"�"�>�8�Q�?�?�?��	'��
M� �!K�L�L�L� ��&�&�&��	D��"�"�>�?�C�C�C�%����r/c���tt|���|��|jr|j|_dSdSrG)r'rA�_add_conn_hooksrE�row_factory�r)�connr-s  �r.rQz!SqliteExtDatabase._add_conn_hookssH���
���&�&�6�6�t�<�<�<���	1�#�0�D����	1�	1r/c��||_dSrG)rE�r)rbs  r.rRzSqliteExtDatabase.row_factory
s������r/)NTFFFF)r0r1r2rOrQrRr5r6s@r.rArA�so�������CG�7<�27�!&�!&�!&�!&�!&�!&�F1�1�1�1�1�
������r/rAr�r��rrFr�
c�0�����fd�}t|��S)zt
        Expose a sqlite3_status() call for a particular flag as a property of
        the Database object.
        c�:��t���}�r|dn|Sr/)r)r)�result�flag�return_highwaters  ��r.�getterz__status__.<locals>.getter+s#���&�t�,�,�F� 0�<�6�!�9�9�f�<r/�r�)r]r^r_s`` r.�
__status__ra&s2����
	=�	=�	=�	=�	=�	=�����r/c�4�������fd�}t|��S)z�
        Expose a sqlite3_dbstatus() call for a particular flag as a property of
        the Database instance. Unlike sqlite3_status(), the dbstatus properties
        pertain to the current connection.
        c���|jj�td���t|jj���}�r|dS�r|dn|S)Nzdatabase connection not opened.rr�)�_staterTr�r)r)r\r]�return_currentr^s  ���r.r_z__dbstatus__.<locals>.getter6sV����{��'�*�+L�M�M�M�)�$�+�*:�D�A�A�F��
!��a�y� � 0�<�6�!�9�9�f�<r/r`)r]r^rer_s``` r.�__dbstatus__rf0s8�����	=�	=�	=�	=�	=�	=�	=�����r/c�d��eZdZ�fd�Zd�fd�	Z�fd�Z�fd�Zd�Zd�Zd�Z	d	�Z
ed
���Zed���Z
dd
�Z		dd�Zdd�Zee��Zeed��Zee��Zee��Zee��Zeed��Zee��Zee ��Z!ee"d��Z#e$e%��Z&e$e'd��Z(e$e)d��Z*e$e+d��Z,e$e-dd��Z.e$e/dd��Z0e$e1dd��Z2e$e3dd��Z4e$e5dd��Z6e$e7dd��Z8�xZ9S)�CSqliteExtDatabasec���d|_dx|_x|_|_d|_tt|��j|i|��dSr)�_conn_helper�_commit_hook�_rollback_hook�_update_hook�_replace_busy_handlerr'rhrO)r)r,r�r-s   �r.rOzCSqliteExtDatabase.__init__@sT��� $�D��JN�N�D��N�� 3�d�6G�).�D�&�4�E�$�d�+�+�4�d�E�f�E�E�E�E�Er/Fc�X��tt|��j|fi|��||_dSrG)r'rh�initrn)r)r1�replace_busy_handlerr�r-s    �r.rpzCSqliteExtDatabase.initFs7���0�E�$�d�+�+�0��D�D�V�D�D�D�)=�D�&�&�&r/c���|jr|j�d��|jr|j�d��|jr|j�d��tt|���	|��SrG)
rkrj�set_commit_hookrl�set_rollback_hookrm�set_update_hookr'rh�_closerSs  �r.rvzCSqliteExtDatabase._closeJs����� �
8��!�1�1�$�7�7�7��"�
:��!�3�3�D�9�9�9�� �
8��!�1�1�$�7�7�7��+�T�2�2�9�9�$�?�?�?r/c����tt|���|��t|��|_|j�|j�|j��|j�|j�|j��|j	�|j�
|j	��|jr(|jpd}|j�
|dz��dSdS)NrWi�)r'rhrQrrjrkrsrlrtrmrurn�_timeout�set_busy_handler)r)rT�timeoutr-s   �r.rQz"CSqliteExtDatabase._add_conn_hooksSs�����$�d�+�+�;�;�D�A�A�A� 0�� 6� 6�D��� �,��!�1�1�$�2C�D�D�D��"�.��!�3�3�D�4G�H�H�H�� �,��!�1�1�$�2C�D�D�D��)�
C��-�,�1���!�2�2�7�T�>�B�B�B�B�B�
C�
Cr/c�p�||_|���s|j�|��|SrG)rk�	is_closedrjrsrVs  r.�	on_commitzCSqliteExtDatabase.on_commit`�8�� "�D���>�>�#�#�
6��!�1�1�"�5�5�5��Ir/c�p�||_|���s|j�|��|SrG)rlr|rjrtrVs  r.�on_rollbackzCSqliteExtDatabase.on_rollbackfs8��"$�D���>�>�#�#�
8��!�3�3�B�7�7�7��Ir/c�p�||_|���s|j�|��|SrG)rmr|rjrurVs  r.�	on_updatezCSqliteExtDatabase.on_updatelr~r/c�4�|j���SrG)rj�changesrHs r.r�zCSqliteExtDatabase.changesrs���$�,�,�.�.�.r/c�4�|j���SrG)rj�last_insert_rowidrHs r.r�z$CSqliteExtDatabase.last_insert_rowidus���$�6�6�8�8�8r/c�4�|j���SrG)rj�
autocommitrHs r.r�zCSqliteExtDatabase.autocommitys���$�/�/�1�1�1r/Nc�r�t|���|���|||���S�N)�pagesr+�progress)r�
connection)r)�destinationr�r+r�s     r.rzCSqliteExtDatabase.backup}s>���$�/�/�+�+�[�-C�-C�-E�-E� %�D�8�E�E�E�
Er/c�N�t|���||||���Sr�)rr�)r)rr�r+r�s     r.rz!CSqliteExtDatabase.backup_to_file�s2��!�$�/�/�"3�"3�X�U�'+�h�@�@�@�
@r/c�(�t|||||��SrG)r)r)r��columnr"�	read_onlys     r.�	blob_openzCSqliteExtDatabase.blob_open�s����e�V�U�I�>�>�>r/Tr�NNN):r0r1r2rOrprvrQr}r�r�r�r�r�r�rrr�ra�SQLITE_STATUS_MEMORY_USED�memory_used�SQLITE_STATUS_MALLOC_SIZE�malloc_size�SQLITE_STATUS_MALLOC_COUNT�malloc_count�SQLITE_STATUS_PAGECACHE_USED�pagecache_used� SQLITE_STATUS_PAGECACHE_OVERFLOW�pagecache_overflow�SQLITE_STATUS_PAGECACHE_SIZE�pagecache_size�SQLITE_STATUS_SCRATCH_USED�scratch_used�SQLITE_STATUS_SCRATCH_OVERFLOW�scratch_overflow�SQLITE_STATUS_SCRATCH_SIZE�scratch_sizerf�SQLITE_DBSTATUS_LOOKASIDE_USED�lookaside_used�SQLITE_DBSTATUS_LOOKASIDE_HIT�
lookaside_hit�#SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE�lookaside_miss�#SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL�lookaside_miss_full�SQLITE_DBSTATUS_CACHE_USED�
cache_used�SQLITE_DBSTATUS_SCHEMA_USED�schema_used�SQLITE_DBSTATUS_STMT_USED�statement_used�SQLITE_DBSTATUS_CACHE_HIT�	cache_hit�SQLITE_DBSTATUS_CACHE_MISS�
cache_miss�SQLITE_DBSTATUS_CACHE_WRITE�cache_writer5r6s@r.rhrh?s��������	F�	F�	F�	F�	F�	>�	>�	>�	>�	>�	>�	@�	@�	@�	@�	@�	C�	C�	C�	C�	C�	�	�	�	�	�	�	�	�	�	/�	/�	/�
�	9�	9�
��	9�
�	2�	2�
��	2�	E�	E�	E�	E�=A�$(�	@�	@�	@�	@�
	?�	?�	?�	?�!�j�!:�;�;�� �j�!:�D�A�A��!�z�"<�=�=��#��$@�A�A��'�Z�(H�I�I��#��$@�$�G�G��!�z�"<�=�=��%�:�&D�E�E��!�z�"<�d�C�C��&��&D�E�E��$��%B�D�I�I�
�%��&I�&*�,�,��*�l�+N�+/�1�1��!�\�"<�e�T�J�J�
�#�l�#>��t�L�L��%��&?���M�M�� �L�!:�E�4�H�H�	�!�\�"<�e�T�J�J�
�"�l�#>��t�L�L�����r/rhc�8�t|tj|��SrG)rrr;)�lhsr�s  r.r�r��s���c�2�8�S�)�)�)r/c�\��t���}�fd�td|d��D��S)Nc	�\��g|](}tjd�||dz���d��)S)z@Irr)�structr�)r�r!�bufs  �r.r�z%_parse_match_info.<locals>.<listcomp>�s6���M�M�M�1�F�M�$��A�a��c�E�
�+�+�A�.�M�M�Mr/rr)r�range)r��bufsizes` r.�_parse_match_infor��s4����#�h�h�G�M�M�M�M��a��!�8L�8L�M�M�M�Mr/c�V�|sdg|zSdg|z}t|��D]
\}}|||<�|S)Nr�r)�	enumerate)�ncol�raw_weightsrYr!�weights     r.�get_weightsr��sL��� ��s�T�z���#��*��"�;�/�/�	 �	 �I�A�v��G�A�J�J��Nr/c�J�t|��}d}|dd�\}}t||��}t|��D]c}d||zdzz}t|��D]F}	||	}
|
s�
||	dzz}||}||dz}
|dkr||
t|��|
zzz
}�G�d|S)N�rrr�r)r�r�r��float)�raw_match_infor�r_rur�r�rY�
phrase_num�phrase_info_idx�col_numr��col_idx�row_hits�
all_rows_hitss              r.rZrZ�s���#�>�2�2�J��E��b�q�b�>�D�A�q��!�[�)�)�G��A�h�h�D�D�
��z�A�~��1�2���Q�x�x�	D�	D�G��W�%�F��
��%��1��5�G�"�'�*�H�&�w��{�3�M��!�|�|���5��?�?�]�#B�C�C���	D� 
�6�Mr/c��t|��}d}d}d}td��\}}}}	||}
||}||}|	|z}
|
|z}t||��}t|
��D]�}t|��D]�}||}|dkr�|d|||zzzz}t||��}t||dz��}t	j||z
dz|dzz��}|dkrd	}t||
|z��}t||	|z��pd
}||z}||d
zz}d
|z
||zz}|||zz}|||zz}|||zz
}�׌�|S)z�
    Usage:

        # Format string *must* be pcnalx
        # Second parameter to bm25 specifies the index of the column, on
        # the table being queries.
        bm25(matchinfo(document_tbl, 'pcnalx'), 1) AS rank
    g333333�?g�?r�rrrrg�?g���ư>rh)r�r�r�r��math�log)r�r,r_�K�Bru�P_O�C_O�N_O�A_O�
term_count�	col_count�
total_docs�L_O�X_OrYr!�jr��x�term_frequency�docs_with_term�idf�
doc_length�
avg_length�ratio�num�b_part�denom�pc_scores                              r.r`r`�s���#�>�2�2�J��A��A��E��q����C��c�3��C��J��3��I��C��J�

�	�/�C�

�	�/�C�:�)�T�*�*�G�
�:�
�
�)�)���y�!�!�	)�	)�A��Q�Z�F���{�{���q�A��I�
�-�.�/�A�"�:�a�=�1�1�N�"�:�a�!�e�#4�5�5�N��(��.�0�3�6�#�c�)�+�,�,�C��c�z�z����z�#��'�2�3�3�J��z�#��'�2�3�3�9�r�J���+�E� �A��G�,�C��1�W��E�	�*�F�"�a�&�j�1�E��c�E�k�*�H��h��'�(�E�E�3	)�6
�6�Mr/c��g}	|�tj|��tj|��f��n#YdSxYw|�rB|���\}}t	|t
��rnt	|t
��r0|D],}||vrdS|�||||f���-n�t	|t��r
|D]	}||vrdS�
n�||vrdSn�t	|t��r�t	|t
��rdSt	|t��rU	tt|����D]%}|�||||f���&n #t$rYdSwxYw||vrdSn||krdS|��BdSr))
rircr��poprZrar`r�r�
IndexError)�src_json�obj_json�stack�obj�srcr�r]r!s        r.rHrH,s����E��
���d�j��*�*�D�J�x�,@�,@�A�B�B�B�B����u�u����
���9�9�;�;���S��c�4� � �	��#�t�$�$�

��7�7�C��#�~�~�$�u�u��L�L�#�c�(�C��H�!5�6�6�6�6�7��C��&�&�
��%�%�D��3���$�u�u�'�%��C����u� �
��T�
"�
"�	��#�t�$�$�	
��u��C��&�&�
�!�"�3�s�8�8�_�_�7�7�����c�!�f�c�!�f�%5�6�6�6�6�7��!�!�!�!� �5�5�!�����C����u� �
�C�Z�Z��5�5��6�4s�;A�A�'AE*�*
E8�7E8r�r)FF)frcr�r=r��sys�peeweerrrrrr	r
rrr
r�playhouse._sqlite_extrrrrrrrrrrrrF�ImportError�version_infor r%rWr\r�r.r�rr!r8r<�DecimalFieldrDrLr�r�r�r��
SchemaManagerr��Modelrrr+�	_alphabetrq�upperr�r�r�r��compiler�r�rrr;r?�SqliteDatabaserAr�r�r�r�r�r��SQLITE_STATUS_PARSER_STACKr�r�r�r�r�r�r�r�r�r�r�r�r��SQLITE_DBSTATUS_DEFERRED_FKSrarfrhr�r�r�rZr`rHr:r/r.�<module>rs�����������	�	�	�	�
�
�
�
�
�
�
�
�����������#�#�#�#�#�#�������������������������������������������������������%��������������������������� $�����%�%�%�$����%������A��!����J�����
���2�2�A�2�6�)�C�C�!�!��K�K��K�#��9�9�9�9�9��9�9�9�1�1�1�1�1��1�1�1�;�;�;�;�;��;�;�;�"�"�"�"�"�L�"�"�"�
87�87�87�87�87�z�87�87�87�v\"�\"�\"�\"�\"�	�\"�\"�\"�~3�3�3�3�3�%�3�3�3�>1�1�1�1�1�
�1�1�1�h
�
�
�
�
�5�
�
�
������<����8L�L�L�L�L�|�L�L�L�^
)�	�
�S�*�
+�
+�
�S��^�^��
�S����"�"�
#�
#�$��S�#�#�b�'�'��_�_��	���K�K�U�U�3�Z�Z�K�K�K�K�K��
�
��B�J�5�6�6�	�X"�X"�X"�X"�X"��X"�X"�X"�vCG�!%�X;�X;�X;�X;�vd�d�d�d�d�|�d�d�d�N���/�/�/�*�*�*�*�*��*�*�*�Z�TM� !��#$� �'(�$�!"��%&�"� !��!"��#$� �!"��!"��%&�"�!"��"#�� !��$%�!�*+�'�*+�'� !��!"��"#��#%� � � � � �
 �
 �
 �
 �cM�cM�cM�cM�cM�.�cM�cM�cM�L*�*�*�N�N�N�
���!�!�!�HN�N�N�b#�#�#�#�#s�A9�9B�B

Filemanager

Name Type Size Permission Actions
__init__.cpython-311.pyc File 182 B 0644
apsw_ext.cpython-311.pyc File 11.22 KB 0644
cockroachdb.cpython-311.pyc File 15.24 KB 0644
dataset.cpython-311.pyc File 28.02 KB 0644
db_url.cpython-311.pyc File 5.35 KB 0644
fields.cpython-311.pyc File 3.21 KB 0644
flask_utils.cpython-311.pyc File 12.57 KB 0644
hybrid.cpython-311.pyc File 3.06 KB 0644
kv.cpython-311.pyc File 11.05 KB 0644
migrate.cpython-311.pyc File 47.59 KB 0644
mysql_ext.cpython-311.pyc File 5.62 KB 0644
pool.cpython-311.pyc File 14.97 KB 0644
postgres_ext.cpython-311.pyc File 32.11 KB 0644
psycopg3_ext.cpython-311.pyc File 2.04 KB 0644
reflection.cpython-311.pyc File 41.08 KB 0644
shortcuts.cpython-311.pyc File 14.82 KB 0644
signals.cpython-311.pyc File 5.32 KB 0644
sqlcipher_ext.cpython-311.pyc File 5.24 KB 0644
sqlite_changelog.cpython-311.pyc File 6 KB 0644
sqlite_ext.cpython-311.pyc File 70.2 KB 0644
sqlite_udf.cpython-311.pyc File 27.55 KB 0644
sqliteq.cpython-311.pyc File 18.7 KB 0644
test_utils.cpython-311.pyc File 4.98 KB 0644