
    (ph(                       % S SK Jr  S SKJrJrJrJrJrJrJ	r	J
r
  S SKJr  S SKJr  \	(       a  S SKJr   " S S\5      r " S S	\5      r " S
 S\5      r\" \R(                  S9\R*                  S'   \" \R,                  SSS9\R*                  S'   \" \R(                  SSS9\R*                  S'   \" \R.                  S9\R*                  S'   \" SS9\R*                  S'   \" \R(                  S9\R*                  S'   \" \R.                  S9\R*                  S'   \" SS9\R*                  S'   \\/\4   rS\S'   \
\\4   rg)    )annotations)CallableDictIterableOptionalSetTupleTYPE_CHECKINGUnion)	TypeAlias)EntitySubstitution)_AttributeValuec                     \ rS rSr% SrSrS\S'   SrS\S'   \" \	" SS	/5      S
9r
S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'           SS jr      S           S S jjrS!S jrS"S jr    S#S jrSrg)$	Formatter
   a  Describes a strategy to use when outputting a parse tree to a string.

Some parts of this strategy come from the distinction between
HTML4, HTML5, and XML. Others are configurable by the user.

Formatters are passed in as the `formatter` argument to methods
like `bs4.element.Tag.encode`. Most people won't need to
think about formatters, and most people who need to think about
them can pass in one of these predefined strings as `formatter`
rather than making a new Formatter object:

For HTML documents:
 * 'html' - HTML entity substitution for generic HTML documents. (default)
 * 'html5' - HTML entity substitution for HTML5 documents, as
             well as some optimizations in the way tags are rendered.
 * 'html5-4.12.0' - The version of the 'html5' formatter used prior to
                    Beautiful Soup 4.13.0.
 * 'minimal' - Only make the substitutions necessary to guarantee
               valid HTML.
 * None - Do not perform any substitution. This will be faster
          but may result in invalid markup.

For XML documents:
 * 'html' - Entity substitution for XHTML documents.
 * 'minimal' - Only make the substitutions necessary to guarantee
               valid XML. (default)
 * None - Do not perform any substitution. This will be faster
          but may result in invalid markup.

htmlstrHTMLxmlXMLscriptstyle)cdata_containing_tagszDict[str, Set[str]]HTML_DEFAULTSOptional[str]language%Optional[_EntitySubstitutionFunction]entity_substitutionvoid_element_close_prefixSet[str]r   indentboolempty_attributes_are_booleansc                \    Ub  U$ XR                   :X  a
  [        5       $ U R                  U   $ )N)r   setr   )selfr   valuekwargs       @/var/www/html/venv/lib/python3.13/site-packages/bs4/formatter.py_defaultFormatter._defaultB   s5     Lxx 5L !!%((    Nc                0   U=(       d    U R                   U l        X l        X0l        U R	                  U R                  US5      U l        XPl        Uc  Sn[        U[        5      (       a  US:  a  SnSU-  nO[        U[        5      (       a  UnOSnXpl
        g)a  Constructor.

:param language: This should be `Formatter.XML` if you are formatting
   XML markup and `Formatter.HTML` if you are formatting HTML markup.

:param entity_substitution: A function to call to replace special
   characters with XML/HTML entities. For examples, see
   bs4.dammit.EntitySubstitution.substitute_html and substitute_xml.
:param void_element_close_prefix: By default, void elements
   are represented as <tag/> (XML rules) rather than <tag>
   (HTML rules). To get <tag>, pass in the empty string.
:param cdata_containing_tags: The set of tags that are defined
   as containing CDATA in this dialect. For example, in HTML,
   <script> and <style> tags are defined as containing CDATA,
   and their contents should not be formatted.
:param empty_attributes_are_booleans: If this is set to true,
  then attributes whose values are sent to the empty string
  will be treated as `HTML boolean
  attributes<https://dev.w3.org/html5/spec-LC/common-microsyntaxes.html#boolean-attributes>`_. (Attributes
  whose value is None are always rendered this way.)
:param indent: If indent is a non-negative integer or string,
    then the contents of elements will be indented
    appropriately when pretty-printing. An indent level of 0,
    negative, or "" will only insert newlines. Using a
    positive integer indent indents that many spaces per
    level. If indent is a string (such as "\t"), that string
    is used to indent each level. The default behavior is to
    indent one space per level.

r   Nr    )r   r   r   r   r*   r   r#   
isinstanceintr   r!   )r&   r   r   r   r   r#   r!   
indent_strs           r)   __init__Formatter.__init__O   s    N !-DII#6 )B&%)]]MM02I&
" .K*>Ffc""zvJ$$JJ r,   c                    U R                   (       d  U$ SSKJn  [        X5      (       a3  UR                  b&  UR                  R
                  U R                  ;   a  U$ U R                  U5      $ )zProcess a string that needs to undergo entity substitution.
This may be a string encountered in an attribute value or as
text.

:param ns: A string.
:return: The same string but with certain characters replaced by named
   or numeric entities.
   )NavigableString)r   elementr6   r/   parentnamer   )r&   nsr6   s      r)   
