ReWVdZddlmZmZmZddlmZddlmZddgZ iZ d d Z d Z d Z dS) aA collection of modules for iterating through different kinds of tree, generating tokens identical to those produced by the tokenizer module. To create a tree walker for a new type of tree, you need to implement a tree walker object (called TreeWalker by convention) that implements a 'serialize' method which takes a tree as sole argument and returns an iterator which generates tokens. )absolute_importdivisionunicode_literals) constants) default_etree getTreeWalkerpprintNc h|}|tvr||dkrddlm}|jt|<n`|dkrddlm}|jt|<nD|dkrddlm}|jt|<n(|dkr"dd lm}|t}|j |fi|jSt |S) a;Get a TreeWalker class for various types of tree with built-in support :arg str treeType: the name of the tree type required (case-insensitive). Supported values are: * "dom": The xml.dom.minidom DOM implementation * "etree": A generic walker for tree implementations exposing an elementtree-like interface (known to work with ElementTree, cElementTree and lxml.etree). * "lxml": Optimized walker for lxml.etree * "genshi": a Genshi stream :arg implementation: A module implementing the tree type e.g. xml.etree.ElementTree or cElementTree (Currently applies to the "etree" tree type only). :arg kwargs: keyword arguments passed to the etree walker--for other walkers, this has no effect :returns: a TreeWalker class dom)r genshi)rlxml) etree_lxmletree)r) lowertreeWalkerCacher TreeWalkerrrrrgetETreeModuleget)treeTypeimplementationkwargsr rrrs /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/html5lib/treewalkers/__init__.pyr r s0~~H&& u        (+OH % %  ! ! (.(9OH % %    $ $ $ $ $ $(2(=OH % %       %!.'5'AA&AAL L   x ( ((c#Kg}|D]L}|d}|dvr||d*|rdd|dVg}|VM|rdd|dVdSdS)Ntype) CharactersSpaceCharactersdatarr)rr!)appendjoin)tokenspendingCharacterstokenrs rconcatenateCharacterTokensr'AsV} 4 4 4  $ $U6] 3 3 3 3  '+RWW=N5O5OPPPPP$&!KKKKI#RWW5F-G-GHHHHHHHIIrc dg}d}t|D]}|d}|dvr |dr_|dtjdkrC|dtjvrtj|d}n|d}|d|d}n|d}|d|zd|d |d z }|d }t |D]W\\}} } |r+|tjvrtj|}n|}|d| }n| }|d|z|d | d X|dkr|d z}0|dkr|d z}=|dkr&|d|zd|d di|dkr|dr|drB|d|zd|dd|dd|dr|dndd|dr/|d|zd|dd|dd|d|zd|dd |d|zd;|dkr&|d|zd |d d g|dkr Jd td!|zd"|S)#zPretty printer for tree walkers Takes a TreeWalker instance and pretty prints the output of walking the tree. :arg walker: a TreeWalker instance rr)StartTagEmptyTag namespacehtml name<>rr!z=""r*EndTagCommentzDoctypepublicIdz z "" "z rr FzBconcatenateCharacterTokens should have got rid of all Space tokenszUnknown token type, %s ) r'r namespacesprefixesr"sorteditems ValueErrorr#) walkeroutputindentr&rnsr.attrsr+ localnamevalues rr r PsF F+F33>>>>V} + + +[! %eK&8I?BB{+B"$""eFmm4V} MMcFlllDDD9 : : : aKF&ME17 1F1F K K-&I% I$666&/ :&&(bb))4DD$D sV||TTT555IJJJJz!!!  X   aKFF Y   MMS6\\\5===I J J J J Y  V} A$ GMM#&<<<#(===#(#4#4#48=j8I#Q5#4#4r#Q#Q #STTTT :&GMM#&<<<#(===#(#4#4#4#67777 MMsV|||7rIsCBBBBBBBBB"""""" H %))))))))X I I IJJJJJr