§
    ¡”j  ã                   óT   — d Z ddlZddlZddlmZ ddlZddlmZ d„ Zd„ Z	d„ Z
d	d„ZdS )
ae  Module that contains the command line app.

Why does this file exist, and why not put this in __main__?
  You might be tempted to import things from __main__ later, but that will
  cause problems: the code will get executed twice:
  - When you run `python -m sqlparse` python will execute
    ``__main__.py`` as a script. That means there won't be any
    ``sqlparse.__main__`` in ``sys.modules``.
  - When you import __main__ it will get executed again (as a module) because
    there's no ``sqlparse.__main__`` in ``sys.modules``.
  Also see (1) from http://click.pocoo.org/5/setuptools/#setuptools-integration
é    N)ÚTextIOWrapper)ÚSQLParseErrorc                  ó  — g d¢} t          j        ddd¬¦  «        }|                     ddd¬	¦  «         |                     d
dddd¬¦  «         |                     ddddd¬¦  «         |                     ddt          j        ¬¦  «         |                     d¦  «        }|                     dddd| d                     d                     d „ | D ¦   «         ¦  «        ¦  «        ¬!¦  «         |                     d"d#dd$| d%                     d                     d&„ | D ¦   «         ¦  «        ¦  «        ¬!¦  «         |                     d'd(d)d*d+d,gd-¬!¦  «         |                     d.d/ddd0¬¦  «         |                     d1d2d3ddd4¬¦  «         |                     d5d6d7t          d8¬9¦  «         |                     d:d;ddd<¬¦  «         |                     d=d>ddd?¬¦  «         |                     d@dAdddB¬C¦  «         |                     dDdEdddF¬C¦  «         |                     dGdHdIt          dJ¬9¦  «         |                     dKdLdt          dM¬9¦  «         |                     dNdOdt          dP¬9¦  «         |                     dQdRdSdT¬U¦  «         |S )VN)ÚupperÚlowerÚ
capitalizeÚ	sqlformatzEFormat FILE according to OPTIONS. Use "-" as FILE to read from stdin.z"%(prog)s [OPTIONS] FILE [FILE ...])ÚprogÚdescriptionÚusageÚfilenameú+z%file(s) to format (use "-" for stdin))ÚnargsÚhelpz-oz	--outfileÚoutfileÚFILEz)write output to FILE (defaults to stdout))ÚdestÚmetavarr   z
--in-placeÚinplaceÚ
store_trueFz0format files in-place (overwrite existing files))r   ÚactionÚdefaultr   z	--versionÚversion)r   r   zFormatting Optionsz-kz
--keywordsÚCHOICEÚkeyword_casez,change case of keywords, CHOICE is one of {}z, c              3   ó"   K  — | ]
}d |› d �V — ŒdS ©ú"N© ©Ú.0Úxs     ú[/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/sqlparse/cli.pyú	<genexpr>z create_parser.<locals>.<genexpr>G   ó*   è è € Ð6Ð6 1�h˜!�h�h�hÐ6Ð6Ð6Ð6Ð6Ð6ó    )r   r   Úchoicesr   z-iz--identifiersÚidentifier_casez/change case of identifiers, CHOICE is one of {}c              3   ó"   K  — | ]
}d |› d �V — ŒdS r   r   r    s     r#   r$   z create_parser.<locals>.<genexpr>O   r%   r&   z-lz
--languageÚLANGÚoutput_formatÚpythonÚphpzJoutput a snippet in programming language LANG, choices are "python", "php"z--strip-commentsÚstrip_commentszremove commentsz-rz
--reindentÚreindentzreindent statementsz--indent_widthÚindent_widthé   z(indentation width (defaults to 2 spaces))r   r   Útyper   z--indent_after_firstÚindent_after_firstz2indent after first line of statement (e.g. SELECT)z--indent_columnsÚindent_columnsz<indent all columns by indent_width instead of keyword lengthz-az--reindent_alignedz%reindent statements to aligned format)r   r   r   z-sz--use_space_around_operatorsz*place spaces around mathematical operatorsz--wrap_afterÚ
wrap_afterr   z*Column after which lists should be wrappedz--comma_firstÚcomma_firstz-Insert linebreak before comma (default False)z	--compactÚcompactz2Try to produce more compact output (default False)z
--encodingÚencodingzutf-8z*Specify the input encoding (default utf-8))r   r   r   )
ÚargparseÚArgumentParserÚadd_argumentÚsqlparseÚ__version__Úadd_argument_groupÚformatÚjoinÚintÚbool)Ú_CASE_CHOICESÚparserÚgroups      r#   Úcreate_parserrF      sð  € Ø4Ð4Ð4€MåÔ$Øð*à2ð	ñ ô €Fð ×ÒØØØ4ð ñ 6ô 6ð 6ð
 ×ÒØˆkØØØ8ð	 ñ :ô :ð :ð ×ÒØØØØØ?ð ñ Aô Að Að ×ÒØØÝÔ$ð ñ &ô &ð &ð
 ×%Ò%Ð&:Ñ;Ô;€Eà	×ÒØˆlØØØØ;×BÒBØ�IŠIÐ6Ð6¨Ð6Ñ6Ô6Ñ6Ô6ñ8ô 8ð ñ 9ô 9ð 9ð 
