
    gB                     F    d dl Z ddlmZ ddlmZ ddlmZ  G d de      Zy)    N   )_parse_date)make_safe_absolute_uri)FeedParserDictc                   X   e Zd ZdZddddddddddddddZd Zd 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d ZeZd Zd Zd Zd Zd Zd 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+e+Z,d Z-e-Z.d  Z/e/Z0d! Z1d" Z2d# Z3d$ Z4d% Z5e5Z6e5Z7d& Z8e8Z9e8Z:d' Z;e;Z<e;Z=d( Z>e>Z?e>Z@d) ZAd* ZBd+ ZCd, ZDd- ZEeEZFd. ZGeGZHd/ ZId0 ZJd1 ZKd2 ZLeLZMd3 ZNeNZOd4 ZPd5 ZQd6 ZRd7 ZSd8 ZTeTZUd9 ZVeVZWd: ZXeXZYd; ZZd< Z[d= Z\d> Z]d? Z^d@ Z_dA Z`dB ZadC ZbebZcdD ZdedZedE ZfefZgefZhefZiefZjdF ZkdG ZlyH)I	NamespacezSupport for the Atom, RSS, RDF, and CDF feed formats.

    The feed formats all share common elements, some of which have conflicting
    interpretations. For simplicity, all of the base feed format support is
    collected here.
     )r	   zhttp://backend.userland.com/rssz%http://blogs.law.harvard.edu/tech/rsszhttp://purl.org/rss/1.0/z&http://my.netscape.com/rdf/simple/0.9/zhttp://example.com/newformat#zhttp://example.com/nechozhttp://purl.org/echo/zuri/of/echo/namespace#zhttp://purl.org/pie/zhttp://purl.org/atom/ns#zhttp://www.w3.org/2005/Atomz'http://purl.org/rss/1.0/modules/rss091#c                     ddddd}| j                   r| j                   j                  d      sN|j                  dd      }|j                  |      }|r|| _         y |j                  d	      rd
| _         y d| _         y y )Nrss091urss092rss093rss094)z0.91z0.92z0.93z0.94rssversionr	   z2.rss20)r   
startswithgetselfattrs_d
versionmapattr_versionr   s        N/var/www/html/venv/lib/python3.12/site-packages/feedparser/namespaces/_base.py
_start_rsszNamespace._start_rss<   sy    	

 ||4<<#:#:5#A";;y"5L nn\2G&((.&$ $B    c                 4    d| _         | j                  |       y )N   )infeed_cdf_commonr   r   s     r   _start_channelzNamespace._start_channelQ   s    !r   c                     d|v r6| j                  i        |d   | j                  d   d<   | j                          d|v r7| j                  i        |d   | j                  d   d<   | j	                          y y )Nlastmodhref)_start_modifiedelementstack_end_modified_start_link	_end_linkr    s     r   r   zNamespace._cdf_commonU   s|      $(/	(:Db!"% WR (/Db!"%NN r   c                     d| _         dddd}| j                  s4|j                  d      }|j                  |      }|r|| _        y d| _        y y )Nr   atom01atom02atom03)z0.1z0.2z0.3r   atom)r   r   r   r   s        r   _start_feedzNamespace._start_feed_   sT    %%%'
 ||";;y1L nn\2G&% r   c                     d| _         y )Nr   )r   r   s    r   _end_channelzNamespace._end_channell   s	    r   c                     | j                         }| j                  s|j                  dt                      d| _        d| _        | j                  dd       y )Nimager   r$   r   )_get_contextinentry
