Ë
    �ïŒh  ã                   óh   — d Z ddlZddlZddlmZ ddlmZmZ ddlZddl	m
Z
 ddlmZ d„ Zd„ Zd
d	„Zy)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)ÚopenÚ	getreader)ÚPY2)ÚSQLParseErrorc                  óŒ  — g d¢} t        j                  ddd¬«      }|j                  d«       |j                  ddd	d
d¬«       |j                  ddt        j                  ¬«       |j                  d«      }|j                  dddd| dj                  dj                  d„ | D «       «      «      ¬«       |j                  dddd| dj                  dj                  d„ | D «       «      «      ¬«       |j                  ddd d!d"d#gd$¬«       |j                  d%d&d'd(d)¬*«       |j                  d+d,d-d'd(d.¬*«       |j                  d/d0d1t        d2¬3«       |j                  d4d5d'd(d6¬7«       |j                  d8d9d'd(d:¬7«       |j                  d;d<d=t        d>¬3«       |j                  d?d@d(t        dA¬3«       |j                  dBdCdDdE¬F«       |S )GN)ÚupperÚlowerÚ
capitalizeÚ	sqlformatzEFormat FILE according to OPTIONS. Use "-" as FILE to read from stdin.z%(prog)s  [OPTIONS] FILE, ...)ÚprogÚdescriptionÚusageÚfilenamez-oz	--outfileÚoutfileÚFILEz)write output to FILE (defaults to stdout))ÚdestÚmetavarÚhelpz	--versionÚversion)Úactionr   zFormatting Optionsz-kz
--keywordsÚCHOICEÚkeyword_casez-change case of keywords, CHOICE is one of {0}z, c              3   ó>   K  — | ]  }d j                  |«      –— Œ y­w©z"{0}"N©Úformat©Ú.0Úxs     úO/var/www/html/ranktracker/api/venv/lib/python3.12/site-packages/sqlparse/cli.pyú	<genexpr>z create_parser.<locals>.<genexpr>A   ó   è ø€ Ò?¨A�g—n‘n Q×'Ñ?ùó   ‚)r   r   Úchoicesr   z-iz--identifiersÚidentifier_casez0change case of identifiers, CHOICE is one of {0}c              3   ó>   K  — | ]  }d j                  |«      –— Œ y­wr   r   r   s     r!   r"   z create_parser.<locals>.<genexpr>I   r#   r$   z-lz
--languageÚLANGÚoutput_formatÚpythonÚphpzJoutput a snippet in programming language LANG, choices are "python", "php"z--strip-commentsÚstrip_commentsÚ
store_trueFzremove comments)r   r   Údefaultr   z-rz
--reindentÚreindentzreindent statementsz--indent_widthÚindent_widthé   z(indentation width (defaults to 2 spaces))r   r.   Útyper   z-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
--encodingÚencodingzutf-8z*Specify the input encoding (default utf-8))r   r.   r   )
ÚargparseÚArgumentParserÚadd_argumentÚsqlparseÚ__version__Úadd_argument_groupr   ÚjoinÚintÚbool)Ú_CASE_CHOICESÚparserÚgroups      r!   Úcreate_parserrB   "   se  € Ú4€Mä×$Ñ$Øð*à-ô	€Fð ×Ñ˜
Ô#à
×ÑØˆkØØØ8ð	 ô :ð ×ÑØØÜ×$Ñ$ð ô &ð
 ×%Ñ%Ð&:Ó;€Eà	×ÑØˆlØØØØ<×CÑCØ�I‰IÑ?°Ô?Ó?óAð ô Bð 
