xkd dZddlZddlZddlZddlZejdZGddZGddZe dkrd Z ee Z e e dSdS) z;deb822 parser with support for comment headers and footers.NTc peZdZdZdefdZdedefdZdeddfdZded eddfd Zde fd Z e j dede j efd Ze j ded ede jeeffdZ dded e j ede je j eeffdZededefdZdefdZdS)SectionzcA single deb822 section, possibly with comments. This represents a single deb822 section. sectionc4ddg}d}d}|dD]?}|dr|dd}||xx|dzz cc<5d}||dzz }@tjt j||_|\|_|_dS)NF #T) split startswith collections OrderedDictapt_pkg TagSectiontagsheaderfooter)selfrcomments in_sectiontrimmed_sectionlines 4/usr/lib/python3/dist-packages/aptsources/_deb822.py__init__zSection.__init__s8 MM$'' + +Ds## ABBx$$$t 3$$$J td{ *OO+G,>,O,OPP #+  T[[[keyreturnc|j|S)zGet the value of a field.rrrs r __getitem__zSection.__getitem__,sy~rNc|j|=dS)zDelete a fieldNr r!s r __delitem__zSection.__delitem__0s IcNNNrvalc||j|<dS)zSet the value of a field.Nr )rrr%s r __setitem__zSection.__setitem__4s #rc*t|jSN)boolrrs r__bool__zSection.__bool__8sDIrcdSr)r!s rgetz Section.get; rdefaultcdSr)r.rrr1s rr/z Section.get?r0rcB |j|S#t$r|cYSwxYwr))rKeyErrorr3s rr/z Section.getCs7 9S> !   NNN s  contentcr|r4dd|DdzndS)Nr c3 K|] }d|zV dS)r Nr.).0rs r z*Section.__comment_lines..Ns&BBTcDjBBBBBBrr)join splitlines)r6s r__comment_lineszSection.__comment_linesKsE DIIBBW-?-?-A-ABBB B BT I I rc||jdd|jDz||jzS)z+Canonical string rendering of this section.rc3,K|]\}}|d|dVdS)z: r Nr.)r9kvs rr:z"Section.__str__..Ws2BB1mmammmBBBBBBr)_Section__comment_linesrr;ritemsrr+s r__str__zSection.__str__Ssd   - -ggBB 0A0ABBBBB C""4;// 0 rr))__name__ __module__ __qualname____doc__strrr"r$r'r*r,typingoverloadOptionalr/rUnion staticmethodrBrDr.rrrrs ,,,,,$sssts$ _ s vs3   _  _ s Q 6<3+?   _ 7;!'!3 foa(#- .     \        rrcVeZdZdZdejfdZdeje fdZ de fdZ dS)FilezC Parse a given file object into a list of Section objects. fobjcv|d}d|D|_dS)N c,g|]}t|Sr.)rr9ss r z!File.__init__..cs666666r)readr sections)rrQrYs rrz File.__init__as699;;$$V,,66X666 rrc*t|jSr))iterrYr+s r__iter__z File.__iter__esDM"""rcJdd|jDS)NrSc34K|]}t|VdSr))rIrUs rr:zFile.__str__..is(99a3q66999999r)r;rYr+s rrDz File.__str__hs%{{994=999999rN) rErFrGrHio TextIOBaserrJIteratorrr\rIrDr.rrrPrP\sx7R]7777#&/'2####:::::::rrP__main__zV# Header # More header K1: V1 # Inline K2: V2 # not a comment # Footer # More footer ) rHr_rrJrTypeVarrrrPrEstrVprintr.rrrfsBA  FN3E E E E E E E E P : : : : : : : :  z B  A E!HHHHHr