o
    µ„j¿	  ã                
   @   sð   d Z ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
mZmZ dZg d¢Z	ddededB d	eejd
f fdd„Z	ddeee B dedB d	eejddf fdd„ZddededB ded	efdd„Z	ddededB ded	ee fdd„ZdS )zParse SQL statements.é    )Ú	Generator)ÚIOÚAny)ÚcliÚengineÚfiltersÚ	formatterÚsqlÚtokensz0.6.0Nr	   ÚencodingÚreturn.c                 C   s   t t| |ƒƒS )zôParse sql and return a list of statements.

    :param sql: A string containing one or more SQL statements.
    :param encoding: The encoding of the statement (optional).
    :returns: A tuple of :class:`~sqlparse.sql.Statement` instances.
    )ÚtupleÚparsestream)r	   r   © r   úO/var/www/html/django_cbt/venv/lib/python3.10/site-packages/sqlparse/__init__.pyÚparse   s   	r   Ústreamc                 C   s   t  ¡ }| ¡  | | |¡S )zçParses sql statements from file-like object.

    :param stream: A file-like object.
    :param encoding: The encoding of the stream contents (optional).
    :returns: A generator of :class:`~sqlparse.sql.Statement` instances.
    )r   ÚFilterStackÚenable_groupingÚrun)r   r   Ústackr   r   r   r       s   	r   Úoptionsc                 K   s@   t  ¡ }t |¡}t ||¡}|j t ¡ ¡ d 	| 
| |¡¡S )a'  Format *sql* according to *options*.

    Available options are documented in :ref:`formatting`.

    In addition to the formatting options this function accepts the
    keyword "encoding" which determines the encoding of the statement.

    :returns: The formatted SQL statement as string.
    Ú )r   r   r   Úvalidate_optionsÚbuild_filter_stackÚpostprocessÚappendr   ÚSerializerUnicodeÚjoinr   )r	   r   r   r   r   r   r   Úformat.   s
   

r   FÚstrip_semicolonc                 C   s"   t j|d�}dd„ | | |¡D ƒS )a#  Split *sql* into single statements.

    :param sql: A string containing one or more SQL statements.
    :param encoding: The encoding of the statement (optional).
    :param strip_semicolon: If True, remove trailing semicolons
        (default: False).
    :returns: A list of strings.
    )r    c                 S   s   g | ]}t |ƒ ¡ ‘qS r   )ÚstrÚstrip)Ú.0Ústmtr   r   r   Ú
<listcomp>K   s    zsplit.<locals>.<listcomp>)r   r   r   )r	   r   r    r   r   r   r   Úsplit?   s   r&   )N)NF)Ú__doc__Úcollections.abcr   Útypingr   r   Úsqlparser   r   r   r   r	   r
   Ú__version__Ú__all__r!   r   Ú	Statementr   r   r   ÚboolÚlistr&   r   r   r   r   Ú<module>   sB    ÿÿÿ
þÿ
ÿÿ
þ ÿÿÿÿþ