setdefaultr   inimagetitle_depthpushr   r   contexts      r   _start_imagezNamespace._start_imagep   sG    ##%||w(89		'1r   c                 4    | j                  d       d| _        y )Nr5   r   )popr9   r2   s    r   
_end_imagezNamespace._end_imagex   s    r   c                     | j                         }|j                  dt                      d| _        d| _        | j                  dd       y )N	textinputr   r$   r   )r6   r8   r   intextinputr:   r;   r<   s      r   _start_textinputzNamespace._start_textinput|   sA    ##%;(89		+q!r   c                 4    | j                  d       d| _        y )NrC   r   )r@   rD   r2   s    r   _end_textinputzNamespace._end_textinput   s    r   c                     d| _         | j                  dd       | j                         }|j                  dg        |d   j	                  t                      y )Nr   authorauthors)inauthorr;   r6   r8   appendr   r<   s      r   _start_authorzNamespace._start_author   sK    		(A##%9b)	!!."23r   c                 T    | j                  d       d| _        | j                          y )NrI   r   )r@   rK   _sync_author_detailr2   s    r   _end_authorzNamespace._end_author   s!      "r   c                     d| _         | j                         }|j                  dg        |d   j                  t	                      | j                  dd       y )Nr   contributorscontributorr   )incontributorr6   r8   rL   r   r;   r<   s      r   _start_contributorzNamespace._start_contributor   sL    ##%>2.&&~'78		-#r   c                 4    | j                  d       d| _        y )NrS   r   )r@   rT   r2   s    r   _end_contributorzNamespace._end_contributor   s    r   c                 (    | j                  dd       y )Nnamer   r;   r    s     r   _start_namezNamespace._start_name       		&!r   c                 &   | j                  d      }| j                  r| j                  d|d       y | j                  r| j                  d|       y | j                  r| j                  d|       y | j                  r| j                         }||d<   y y )NrY   	publisher)r@   inpublisher_save_authorrK   rT   _save_contributorrD   r6   r   valuer=   s      r   	_end_namezNamespace._end_name   s     fe[9]]fe,""651'')G#GFO r   c                 (    | j                  dd       y Nwidthr   rZ   r    s     r   _start_widthzNamespace._start_width       		'1r   c                     | j                  d      }	 t        |      }| j                  r| j	                         }||d<   y y # t        $ r d}Y 0w xY wrf   r@   int
ValueErrorr9   r6   rb   s      r   
_end_widthzNamespace._end_width   sZ    !	JE <<'')G$GG   	E	   A AAc                 (    | j                  dd       y Nheightr   rZ   r    s     r   _start_heightzNamespace._start_height   s    		(Ar   c                     | j                  d      }	 t        |      }| j                  r| j	                         }||d<   y y # t        $ r d}Y 0w xY wrq   rk   rb   s      r   _end_heightzNamespace._end_height   sZ    "	JE <<'')G %GH   	E	ro   c                 (    | j                  dd       y )Nr%   r   rZ   r    s     r   
_start_urlzNamespace._start_url   r\   r   c                     | j                  d      }| j                  r| j                  d|       y | j                  r| j	                  d|       y y )Nr%   )r@   rK   r`   rT   ra   r   rc   s     r   _end_urlzNamespace._end_url   sE     ==fe,""651  r   c                 (    | j                  dd       y )Nemailr   rZ   r    s     r   _start_emailzNamespace._start_email   ri   r   c                     | j                  d      }| j                  r| j                  d|d       y | j                  r| j                  d|       y | j                  r| j                  d|       y y )Nr|   r^   )r@   r_   r`   rK   rT   ra   ry   s     r   
_end_emailzNamespace._end_email   s`    !guk:]]gu-""7E2  r   c                 ,    | j                  d|dd       y )Nsubtitle
text/plainr   push_contentr    s     r   _start_subtitlezNamespace._start_subtitle   s    *g|Q?r   c                 &    | j                  d       y )Nr   pop_contentr2   s    r   _end_subtitlezNamespace._end_subtitle   s    $r   c                 ,    | j                  d|dd       y )Nrightsr   r   r   r    s     r   _start_rightszNamespace._start_rights   s    (G\1=r   c                 &    | j                  d       y )Nr   r   r2   s    r   _end_rightszNamespace._end_rights   s    "r   c                    | j                   j                  t                      | j                  dd       d| _        d| _        d| _        | j                  |d      }|r| j                         }||d<   | j                  |       y )Nitemr   r   r$   z	rdf:aboutid)
entriesrL   r   r;   r7   
guidislinkr:   _get_attributer6   r   )r   r   r   r=   s       r   _start_itemzNamespace._start_item   su    N,-		&!  +6'')GGDM!r   c                 B    | j                  d       d| _        d| _        y )Nr   r   )r@   r7   
hasContentr2   s    r   	_end_itemzNamespace._end_item  s    r   c                 (    | j                  dd       y )Nlanguager   rZ   r    s     r   _start_languagezNamespace._start_language	  s    		*a r   c                 0    | j                  d      | _        y )Nr   )r@   langr2   s    r   _end_languagezNamespace._end_language  s    HHZ(	r   c                 (    | j                  dd       y )Nr^   r   rZ   r    s     r   _start_webmasterzNamespace._start_webmaster      		+q!r   c                 H    | j                  d       | j                  d       y )Nr^   )r@   rO   r2   s    r   _end_webmasterzNamespace._end_webmaster  s      -r   c                 (    | j                  dd       y )N	publishedr   rZ   r    s     r   _start_publishedzNamespace._start_published  r   r   c                 `    | j                  d      }| j                  dt        |      d       y )Nr   published_parsedT	overwriter@   _saver   ry   s     r   _end_publishedzNamespace._end_published  s(    %

%{5'9T
Jr   c                 (    | j                  dd       y )Nupdatedr   rZ   r    s     r   _start_updatedzNamespace._start_updated!      		)Qr   c                 d    | j                  d      }t        |      }| j                  d|d       y )Nr   updated_parsedTr   )r@   r   r   )r   rc   parsed_values      r   _end_updatedzNamespace._end_updated&  s-    #"5)

