
    k"g	                     |    d 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Z
ddZddZddZy
)zParse SQL statements.    )sql)cli)engine)tokens)filters)	formatterz0.5.1)r   r   r   r   r   r   Nc                 ,    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   encodings     J/var/www/html/djangosite/lib/python3.12/site-packages/sqlparse/__init__.pyparser      s     S(+,,    c                 n    t        j                         }|j                          |j                  | |      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)streamr   stacks      r   r   r   !   s/      E	99VX&&r   c                    t        j                         }t        j                  |      }t        j                  ||      }|j
                  j                  t        j                                dj                  |j                  | |            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   optionsr   s       r   formatr   -   sk      E((1G((8E	W668977599S(+,,r   c                     t        j                  |      }|j                  | |      D cg c]  }t        |      j	                          c}S c c}w )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 trainling semicolons
        (default: False).
    :returns: A list of strings.
    )strip_semicolon)r   r   r   strstrip)r   r   r!   r   stmts        r   splitr%   >   s>     ?E*/))C*BC$CIOOCCCs    A)N)NF)__doc__sqlparser   r   r   r   r   r   __version____all__r   r   r   r%    r   r   <module>r+      s?           
D-	'-"
Dr   