o
    LK&hÁ  ã                   @  sì   d Z ddlmZ ddlZddlmZ e d¡Ze d¡Ze d¡Z	e d¡Z
e d	¡Ze d
¡Ze d¡Ze d¡Ze d¡Ze d¡Ze d¡Ze d¡Ze d¡Ze d¡Ze d¡Zeee	e
eeeeeeeeeeedœZddd„ZdS )aç  
Format a pretty string of a `SoupSieve` object for easy debugging.

This won't necessarily support all types and such, and definitely
not support custom outputs.

It is mainly geared towards our types as the `SelectorList`
object is a beast to look at without some indentation and newlines.
The format and various output types is fairly known (though it
hasn't been tested extensively to make sure we aren't missing corners).

Example:
-------
```
>>> import soupsieve as sv
>>> sv.compile('this > that.class[name=value]').selectors.pretty()
SelectorList(
    selectors=(
        Selector(
            tag=SelectorTag(
                name='that',
                prefix=None),
            ids=(),
            classes=(
                'class',
                ),
            attributes=(
                SelectorAttribute(
                    attribute='name',
                    prefix='',
                    pattern=re.compile(
                        '^value$'),
                    xml_type_pattern=None),
                ),
            nth=(),
            selectors=(),
            relation=SelectorList(
                selectors=(
                    Selector(
                        tag=SelectorTag(
                            name='this',
                            prefix=None),
                        ids=(),
                        classes=(),
                        attributes=(),
                        nth=(),
                        selectors=(),
                        relation=SelectorList(
                            selectors=(),
                            is_not=False,
                            is_html=False),
                        rel_type='>',
                        contains=(),
                        lang=(),
                        flags=0),
                    ),
                is_not=False,
                is_html=False),
            rel_type=None,
            contains=(),
            lang=(),
            flags=0),
        ),
    is_not=False,
    is_html=False)
```

é    )ÚannotationsN)ÚAnyz(?i)[a-z_][_a-z\d\.]+\(z(?i)[_a-z][_a-z\d]+=z\(\)|\[\]|\{\}z\[z\{z\(z\]z\}z\)z\d+z(?i)[_a-z][_a-z\d]+z"(?:\\.|[^"\\])*"z'(?:\\.|[^'\\])*'z	\s*(,)\s*z	\s*(:)\s*)ÚclassÚparamÚemptyÚlstrtÚdstrtÚtstrtÚlendÚdendÚtendÚsqstrÚsepÚdsepÚintÚkwordÚdqstrÚobjr   ÚreturnÚstrc           
      C  s$  t | ƒ}d}t|ƒd }d}g }||krd}t ¡ D ]n\}}| ||¡}|rˆ|}	| d¡}|	dv rE|d7 }| | d¡› dd| › ¡ nA|	dv rR| | d¡¡ n4|	d	v rc|d8 }| | d¡¡ n#|	d
v rw| | d¡› dd| › ¡ n|	dv r†| | d¡› d¡  nq||ksd |¡S )z%Make the object output string pretty.r   é   N)r   r   r   r	   é   Ú
ú )r   r   r   r   r   r   )r
   r   r   )r   )r   Ú )	r   ÚlenÚTOKENSÚitemsÚmatchÚendÚappendÚgroupÚjoin)
r   ÚselÚindexr   ÚindentÚoutputÚmÚkÚvÚname© r+   úC/var/www/html/venv/lib/python3.10/site-packages/soupsieve/pretty.pyÚprettyl   s8   
  ñû
r-   )r   r   r   r   )Ú__doc__Ú
__future__r   ÚreÚtypingr   ÚcompileÚRE_CLASSÚRE_PARAMÚRE_EMPTYÚRE_LSTRTÚRE_DSTRTÚRE_TSTRTÚRE_LENDÚRE_DENDÚRE_TENDÚRE_INTÚRE_KWORDÚRE_DQSTRÚRE_SQSTRÚRE_SEPÚRE_DSEPr   r-   r+   r+   r+   r,   Ú<module>   sH    D














ñ