#\T
Br   c                 (    | j                  dd       y )Ncreatedr   rZ   r    s     r   _start_createdzNamespace._start_created-  r   r   c                 `    | j                  d      }| j                  dt        |      d       y )Nr   created_parsedTr   r   ry   s     r   _end_createdzNamespace._end_created0  s(    #

#[%74
Hr   c                 (    | j                  dd       y )Nexpiredr   rZ   r    s     r   _start_expirationdatezNamespace._start_expirationdate4  r   r   c                 \    | j                  dt        | j                  d            d       y )Nexpired_parsedr   Tr   )r   r   r@   r2   s    r   _end_expirationdatezNamespace._end_expirationdate7  s$    

#[)1D%EQU
Vr   c                     |j                  d      }|j                  d|j                  d            }|j                  d      }| j                  |||       | j                  dd       y )Ntermschemedomainlabelcategoryr   )r   _add_tagr;   )r   r   r   r   r   s        r   _start_categoryzNamespace._start_category:  sU    {{6"Xw{{8'<=G$dFE*		*a r   c                     | j                  d      }|sy | j                         }|d   }|rt        |      r|d   d   s	||d   d<   y | j                  |d d        y )Nr   tagsr$   r   )r@   r6   lenr   )r   rc   r=   r   s       r   _end_categoryzNamespace._end_categoryB  s_    $##%vSYtBx'7$DHVMM%t,r   c                 <    t        |      | j                         d<   y )Ncloud)r   r6   r    s     r   _start_cloudzNamespace._start_cloudN  s    '5g'>G$r   c                    |j                  dd       |d   dk(  r|j                  dd       n|j                  dd       | j                         }| j                  |      }d|v r| j                  |d         |d<   | j                  xs | j
                  xs | j                  }|j                  dg        | j
                  r| j                  s|d   j                  t        |             d|v rK|j                  d      dk(  r6| j                  |j                  d            | j                  v r	|d   |d	<   y y y | j                  d	|       y )
Nrel	alternater   typezapplication/atom+xml	text/htmlr%   linkslink)r8   r6   _enforce_hrefresolve_urir   r7   insourcer9   rL   r   r   map_content_type
html_typesr;   )r   r   r=   expecting_texts       r   r)   zNamespace._start_linkQ  s.   5+.5>V#v'=>v{3##%$$W-W"..wv?GFOEE7B'G##N7$;<WKK&+5--gkk&.ABdooU")&/ V 6
 IIfn-r   c                 &    | j                  d       y )Nr   )r@   r2   s    r   r*   zNamespace._end_linkh  s    r   c                 \    |j                  dd      dk(  | _        | j                  dd       y )Nispermalinktruer   r   )r   r   r;   r    s     r   _start_guidzNamespace._start_guidk  s'    ";;}f=G		$r   c                     | j                  d      }| j                  d| j                  xr d| j                         v       | j                  r| j                  d|       y y )Nr   r   r   )r@   r   r   r6   ry   s     r   	_end_guidzNamespace._end_guidp  sP    

<!VV4CTCTCV5VW?? JJvu% r   c                     | j                   r)| j                  dt        |j                                     S | j	                  d|d| j
                  xs | j                  xs | j                         y )Ntitler   )svgOKunknown_starttaglistitemsr   r   r7   r   r    s     r   _start_titlezNamespace._start_titley  sT    ::(($w}}2GHH'7L$++:f:fY]YfYfgr   c                 h    | j                   ry | j                  d      }|sy | j                  | _        y )Nr   )r   r   depthr:   ry   s     r   
_end_titlezNamespace._end_title~  s.    ::  )::r   c                     | j                         }d|v r%| j                  sd| _        | j                  |       y | j	                  d|d| j
                  xs | j                  xs | j                         y )Nsummarycontentdescriptionr   )r6   r   _summaryKey_start_contentr   r   r7   r   r<   s      r   _start_descriptionzNamespace._start_description  sd    ##%(D(mWk4;;CoRVR^R^Cobfbobopr   c                 x    | j                  d|d| j                  xs | j                  xs | j                         y )Nr   r   )r   r   r7   r   r    s     r   _start_abstractzNamespace._start_abstract  s/    -,@lt||@l_c_l_lmr   c                     | j                   dk(  r| j                          d | _         y | j                  d       d | _         y )Nr   r   r   _end_contentr   r2   s    r   _end_descriptionzNamespace._end_description  s>    y(   ]+r   c                 ,    | j                  d|dd       y )Ninfor   r   r   r    s     r   _start_infozNamespace._start_info  s    &'<;r   c                 &    | j                  d       y )Nr   r   r2   s    r   	_end_infozNamespace._end_info  s     r   c                     |r,| j                  |      }d|v r| j                  |d         |d<   t        |      | j                         d<   | j	                  dd       y )Nr%   generator_detail	generatorr   )r   r   r   r6   r;   r    s     r   _start_generatorzNamespace._start_generator  s\    ((1G "&"2"276?"C2@2I./		+q!r   c                 `    | j                  d      }| j                         }d|v r	||d   d<   y y )Nr  r  rY   )r@   r6   rb   s      r   _end_generatorzNamespace._end_generator  s;    %##%(27G&'/ )r   c                     | j                         }d|v r%| j                  sd| _        | j                  |       y d| _        | j	                  | j                  |dd       y )Nr   r   r   r   )r6   r   r   r   r   r<   s      r   _start_summaryzNamespace._start_summary  sV    ##%(D((Dd..qIr   c                     | j                   dk(  r| j                          d | _         y | j                  | j                   xs d       d | _         y )Nr   r   r   r2   s    r   _end_summaryzNamespace._end_summary  sI    y(   T--:;r   c                     | j                  |      }| j                         }d|d<   |j                  dg       j                  t	        |             y )N	enclosurer   r   )r   r6   r8   rL   r   r<   s      r   _start_enclosurezNamespace._start_enclosure  sI    $$W-##%$7B'..~g/FGr   c                 p    d|v r|d   | j                   d<   | j                  dd       d| _        d| _        y )Nurlr%   sourcer   r$   )
