Ë
    î%9j  ã                   óR   — 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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)ÚSQLParseErrorc                  óJ  — g d¢} t        j                  ddd¬«      }|j                  ddd¬	«       |j                  d
ddd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d0¬«       |j                  d1d2d3ddd4¬«       |j                  d5d6d7t        d8¬9«       |j                  d:d;ddd<¬«       |j                  d=d>ddd?¬«       |j                  d@dAdddB¬C«       |j                  dDdEdddF¬C«       |j                  dGdHdIt        dJ¬9«       |j                  dKdLdt        dM¬9«       |j                  dNdOdt        dP¬9«       |j                  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 �–— Œ y­w©ú"N© ©Ú.0Úxs     úH/var/www/html/truck-me/venv/lib/python3.12/site-packages/sqlparse/cli.pyú	<genexpr>z create_parser.<locals>.<genexpr>G   ó   è ø€ Ò6 1˜˜!˜˜A”hÑ6ùó   ‚)r   r   Úchoicesr   z-iz--identifiersÚidentifier_casez/change case of identifiers, CHOICE is one of {}c              3   ó(   K  — | ]
  }d |› d �–— Œ y­w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€Mä×$Ñ$Øð*à2ô	€Fð ×ÑØØØ4ð ô 6ð
 ×ÑØˆkØØØ8ð	 ô :ð ×ÑØØØØØ?ð ô Að ×ÑØØÜ×$Ñ$ð ô &ð
 ×%Ñ%Ð&:Ó;€Eà	×ÑØˆlØØØØ;×BÑBØ�I‰IÑ6¨Ô6Ó6ó8ð ô 9ð 
×ÑØˆoØØØØ>×EÑEØ�I‰IÑ6¨Ô6Ó6ó8ð ô 9ð 
×ÑØˆlØØØ˜5Ð!ð+ð ô ,ð 
×ÑØØØØØð ô  ð 
×ÑØˆlØØØØ"ð ô $ð 
×ÑØØØÜØ7ð ô 9ð 
×ÑØØ!ØØØAð ô Cð 
×ÑØØØØØKð ô Mð 
×ÑØÐ"ØØØ4ð	 ô 6ð 
×ÑØÐ,ØØØ9ð	 ô ;ð 
×ÑØØØÜØ9ð ô ;ð 
×ÑØØØÜØ<ð ô >ð 
×ÑØØØÜØAð ô Cð 
×ÑØØØØ9ð	 ô ;ð €Mó    c                 óJ   — t         j                  j                  d| › d�«       y)z5Print msg and optionally exit with return code exit_.z[ERROR] ú
é   )ÚsysÚstderrÚwrite)Úmsgs    r#   Ú_errorrO   ¦   s    € ä‡J�J×Ñ�x ˜u BÐ'Ô(ØrG   c                 ó°  — | dk(  r|j                   rt        d«      S | dk(  rQt        t        j                  j
                  |j                  ¬«      }	 |j                  «       }|j                  «        n@	 t        | |j                  ¬«      5 }dj                  |j                  «       «      }ddd«       d}|j                   r	 t        | d	|j                  ¬«      }d
}nB|j                  r&	 t        |j                  d	|j                  ¬«      }d
}nt        j                  }t        |«      }	 t         j"                  j%                  |«      }t!        j(                  fi |¤Ž}	|j+                  |	«       |j-                  «        |r|j/                  «        y# |j                  «        w xY w# 1 sw Y   ŒÿxY w# t        $ r}t        d| › d|› �«      cY d}~S d}~ww xY w# t        $ r}t        d| › d|› �«      cY d}~S d}~ww xY w# t        $ r%}t        d|j                  › d|› �«      cY d}~S d}~ww xY w# t&        $ r}t        d|› �«      cY d}~S d}~ww xY w)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   rO   r   rK   ÚstdinÚbufferr8   ÚreadÚdetachÚopenr@   Ú	readlinesÚOSErrorr   ÚstdoutÚvarsr<   Ú	formatterÚvalidate_optionsr   r?   rM   ÚflushÚclose)
r   ÚargsÚwrapperÚdataÚfÚeÚclose_streamÚstreamÚformatter_optsÚss
             r#   Ú_process_filerj   ¬   s  € ð �3‚˜4Ÿ<š<ÜÐ8Ó9Ð9ð �3‚Ü¤§	¡	× 0Ñ 0¸4¿=¹=ÔIˆð	Ø—<‘<“>ˆDà�N‰NÕð	=Ü�h¨¯©Ô7ð .¸1Ø—w‘w˜qŸ{™{›}Ó-�÷.ð €LØ‡|‚|ð	=Ü˜( C°$·-±-Ô@ˆFØ‰Lð 
�Šð	AÜ˜$Ÿ,™,¨°d·m±mÔDˆFØ‰Lô —‘ˆô ˜$“Z€Nð/Ü!×+Ñ+×<Ñ<¸^ÓLˆô 	�‰˜Ñ/ Ñ/€AØ
‡L�L�„OØ
‡L�L„NÙØ�‰ŒØøðK �N‰NÕú÷.ð .ûäò 	=Ü˜O¨H¨:°R¸°sÐ;Ó<Õ<ûð	=ûô ò 	=Ü˜O¨H¨:°R¸°sÐ;Ó<Õ<ûð	=ûô ò 	AÜ˜O¨D¯L©L¨>¸¸A¸3Ð?Ó@Õ@ûð	Aûô ò /ÜÐ)¨!¨Ð-Ó.Õ.ûð/úsœ   ÁF Á4F5 Â F)Â+F5 ÃG Ã*$H Ä+H4 ÆF&Æ)F2Æ.F5 Æ5	GÆ>GÇGÇGÇ	H Ç%G;Ç5H Ç;H È	H1ÈH,È&H1È,H1È4	IÈ=IÉ
IÉIc                 ó  — t        «       }|j                  | «      } t        | j                  «      dkD  r.| j                  rt        d«      S | j                  st        d«      S d}| j                  D ]  }t        || «      }|dk7  sŒ|}Œ |S )NrJ   z+Cannot use -o/--outfile with multiple filesz&Multiple files require --in-place flagr   )rF   Ú
parse_argsÚlenr   r   rO   r   rj   )ra   rD   Ú	exit_coder   Úresults        r#   Úmainrp   ã   sŒ   € Ü‹_€FØ×Ñ˜TÓ"€Dô ˆ4�=‰=Ó˜AÒØ�<Š<ÜÐGÓHÐHØ�|Š|ÜÐBÓCÐCð €IØ—M‘Mò ˆÜ˜x¨Ó.ˆØ�Q‹;Ø‰Iðð ÐrG   )N)Ú__doc__r9   rK   Úior   r<   Úsqlparse.exceptionsr   rF   rO   rj   rp   r   rG   r#   ú<module>rt      s2   ðñó Û 
Ý ã Ý -ò
EòPò4ônrG   