m
CmJc           @   s	  d  Z  d Z d Z d Z d d d d d g Z d	 Z d
 e Z d Z d g Z d	 Z	 d d g Z
 d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z y d k l Z Wn d k l Z n Xy d k Z Wn e Z n Xy d k Z Wn e Z n Xy0 d k Z e i i e  d k  l! Z" d Z# Wn d	 Z# d   Z" n Xy d k$ Z$ d k% Z% Wn e Z$ Z% n Xy d k& Z' Wn n Xy d k( Z( Wn n Xy- d k) Z) e o d k* Z) d e) i+ _ n Wn e Z) n Xd e, f d     YZ- d e- f d     YZ. d e- f d     YZ/ d e- f d     YZ0 d e, f d     YZ1 e i2 d  e _3 e i2 d  e _4 e i2 d   e _5 h  d! d" <d# d$ <d% d& <d' d( <d) d* <d+ d, <d- d. <d/ d0 <d1 d2 <d3 d4 <d5 d6 <d7 d8 <d9 d: <d; d< <d= d> <d? d@ <dA dB <Z6 y
 e7 Z8 Wn) e9 j
 o dC k8 l8 Z8 dD   Z7 n XdE e8 f dF     Ya: dG   Z; e a< dH   Z= e i2 dI  Z> dJ   Z? dK f  dL     YZ@ e# o& dM e@ e i iA iB f dN     YZC n dO e iD f dP     YZE dQ e@ eE f dR     YZF dS eE f dT     YZG dU   ZH dV eE f dW     YZI dX   ZJ dY e iK e iL e iM f dZ     YZN d[   ZO g  ZP d\   ZQ d] d^ d_ d` da db dc dd de df dg dh di d! g ZR g  ZS eR D]a ZT eS eT iU db dj  iU dk dl  iU dm dn  iU do dp  iU dq dr  iU di ds  dt du dv q[S ZV [T g  ZS eV D] ZW eS e i2 eW  iX q`[S ZY [W dw   ZZ eQ eZ  dx Z[ dy Z\ dz Z] d{ Z^ d| Z_ e i2 d} e[ e\ e] f  Z` e i2 d~ e^ e_ f  Za d   Zb eQ eb  d   Zc eQ ec  e i2 d  Zd d   Ze eQ ee  h  d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <Zf h  d d <d d <d d <d d <d d <d d <d d <Zg e i2 d  Zh d   Zi eQ ei  h  d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <Zj e i2 d  Zk d   Zl eQ el  d   Zm eQ em  d   Zn h  d d <d d <d d <d d <d d <Zo e ip iq eo  eQ en  d   Zr d   Zs d   Zt d   Zu e e e e g  d  Zv ew d j ox e ix d o e  GHe iy d	  n e ix d Zz e;   d k{ l{ Z{ x+ ez D]# Z| e| GHHev e|  Z} e{ e}  HqWn d S(   sU  Universal feed parser

Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds

Visit http://feedparser.org/ for the latest version
Visit http://feedparser.org/docs/ for the latest documentation