sourcedatar;   r   r:   r    s     r   _start_sourcezNamespace._start_source  s9    G&-enDOOF#		(Ar   c                     d| _         | j                  d      }|r|| j                  d<   t        j                  | j                        | j                         d<   | j                  j                          y )Nr   r  r   )r   r@   r  copydeepcopyr6   clearry   s     r   _end_sourcezNamespace._end_source  sX    "',DOOG$(,doo(FH%r   c                     d| _         | j                  d|dd       |j                  d      }|r|| j                  d<   | j	                  dd       y )Nr   r   r   src)r   r   r   contentparamsr;   )r   r   r  s      r   r   zNamespace._start_content  sL    )WlA>kk% (+Du%		)Qr   c                 ,    | j                  d|dd       y )Nr   zapplication/xhtml+xmlr   r   r    s     r   _start_bodyzNamespace._start_body  s    )W.EqIr   c                 :    d| _         | j                  d|dd       y )Nr   r   r   )r   r   r    s     r   _start_content_encodedz Namespace._start_content_encoded  s    )Wk1=r   c                     | j                  | j                  j                  d            dh| j                  z  v }| j	                  d      }|r| j                  d|       y y )Nr   r   r   r   )r   r  r   r   r   r   )r   copyToSummaryrc   s      r   r   zNamespace._end_content  s^    --d.@.@.D.DV.LMS_R`cgcrcrRrs  +JJy%( r   c                 (    | j                  dd       y )Nnewlocationr   rZ   r    s     r   _start_newlocationzNamespace._start_newlocation  s    		-#r   c                     | j                  d      }| j                         }|| j                  ury t        | j                  |j                               |d<   y )Nr"  )r@   r6   feeddatar   baseuristrip)r   r  r=   s      r   _end_newlocationzNamespace._end_newlocation  sH    hh}%##%$--'!7ciik!Rr   N)m__name__
__module____qualname____doc__supported_namespacesr   r!   r   r0   r3   	_end_feedr>   rA   rE   _start_textInputrG   _end_textInputrM   _start_managingeditorrP   _end_managingeditorrU   rW   r[   rd   rh   rn   rs   ru   rw   _start_homepage
_start_urirz   _end_homepage_end_urir}   r   r   _start_tagliner   _end_tagliner   _start_copyrightr   _end_copyrightr   _start_entryr   
_end_entryr   r   r   r   r   _start_issued_start_pubdater   _end_issued_end_pubdater   r&   _start_lastbuilddater   r(   _end_lastbuilddater   r   r   r   r   _start_keywordsr   _end_keywordsr   r)   r*   r   	_start_idr   _end_idr   r   r   r   r   _end_abstractr   !_start_feedburner_browserfriendlyr   _end_feedburner_browserfriendlyr  r  r  r
  r  r  r  r   r  _start_xhtml_bodyr  _start_fullitemr   	_end_body_end_xhtml_body_end_content_encoded_end_fullitemr#  r(   r   r   r   r   $   sv    +-13$&24)+$&!#"$ "$&')35 %*"&I" ( $N4 *# &$
$%& OJ2 MH3@$N% L>$# N
" L J!)"."$M%NK !K!L $O)C !M% I W! &O	- "M?.. I& Gh
&qn  %M<(3%!&/#"8J H  J#> -O) I"O' M$Sr   r   )	r  	datetimesr   urlsr   utilr   objectr   rP  r   r   <module>rU     s#   :  # ) !VS VSr   