;ò Œ Ac@s~dfd„ƒYZeZydkZeZWndkZnXdeifd„ƒYZep edjoei ƒndS(sTagcBs‘tZdZdZdZdZdZgZdZgZ dZ dddZ e de dd „Z d „Zd „Zd „Zdd „Zd„ZRS(s This class represents a HTML Tag. It have a name (name), attributes (attrs) and children, which are other Tag elements. s4Gustavo Sverzut Barbieri s$Revision: 1.1 $isis border="3" cellpadding="5" s cellspacing="2" style="s(border: #ff0000 2px dashed; margin: 5px"cCs?||_||_|pg|_|pg|_||_dS(sñ name: the name of this tag. attrs: the attributes of this tag. It's a list of tuples ( 'name', 'value' ) cdata: the contents data of this tag. children: the children of this tag (other Tag()s). verbose: set this to 1, then when printing the tag , it will add some color to it's border, so you can understand the document layout (some are a hell of table inside other tables!) N(snamesselfscdatasattrsschildrensverbose(sselfsnamesattrsscdataschildrensverbose((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pys__init__3s   cCs9x.|iD]#}|d|jo |dSq q WtSdS(sT Return the attribute value or None, if the attribute isn't present iiN(sselfsattrssattrsnamesNone(sselfsnamesattr((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pys getAttributeGs  cCsc|i|ƒ}|tjo|ii||fƒn|tjo|i||fg7_ndS(s± Change the attribute value or add it to the attribute list if it was not present. If value==None, then the attribute will be removed from list. N(sselfs getAttributesnamesvsNonesattrssremovesvalue(sselfsnamesvaluesv((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pys setAttributeRs   cCs|i|tƒdS(s@ Remove, if exists, the attribute called 'name' N(sselfs setAttributesnamesNone(sselfsname((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pys delAttributeascCsKd||if}|ioH|d7}x-|iD]"}|d|d|df7}q1W|d }n|io%|idjo||i7}q”n|d7}|io&|d |d|i |if7}n|d|i 7}xB|i D]7}|i}|i|_||i |ƒ7}||_qéW|d ||i |if7}|Sd S( s› String representation of this Tag. It will recurse into children, so calling it on the root tag will give you the whole document. u%s<%ss s%s="%s" iiiÿÿÿÿstables> s%s%s s%s N(sindentsselfsnamesssattrssasverboses table_decorscdatastabstopschildrenscsvs__str__(sselfsindentsascsssv((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pys__str__hs.       &    cCs*d|i|i|it|iƒfSdS(Ns5(sselfsnamesattrsscdataslenschildren(sself((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pys__repr__s(s__name__s __module__s__doc__s __author__s __revision__sverbosesnamesattrsscdataschildrenstabstops table_decorsNones__init__s getAttributes setAttributes delAttributes__str__s__repr__(((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pysTags    'Ns Tag_UnitTestcBs#tZd„Zd„Zd„ZRS(NcCs’tdddfddfgdƒ|_ddti|_td d td d d ƒgƒ|_ddtidtiddtif|_dS(Nsashrefs link.htmlstitleslinksa links0 %sa link s sdivschildrensbscdatas bold texts&
%s %sbold text %s
i(sTagsselfsi1stabstopso1si2so2(sself((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pyssetUpŸs'$cCs-t|iƒ}||ijp t|‚dS(N(sstrsselfsi1svso1sAssertionError(sselfsv((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pystest01©scCs-t|iƒ}||ijp t|‚dS(N(sstrsselfsi2svso2sAssertionError(sselfsv((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pystest02ªs(s__name__s __module__ssetUpstest01stest02(((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pys Tag_UnitTestžs s__main__( sTagsFalsesusing_unittest2s unittest2sunittestsTruesTestCases Tag_UnitTests__name__smain(susing_unittest2sunittestsTags Tag_UnitTest((sH/mnt/gmirror/ports/textproc/py-tvgrab/work/pytvgrab-lib-0.5.1/lib/tag.pys?sy