Required: Python 2.1 or later
Recommended: Python 2.3 or later
Recommended: CJKCodecs and iconv_codec <http://cjkpython.i18n.org/>
s   4.1s  Copyright (c) 2002-2006, Mark Pilgrim, All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.s'   Mark Pilgrim <http://diveintomark.org/>s%   Jason Diamond <http://injektilo.org/>s'   John Beimler <http://john.beimler.org/>s1   Fazal Majid <http://www.majid.info/mylos/weblog/>s"   Aaron Swartz <http://aaronsw.com/>s(   Kevin Marks <http://epeus.blogspot.com/>i    s.   UniversalFeedParser/%s +http://feedparser.org/s   application/atom+xml,application/rdf+xml,application/rss+xml,application/x-netcdf,application/xml;q=0.9,text/xml;q=0.2,*/*;q=0.1t   drv_libxml2t   uTidyt   mxTidyN(   s   StringIO(   s   escapei   c         C   s:   |  i d d  }  |  i d d  }  |  i d d  }  |  S(   Nt   &s   &amp;t   >s   &gt;t   <s   &lt;(   t   datat   replace(   R   (    (    tM   /afs/cs.wisc.edu/u/s/b/sblanas/public/html/personal/news2mobile/feedparser.pyt
   _xmlescapeb   s    t   ThingsNobodyCaresAboutButMec           B   s   t  Z RS(   N(   t   __name__t
   __module__(    (    (    R   R
      s    t   CharacterEncodingOverridec           B   s   t  Z RS(   N(   R   R   (    (    (    R   R      s    t   CharacterEncodingUnknownc           B   s   t  Z RS(   N(   R   R   (    (    (    R   R      s    t   NonXMLContentTypec           B   s   t  Z RS(   N(   R   R   (    (    (    R   R      s    t   UndeclaredNamespacec           B   s   t  Z RS(   N(   R   R   (    (    (    R   R      s    s   [a-zA-Z][-_.:a-zA-Z0-9]*s   <!s   &#(x?[0-9A-Fa-f]+)[^0-9A-Fa-f]t    t   unknownt   rss090s   RSS 0.90t   rss091ns   RSS 0.91 (Netscape)t   rss091us   RSS 0.91 (Userland)t   rss092s   RSS 0.92t   rss093s   RSS 0.93t   rss094s   RSS 0.94t   rss20s   RSS 2.0t   rss10s   RSS 1.0t   rsss   RSS (unknown version)t   atom01s   Atom 0.1t   atom02s   Atom 0.2t   atom03s   Atom 0.3t   atom10s   Atom 1.0t   atoms   Atom (unknown version)t   cdft   CDFt   hotrsss   Hot RSS(   s   UserDictc         C   s+   h  } x |  D] \ } } | | | <q W| S(   N(   t   rct   aListt   kt   v(   R%   R&   R'   R$   (    (    R   t   dict   s
     t   FeedParserDictc           B   s   t  Z h  d d <d d <d d <d d <d	 d
 <d d d g <d d g <d d <d d
 <d d <d d <d d <d d <d d <d d <Z d   Z d   Z d  d  Z d    Z d!   Z d"   Z	 d#   Z
 d$   Z RS(%   Nt   channelt   feedt   itemst   entriest   guidt   idt   datet   updatedt   date_parsedt   updated_parsedt   descriptiont   subtitlet   summaryt   urlt   hreft   modifiedt   modified_parsedt   issuedt	   publishedt   issued_parsedt   published_parsedt	   copyrightt   rightst   copyright_detailt   rights_detailt   taglinet   tagline_detailt   subtitle_detailc         C   s  | d j o t i |  d  d d Sn | d j o= g  } t i |  d  D] } | | d | d f qM ~ Sn |  i i | |  } t	 |  t
 i j o< x9 | D]- } t i |  |  o t i |  |  Sq q Wn t i |  |  o t i |  |  Sn t i |  |  S(   Nt   categoryt   tagsi    t   termt
   categoriest   scheme(   t   keyt   UserDictt   __getitem__t   selft   _[1]t   tagt   keymapt   gett   realkeyt   typet   typest   ListTypeR&   t   has_key(   RN   RK   RS   RO   RP   R&   (    (    R   RM      s    = c         C   so   xY |  i i   D]H } | | j o5 |  i | } t |  t i j o | d } qX q q Wt i	 |  | |  S(   Ni    (   RN   RQ   t   keysR&   RK   RT   RU   RV   RL   t   __setitem__t   value(   RN   RK   RZ   R&   (    (    R   RY      s     c         C   s$   |  i |  o |  | Sn | Sd  S(   N(   RN   RW   RK   t   default(   RN   RK   R[   (    (    R   RR      s    c         C   s&   |  i |  p | |  | <n |  | S(   N(   RN   RW   RK   RZ   (   RN   RK   RZ   (    (    R   t
   setdefault   s    c         C   sB   y$ t  |  |  p t i |  |  SWn t j
 o t Sn Xd  S(   N(   t   hasattrRN   RK   RL   RW   t   AttributeErrort   False(   RN   RK   (    (    R   RW      s    $c         C   si   y |  i | SWn t j
 o n Xy) | i d  p t  |  i |  SWn t d |  n Xd  S(   Nt   _s   object has no attribute '%s'(   RN   t   __dict__RK   t   KeyErrort
   startswitht   AssertionErrorRM   R^   (   RN   RK   (    (    R   t   __getattr__   s    c         C   sB   | i d  p | d j o | |  i | <n |  i | |  Sd  S(   NR`   R   (   RK   Rc   RZ   RN   Ra   RY   (   RN   RK   RZ   (    (    R   t   __setattr__   s    c         C   s   |  i |  S(   N(   RN   RW   RK   (   RN   RK   (    (    R   t   __contains__   s    (   R   R   RQ   RM   RY   t   NoneRR   R\   RW   Re   Rf   Rg   (    (    (    R   R)      s   						c           C   s   b  d  d  a  d  S(   Nc         C   s"   h  } |  o | i |   n | S(   N(   R$   t   aDictt   update(   Ri   R$   (    (    R   R)      s    (   R)   Rh   (    (    (    R   t   zopeCompatibilityHack   s     c         C   sh  t  oOd d d d d d d d d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF dG dH dI dJ dK dL dM dN dO dP dQ dR dS dT dU dV dW dX dY dZ d[ d\ d] d^ d_ d` da db dc dd de df dg dh di dj dk dl dm dn do dp dq dr ds dt du dv dw dx dy dz d{ d| d} d~ d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d f } d  k } | i di t t t d   di t t |    a  n |  i	 t   Sd  S(  Ni    i   i   i   i   i	   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i
   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i    i   i   i   i   i   i   i   i   i   i[   i.   i<   i(   i+   i!   i&   i   i   i   i   i   i   i   i   i   i]   i$   i*   i)   i;   i^   i-   i/   i   i   i   i   i   i   i   i   i|   i,   i%   i_   i>   i?   i   i   i   i   i   i   i   i   i   i`   i:   i#   i@   i'   i=   i"   i   ia   ib   ic   id   ie   if   ig   ih   ii   i   i   i   i   i   i   i   ij   ik   il   im   in   io   ip   iq   ir   i   i   i   i   i   i   i   i~   is   it   iu   iv   iw   ix   iy   iz   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i   i{   iA   iB   iC   iD   iE   iF   iG   iH   iI   i   i   i   i   i   i   i}   iJ   iK   iL   iM   iN   iO   iP   iQ   iR   i   i   i   i   i   i   i\   i   iS   iT   iU   iV   iW   iX   iY   iZ   i   i   i   i   i   i   i0   i1   i2   i3   i4   i5   i6   i7   i8   i9   i   i   i   i   i   i   R   i   (
   t   _ebcdic_to_ascii_mapt   emapt   stringt	   maketranst   joint   mapt   chrt   ranget   st	   translate(   Rt   Rm   Rn   (    (    R   t   _ebcdic_to_ascii  s        		@s&   ^([A-Za-z][A-Za-z0-9+-.]*://)(/*)(.*?)c         C   s"   t  i d |  } t i |  |  S(   Ns   \1\3(   t	   _urifixert   subt   urit   urlparset   urljoint   base(   R|   Ry   (    (    R   t   _urljoin  s    t   _FeedParserMixinc           B   sE  t  Z h  d d <d d <d d <d d <d d <d d <d d <d d <d	 d <d
 d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d  d! <d" d# <d$ d% <d& d' <d( d) <d* d+ <d, d- <d. d/ <d0 d1 <d2 d3 <d4 d5 <d6 d7 <d8 d7 <d9 d: <d; d< <d= d> <d? d@ <dA dB <dC dD <dE dF <dG dH <dI dJ <dK dL <dM dN <dO dP <dQ dR <dS dT <dU dV <dW dX <dY dZ <d[ d\ <d] d^ <d_ d` <da db <dc dd <de df <dg dh <Z h  Z di dj dk dl dm dn do dp dq dr ds g Z d dt du dv dw dx dy dz d{ g	 Z d dt du dv dw dx dy dz d{ g	 Z d| d} g Z e e d~ d  Z	 d   Z
 d   Z d   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" e" Z# d   Z$ d   Z% d   Z& e& Z' d   Z( d   Z) d   Z* e* Z+ d   Z, e, Z- d   Z. e. Z/ e. Z0 e. Z1 e. Z2 d   Z3 e3 Z4 e3 Z5 e3 Z6 e3 Z7 d   Z8 d   Z9 d   Z: d   Z; d   Z< d   Z= d   Z> e> Z? d   Z@ e@ ZA d   ZB d   ZC d   ZD d   ZE d   ZF eF ZG eF ZH d   ZI eI ZJ eI ZK d   ZL eL ZM d   ZN eN ZO d   ZP d d  ZQ d   ZR d d  ZS d   ZT eT ZU eT ZV d   ZW eW ZX eW ZY d   ZZ eZ Z[ eZ Z\ d   Z] e] Z^ e] Z_ d   Z` e` Za e` Zb d   Zc ec Zd d   Ze ee Zf d   Zg eg Zh d   Zi ei Zj d   Zk ek Zl d   Zm em Zn em Zo d   Zp ep Zq ep Zr d   Zs es Zt es Zu es Zv es Zw d   Zx ex Zy ex Zz ex Z{ ex Z| d   Z} e} Z~ d   Z e Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e Z e Z d   Z d   Z d   Z e Z e Z e Z d   Z d   Z e Z d   Z e Z d   Z d   Z d   Z e Z e Z d   Z e Z e Z d   Z d   Z d   Z e Z d   Z e Z d   Z e Z d   Z d   Z d   Z d   Z d   Z e Z d   Z e Z d   Z d   Z d   Z d   Z d   Z d   Z e Z d   Z e Z d   Z e Z e Z e Z e Z e Z d   Z e Z d   Z d   Z RS(   NR   s   http://backend.userland.com/rsss%   http://blogs.law.harvard.edu/tech/rsss   http://purl.org/rss/1.0/s&   http://my.netscape.com/rdf/simple/0.9/s   http://example.com/newformat#s   http://example.com/nechos   http://purl.org/echo/s   uri/of/echo/namespace#s   http://purl.org/pie/s   http://purl.org/atom/ns#s   http://www.w3.org/2005/Atoms'   http://purl.org/rss/1.0/modules/rss091#s   http://webns.net/mvcb/t   admins,   http://purl.org/rss/1.0/modules/aggregation/t   ags)   http://purl.org/rss/1.0/modules/annotate/t   annotates!   http://media.tangent.org/rss/1.0/t   audios-   http://backend.userland.com/blogChannelModulet   blogChannels   http://web.resource.org/cc/t   ccs4   http://backend.userland.com/creativeCommonsRssModulet   creativeCommonss'   http://purl.org/rss/1.0/modules/companyt   cos(   http://purl.org/rss/1.0/modules/content/t   contents&   http://my.theinfo.org/changed/1.0/rss/t   cps    http://purl.org/dc/elements/1.1/t   dcs   http://purl.org/dc/terms/t   dctermss&   http://purl.org/rss/1.0/modules/email/t   emails&   http://purl.org/rss/1.0/modules/event/t   evs*   http://rssnamespace.org/feedburner/ext/1.0t
   feedburners   http://freshmeat.net/rss/fm/t   fms   http://xmlns.com/foaf/0.1/t   foafs(   http://www.w3.org/2003/01/geo/wgs84_pos#t   geos   http://postneo.com/icbm/t   icbms&   http://purl.org/rss/1.0/modules/image/t   images*   http://www.itunes.com/DTDs/PodCast-1.0.dtdt   ituness'   http://example.com/DTDs/PodCast-1.0.dtds%   http://purl.org/rss/1.0/modules/link/t   ls   http://search.yahoo.com/mrsst   medias4   http://madskills.com/public/xml/rss/module/pingback/t   pingbacks.   http://prismstandard.org/namespaces/1.2/basic/t   prisms+   http://www.w3.org/1999/02/22-rdf-syntax-ns#t   rdfs%   http://www.w3.org/2000/01/rdf-schema#t   rdfss*   http://purl.org/rss/1.0/modules/reference/t   refs*   http://purl.org/rss/1.0/modules/richequiv/t   reqvs'   http://purl.org/rss/1.0/modules/search/t   searchs&   http://purl.org/rss/1.0/modules/slash/t   slashs)   http://schemas.xmlsoap.org/soap/envelope/t   soaps.   http://purl.org/rss/1.0/modules/servicestatus/t   sss-   http://hacks.benhammersley.com/rss/streaming/t   strs-   http://purl.org/rss/1.0/modules/subscription/Rx   s,   http://purl.org/rss/1.0/modules/syndication/t   sys)   http://purl.org/rss/1.0/modules/taxonomy/t   taxos*   http://purl.org/rss/1.0/modules/threading/t   thrs*   http://purl.org/rss/1.0/modules/textinput/t   tis5   http://madskills.com/public/xml/rss/module/trackback/t	   trackbacks$   http://wellformedweb.org/commentAPI/t   wfws%   http://purl.org/rss/1.0/modules/wiki/t   wikis   http://www.w3.org/1999/xhtmlt   xhtmls$   http://www.w3.org/XML/1998/namespacet   xmls/   http://schemas.pocketsoap.com/rss/myDescModule/t   szft   linkR/   t   wfw_commentt   wfw_commentrsst   docsR7   R8   t   commentst   licenset   icont   logot   titleR6   t   infoRC   R5   R?   R@   R4   s	   text/htmls   application/xhtml+xmls   utf-8c         C   s^  t  o t i i d  n |  i p7 x4 |  i i   D] \ } } | |  i | i
   <q5 Wn t   |  _ | |  _ g  |  _ d |  _ h  |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ t   |  _ t   |  _ d  |  _ h  |  _ g  |  _ g  |  _  g  |  _! | p d |  _" | p d  |  _$ | o | |  i d <n d  S(   Ns   initializing FeedParser
R   i    t   language(%   t   _debugt   syst   stderrt   writeRN   t   _matchnamespacest
   namespacesR,   R&   R'   t   lowerR)   t   feeddatat   encodingR-   t   versiont   namespacesInUset   infeedt   inentryt	   incontentt   intextinputt   inimaget   inauthort   incontributort   inpublishert   insourcet
   sourcedatat   contentparamsRh   t   _summaryKeyt   namespacemapt   elementstackt	   basestackt	   langstackt   baseurit   baselangt   lang(   RN   R   R   R   R'   R&   (    (    R   t   __init__e  s>     
 																		c      	   C   s  t  o t i i d | | f  n g  } | D] \ }	 } | |	 i	   | f q0 ~ } g  } | D]3 \ }	 } | |	 |	 d# j o | i	   p | f qc ~ } t
 |  } | i d | i d   p |  i } t |  i |  |  _ | i d | i d   } | d j o
 d  } n | d  j o |  i } n | o" | d$ j o | |  i d <qZn | |  _ |  i i |  i  |  i i |  x] | D]U \ } }
 | i d  o |  i | d |
  q| d j o |  i d  |
  qqW|  i oD |  i i d  o1 |  i i d d  i d  o d |  i d <n |  i ou |  i i d  d j o\ | i d  d } |  i d | d i  g  } | D] } | d | q~  f d d Sn | i" d  d j o | i d d  \ } } n d | } } |  i$ i | |  } | o | d } n | o | d% j o d |  _% n | o | d& j o d |  _& n d" | | } y t( |  |  } | |  SWn' t* j
 o |  i+ | | d  Sn Xd  S('   Ns   start %s with %s
t   relRT   s   xml:baseR|   s   xml:langR   R   R+   R   s   rdf:RDFR   s   xmlns:i   t   xmlnsR   s   application/xhtml+xmlt   :is   <%s%s>s    %s="%s"t   escapei    i   R`   R   R   R4   t   nameR7   R8   t   widtht   heightt   _start_(   R   s   type(   s   feeds   rsss   rdf:RDF(   s   titles   links   descriptions   name(   s   titles   links   descriptions   urls   hrefR   R   (,   R   R   R   R   RP   t   attrsRO   R&   R'   R   R(   t   attrsDRR   RN   R   R}   R   Rh   R   R   t   appendR   t   prefixRy   Rc   t   trackNamespaceR   R   RW   t   endswitht   splitt   handle_dataRp   t   tt   findt   suffixR   R   R   t
   methodnamet   getattrt   methodR^   t   push(   RN   RP   R   R   R   R   R   R   R   R&   Ry   RO   R   R   R'   (    (    R   t   unknown_starttag  sZ     3G%
	 =#	Ic         C   s  t  o t i i d |  n | i d  d j o | i d d  \ } } n d | } } |  i
 i | |  } | o | d } n d | | } y t |  |  } |   Wn$ t j
 o |  i | |  n X|  i oD |  i i d  o1 |  i i d d	  i d	  o d
 |  i d <n |  i oG |  i i d  d
 j o. | i d  d } |  i d | d d n |  i o= |  i i   |  i o" |  i d o |  i d |  _ qn |  i o/ |  i i   |  i o |  i d |  _ qn d  S(   Ns   end %s
R   ii   R   R`   t   _end_RT   R   s   application/xhtml+xmls   </%s>R   i    (   R   R   R   R   RP   R   R   R   R   RN   R   RR   R   R   R   R^   t   popR   R   RW   R   R   R   R   R   R   (   RN   RP   R   R   R   R   (    (    R   t   unknown_endtag  s6     =#


c         C   s   |  i p d  Sn | i   } | d j o d | } nJ | d d j o t | d d  } n t |  } t |  i d  } |  i d d i	 |  d  S(   Nt   34t   38t   39t   60t   62t   x22t   x26t   x27t   x3ct   x3es   &#%s;i    t   xi   i   s   utf-8ii   (
   R   R   R   R   R   R   R   R   R   R   (
   RN   R   R   R   t   textt   intt   ct   unichrt   encodeR   (   RN   R   R   R   (    (    R   t   handle_charref  s    
 c         C   s   |  i p d  Sn t o t i i d |  n | d j o d | } nS d   } y | |  Wn t	 j
 o d | } n Xt
 | |   i d	  } |  i d
 d i |  d  S(   Ns"   entering handle_entityref with %s
t   ltt   gtt   quott   ampt   aposs   &%s;c         C   st   d  k  } t | d  o | i |  Sn | i |  }  |  i d  o% |  i d  o t |  d d ! Sn t |   S(   Nt   name2codepoints   &#t   ;i   i(	   t   htmlentitydefsR]   R  R&   t
   entitydefsRc   R   R   t   ord(   R&   R  (    (    R   t   name2cp  s    	 s   utf-8ii   (   R  R  R  R  R  (   RN   R   R   R   R   R   R   R   R  Rb   R   R   R   (   RN   R   R  R   (    (    R   t   handle_entityref   s    
  	  i   c         C   s^   |  i p d  Sn | o) |  i i d  d j o t |  } n |  i d d i |  d  S(   NRT   s   application/xhtml+xmlii   (   RN   R   R   R   RR   R	   R   R   (   RN   R   R   (    (    R   R     s
    
  c         C   s   d  S(   N(    (   RN   R   (    (    R   t   handle_comment  s    c         C   s   d  S(   N(    (   RN   R   (    (    R   t	   handle_pi!  s    c         C   s   d  S(   N(    (   RN   R   (    (    R   t   handle_decl%  s    c         C   s   t  o t i i d  n |  i | | d !d j oe |  i i d |  } | d j o t	 |  i  } n |  i
 t |  i | d | ! d  | d Sn |  i i d |  } | d	 Sd  S(
   Ns   entering parse_declaration
i	   s	   <![CDATA[s   ]]>ii    i   R   i   (   R   R   R   R   RN   t   rawdatat   iR   R&   t   lenR   R	   (   RN   R  R&   (    (    R   t   parse_declaration(  s      $c         C   sU   | i   } | d j o
 d } n/ | d j o
 d } n | d j o
 d } n | S(   NR   s
   text/plaint   htmls	   text/htmlR   s   application/xhtml+xml(   t   contentTypeR   (   RN   R  (    (    R   t   mapContentType4  s    


c         C   s   | i   } | | f d j o |  i o d |  _ n | d j o |  i o d |  _ n | d j o |  i o d |  _ n | i d  d j o d	 } | } n |  i i	 |  o, |  i | |  i
 | <| |  i |  i | <n | |  i | p d
 <d  S(   Ns&   http://my.netscape.com/rdf/simple/0.9/R   s   http://purl.org/rss/1.0/R   s   http://www.w3.org/2005/atomR   s   backend.userland.com/rssis   http://backend.userland.com/rssR   (   Ns&   http://my.netscape.com/rdf/simple/0.9/(   Ry   R   t   loweruriR   Rh   RN   R   R   R   RW   R   R   (   RN   R   Ry   R  (    (    R   R   >  s    
c         C   s   t  |  i p d |  S(   NR   (   R}   RN   R   Ry   (   RN   Ry   (    (    R   t
   resolveURIP  s    c         C   s   | S(   N(   R   (   RN   t   elementR   (    (    R   t   decodeEntitiesS  s    c         C   s   |  i i | | g  g  d  S(   N(   RN   R   R   R  t   expectingText(   RN   R  R  (    (    R   R   V  s    c         C   sa  |  i p d  Sn |  i d d | j o d  Sn |  i i   \ } } } d i |  } | o | i	   } n | p | Sn t
 o[ |  i i d d  oE y t
 i |  } Wq t i j
 o q t i j
 o q Xn | |  i j o | o |  i |  } n |  i i d d  p |  i | |  } n y |  i d =Wn t j
 o n Xy |  i d =Wn t j
 o n X|  i |  i i d d   |  i j o0 | |  i j o t | |  i |  i  } qn |  i |  i i d d   |  i j o* | |  i j o t | |  i  } q)n |  i o= t |  t d  j o$ y t | |  i  } WqpqpXn | d	 j o | Sn |  i o|  i  o| d
 j oO |  i! d i" | g   t# i$ |  i  } | | d <|  i! d | i% |  q]| d j o9 | |  i! d | <| o | |  i! d d d d <qq]| d j o
 d } n | |  i! d | <|  i& o5 t# i$ |  i  } | | d <| |  i! d | d <q]n |  i' p
 |  i  o |  i( o |  i) o |  i*   } | d j o
 d } n | | | <| d j o | | d d d <q]|  i& o. t# i$ |  i  } | | d <| | | d <q]n | S(   Nii    R   t   base64t   modeRT   s	   text/htmlu    RF   R   RZ   R   t   linksR8   R4   R6   t   _detailR5   (,   RN   R   R  R   R  t   piecesRp   t   outputt   stripWhitespacet   stripR  R   RR   t   decodestringt   binasciit   Errort
   Incompletet   can_be_relative_uriR  R  Rb   R  t
   html_typest   can_contain_relative_urist   _resolveRelativeURIsR   R   t   can_contain_dangerous_markupt   _sanitizeHTMLRT   t   unicodeR   R   R-   R\   t   copyt   deepcopyR   R   R   R   R   t   _getContextt   context(   RN   R  R"  R   R2  R  R   R!  (    (    R   R   Y  s    
   	( (#
!


*



c         C   s   |  i d 7_ t h  d |  i | i d |   <d |  i <d |  i < |  _	 |  i
 | |  i	  |  i	 d <|  i | |  d  S(   Ni   RT   R   R|   R  (   RN   R   R)   R  R   RR   t   defaultContentTypeR   R   R   t	   _isBase64R   RP   R  (   RN   RP   R   R3  R  (    (    R   t   pushContent  s    Ec         C   s/   |  i |  } |  i d 8_ |  i i   | S(   Ni   (   RN   R   RP   RZ   R   R   t   clear(   RN   RP   RZ   (    (    R   t
   popContent  s    c         C   s_   | i d  } | d j o? | |  } | | d } |  i i | |  } | d | } n | S(   NR   ii   (   R   R   t   colonposR   R   RN   R   RR   (   RN   R   R8  R   R   (    (    R   t   _mapToStandardPrefix  s    
c         C   s   | i |  i |   S(   N(   R   RR   RN   R9  R   (   RN   R   R   (    (    R   t   _getAttribute  s    c         C   s   | i d d  d j o d Sn |  i d i d  o d Sn |  i d i d  o d Sn |  i d i d	  o d Sn d S(
   NR  R   R  i   RT   s   text/i    s   +xmls   /xml(   R   RR   RN   R   Rc   R   (   RN   R   R   (    (    R   R4    s    c         C   s   | i d | i d | i d d     } | oP y | d =Wn t j
 o n Xy | d =Wn t j
 o n X| | d <n | S(   NR7   Ry   R8   (   R   RR   Rh   R8   Rb   (   RN   R   R8   (    (    R   t   _itsAnHrefDamnIt  s    *c         C   s    |  i   } | i | |  d  S(   N(   RN   R1  R2  R\   RK   RZ   (   RN   RK   RZ   R2  (    (    R   t   _save  s    c         C   s   h  d d <d d <d d <d d <} |  i p_ | i d	 d
  } | i |  } | o | |  _ q | i d  o d |  _ q d |  _ n d  S(   Ns   0.91R   s   0.92R   s   0.93R   s   0.94R   R   R   s   2.R   R   (   t
   versionmapRN   R   R   RR   t   attr_versionRc   (   RN   R   R>  R   R=  (    (    R   t
   _start_rss  s    *
c         C   s   d |  _ d  S(   NR#   (   RN   R   (   RN   R   (    (    R   t   _start_dlhottitles  s    c         C   s   d |  _ |  i |  d  S(   Ni   (   RN   R   t   _cdf_commonR   (   RN   R   (    (    R   t   _start_channel  s    	c         C   s   | i d  o0 |  i h   | d |  i d d <|  i   n | i d  o0 |  i h   | d |  i d d <|  i   n d  S(   Nt   lastmodiR8   (   R   RW   RN   t   _start_modifiedR   t   _end_modifiedt   _start_linkt	   _end_link(   RN   R   (    (    R   RA    s    c         C   sw   d |  _ h  d d <d d <d d <} |  i p? | i d  } | i |  } | o | |  _ qs d	 |  _ n d  S(
   Ni   s   0.1R   s   0.2R   s   0.3R   R   R    (   RN   R   R=  R   R   RR   R>  (   RN   R   R>  R   R=  (    (    R   t   _start_feed  s    	!
c         C   s   d |  _ d  S(   Ni    (   RN   R   (   RN   (    (    R   t   _end_channel  s    c         C   s<   d |  _ |  i d d  |  i   } | i d t    d  S(   Ni   R   i    (   RN   R   R   R1  R2  R\   R)   (   RN   R   R2  (    (    R   t   _start_image  s    	c         C   s   |  i d  d |  _ d  S(   NR   i    (   RN   R   R   (   RN   (    (    R   t
   _end_image"  s    c         C   s<   d |  _ |  i d d  |  i   } | i d t    d  S(   Ni   t	   textinputi    (   RN   R   R   R1  R2  R\   R)   (   RN   R   R2  (    (    R   t   _start_textinput&  s    	c         C   s   |  i d  d |  _ d  S(   NRL  i    (   RN   R   R   (   RN   (    (    R   t   _end_textinput-  s    c         C   s   d |  _ |  i d d  d  S(   Ni   t   author(   RN   R   R   (   RN   R   (    (    R   t   _start_author2  s    	c         C   s$   |  i d  d |  _ |  i   d  S(   NRO  i    (   RN   R   R   t   _sync_author_detail(   RN   (    (    R   t   _end_author:  s    	c         C   s   d |  _ |  i d d  d  S(   Ni   t	   publisheri    (   RN   R   R   (   RN   R   (    (    R   t   _start_itunes_ownerC  s    	c         C   s'   |  i d  d |  _ |  i d  d  S(   NRS  i    (   RN   R   R   RQ  (   RN   (    (    R   t   _end_itunes_ownerG  s    	c         C   sM   d |  _ |  i   } | i d g   | d i t    |  i d d  d  S(   Ni   t   contributorst   contributori    (   RN   R   R1  R2  R\   R   R)   R   (   RN   R   R2  (    (    R   t   _start_contributorL  s
    	c         C   s   |  i d  d |  _ d  S(   NRW  i    (   RN   R   R   (   RN   (    (    R   t   _end_contributorS  s    c         C   sM   d |  _ |  i   } | i d g   | d i t    |  i d d  d  S(   Ni   RV  R   i    (   RN   R   R1  R2  R\   R   R)   R   (   RN   R   R2  (    (    R   t   _start_dc_contributorW  s
    	c         C   s   |  i   d |  _ d  S(   Ni    (   RN   t	   _end_nameR   (   RN   (    (    R   t   _end_dc_contributor^  s    
c         C   s   |  i d d  d  S(   NR   i    (   RN   R   (   RN   R   (    (    R   t   _start_nameb  s    c         C   s   |  i d  } |  i o |  i d | d  ne |  i o |  i d |  nG |  i o |  i d |  n) |  i o |  i	   } | | d d <n d  S(   NR   RS  RL  (   RN   R   RZ   R   t   _save_authorR   R   t   _save_contributorR   R1  R2  (   RN   R2  RZ   (    (    R   R[  f  s    



c         C   s   |  i d d  d  S(   NR   i    (   RN   R   (   RN   R   (    (    R   t   _start_widths  s    c         C   s[   |  i d  } y t |  } Wn d } n X|  i o |  i   } | | d d <n d  S(   NR   i    R   (   RN   R   RZ   R   R   R1  R2  (   RN   R2  RZ   (    (    R   t
   _end_widthv  s    

c         C   s   |  i d d  d  S(   NR   i    (   RN   R   (   RN   R   (    (    R   t   _start_height  s    c         C   s[   |  i d  } y t |  } Wn d } n X|  i o |  i   } | | d d <n d  S(   NR   i    R   (   RN   R   RZ   R   R   R1  R2  (   RN   R2  RZ   (    (    R   t   _end_height  s    

c         C   s   |  i d d  d  S(   NR8   i   (   RN   R   (   RN   R   (    (    R   t
   _start_url  s    c         C   s   |  i d  } |  i o |  i d |  no |  i o |  i d |  nQ |  i o |  i   } | | d d <n) |  i
 o |  i   } | | d d <n d  S(   NR8   R   RL  R   (   RN   R   RZ   R   R^  R   R_  R   R1  R2  R   (   RN   R2  RZ   (    (    R   t   _end_url  s    



c         C   s   |  i d d  d  S(   NR   i    (   RN   R   (   RN   R   (    (    R   t   _start_email  s    c         C   sp   |  i d  } |  i o |  i d | d  n= |  i o |  i d |  n |  i o |  i d |  n d  S(   NR   RS  (   RN   R   RZ   R   R^  R   R   R_  (   RN   RZ   (    (    R   t
   _end_email  s    


c         C   s?   |  i o |  i } n% |  i o |  i d } n
 |  i } | S(   Ni(   RN   R   R   R2  R   R-   R   (   RN   R2  (    (    R   R1    s    

	RO  c         C   sC   |  i   } | i | d t    | | | d | <|  i   d  S(   NR  (	   RN   R1  R2  R\   R   R)   RZ   RK   RQ  (   RN   RK   RZ   R   R2  (    (    R   R^    s    c         C   s8   |  i   } | i d t   g  | | d d | <d  S(   NRV  i(   RN   R1  R2  R\   R)   RZ   RK   (   RN   RK   RZ   R2  (    (    R   R_    s    c         C   s  |  i   } | i d |  } | or | i d  } | i d  } | o | o d | | f | | <q| o | | | <q| o | | | <qn| i |  } | p d  Sn t	 i
 d |  } | p d  Sn | i d  } | i | d  } | i d d  } | i   } | o | d d	 j o | d
 } n | o | d d j o | d  } n | i   } | i d | t    | | d | d <| | d | d <d  S(   Ns	   %s_detailR   R   s   %s (%s)sx   (([a-zA-Z0-9\_\-\.\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?))i    R   s   ()t   (i   it   )(   RN   R1  R2  RR   RK   t   detailR   R   RO  t   reR   t
   emailmatcht   groupR   R#  R\   R)   (   RN   RK   R   RO  Rl  Rj  R2  R   (    (    R   RQ    s:      c         C   s   |  i d | d d  d  S(   NR5   s
   text/plaini   (   RN   R5  R   (   RN   R   (    (    R   t   _start_subtitle  s    c         C   s   |  i d  d  S(   NR5   (   RN   R7  (   RN   (    (    R   t   _end_subtitle  s    c         C   s   |  i d | d d  d  S(   NR@   s
   text/plaini   (   RN   R5  R   (   RN   R   (    (    R   t   _start_rights  s    c         C   s   |  i d  d  S(   NR@   (   RN   R7  (   RN   (    (    R   t   _end_rights  s    c         C   sy   |  i i t    |  i d d  d |  _ d |  _ |  i | d  } | o |  i
   } | | d <n |  i |  d  S(   Nt   itemi    i   s	   rdf:aboutR/   (   RN   R-   R   R)   R   R   t
   guidislinkR:  R   R/   R1  R2  RA  (   RN   R   R/   R2  (    (    R   t   _start_item  s    		c         C   s   |  i d  d |  _ d  S(   NRr  i    (   RN   R   R   (   RN   (    (    R   t	   _end_item  s    c         C   s   |  i d d  d  S(   NR   i   (   RN   R   (   RN   R   (    (    R   t   _start_dc_language  s    c         C   s   |  i d  |  _ d  S(   NR   (   RN   R   R   (   RN   (    (    R   t   _end_dc_language  s    c         C   s   |  i d d  d  S(   NRS  i   (   RN   R   (   RN   R   (    (    R   t   _start_dc_publisher  s    c         C   s   |  i d  |  i d  d  S(   NRS  (   RN   R   RQ  (   RN   (    (    R   t   _end_dc_publisher  s    c         C   s   |  i d d  d  S(   NR<   i   (   RN   R   (   RN   R   (    (    R   t   _start_published  s    c         C   s)   |  i d  } |  i d t |   d  S(   NR<   R>   (   RN   R   RZ   R<  t   _parse_date(   RN   RZ   (    (    R   t   _end_published  s    c         C   s   |  i d d  d  S(   NR1   i   (   RN   R   (   RN   R   (    (    R   t   _start_updated$  s    c         C   s/   |  i d  } t |  } |  i d |  d  S(   NR1   R3   (   RN   R   RZ   R{  t   parsed_valueR<  (   RN   R~  RZ   (    (    R   t   _end_updated+  s    c         C   s   |  i d d  d  S(   Nt   createdi   (   RN   R   (   RN   R   (    (    R   t   _start_created4  s    c         C   s)   |  i d  } |  i d t |   d  S(   NR  t   created_parsed(   RN   R   RZ   R<  R{  (   RN   RZ   (    (    R   t   _end_created8  s    c         C   s   |  i d d  d  S(   Nt   expiredi   (   RN   R   (   RN   R   (    (    R   t   _start_expirationdate=  s    c         C   s#   |  i d t |  i d    d  S(   Nt   expired_parsedR  (   RN   R<  R{  R   (   RN   (    (    R   t   _end_expirationdate@  s    c         C   sV   |  i d d  |  i | d  } | o |  i d d i |  n |  i d  d  S(   NR   i   s   rdf:resourceii   (   RN   R   R:  R   RZ   R   R   R   (   RN   R   RZ   (    (    R   t   _start_cc_licenseC  s
    c         C   s   |  i d d  d  S(   NR   i   (   RN   R   (   RN   R   (    (    R   t   _start_creativecommons_licenseJ  s    c         C   s   |  i d  d  S(   NR   (   RN   R   (   RN   (    (    R   t   _end_creativecommons_licenseM  s    c         C   s   |  i   } | i d g   } | o | o | o d  Sn t h  d | <d | <d | < } | | j o2 | i
 t h  d | <d | <d | <  n d  S(   NRG   RH   RJ   t   label(   RN   R1  R2  R\   RG   RH   RJ   R  R)   RZ   R   (   RN   RH   RJ   R  RG   RZ   R2  (    (    R   t   _addTagP  s     'c         C   s   t  o t i i d t |   n | i d  } | i d | i d   } | i d  } |  i | | |  |  i d d  d  S(   Ns!   entering _start_category with %s
RH   RJ   t   domainR  RF   i   (   R   R   R   R   t   reprR   RR   RH   RJ   R  RN   R  R   (   RN   R   RH   R  RJ   (    (    R   t   _start_categoryX  s     c         C   s7   x0 |  i d  i   D] } |  i | d d   q Wd  S(   Nt   itunes_keywordss   http://www.itunes.com/(   RN   R   R   RH   R  Rh   (   RN   RH   (    (    R   t   _end_itunes_keywordsb  s     c         C   s0   |  i | i d  d d   |  i d d  d  S(   NR   s   http://www.itunes.com/RF   i   (   RN   R  R   RR   Rh   R   (   RN   R   (    (    R   t   _start_itunes_categoryf  s    c         C   s   |  i d  } | p d  Sn |  i   } | d } | o/ t |  o" | d d o | | d d <n |  i | d  d   d  S(   NRF   RG   iRH   (	   RN   R   RZ   R1  R2  RG   R  R  Rh   (   RN   RG   RZ   R2  (    (    R   t   _end_categoryj  s     
$c         C   s   t  |  |  i   d <d  S(   Nt   cloud(   R)   R   RN   R1  (   RN   R   (    (    R   t   _start_cloudw  s    c         C   sD  | i d d  | i d d  |  i |  } | i d  o |  i | d  | d <n |  i p |  i p |  i } |  i
   } | i d g   | d i t |   | d d j o |  i |  n | i d  oT d } | i d  d j o4 |  i | i d   |  i j o | d | d	 <q@n |  i d	 |  d  S(
   NR   t	   alternateRT   s	   text/htmlR8   R  t	   enclosurei    R   (   R   R\   RN   R;  RW   R  R   R   R   R  R1  R2  R   R)   t   _start_enclosureRR   R  R)  R   (   RN   R   R2  R  (    (    R   RF  z  s     8c         C   sW   |  i d  } |  i   } |  i o | | d d <n |  i o | | d d <n d  S(   NR   RL  R   (   RN   R   RZ   R1  R2  R   R   (   RN   R2  RZ   (    (    R   RG    s    

c         C   s/   | i d d  d j |  _ |  i d d  d  S(   Nt   ispermalinkt   trueR/   i   (   R   RR   RN   Rs  R   (   RN   R   (    (    R   t   _start_guid  s    c         C   s[   |  i d  } |  i d |  i o |  i   i d   |  i o |  i d |  n d  S(   NR/   Rs  R   (   RN   R   RZ   R<  Rs  R1  RW   (   RN   RZ   (    (    R   t	   _end_guid  s    *
c         C   s1   |  i d | d |  i p |  i p |  i  d  S(   NR   s
   text/plain(   RN   R5  R   R   R   R   (   RN   R   (    (    R   t   _start_title  s    c         C   sW   |  i d  } |  i   } |  i o | | d d <n |  i o | | d d <n d  S(   NR   RL  R   (   RN   R7  RZ   R1  R2  R   R   (   RN   R2  RZ   (    (    R   t
   _end_title  s    

c         C   sg   |  i   } | i d  o d |  _ |  i |  n. |  i d | d |  i p |  i	 p |  i
  d  S(   NR6   R   R4   s	   text/html(   RN   R1  R2  RW   R   t   _start_contentR   R5  R   R   R   (   RN   R   R2  (    (    R   t   _start_description  s
    	c         C   s1   |  i d | d |  i p |  i p |  i  d  S(   NR4   s
   text/plain(   RN   R5  R   R   R   R   (   RN   R   (    (    R   t   _start_abstract  s    c         C   s~   |  i d j o |  i   nT |  i d  } |  i   } |  i o | | d d <n |  i o | | d d <n d  |  _ d  S(   NR   R4   RL  R   (
   RN   R   t   _end_contentR7  RZ   R1  R2  R   R   Rh   (   RN   R2  RZ   (    (    R   t   _end_description  s    

c         C   s   |  i d | d d  d  S(   NR   s
   text/plaini   (   RN   R5  R   (   RN   R   (    (    R   t   _start_info  s    c         C   s   |  i d  d  S(   NR   (   RN   R7  (   RN   (    (    R   t	   _end_info  s    c         C   so   | o> |  i |  } | i d  o |  i | d  | d <qE n t |  |  i   d <|  i d d  d  S(   NR8   t   generator_detailt	   generatori   (   R   RN   R;  RW   R  R)   R1  R   (   RN   R   (    (    R   t   _start_generator  s    c         C   sA   |  i d  } |  i   } | i d  o | | d d <n d  S(   NR  R  R   (   RN   R   RZ   R1  R2  RW   (   RN   R2  RZ   (    (    R   t   _end_generator  s    c         C   su   |  i d d  |  i | d  } | o |  i d d i |  n |  i d  t h  d | < |  i	   d <d  S(   NR  i   s   rdf:resourceii   R8   R  (
   RN   R   R:  R   RZ   R   R   R   R)   R1  (   RN   R   RZ   (    (    R   t   _start_admin_generatoragent  s    c         C   sV   |  i d d  |  i | d  } | o |  i d d i |  n |  i d  d  S(   Nt   errorreportstoi   s   rdf:resourceii   (   RN   R   R:  R   RZ   R   R   R   (   RN   R   RZ   (    (    R   t   _start_admin_errorreportsto  s
    c         C   s\   |  i   } | i d  o d |  _ |  i |  n# d |  _ |  i |  i | d d  d  S(   NR6   R   s
   text/plaini   (   RN   R1  R2  RW   R   R  R   R5  (   RN   R   R2  (    (    R   t   _start_summary  s    		c         C   sB   |  i d j o |  i   n |  i |  i p d  d  |  _ d  S(   NR   R6   (   RN   R   R  R7  Rh   (   RN   (    (    R   t   _end_summary  s    c         C   s|   |  i |  } |  i   i d g   i t |   | i d  } | o. |  i   } | i d  p | | d <qx n d  S(   Nt
   enclosuresR8   R/   (
   RN   R;  R   R1  R\   R   R)   RR   R8   R2  (   RN   R   R8   R2  (    (    R   R    s    %c         C   s   d |  _ d  S(   Ni   (   RN   R   (   RN   R   (    (    R   t   _start_source
  s    c         C   s6   d |  _ t i |  i  |  i   d <|  i i   d  S(   Ni    t   source(   RN   R   R/  R0  R   R1  R6  (   RN   (    (    R   t   _end_source  s    	c         C   sQ   |  i d | d d  | i d  } | o | |  i d <n |  i d d  d  S(   NR   s
   text/plaini   t   src(   RN   R5  R   RR   R  R   R   (   RN   R   R  (    (    R   R    s
    c         C   s   |  i d | d d  d  S(   NR   s	   text/htmli   (   RN   R5  R   (   RN   R   (    (    R   t   _start_prodlink  s    c         C   s   |  i d | d d  d  S(   NR   s   application/xhtml+xmli   (   RN   R5  R   (   RN   R   (    (    R   t   _start_body  s    c         C   s   |  i d | d d  d  S(   NR   s	   text/htmli   (   RN   R5  R   (   RN   R   (    (    R   t   _start_content_encoded   s    c         C   sY   |  i |  i i d   d g |  i j } |  i d  } | o |  i d |  n d  S(   NRT   s
   text/plainR   R4   (	   RN   R  R   RR   R)  t   copyToDescriptionR7  RZ   R<  (   RN   R  RZ   (    (    R   R  $  s    +c         C   s<   |  i d d  t h  d | i d  < |  i   d <d  S(   Nt   itunes_imagei    R8   R   (   RN   R   R)   R   RR   R1  (   RN   R   (    (    R   t   _start_itunes_image/  s    c         C   s:   |  i d d  } | d j o d p d |  i   d <d  S(   Nt   itunes_blocki    t   yesi   (   RN   R   RZ   R1  (   RN   RZ   (    (    R   t   _end_itunes_block4  s    c         C   s:   |  i d d  } | d j o d p d |  i   d <d  S(   Nt   itunes_expliciti    R  i   (   RN   R   RZ   R1  (   RN   RZ   (    (    R   t   _end_itunes_explicit8  s    (   R   R   R   R   R(  R*  R,  R)  Rh   R   R   R   R   R  R   R  R  R  R  R  R   R  R  R   R   R5  R7  R9  R:  R4  R;  R<  R?  R@  RB  t   _start_feedinfoRA  RH  RI  t	   _end_feedRJ  RK  RM  t   _start_textInputRN  t   _end_textInputRP  t   _start_managingeditort   _start_dc_authort   _start_dc_creatort   _start_itunes_authorRR  t   _end_managingeditort   _end_dc_authort   _end_dc_creatort   _end_itunes_authorRT  RU  RX  RY  RZ  R\  R]  t   _start_itunes_nameR[  t   _end_itunes_nameR`  Ra  Rb  Rc  Rd  t   _start_homepaget
   _start_uriRe  t   _end_homepaget   _end_uriRf  t   _start_itunes_emailRg  t   _end_itunes_emailR1  R^  R_  RQ  Rn  t   _start_taglinet   _start_itunes_subtitleRo  t   _end_taglinet   _end_itunes_subtitleRp  t   _start_dc_rightst   _start_copyrightRq  t   _end_dc_rightst   _end_copyrightRt  t   _start_entryt   _start_productRu  t
   _end_entryRv  t   _start_languageRw  t   _end_languageRx  t   _start_webmasterRy  t   _end_webmasterRz  t   _start_dcterms_issuedt   _start_issuedR|  t   _end_dcterms_issuedt   _end_issuedR}  RD  t   _start_dcterms_modifiedt   _start_pubdatet   _start_dc_dateR  RE  t   _end_dcterms_modifiedt   _end_pubdatet   _end_dc_dateR  t   _start_dcterms_createdR  t   _end_dcterms_createdR  R  R  R  R  R  R  t   _start_dc_subjectt   _start_keywordsR  R  R  t   _end_dc_subjectt   _end_keywordst   _end_itunes_categoryR  RF  t   _start_producturlRG  t   _end_producturlR  R  R  t   _start_dc_titlet   _start_media_titleR  t   _end_dc_titlet   _end_media_titleR  R  R  t   _end_abstractR  t!   _start_feedburner_browserfriendlyR  t   _end_feedburner_browserfriendlyR  R  R  R  R  t   _start_itunes_summaryR  t   _end_itunes_summaryR  R  R  R  R  R  t   _start_xhtml_bodyR  t   _start_fullitemR  t	   _end_bodyt   _end_xhtml_bodyt   _end_content_encodedt   _end_fullitemt   _end_prodlinkR  t   _start_itunes_linkR  R  (    (    (    R   R~      s~    ='!!"	F	%							
				Y													
																		
		
												
																																																			t   _StrictFeedParserc           B   sG   t  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   Nc         C   s]   t  o t i i d  n t i i i i |   t
 i |  | | |  d |  _ d  |  _ d  S(   Ns   trying StrictFeedParser
i    (   R   R   R   R   R   t   saxt   handlert   ContentHandlerR   RN   R~   R   R   R   t   bozoRh   t   exc(   RN   R   R   R   (    (    R   R   >  s     	c         C   s   |  i | |  d  S(   N(   RN   R   R   Ry   (   RN   R   Ry   (    (    R   t   startPrefixMappingE  s    c         C   s"  | \ } }
 t | p d  i   } | i d  d j o d } | } n | o- | i d  d j o | i d  d }	 n d  }	 |  i i | |	  } |	 oL | d  j p | d j o | d j o% |  i i |	  o t d |	  n | o | d |
 }
 n t |
  i   }
 t o0 t i i d | | |	 | | i   |
 f  n h  } xz | i i   D]i \ \ } } } | p d i   } |  i i | d  } | o | d | } n | | t |  i   <qeWx3 | i   D]% } | i |  | t |  i   <qW|  i |
 | i    d  S(	   NR   s   backend.userland.com/rssis   http://backend.userland.com/rssR   i    s'   '%s' is not associated with a namespacesf   startElementNS: qname = %s, namespace = %s, givenprefix = %s, prefix = %s, attrs = %s, localname = %s
(   R   t	   namespacet	   localnameR   R   t   lowernamespaceR   t   qnameR   t   givenprefixRh   RN   R   RR   R   R   RW   R   R   R   R   R   R   R,   R   t   _attrst   attrlocalnamet	   attrvaluet	   getQNamest   getValueByQNameR   (   RN   R   R  R   R  R  R  R   R   R  R  R  (    (    R   t   startElementNSH  s8    
B 0	  #c         C   s   |  i |  d  S(   N(   RN   R   R   (   RN   R   (    (    R   t
   charactersm  s    c         C   s   | \ } } t | p d  i   } | o- | i d  d j o | i d  d } n d } |  i i | |  } | o | d | } n t |  i   } |  i |  d  S(   NR   R   i    (   R   R  R  R   R   R  R  R   R   R  RN   R   RR   R   R   (   RN   R   R  R  R  R   R  R  (    (    R   t   endElementNSp  s    c         C   s   d |  _ | |  _ d  S(   Ni   (   RN   R
  R  (   RN   R  (    (    R   t   error}  s    	c         C   s   |  i |  |  d  S(   N(   RN   R  R  (   RN   R  (    (    R   t
   fatalError  s    (	   R   R   R   R  R  R  R  R  R  (    (    (    R   R  =  s   			%			t   _BaseHTMLProcessorc           B   s   t  Z d d d d d d d d d	 d
 d d d g Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d   Z e i d  i Z d   Z d   Z RS(   Nt   areaR|   t   basefontt   brt   colt   framet   hrt   imgt   inputt   isindexR   t   metat   paramc         C   s?   | |  _  t o t i i d |  i   n t i i |   d  S(   Ns(   entering BaseHTMLProcessor, encoding=%s
(	   R   RN   R   R   R   R   t   sgmllibt
   SGMLParserR   (   RN   R   (    (    R   R     s    	 c         C   s   g  |  _ t i i |   d  S(   N(   RN   R   R(  R)  t   reset(   RN   (    (    R   R*    s    	c         C   sG   | i d  } | |  i j o d | d Sn d | d | d Sd  S(   Ni   R   s    />s   ></R   (   t   matchRm  RP   RN   t   elements_no_end_tag(   RN   R+  RP   (    (    R   t   _shorttag_replace  s    c         C   s   t  i d t  i  i d |  } t  i d |  i |  } | i d d  } | i d d  } |  i o/ t	 |  t	 d  j o | i
 |  i  } n t i i |  |  d  S(	   Ns   <!((?!DOCTYPE|--|\[))s   &lt;!\1s   <([^<\s]+?)\s*/>s   &#39;t   's   &#34;t   "u    (   Rk  t   compilet
   IGNORECASERx   R   RN   R-  R   R   RT   R   R(  R)  R+   (   RN   R   (    (    R   R+     s    !#c         C   s~   g  } | D] \ } } | | i   | f q ~ } g  } | D]3 \ } } | | | d j o | i   p | f q> ~ } | S(   NR   RT   (   s   rels   type(   RO   R   R&   R'   R   (   RN   R   RO   R&   R'   (    (    R   t   normalize_attrs  s    3Gc         C   s  t  o t i i d |  n g  } xb | D]Z \ } } t	 |  t	 d  j o t
 | |  i  } n | i t
 | |  i  | f  q, Wd i g  } | D] \ } } | d | | f q ~  i |  i  } | |  i j o |  i i d t    n |  i i d t    d  S(   Ns-   _BaseHTMLProcessor, unknown_starttag, tag=%s
u    u    %s="%s"s   <%(tag)s%(strattrs)s />s   <%(tag)s%(strattrs)s>(   R   R   R   R   RP   t   uattrsR   RK   RZ   RT   R.  RN   R   R   Rp   RO   R   t   strattrsR,  R   t   locals(   RN   RP   R   RO   R4  R3  RZ   RK   (    (    R   R     s      #Fc         C   s/   | |  i j o |  i i d t    n d  S(   Ns
   </%(tag)s>(   RP   RN   R,  R   R   R5  (   RN   RP   (    (    R   R     s    c         C   s   |  i i d t    d  S(   Ns
   &#%(ref)s;(   RN   R   R   R5  (   RN   R   (    (    R   R     s    c         C   s   |  i i d t    d  S(   Ns	   &%(ref)s;(   RN   R   R   R5  (   RN   R   (    (    R   R    s    c         C   s3   t  o t i i d |  n |  i i |  d  S(   Ns)   _BaseHTMLProcessor, handle_text, text=%s
(   R   R   R   R   R   RN   R   R   (   RN   R   (    (    R   R     s     c         C   s   |  i i d t    d  S(   Ns   <!--%(text)s-->(   RN   R   R   R5  (   RN   R   (    (    R   R    s    c         C   s   |  i i d t    d  S(   Ns   <?%(text)s>(   RN   R   R   R5  (   RN   R   (    (    R   R    s    c         C   s   |  i i d t    d  S(   Ns   <!%(text)s>(   RN   R   R   R5  (   RN   R   (    (    R   R    s    s   [a-zA-Z][-_.a-zA-Z0-9:]*\s*c         C   s   |  i } t |  } | | j o d Sn |  i | |  } | oQ | i   } | i
   } | t |  | j o d Sn | i   | i   f Sn |  i |  d Sd  S(   Ni(   Ni(   Ni(   Ni(   RN   R  R  t   nR  Rh   t   _new_declname_matcht   mRm  Rt   R#  R   R   t   endR   (   RN   R  t   declstartposR   R8  R6  Rt   R  (    (    R   t
   _scan_name  s    	c         C   s1   d i  g  } |  i D] } | t |  q ~  S(   s(   Return processed HTML as a single stringR   N(   Rp   RO   RN   R   t   pR   (   RN   RO   R<  (    (    R   R!    s     (   R   R   R,  R   R*  R-  R+   R2  R   R   R   R  R   R  R  R  Rk  R0  R+  R7  R;  R!  (    (    (    R   R    s"   -				
										t   _LooseFeedParserc           B   s   t  Z d   Z d   Z RS(   Nc         C   s*   t  i i |   t i |  | | |  d  S(   N(   R(  R)  R   RN   R~   R   R   R   (   RN   R   R   R   (    (    R   R     s    c         C   sI  | i d d  } | i d d  } | i d d  } | i d d  } | i d d  } | i d	 d  } | i d
 d  } | i d d  } | i d d  } | i d d  } |  i i d  o~ |  i i d d  i d  o^ | i d d  } | i d d  } | i d d  } | i d d  } | i d d  } n | S(   Ns   &#60;s   &lt;s   &#x3c;s   &#62;s   &gt;s   &#x3e;s   &#38;s   &amp;s   &#x26;s   &#34;s   &quot;s   &#x22;s   &#39;s   &apos;s   &#x27;RT   R   R   R   R   R/  R.  (   R   R   RN   R   RW   RR   R   (   RN   R  R   (    (    R   R    s"    3(   R   R   R   R  (    (    (    R   R=    s   	t   _RelativeURIResolverc           B   st   t  Z d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 g Z d   Z d   Z d   Z RS(9   Nt   aR8   t   applett   codebaseR  t
   blockquotet   citet   bodyt
   backgroundt   delt   formt   actionR!  t   longdescR  t   iframet   headt   profileR#  t   usemapR$  t   insR   t   objectt   classidR   t   qt   scriptc         C   s   t  i |  |  | |  _ d  S(   N(   R  R   RN   R   R   (   RN   R   R   (    (    R   R   +  s    c         C   s   t  |  i |  S(   N(   R}   RN   R   Ry   (   RN   Ry   (    (    R   R  /  s    c         C   sy   |  i |  } g  } | D]? \ } } | | | | f |  i j o |  i |  p | f q ~ } t	 i
 |  | |  d  S(   N(   RN   R2  R   RO   RK   RZ   RP   t   relative_urisR  R  R   (   RN   RP   R   RZ   RO   RK   (    (    R   R   2  s    S(   R?  s   href(   R@  RA  (   s   areas   href(   RB  RC  (   RD  RE  (   RF  RC  (   RG  s   action(   s   frameRI  (   s   frames   src(   RJ  RI  (   RJ  s   src(   s   headRL  (   s   imgRI  (   s   imgs   src(   s   imgRM  (   s   inputs   src(   s   inputRM  (   RN  RC  (   s   links   href(   s   objectRP  (   s   objectRA  (   s   objects   data(   s   objectRM  (   RQ  RC  (   RR  s   src(   R   R   RS  R   R  R   (    (    (    R   R>    s   Q		c         C   sA   t  o t i i d  n t | |  } | i |   | i
   S(   Ns   entering _resolveRelativeURIs
(   R   R   R   R   R>  t   baseURIR   R<  R+   t
   htmlSourceR!  (   RU  RT  R   R<  (    (    R   R+  7  s
     t   _HTMLSanitizerc        G   B   s   t  Z d d d d d d d d d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF dG gG Z d dH dI dJ dK dL dM dN dO dP dQ dR dS dT dU d dV dW dX dY dZ d[ d\ d] d d^ d_ d` da db dc dd de df dg dh d( di dj dk dl dm dn do dp dq dr ds dt du dv dw dx dy dz d{ d| d} d7 d~ d d d d d d d d d d d gG Z d d g Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(   NR?  t   abbrt   acronymt   addressR  t   bt   bigRB  R  t   buttont   captiont   centerRC  t   codeR   t   colgroupt   ddRF  t   dfnt   dirt   divt   dlt   dtt   emt   fieldsett   fontRG  t   h1t   h2t   h3t   h4t   h5t   h6R"  R  R#  R$  RN  t   kbdR  t   legendt   liRq   t   menut   olt   optgroupt   optionR<  t   preRQ  Rt   t   sampt   selectt   smallt   spant   striket   strongRx   t   supt   tablet   tbodyt   tdt   textareat   tfoott   tht   theadt   trt   ttt   ut   ult   vart   accepts   accept-charsett	   accesskeyRH  t   alignt   altt   axist   bordert   cellpaddingt   cellspacingt   chart   charofft   charsett   checkedt   classR6  t   colst   colspant   colort   compactt   coordst   datetimet   disabledt   enctypet   forR!  t   headersR   R8   t   hreflangt   hspaceR/   t   ismapR   RI  t	   maxlengthR   R   t   multipleR   t   nohreft   noshadet   nowrapt   promptt   readonlyR   t   revt   rowst   rowspant   rulest   scopet   selectedt   shapet   sizeR  t   startR6   t   tabindext   targetR   RT   RM  t   valignRZ   t   vspaceR   RR  R@  c         C   s   t  i |   d |  _ d  S(   Ni    (   R  R*  RN   t   unacceptablestack(   RN   (    (    R   R*  T  s    c         C   s   | |  i j o+ | |  i j o |  i d 7_ n d  Sn |  i |  } g  } | D]- \ } } | |  i
 j o | | | f qU qU ~ } t i |  | |  d  S(   Ni   (   RP   RN   t   acceptable_elementst"   unacceptable_elements_with_end_tagR  R2  R   RO   RK   RZ   t   acceptable_attributesR  R   (   RN   RP   R   RZ   RO   RK   (    (    R   R   X  s    Ac         C   sO   | |  i j o+ | |  i j o |  i d 8_ n d  Sn t i |  |  d  S(   Ni   (   RP   RN   R  R  R  R  R   (   RN   RP   (    (    R   R   a  s
    c         C   s   d  S(   N(    (   RN   R   (    (    R   R  h  s    c         C   s   d  S(   N(    (   RN   R   (    (    R   R  k  s    c         C   s"   |  i p t i |  |  n d  S(   N(   RN   R  R  R   R   (   RN   R   (    (    R   R   n  s    
(   R   R   R  R  R  R*  R   R   R  R  R   (    (    (    R   RV  =  s   							c   	         s  t  |  } | i |   | i   } t oxd  } xr t
 D]j } yZ | d j o d k l     d   } Pn, | d j o d k l   d   } Pn Wq9 q9 Xq9 W| o t |  t d  j } | o | i d  } n | | d	 d
 d d
 d d d d } | o t | d  } n | i d  oD | i d d
  d
 } | i d  o | i d d
  d
 } qrn | i d  o | i d d
  d } qqn | i   i d d  } | S(   NR   (   s   parseStringc            s   t    |  |   S(   N(   R   t   _utidyR   t   kwargs(   R   R  (   R  (    R   t   _tidy~  s    R   (   s   Tidyc            s"     i |  |  \ } } }  } |  S(   N(   t   _mxtidyt   tidyR   R  t   nerrorst	   nwarningst	   errordata(   R   R  R  R  R  (   R  (    R   R    s    u    s   utf-8t   output_xhtmli   t   numeric_entitiest   wrapi    t   char_encodingt   utf8s   <bodyR   s   </bodys   
s   
(   RV  R   R<  R+   RU  R!  R   t   TIDY_MARKUPRh   R  t   PREFERRED_TIDY_INTERFACESt   tidy_interfaceR  t   parseStringR  t   mx.Tidyt   TidyR  RT   R  R   R.  t   countR   R#  R   (	   RU  R   R  R  R  R<  R  R  R   (    (   R  R  R   R-  r  sB     	$"t   _FeedURLHandlerc           B   s>   t  Z d   Z d   Z d   Z e Z e Z e Z d   Z RS(   Nc         C   sc   | d d j o* | d j o |  i | | | | |  Sn t i | | | i	    } | | _ | S(   Nid   i   i0  (   R_  RN   t   http_error_302t   reqt   fpt   msgR  t   urllibt
   addinfourlt   get_full_urlt   infourlt   status(   RN   R  R  R_  R  R  R  (    (    R   t   http_error_default  s
    	c         C   st   | i i d  o% t i i |  | | | | |  } n t i | | | i    } t | d  p | | _ n | S(   Nt   locationR  (   R  R(   RW   t   urllib2t   HTTPRedirectHandlerR  RN   R  R  R_  R  R  R  R  R  R]   R  (   RN   R  R  R_  R  R  R  (    (    R   R    s    %c         C   st   | i i d  o% t i i |  | | | | |  } n t i | | | i    } t | d  p | | _ n | S(   NR  R  (   R  R(   RW   R  R  t   http_error_301RN   R  R  R_  R  R  R  R  R  R]   R  (   RN   R  R  R_  R  R  R  (    (    R   R    s    %c         C   s  t  i  | i    d } y t i i   d d j p t  t d  j p t  t i
 | i d i d  d  i d  \ }	 }
 t i d | d  d } |  i | | |	 |
  |  i d	 | | |  } |  i   | SWn  |  i | | | | |  Sn Xd  S(
   Ni   i    s   2.3.3t   Authorizationt    R   s   realm="([^"]*)"s   WWW-Authenticates   www-authenticate(   Rz   R  R  t   hostR   R   R   Rd   R  Rh   R$  R  t   usert   passwRk  t   findallt   realmRN   t   add_passwordt   http_error_auth_reqedt   retryt   reset_retry_countR  R  R_  R  (   RN   R  R  R_  R  R  R  R  R  R  R  (    (    R   t   http_error_401  s    !2
(	   R   R   R  R  R  t   http_error_300t   http_error_303t   http_error_307R  (    (    (    R   R    s   					c         C   s  t  |  d  o |  Sn |  d j o t i Sn t i |   d d1 j o| p
 t } n d0 } t	 o t
 i |   \ } } t
 i |  \ }	 } |	 oL t
 i |	  \ } }	 | o, d | |	 | f }  t	 i |  i   } q q n t i |   } | i d |  | o | i d	 |  n | o d
 d d d d d d g } d d d d d d d d d d d d g } | i d d | | d | d  | | d! d! | d | d" | d# | d$ f  n | o | i d% |  n t o t o | i d& d'  nG t o | i d& d(  n, t o | i d& d)  n | i d& d*  | o | i d+ d, |  n t o | i d- t  n | i d. d/  t  t i! t" t#   g |   }
 g  |
 _& z |
 i' |  SWd0 |
 i(   Xn y t' |   SWn n Xt) t* |    S(2   s8  URL, filename, or string --> stream

    This function lets you define parsers that take any input source
    (URL, pathname to local or network file, or actual data as a string)
    and deal with it in a uniform manner.  Returned object is guaranteed
    to have all the basic stdio read methods (read, readline, readlines).
    Just .close() the object when you're done with it.

    If the etag argument is supplied, it will be used as the value of an
    If-None-Match request header.

    If the modified argument is supplied, it must be a tuple of 9 integers
    as returned by gmtime() in the standard Python time module. This MUST
    be in GMT (Greenwich Mean Time). The formatted date/time will be used
    as the value of an If-Modified-Since request header.

    If the agent argument is supplied, it will be used as the value of a
    User-Agent request header.

    If the referrer argument is supplied, it will be used as the value of a
    Referer[sic] request header.

    If handlers is supplied, it is a list of handlers used to build a
    urllib2 opener.
    t   readt   -i    t   httpt   httpst   ftps	   %s://%s%ss
   User-Agents   If-None-Matcht   Mont   Tuet   Wedt   Thut   Frit   Satt   Sunt   Jant   Febt   Mart   Aprt   Mayt   Junt   Jult   Augt   Sept   Octt   Novt   Decs   If-Modified-Sinces#   %s, %02d %s %04d %02d:%02d:%02d GMTi   i   i   i   i   i   t   Referers   Accept-encodings   gzip, deflatet   gzipt   deflateR   R  s   Basic %st   Accepts   A-IMR+   N(   R  R  R  (+   R]   t   url_file_stream_or_stringR   t   stdinRz   t   agentt
   USER_AGENTRh   t   authR  R  t	   splittypet   urltypet   restt	   splithostt   realhostt	   splitusert   user_passwdt   encodestringR#  R  t   Requestt   requestt
   add_headert   etagR9   t   short_weekdayst   monthst   referrerR  t   zlibt   ACCEPT_HEADERt   applyt   build_openert   tupleR  t   handlerst   openert
   addheaderst   opent   closet	   _StringIOR   (   R  R  R9   R  R  R$  R  R  R  R  R%  R  R  R  R  (    (    R   t   _open_resource  sd     
!*U"	 c         C   s   t  i d |   d S(   sL   Register a date handler function (takes string, returns 9-tuple date in GMT)i    N(   t   _date_handlerst   insertt   func(   R-  (    (    R   t   registerDateHandler*  s     s   YYYY-?MM-?DDs   YYYY-MMs	   YYYY-?OOOs
   YY-?MM-?DDs   YY-?OOOt   YYYYs   -YY-?MMs   -OOOs   -YYs   --MM-?DDs   --MMs   ---DDt   CCs   (?P<year>\d{4})t   YYs   (?P<year>\d\d)t   MMs   (?P<month>[01]\d)t   DDs   (?P<day>[0123]\d)t   OOOs   (?P<ordinal>[0123]\d\d)s   (?P<century>\d\d$)s$   (T?(?P<hour>\d{2}):(?P<minute>\d{2})s   (:(?P<second>\d{2}))?s6   (?P<tz>[+-](?P<tzhour>\d{2})(:(?P<tzmin>\d{2}))?|Z)?)?c      	   C   s  d } x& t D] } | |   } | o Pq q W| p d Sn | i   d j o d Sn | i   }	 |	 i d d  } | o t
 |  } n d } |	 i d d  } | p | d j o t i   d } nL t |  d j o, d t
 t i   d d  t
 |  } n t
 |  } |	 i d d	  } | p | d	 j o% | o
 d
 } qft i   d
 } n t
 |  } |	 i d d  } | ph | o
 | } q|	 i d d  p& |	 i d d  p |	 i d d  o
 d
 } qt i   d } n t
 |  } d |	 i   j o  t
 |	 d  d
 d d
 } n x> d d d d d g D]' } |	 i | d  p d |	 | <qHqHWt
 |	 i d d   } t
 |	 i d d   } t
 |	 i d d   } d }
 d } | | | | | | |
 | | g	 } |	 i d  } | o | d j o | d d	 j oH | d c t
 |	 i d d   7<| d c t
 |	 i d d   7<q| d d j oH | d c t
 |	 i d d   8<| d c t
 |	 i d d   8<qd Sn t i t i |   S(   s<   Parse a variety of ISO-8601-compatible formats like 20040105Ni    t   ordinalt   years   --i   id   t   monthR  i   t   dayt   centuryt   hourt   minutet   secondt   tzhourt   tzmint   tzt   Zi   i   t   +(   i    i    (   Rh   R8  t   _iso8601_matchest   _iso8601_matcht
   dateStringR{  t	   groupdictt   paramsRR   R5  R   R6  t   timet   gmtimeR  R7  R8  RX   t   fieldR:  R;  R<  t   weekdayt   daylight_savings_flagt   tmR?  t	   localtimet   mktime(   RD  R5  R?  R:  R8  RC  RI  R<  RL  RF  RJ  R6  RK  R7  R8  R;  (    (    R   t   _parse_date_iso8601L  st       	  ,

9
  !"&"&u   년u   월u   일u   오전u   오후s;   (\d{4})%s\s+(\d{2})%s\s+(\d{2})%s\s+(\d{2}):(\d{2}):(\d{2})u>   (\d{4})-(\d{2})-(\d{2})\s+(%s|%s)\s+(\d{,2}):(\d{,2}):(\d{,2})c         C   s   t  i |   } | p d Sn d h  d | i d  <d | i d  <d | i d  <d	 | i d
  <d | i d  <d | i d  <d d <} t o t i i	 d |  n t
 |  S(   s8   Parse a string according to the OnBlog 8-bit date formatNsE   %(year)s-%(month)s-%(day)sT%(hour)s:%(minute)s:%(second)s%(zonediff)sR6  i   R7  i   R8  i   R:  i   R;  i   R<  i   t   zonediffs   +09:00s   OnBlog date parsed as: %s
(   t   _korean_onblog_date_reR+  RD  R8  Rm  t	   w3dtfdateR   R   R   R   t   _parse_date_w3dtf(   RD  RR  R8  (    (    R   t   _parse_date_onblog  s       c         C   s)  t  i |   } | p d Sn t | i d   } | i d  } | t j o | d 7} n t	 |  } t
 |  d j o d | } n d h  d | i d  <d	 | i d
  <d | i d  <d | <d | i d  <d | i d  <d d <} t o t i i d |  n t |  S(   s6   Parse a string according to the Nate 8-bit date formatNi   i   i   i   t   0sE   %(year)s-%(month)s-%(day)sT%(hour)s:%(minute)s:%(second)s%(zonediff)sR6  R7  i   R8  i   R:  R;  i   R<  i   RP  s   +09:00s   Nate date parsed as: %s
(   t   _korean_nate_date_reR+  RD  R8  R   Rm  R:  t   ampmt
   _korean_pmR   R  RR  R   R   R   R   RS  (   RD  RR  R:  RW  R8  (    (    R   t   _parse_date_nate  s      v s9   (\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2}):(\d{2})(\.\d+)?c         C   s   t  i |   } | p d Sn d h  d | i d  <d | i d  <d | i d  <d	 | i d
  <d | i d  <d | i d  <d d <} t o t i i	 d |  n t
 |  S(   s2   Parse a string according to the MS SQL date formatNsE   %(year)s-%(month)s-%(day)sT%(hour)s:%(minute)s:%(second)s%(zonediff)sR6  i   R7  i   R8  i   R:  i   R;  i   R<  i   RP  s   +09:00s   MS SQL date parsed as: %s
(   t   _mssql_date_reR+  RD  R8  Rm  RR  R   R   R   R   RS  (   RD  RR  R8  (    (    R   t   _parse_date_mssql  s       u   Ιανu   Janu   Φεβu   Febu   Μάώu   Maru   Μαώu   Απρu   Apru   Μάιu   Mayu   Μαϊu   Μαιu   Ιούνu   Junu   Ιονu   Ιούλu   Julu   Ιολu   Αύγu   Augu   Αυγu   Σεπu   Sepu   Οκτu   Octu   Νοέu   Novu   Νοεu   Δεκu   Decu   Κυρu   Sunu   Δευu   Monu   Τριu   Tueu   Τετu   Wedu   Πεμu   Thuu   Παρu   Friu   Σαβu   SatuL   ([^,]+),\s+(\d{2})\s+([^\s]+)\s+(\d{4})\s+(\d{2}):(\d{2}):(\d{2})\s+([^\s]+)c         C   s  t  i |   } | p d Sn y* t | i d  } t | i d  } Wn d Sn Xd h  d | <d | i d  <d | <d	 | i d
  <d | i d  <d | i d  <d | i d  <d | i d  <} t
 o t i i d |  n t |  S(   s6   Parse a string according to a Greek 8-bit date format.Ni   i   sP   %(wday)s, %(day)s %(month)s %(year)s %(hour)s:%(minute)s:%(second)s %(zonediff)st   wdayR8  i   R7  R6  i   R:  i   R;  i   R<  i   RP  i   s   Greek date parsed as: %s
(   t   _greek_date_format_reR+  RD  R8  t   _greek_wdaysRm  R\  t   _greek_monthsR7  t
   rfc822dateR   R   R   R   t   _parse_date_rfc822(   RD  R8  R7  R`  R\  (    (    R   t   _parse_date_greek  s       u   januáru   01u	   februáriu   02u   márciusu   03u   áprilisu   04u   máujusu   05u   júniusu   06u   júliusu   07u	   augusztusu   08u
   szeptemberu   09u   októberu   10u   novemberu   11u   decemberu   12u?   (\d{4})-([^-]+)-(\d{,2})T(\d{,2}):(\d{2})((\+|-)(\d{,2}:\d{2}))c         C   s'  t  i |   } | p d Sn yw t | i d  } | i d  } t |  d j o d | } n | i d  } t |  d j o d | } n Wn d Sn Xd h  d | i d  <d	 | <d
 | <d | <d | i d  <d | i d  <} t o t i i d |  n t |  S(   s:   Parse a string according to a Hungarian 8-bit date format.Ni   i   i   RU  i   s:   %(year)s-%(month)s-%(day)sT%(hour)s:%(minute)s%(zonediff)sR6  R7  R8  R:  R;  i   RP  i   s   Hungarian date parsed as: %s
(   t   _hungarian_date_format_reR+  RD  R8  t   _hungarian_monthsRm  R7  R8  R  R:  RR  R   R   R   R   RS  (   RD  R:  RR  R8  R7  R8  (    (    R   t   _parse_date_hungarian!  s$      [ c         C   s   d   } d   } d   } d } d } t i |  }
 d | } d | | f } t i |  } | i |   } | d  j p | i   |  j o d  Sn | |  | |  d	 }	 |	 d d j o d  Sn t i t i |	  | |  t i  S(
   Nc      
   C   s  t  |  i d   } | d j  o, d t  t i   d d  t  |  } n | d j  o d Sn |  i d  } | ot  |  } | d d } | d d } d  } x | | j o t i | | | d d d d d d f	  } t i |  d } t | |  } | | j o/ | | j  o | | } qz| d } d	 } q | | j  o- | | d
 j  o | | } qz| d } q q W| | | f Sn |  i d  } d } | d  j o
 d } n9 t  |  } |  i d  } | o t  |  } n d } | | | f S(   NR6  id   i    i  t   juliani   i   ii   i   R7  R8  (   i    i    i    (   R   R8  Rm  R6  RG  RH  Rf  R7  R8  Rh   t   jdayRN  R   t   abst   diff(   R8  Rf  R6  R7  Rg  R   Ri  R8  (    (    R   t   __extract_date<  sH    , *


c         C   s   |  p d Sn |  i d  } | p d Sn t |  } t |  i d   } |  i d  } | o t |  } n d } | | | f S(   Ni    t   hourst   minutest   seconds(   i    i    i    (   i    i    i    (   R8  Rm  Rk  R   Rl  Rm  (   R8  Rk  Rl  Rm  (    (    R   t   __extract_timee  s    c         C   s   |  p d Sn |  i d  } | p d Sn | d j o d Sn t |  i d   } |  i d  } | o t |  } n d } | d | d } | d d j o	 | Sn | S(	   sA   Return the Time Zone Designator as an offset in seconds from UTC.i    t   tzdR@  t   tzdhourst
   tzdminutesi<   RA  N(   R8  Rm  Ro  R   Rk  Rl  t   offset(   R8  Rk  Ro  Rr  Rl  (    (    R   t   __extract_tzdt  s"     	sd   (?P<year>\d\d\d\d)(?:(?P<dsep>-|)(?:(?P<julian>\d\d\d)|(?P<month>\d\d)(?:(?P=dsep)(?P<day>\d\d))?))?s;   (?P<tzd>[-+](?P<tzdhours>\d\d)(?::?(?P<tzdminutes>\d\d))|Z)sW   (?P<hours>\d\d)(?P<tsep>:|)(?P<minutes>\d\d)(?:(?P=tsep)(?P<seconds>\d\d(?:[.,]\d+)?))?s
   %s(?:T%s)?i    (   i    i    i    (   Rj  Rn  Rs  t	   __date_ret   __tzd_reRk  R0  t   __tzd_rxt	   __time_ret   __datetime_ret   __datetime_rxR+  RD  R8  Rh   Rm  t   gmtRG  RH  RN  t   timezone(   RD  Ru  Rn  Rx  R8  Rt  Rj  Ry  Rw  Rz  Rv  Rs  (    (    R   RS  ;  s     	)		
   c         C   s  |  i   } | d d d j p | d i   t i j o | d =n t |  d j of | d } | i d  } | d j o  | |  | | d g | d )n | i
 d	  d
 i |  }  n t |  d j  o |  d 7}  n t i |   } | o t i t i |   Sn d S(   s8   Parse an RFC822, RFC1123, RFC2822, or asctime-style datei    it   ,t   .i   i   RA  i   R   R  i   s    00:00:00 GMTN(   R|  R}  (   RD  R   R   R   t   rfc822t	   _daynamesR  Rt   R   R  R   Rp   t   parsedate_tzRL  RG  RH  t	   mktime_tz(   RD  R  Rt   RL  R   (    (    R   Ra    s      /
 t   ATipt   ETit   CTit   MTiDt   PTic         C   s   x t  D] } yg | |   } | p w n t |  d j o% t o t i i d  n t	  n t
 t |  | SWq t j
 o7 } t o' t i i d | i t |  f  q q Xq Wd S(   s6   Parses a variety of date formats into a 9-tuple in GMTi	   s*   date handler function must return 9-tuple
s   %s raised %s
N(   R+  R  RD  t
   date9tupleR  R   R   R   R   t
   ValueErrorRq   R   t	   Exceptiont   eR   R  Rh   (   RD  R  R  R  (    (    R   R{    s$        
 '	c         C   s  d   } d } d } d } | |  i d   \ }
 } yj| d  d j o t	 |  } n.| d  d j o" d } t
 | d  i d  } nt |  d j oK | d	  d
 j o: | d	 d !d j o& d } t
 | d	 d  i d  } n| d  d j o" d } t
 | d  i d  } njt |  d j oK | d	  d j o: | d	 d !d j o& d } t
 | d	 d  i d  } n| d  d j o" d } t
 | d  i d  } n | d  d j o" d } t
 | d  i d  } n | d  d j o& d } t
 | d d  i d  } no | d  d j o& d } t
 | d d  i d  } n8 | d  d j o& d } t
 | d d  i d  } n t i d  i |  } Wn d0 } n X| o8 | i   d i   } | o | d1 j o
 | } qn d }	 d2 } d3 } |
 | j p  |
 i d*  o. |
 i d+  o d, }	 | p | p d } n |
 | j p  |
 i d-  o' |
 i d+  o d, }	 | p d. } nX |
 i d-  o | p d. } n7 |  o" |  i d  o | p d/ } n | p d } | | | | |	 f S(4   s	  Get the character encoding of the XML document

    http_headers is a dictionary
    xml_data is a raw string (not Unicode)
    
    This is so much trickier than it sounds, it's not even funny.
    According to RFC 3023 ('XML Media Types'), if the HTTP Content-Type
    is application/xml, application/*+xml,
    application/xml-external-parsed-entity, or application/xml-dtd,
    the encoding given in the charset parameter of the HTTP Content-Type
    takes precedence over the encoding given in the XML prefix within the
    document, and defaults to 'utf-8' if neither are specified.  But, if
    the HTTP Content-Type is text/xml, text/*+xml, or
    text/xml-external-parsed-entity, the encoding given in the XML prefix
    within the document is ALWAYS IGNORED and only the encoding given in
    the charset parameter of the HTTP Content-Type header should be
    respected, and it defaults to 'us-ascii' if not specified.

    Furthermore, discussion on the atom-syntax mailing list with the
    author of RFC 3023 leads me to the conclusion that any document
    served with a Content-Type of text/* and no charset parameter
    must be treated as us-ascii.  (We now do this.)  And also that it
    must always be flagged as non-well-formed.  (We now do this too.)
    
    If Content-Type is unspecified (input was local file or non-HTTP source)
    or unrecognized (server just got it totally wrong), then go by the
    encoding given in the XML prefix of the document and default to
    'iso-8859-1' as per the HTTP specification (RFC 2616).
    
    Then, assuming we didn't find a character encoding in the HTTP headers
    (and the HTTP Content-type allowed us to look in the body), we need
    to sniff the first few bytes of the XML data and try to determine
    whether the encoding is ASCII-compatible.  Section F of the XML
    specification shows the way here:
    http://www.w3.org/TR/REC-xml/#sec-guessing-no-ext-info

    If the sniffed encoding is not ASCII-compatible, we need to make it
    ASCII compatible so that we can sniff further into the XML declaration
    to find the encoding attribute, which will tell us the true encoding.

    Of course, none of this guarantees that we will be able to parse the
    feed in the declared character encoding (assuming it was declared
    correctly, which many are not).  CJKCodecs and iconv_codec help a lot;
    you should definitely install them if you can.
    http://cjkpython.i18n.org/
    c         C   sD   |  p d }  t i |   \ }  } |  | i d d  i d d  f S(   s  takes HTTP Content-Type header and returns (content type, charset)

        If no charset is specified, returns (content type, '')
        If no content type is specified, returns ('', '')
        Both return parameters are guaranteed to be lowercase strings
        R   R  R.  N(   t   content_typet   cgit   parse_headerRF  RR   R   (   R  RF  (    (    R   t   _parseHTTPContentType  s     R   s   content-typei   s   Lot    < ?s   utf-16bes   utf-8i   s   t     s   < ? s   utf-16les   t      <s   utf-32bes   <   s   utf-32let     s     i   s   ﻿s!   ^<\?.*encoding=['"](.*?)['"].*\?>i    s   iso-10646-ucs-2s   ucs-2t	   csunicodes   iso-10646-ucs-4s   ucs-4t   csucs4s   utf-16s   utf-32t   utf_16t   utf_32t   utf16t   u16s   application/xmls   application/xml-dtds&   application/xml-external-parsed-entitys   text/xmls   text/xml-external-parsed-entitys   application/s   +xmli   s   text/s   us-asciis
   iso-8859-1N(   s   iso-10646-ucs-2s   ucs-2R  s   iso-10646-ucs-4s   ucs-4R  s   utf-16s   utf-32s   utf_16R  s   utf16s   u16(   s   application/xmls   application/xml-dtds&   application/xml-external-parsed-entity(   s   text/xmls   text/xml-external-parsed-entity(   R  t   sniffed_xml_encodingt   xml_encodingt   true_encodingt   http_headersRR   t   http_content_typet   http_encodingt   xml_dataRv   R.  R   R  Rk  R0  R+  t   xml_encoding_matchRh   t   groupsR   t   acceptable_content_typet   application_content_typest   text_content_typesRc   R   RW   (   R  R  R  R  R  R  R  R  R  R  R  R  (    (    R   t   _getCharacterEncoding  sv    . 	8 8     
--c         C   s  t  o t i i d |  n t |   d j ou |  d  d j od |  d d !d j oP t  o5 t i i d  | d j o t i i d  q n d } |  d }  nt |   d j ou |  d  d	 j od |  d d !d j oP t  o5 t i i d  | d
 j o t i i d  qn d
 } |  d }  n$|  d  d j oP t  o5 t i i d  | d j o t i i d  q|n d } |  d }  n |  d  d j oP t  o5 t i i d  | d j o t i i d  qn d } |  d }  nb |  d  d j oP t  o5 t i i d  | d j o t i i d  q>n d } |  d }  n t |  |  } t  o t i i d |  n t	 i
 d  } d } | i |  o | i | |  } n | d | } | i d  S(   s   Changes an XML data stream on the fly to specify a new encoding

    data is a raw sequence of bytes (not Unicode) that is presumed to be in %encoding already
    encoding is a string recognized by encodings.aliases
    s%   entering _toUTF8, trying encoding %s
i   i   s   R  s   stripping BOM
s   utf-16bes   trying utf-16be instead
s   s   utf-16les   trying utf-16le instead
i   s   ﻿s   utf-8s   trying utf-8 instead
R  s   utf-32bes   trying utf-32be instead
s     s   utf-32les   trying utf-32le instead
s*   successfully converted %s data to unicode
s   ^<\?xml[^>]*?>s&   <?xml version='1.0' encoding='utf-8'?>u   
N(   R   R   R   R   R   R  R   R.  t   newdataRk  R0  t	   declmatcht   newdeclR   Rx   R   (   R   R   R  R  R  (    (    R   t   _toUTF8J	  s^      88 c         C   s   t  i d t  i  } | i d |   }  t  i d t  i  } | i |   } | o | d p d } | i
   i d  o
 d } n d } | i d |   }  | |  f S(   s   Strips DOCTYPE from XML document, returns (rss_version, stripped_data)

    rss_version may be 'rss091n' or None
    stripped_data is the same XML document, minus the DOCTYPE
    s   <!ENTITY([^>]*?)>R   s   <!DOCTYPE([^>]*?)>i    t   netscapeR   N(   Rk  R0  t	   MULTILINEt   entity_patternRx   R   t   doctype_patternR  t   doctype_resultst   doctypeR   R  R   Rh   (   R   R  R  R   R  R  (    (    R   t   _stripDoctype	  s     
c         C   s  t    }	 t    |	 d <g  |	 d <t o d |	 d <n t |  t i j o | g } n y+ t |  | | | | |  } | i   } Wn5 t j
 o) } d |	 d <| |	 d <d } d* } n X| o	| ot | d  o t ot | i i d	 d  d
 j oX y" t i d t |   i   } Wqt j
 o# } d |	 d <| |	 d <d } qXqt ol | i i d	 d  d j oP y t i | t i  } Wqt j
 o# } d |	 d <| |	 d <d } qXqn t | d  oM | i   } | i d  |	 d <| i d  } | o t |  |	 d <q(n t | d  o | i  |	 d <d |	 d <n t | d  o | i! |	 d <n t | d  o | i i" |	 d <n t | d  o | i#   n |	 i d h   } t% | |  \ |	 d <} } } } | oN | oF | i* d  o d | d } n d } d |	 d <t, |  |	 d <n t- |  \ |	 d <} | i d |	 i d   } | i d d*  } |	 i d d  d j o  d |	 d <d d  |	 d! <|	 Sn | p |	 Sn d } d } g  } xr |	 d | | f D]] }
 |
 p qn |
 | j o qn | i4 |
  y t5 | |
  } d } } PWqqXqW| oj t6 oc yU t6 i7 |  d }
 |
 o7 |
 | j o* | i4 |
  t5 | |
  } d } } n WqqXn | oK d" | j o> y0 d" }
 | i4 |
  t5 | |
  } d } } WqqXn | oK d# | j o> y0 d# }
 | i4 |
  t5 | |
  } d } } WqiqiXn | p: d |	 d <t8 d$ d% |	 d | f  |	 d <d |	 d <nH |
 |	 d j o6 d |	 d <t9 d& |	 d |
 f  |	 d <|
 |	 d <n t p
 d } n | o2t: | | d"  } t< i= i> t?  } | iA t< i= iB iC d  | iD |  | iE |  t< i= iF iG   } | iI t |   t | d'  o | iJ i4 h  d( d) < n y | iK |  Wq;t j
 oe } tL o1 d* kM } | iN   | iO   tP iQ iR d+  n d |	 d <| iS p | |	 d <d } q;Xn | p1 tT | | | o d" p d  } | iU |  n | iV |	 d <| iW |	 d <|	 d p | iX |	 d <| iY |	 d, <|	 S(-   s0   Parse a feed from a URL, file, stream, or stringR+   R-   i    R
  i   t   bozo_exceptionR   R  s   content-encodingR  t   fileobjR	  R   t   ETagR  s   Last-ModifiedR9   R7   R8   i   R  R(  R   s   content-types   %s is not an XML media types   no Content-type specifiedR   s   content-locations   content-languagei0  s1   The feed has not changed since you last checked, s:   so the server sent no data.  This is a feature, not a bug!t   debug_messages   utf-8s   windows-1252s#   document encoding unknown, I tried s2   %s, %s, utf-8, and windows-1252 but nothing workeds+   documented declared as %s, but parsed as %st	   _ns_stacks$   http://www.w3.org/XML/1998/namespaceR   Ns   xml parsing failed
R   (Z   R)   t   resultt   _XML_AVAILABLERT   R$  RU   t   InstanceTypeR*  R  R  R9   R  R  t   fR  R   R  R  Rh   R]   R  R  RR   t   GzipFileR)  R  t
   decompresst	   MAX_WBITSR   t	   getheadert   last_modifiedR{  R7   R  R(   R(  R  R  R  R  R  R  RW   t   bozo_messageR   R  R   R   t   use_strict_parsert   known_encodingt   tried_encodingst   proposed_encodingR   R  t   chardett   detectR   R   R  t
   feedparserR   R  t   make_parsert   PREFERRED_XML_PARSERSt	   saxparsert
   setFeatureR  t   feature_namespacest   setContentHandlert   setErrorHandlert	   xmlreadert   InputSourceR  t   setByteStreamR  t   parseR   t	   tracebackt   print_stackt	   print_excR   R   R   R  R=  R+   R   R-   R   R   (   R  R  R9   R  R  R$  R  R  R  R  R  R  R  R  R  R  R  R  R   R  R  R  R   R   R   R  R  R  (    (    R   R  	  s    	


#"

#

"

   

"

	


 t   __main__(   s   pprint(~   t   __doc__t   __version__t   __license__t
   __author__t   __contributors__R   R  R   R  R  R  R(  Rk  R   R/  Rz   RG  R~  RU   R  R  R  t	   cStringIOt   StringIOR)  R  Rh   R  t   xml.saxR   R  R  t   xml.sax.saxutilsR   R	   R  R  R%  t   cjkcodecs.aliasest	   cjkcodecst   iconv_codecR  t   chardet.constantst	   constantsR  R
   R   R   R   R   R0  t   tagfindt   specialt   charreft   SUPPORTED_VERSIONSR(   RL   t	   NameErrorR)   Rk   Rl   Rv   Rw   R}   R~   R  R	  R  R)  R  R=  R>  R+  RV  R-  t   HTTPDigestAuthHandlerR  t   HTTPDefaultErrorHandlerR  R*  R+  R.  t   _iso8601_tmplRO   t   tmplR   t   _iso8601_ret   regexR+  RB  RO  t   _korean_yeart   _korean_montht   _korean_dayt
   _korean_amRX  RQ  RV  RT  RY  RZ  R[  R_  R^  R]  Rb  Rd  Rc  Re  RS  Ra  t   _additional_timezonest
   _timezonesRj   R{  R  R  R  R  R   t   argvt   exitt   urlst   pprintR7   R  (]   Ra  R  R  R^  R
   R  R   R(  R   R  R   R  R  RS  R  R  R.  Re  Rk   R   R{  R  R(   Rd  R+  R  R  R  R  Rk  RV  RL   R  R  R   R  R   RO  R  R   RZ  R  R  R  R[  R  RT  RX  R  R  RB  R  R%  R+  Rc  R  R_  R	   R~   R  R/  R>  Rv   R  R  R  R)  R  R=  R  RO   R  R]  R-  R  R  RV  R~  R  R}   R  R  RQ  RU   R7   R  Rb  Rz   RY  R   RG  R*  Rw   (    (    R   t   ?   s  
	c

	
		

K				     &Hs'	5	'%6	Z	0u-	N
	

	
	

E	
r	
	]
	3
			5	 