substituteFormatter.substitute   sZ     ''I, r++		%		$"<"<< I''++r,   c                $    U R                  U5      $ )zProcess the value of an attribute.

:param ns: A string.
:return: A string with certain characters replaced by named
   or numeric entities.
)r;   )r&   r'   s     r)   attribute_valueFormatter.attribute_value   s     u%%r,   c                   ^  UR                   c  / $ [        UR                   R                  5       5      n[        U 4S jU 5       5      $ )ax  Reorder a tag's attributes however you want.

By default, attributes are sorted alphabetically. This makes
behavior consistent between Python 2 and Python 3, and preserves
backwards compatibility with older versions of Beautiful Soup.

If `empty_attributes_are_booleans` is True, then
attributes whose values are set to the empty string will be
treated as boolean attributes.
c              3  b   >#    U  H$  u  pUTR                   (       a  US :X  a  SOU4v   M&     g7f) N)r#   ).0kvr&   s      r)   	<genexpr>'Formatter.attributes.<locals>.<genexpr>   s/      
 ;;RQPs   ,/)attrslistitemssorted)r&   tagrJ   s   `  r)   
attributesFormatter.attributes   sC     99I7;CIIOO<M7N 

 
 	
r,   )r   r#   r   r!   r   r   )r   r   r'   Optional[Set[str]]r(   r   returnr    )NN/NFr5   )r   r   r   r   r   r   r   rO   r#   r"   r!   Union[int, str])r:   r   rP   r   )r'   r   rP   r   )rL   zbs4.element.TagrP   z/Iterable[Tuple[str, Optional[_AttributeValue]]])__name__
__module____qualname____firstlineno____doc__r   __annotations__r   dictr%   r   r*   r2   r;   r>   rM   __static_attributes__ r,   r)   r   r   
   s   @ D# C *.!8W"56*M&  >>""##K $('))$6)?B)	) #'EI),48.3!"9!9! C9! $'	9!
  29! (,9! 9!v,.&
"
	8
r,   r   c                  `   ^  \ rS rSr% Sr0 rS\S'        S         SU 4S jjjrSrU =r	$ )	HTMLFormatter   zA generic Formatter for HTML.z"Dict[Optional[str], HTMLFormatter]REGISTRYc           	     F   > [         [        U ]  U R                  UUUUUS9  g N)r!   )superr]   r2   r   r&   r   r   r   r#   r!   	__class__s         r)   r2   HTMLFormatter.__init__   s/     	mT+II%!) 	, 	
r,   r[   NrQ   NFr5   
r   r   r   r   r   rO   r#   r"   r!   rR   
rS   rT   rU   rV   rW   r_   rX   r2   rZ   __classcell__rd   s   @r)   r]   r]      s^    '35H05 FJ),48.3!"
B
 $'
  2	

 (,
 
 
r,   r]   c                  `   ^  \ rS rSr% Sr0 rS\S'        S         SU 4S jjjrSrU =r	$ )	XMLFormatter   zA generic Formatter for XML.z!Dict[Optional[str], XMLFormatter]r_   c           	     F   > [         [        U ]  U R                  UUUUUS9  g ra   )rb   rl   r2   r   rc   s         r)   r2   XMLFormatter.__init__   s/     	lD*HH%!) 	+ 	
r,   r[   rf   rg   rh   rj   s   @r)   rl   rl      s^    &24H/4 FJ),48.3!"
B
 $'
  2	

 (,
 
 
r,   rl   )r   r   rB   T)r   r   r#   html5z
html5-4.12minimalNr   _EntitySubstitutionFunction)
__future__r   typingr   r   r   r   r   r	   r
   r   typing_extensionsr   
bs4.dammitr   bs4._typingr   r   r]   rl   substitute_htmlr_   substitute_html5substitute_xmlr   rr   rX   _FormatterOrNamer[   r,   r)   <module>r|      sf   " W W W ' )+t
" t
n
I 
.
9 
0 "/*::"  v  #0*;; "&#  w 
 (5*:: "&(  | $
 %2*99%  y !  -F  t  ,*::!  f  $0*99$  i   +tD  d  *23%*)= Y = C( r,   