×ÒØˆoØØØØ>×EÒEØ�IŠIÐ6Ð6¨Ð6Ñ6Ô6Ñ6Ô6ñ8ô 8ð ñ 9ô 9ð 9ð 
×ÒØˆlØØØ˜5Ð!ð+ð ñ ,ô ,ð ,ð 
×ÒØØØØØð ñ  ô  ð  ð 
×ÒØˆlØØØØ"ð ñ $ô $ð $ð 
×ÒØØØÝØ7ð ñ 9ô 9ð 9ð 
×ÒØØ!ØØØAð ñ Cô Cð Cð 
×ÒØØØØØKð ñ Mô Mð Mð 
×ÒØÐ"ØØØ4ð	 ñ 6ô 6ð 6ð 
×ÒØÐ,ØØØ9ð	 ñ ;ô ;ð ;ð 
×ÒØØØÝØ9ð ñ ;ô ;ð ;ð 
×ÒØØØÝØ<ð ñ >ô >ð >ð 
×ÒØØØÝØAð ñ Cô Cð Cð 
×ÒØØØØ9ð	 ñ ;ô ;ð ;ð €Mr&   c                 óL   — t           j                             d| › d�¦  «         dS )z5Print msg and optionally exit with return code exit_.z[ERROR] ú
é   )ÚsysÚstderrÚwrite)Úmsgs    r#   Ú_errorrN   ¦   s)   € å„J×ÒÐ' Ð'Ð'Ð'Ñ(Ô(Ð(Øˆ1r&   c                 óÜ  — | dk    r|j         rt          d¦  «        S | dk    rht          t          j        j        |j        ¬¦  «        }	 |                     ¦   «         }|                     ¦   «          nœ# |                     ¦   «          w xY w	 t          | |j        ¬¦  «        5 }d 
                    |                     ¦   «         ¦  «        }ddd¦  «         n# 1 swxY w Y   n,# t          $ r}t          d| › d|› �¦  «        cY d}~S d}~ww xY wd}|j         rG	 t          | d	|j        ¬¦  «        }d
}n�# t          $ r}t          d| › d|› �¦  «        cY d}~S d}~ww xY w|j        rQ	 t          |j        d	|j        ¬¦  «        }d
}n=# t          $ r$}t          d|j        › d|› �¦  «        cY d}~S d}~ww xY wt          j        }t          |¦  «        }	 t           j                             |¦  «        }n)# t&          $ r}t          d|› �¦  «        cY d}~S d}~ww xY wt!          j        |fi |¤Ž}	|                     |	¦  «         |                     ¦   «          |r|                     ¦   «          dS )zdProcess a single file with the given formatting options.

    Returns 0 on success, 1 on error.
    ú-z Cannot use --in-place with stdin)r8   Ú NzFailed to read z: FÚwTzFailed to open zInvalid options: r   )r   rN   r   rJ   ÚstdinÚbufferr8   ÚreadÚdetachÚopenr@   Ú	readlinesÚOSErrorr   ÚstdoutÚvarsr<   Ú	formatterÚvalidate_optionsr   r?   rL   ÚflushÚclose)
