
    h                     ,    d Z ddlmZ ddlmZ d Zd Zy)zSQL formatter    )filters)SQLParseErrorc                    | j                  d      }|dvrt        dj                  |            | j                  d      }|dvrt        dj                  |            | j                  d      }|dvrt        dj                  |            | j                  d	d
      }|dvrt        dj                  |            | j                  dd
      }|dvrt        dj                  |            | j                  dd
      }|dvrt        dj                  |            | j                  d      }|E	 t        |      }|dk  rt        dj                  |            || d<   | j                  dd      | d<   | j                  dd
      }|dvrt        dj                  |            |rd| d<   | j                  dd
      }	|	dvrt        dj                  |            |	rd| d<   | j                  dd
      }
|
dvrt        dj                  |
            |
rd| d<   nd| d<   | j                  d d!      }	 t        |      }|dk  rt        d#      || d <   | j                  d$d%      }	 t        |      }|d%k  rt        d'      || d$<   | j                  d(d
      }|dvrt        d)      || d(<   | j                  d*      }|	 t        |      }|d,k  rt        d-      || d*<   | S # t        t
        f$ r t        dj                  |            w xY w# t
        t        f$ r t        d"      w xY w# t
        t        f$ r t        d&      w xY w# t
        t        f$ r t        d+      w xY w).zValidates options.keyword_case)Nupperlower
capitalizez%Invalid value for keyword_case: {0!r}identifier_casez(Invalid value for identifier_case: {0!r}output_format)NsqlpythonphpzUnknown output format: {0!r}strip_commentsF)TFz'Invalid value for strip_comments: {0!r}use_space_around_operatorsz3Invalid value for use_space_around_operators: {0!r}strip_whitespacez)Invalid value for strip_whitespace: {0!r}truncate_stringsz)Invalid value for truncate_strings: {0!r}   truncate_charz[...]reindentz!Invalid value for reindent: {0!r}Treindent_alignedz)Invalid value for reindent_aligned: {0!r}indent_tabsz$Invalid value for indent_tabs: {0!r}	indent_char indent_width   z indent_width requires an integerz(indent_width requires a positive integer
wrap_afterr   zwrap_after requires an integerz&wrap_after requires a positive integercomma_firstz$comma_first requires a boolean valueright_marginz right_margin requires an integer
   z%right_margin requires an integer > 10)getr   formatint
ValueError	TypeError)optionskwcaseidcaseofrmtr   space_around_operatorsstrip_wsr   r   r   r   r   r   r   r   s                  U/var/www/html/ranktracker/api/venv/lib/python3.12/site-packages/sqlparse/formatter.pyvalidate_optionsr-      s   [[(F;; $$*F6N4 	4 [[*+F;; $$*F6N4 	4 KK(E22 $$*F5M3 	3 [[!159N]* $$*F>$:< 	< %[[)EuM]2 $$*F+A$BD 	D {{-u5H}$ $$*F8$46 	6 {{#56#	B"#34 q  !((./?(@B B&6"##*;;#H {{:u-H}$ $$*F8$46 	6	&*"#{{#5u=}, $$*F8$46 	6	&*"#++mU3K-' $$*F;$79 	9	!%!$;;~q1L@<( aFGG*GN\1-J>_
 A~DEE&GL++mU3K-'BCC(GM;;~.L	D|,L " GHH*GNNC I& 	B !((./?(@B B	BF z" @>??@ z" ><==> :& 	D BCC	Ds0   2K# 4L 'L. M #*LL+.M	M'c           	         |j                  d      r1| j                  j                  t        j                  |d                |j                  d      r1| j                  j                  t        j
                  |d                |j                  d      r6| j                  j                  t        j                  |d   |d                |j                  dd      r=| j                          | j                  j                  t        j                                |j                  d      r=| j                          | j                  j                  t        j                                |j                  d	      s|j                  d
      r=| j                          | j                  j                  t        j                                |j                  d
      rN| j                          | j                  j                  t        j                  |d   |d   |d   |d                |j                  dd      rB| j                          | j                  j                  t        j                  |d                |j                  d      rB| j                          | j                  j                  t        j                  |d                |j                  d      rt|d   }|j                         dk(  rt        j                          }n*|j                         dk(  rt        j"                         }nd}|| j$                  j                  |       | S )zSetup and return a filter stack.

    Args:
      stack: :class:`~sqlparse.filters.FilterStack` instance
      options: Dictionary with options validated by validate_options.
    r   r
   r   r   )widthcharr   Fr   r   r   r   r   r   r   )r0   r/   r   r   r   )r0   r   )r/   r   r   r   N)r!   
preprocessappendr   KeywordCaseFilterIdentifierCaseFilterTruncateStringFilterenable_groupingstmtprocessSpacesAroundOperatorsFilterStripCommentsFilterStripWhitespaceFilterReindentFilterAlignedIndentFilterRightMarginFilterr   OutputPHPFilterOutputPythonFilterpostprocess)stackr&   frmtfltrs       r,   build_filter_stackrD   v   s    {{>"%%gn&=>	@ {{$%((1B)CD	F {{%& < <,-GO4L!N 	O {{/7  !D!D!FG {{#$  !<!<!>?{{%&'++j*A  !>!>!@A{{:  ""(>)0)@.5l.C/6}/EG	H {{%u-  ''W]-CD	F {{>"  %%GN,CD	F {{?#'::<5 **,DZZ\X%--/DD$$T*L    N)__doc__sqlparser   sqlparse.exceptionsr   r-   rD    rE   r,   <module>rJ      s      -eP?rE   