×ÑØˆoØØØØ?×FÑFØ�I‰IÑ?°Ô?Ó?óAð ô Bð 
×ÑØˆlØØØ˜5Ð!ð+ð ô ,ð 
×ÑØØØØØð ô  ð 
×ÑØˆlØØØØ"ð ô $ð 
×ÑØØØÜØ7ð ô 9ð 
×ÑØÐ"ØØØ4ð	 ô 6ð 
×ÑØÐ,ØØØ9ð	 ô ;ð 
×ÑØØØÜØ9ð ô ;ð 
×ÑØØØÜØ<ð ô >ð 
×ÑØØØØ9ð	 ô ;ð €Mó    c                 ó`   — t         j                  j                  dj                  | «      «       y)z5Print msg and optionally exit with return code exit_.z[ERROR] {0}
é   )ÚsysÚstderrÚwriter   )Úmsgs    r!   Ú_errorrJ   ‹   s#   € ä‡J�J×ÑÐ%×,Ñ,¨SÓ1Ô2ØrC   c                 ó¶  — t        «       }|j                  | «      } | j                  dk(  r|t        r8 t	        | j
                  «      t        j                  «      j                  «       }nˆt        t        j                  j                  | j
                  ¬«      j                  «       }nJ	 t        | j                  d| j
                  «      5 }dj                  |j                  «       «      }d d d «       d}| j"                  r%	 t        | j"                  d| j
                  «      }d}nt        j$                  }t'        | «      }	 t(        j*                  j-                  |«      }t)        j                   fi |¤Ž}|j1                  |«       |j3                  «        |r|j5                  «        y# 1 sw Y   ŒÁxY w# t        $ r/}t        dj!                  | j                  |«      «      cY d }~S d }~ww xY w# t        $ r/}t        d	j!                  | j"                  |«      «      cY d }~S d }~ww xY w# t.        $ r$}t        d
j!                  |«      «      cY d }~S d }~ww xY w)Nú-)r5   ÚrÚ zFailed to read {0}: {1}FÚwTzFailed to open {0}: {1}zInvalid options: {0}r   )rB   Ú
parse_argsr   r   r   r5   rF   ÚstdinÚreadr   Úbufferr   r<   Ú	readlinesÚIOErrorrJ   r   r   ÚstdoutÚvarsr9   Ú	formatterÚvalidate_optionsr   rH   ÚflushÚclose)	Úargsr@   ÚdataÚfÚeÚclose_streamÚstreamÚformatter_optsÚss	            r!   Úmainrd   ‘   sØ  € Ü‹_€FØ×Ñ˜TÓ"€Dà‡}�}˜ÒÝØ+”9˜TŸ]™]Ó+¬C¯I©IÓ6×;Ñ;Ó=‰Dä Ü—	‘	× Ñ ¨4¯=©=ô:ß:>¹$»&ñ ð	EÜ�d—m‘m S¨$¯-©-Ó8ð .¸AØ—w‘w˜qŸ{™{›}Ó-�÷.ð €LØ‡|‚|ð	NÜ˜$Ÿ,™,¨¨T¯]©]Ó;ˆFØ‰Lô —‘ˆä˜$“Z€Nð9Ü!×+Ñ+×<Ñ<¸^ÓLˆô 	�‰˜Ñ/ Ñ/€AØ
‡L�L�„OØ
‡L�L„NÙØ�‰ŒØ÷7.ð .ûäò 	EÜØ*×1Ñ1°$·-±-ÀÓCóEõ Eûð	Eûô ò 	NÜÐ4×;Ñ;¸D¿L¹LÈ!ÓLÓMÕMûð	Nûô ò 9ÜÐ-×4Ñ4°QÓ7Ó8Õ8ûð9úsr   Â(!F5 Ã	 F)Ã)F5 Ä #G0 Å H+ Æ)F2Æ.F5 Æ5	G-Æ>$G(Ç"G-Ç(G-Ç0	H(Ç9$H#ÈH(È#H(È+	IÈ4IÉIÉI)N)Ú__doc__r6   rF   Úior   Úcodecsr   r   r9   Úsqlparse.compatr   Úsqlparse.exceptionsr   rB   rJ   rd   © rC   r!   ú<module>rk      s2   ðñó Û 
Ý ß "ã Ý Ý -ò
fòRô'rC   