r   ÚargsÚwrapperÚdataÚfÚeÚclose_streamÚstreamÚformatter_optsÚss
             r#   Ú_process_fileri   ¬   s  € ð �3‚€˜4œ<€ÝÐ8Ñ9Ô9Ð9ð �3‚€Ý¥¤	Ô 0¸4¼=ÐIÑIÔIˆð	Ø—<’<‘>”>ˆDà�NŠNÑÔÐÐøˆG�NŠNÑÔÐÐøøøð	=Ý�h¨¬Ð7Ñ7Ô7ð .¸1Ø—w’w˜qŸ{š{™}œ}Ñ-Ô-�ð.ð .ð .ñ .ô .ð .ð .ð .ð .ð .ð .øøøð .ð .ð .ð .øøåð 	=ð 	=ð 	=ÝÐ;¨HÐ;Ð;¸Ð;Ð;Ñ<Ô<Ð<Ð<Ð<Ð<Ð<Ð<øøøøð	=øøøð €LØ„|ð ð	=Ý˜( C°$´-Ð@Ñ@Ô@ˆFØˆLˆLøÝð 	=ð 	=ð 	=ÝÐ;¨HÐ;Ð;¸Ð;Ð;Ñ<Ô<Ð<Ð<Ð<Ð<Ð<Ð<øøøøð	=øøøà	Œð ð	AÝ˜$œ,¨°d´mÐDÑDÔDˆFØˆLˆLøÝð 	Að 	Að 	AÝÐ?¨D¬LÐ?Ð?¸AÐ?Ð?Ñ@Ô@Ð@Ð@Ð@Ð@Ð@Ð@øøøøð	Aøøøõ ”ˆõ ˜$‘Z”Z€Nð/Ý!Ô+×<Ò<¸^ÑLÔLˆˆøÝð /ð /ð /ÝÐ-¨!Ð-Ð-Ñ.Ô.Ð.Ð.Ð.Ð.Ð.Ð.øøøøð/øøøõ 	Œ˜Ð/Ð/ Ð/Ð/€AØ
‡L‚L��O„O€OØ
‡L‚L�N„N€NØð Ø�Š‰ŒˆØˆ1s¨   Á	A2 Á2BÂC" Â"(CÃ
C" ÃCÃC" ÃCÃC" Ã"
DÃ,DÄ DÄDÄD2 Ä2
EÄ<EÅEÅEÅ&F Æ
F3ÆF.Æ(F3Æ.F3ÇG2 Ç2
HÇ<HÈHÈHc                 ó  — t          ¦   «         }|                     | ¦  «        } t          | j        ¦  «        dk    r,| j        rt          d¦  «        S | j        st          d¦  «        S d}| j        D ]}t          || ¦  «        }|dk    r|}Œ|S )NrI   z+Cannot use -o/--outfile with multiple filesz&Multiple files require --in-place flagr   )rF   Ú
parse_argsÚlenr   r   rN   r   ri   )r`   rD   Ú	exit_coder   Úresults        r#   Úmainro   ã   s§   € Ý‰_Œ_€FØ×Ò˜TÑ"Ô"€Dõ ˆ4Œ=ÑÔ˜AÒÐØŒ<ð 	IÝÐGÑHÔHÐHØŒ|ð 	DÝÐBÑCÔCÐCð €IØ”Mð ð ˆÝ˜x¨Ñ.Ô.ˆØ�QŠ;ˆ;ØˆIøð Ðr&   )N)Ú__doc__r9   rJ   Úior   r<   Úsqlparse.exceptionsr   rF   rN   ri   ro   r   r&   r#   ú<module>rs      s    ððð ð €€€Ø 
€
€
€
Ø Ð Ð Ð Ð Ð à €€€Ø -Ð -Ð -Ð -Ð -Ð -ð
Eð Eð EðPð ð ð4ð 4ð 4ðnð ð ð ð ð r&   