o
    6i9
                  
   @   s$  d Z ddlmZmZmZmZmZmZmZ ddl	m
Z
 ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ d	Zg d
Z	ddedee dee
jdf fddZ	ddeeee f dee dee
jddf fddZddedee dedefddZ	ddedee dedee fddZdS )zParse SQL statements.    )Any	GeneratorIOListOptionalTupleUnion)sql)cli)engine)tokens)filters)	formatterz0.5.4)r   r   r   r	   r   r
   Nr	   encodingreturn.c                 C   s   t t| |S )zParse 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   V/var/www/hoanhtaovolam_webdjango/env/lib/python3.10/site-packages/sqlparse/__init__.pyparse   s   	r   streamc                 C   s   t  }|  || |S )zParses 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   format3   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>P   s    zsplit.<locals>.<listcomp>)r   r   r   )r	   r   r$   r   r   r   r   splitD   s   r*   )N)NF)__doc__typingr   r   r   r   r   r   r   sqlparser	   r
   r   r   r   r   __version____all__r%   	Statementr   r   r#   boolr*   r   r   r   r   <module>   sJ   $

 