
    !}gB                     N    d dl Z ddlmZ ddlmZ ddlmZ  G d de          ZdS )    N   )_parse_date)make_safe_absolute_uri)FeedParserDictc                   Z   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 ZldHS )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                             d          s]|                    dd          }|                    |          }|r	|| _         d S |                    d	          r	d
| _         d S d| _         d S d S )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        [/var/www/py-google-trends/myenv/lib/python3.11/site-packages/feedparser/namespaces/_base.py
_start_rsszNamespace._start_rss<   s    	
 

 | 	%4<#:#:5#A#A 	%";;y"55L nn\22G %&((.. %&$	% 	%    c                 >    d| _         |                     |           d S )N   )infeed_cdf_commonr   r   s     r   _start_channelzNamespace._start_channelQ   s#    !!!!!r   c                    d|v r?|                      i            |d         | j        d         d<   |                                  d|v rA|                     i            |d         | j        d         d<   |                                  d S d S )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        s>|                    d          }|                    |          }|r	|| _        d S d| _        d S d S )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11L nn\22G &&%	& 	&r   c                     d| _         d S )Nr   )r   r   s    r   _end_channelzNamespace._end_channell   s    r   c                     |                                  }| j        s"|                    dt                                 d| _        d| _        |                     dd           d S )Nimager   r$   r   )_get_contextinentry
setdefaultr   inimagetitle_depthpushr   r   contexts      r   _start_imagezNamespace._start_imagep   sb    ##%%| 	:w(8(8999		'1r   c                 >    |                      d           d| _        d S )Nr5   r   )popr9   r2   s    r   
_end_imagezNamespace._end_imagex   s    r   c                     |                                  }|                    dt                                 d| _        d| _        |                     dd           d S )N	textinputr   r$   r   )r6   r8   r   intextinputr:   r;   r<   s      r   _start_textinputzNamespace._start_textinput|   sY    ##%%;(8(8999		+q!!!!!r   c                 >    |                      d           d| _        d S )NrC   r   )r@   rD   r2   s    r   _end_textinputzNamespace._end_textinput   s"    r   c                     d| _         |                     dd           |                                 }|                    dg            |d                             t                                 d S )Nr   authorauthors)inauthorr;   r6   r8   appendr   r<   s      r   _start_authorzNamespace._start_author   si    		(A##%%9b)))	!!."2"233333r   c                 f    |                      d           d| _        |                                  d S )NrI   r   )r@   rK   _sync_author_detailr2   s    r   _end_authorzNamespace._end_author   s3      """""r   c                     d| _         |                                 }|                    dg            |d                             t	                                 |                     dd           d S )Nr   contributorscontributorr   )incontributorr6   r8   rL   r   r;   r<   s      r   _start_contributorzNamespace._start_contributor   sj    ##%%>2...&&~'7'7888		-#####r   c                 >    |                      d           d| _        d S )NrS   r   )r@   rT   r2   s    r   _end_contributorzNamespace._end_contributor   s"    r   c                 2    |                      dd           d S )Nnamer   r;   r    s     r   _start_namezNamespace._start_name       		&!r   c                 0   |                      d          }| j        r|                     d|d           d S | j        r|                     d|           d S | j        r|                     d|           d S | j        r|                                 }||d<   d S d S )NrY   	publisher)r@   inpublisher_save_authorrK   rT   _save_contributorrD   r6   r   valuer=   s      r   	_end_namezNamespace._end_name   s       	$fe[99999] 	$fe,,,,, 	$""6511111 	$''))G#GFOOO	$ 	$r   c                 2    |                      dd           d S Nwidthr   rZ   r    s     r   _start_widthzNamespace._start_width       		'1r   c                     |                      d          }	 t          |          }n# t          $ r d}Y nw xY w| j        r|                                 }||d<   d S d S rf   r@   int
ValueErrorr9   r6   rb   s      r   
_end_widthzNamespace._end_width   s~    !!	JJEE 	 	 	EEE	< 	%''))G$GG	% 	%   ' 66c                 2    |                      dd           d S Nheightr   rZ   r    s     r   _start_heightzNamespace._start_height   s    		(Ar   c                     |                      d          }	 t          |          }n# t          $ r d}Y nw xY w| j        r|                                 }||d<   d S d S rq   rk   rb   s      r   _end_heightzNamespace._end_height   s~    ""	JJEE 	 	 	EEE	< 	&''))G %GH	& 	&ro   c                 2    |                      dd           d S )Nr%   r   rZ   r    s     r   
_start_urlzNamespace._start_url   r\   r   c                     |                      d          }| j        r|                     d|           d S | j        r|                     d|           d S d S )Nr%   )r@   rK   r`   rT   ra   r   rc   s     r   _end_urlzNamespace._end_url   sj      = 	2fe,,,,, 	2""6511111	2 	2r   c                 2    |                      dd           d S )Nemailr   rZ   r    s     r   _start_emailzNamespace._start_email   ri   r   c                     |                      d          }| j        r|                     d|d           d S | j        r|                     d|           d S | j        r|                     d|           d S d S )Nr|   r^   )r@   r_   r`   rK   rT   ra   ry   s     r   
_end_emailzNamespace._end_email   s    !! 	3guk:::::] 	3gu----- 	3""7E22222	3 	3r   c                 6    |                      d|dd           d S )Nsubtitle
text/plainr   push_contentr    s     r   _start_subtitlezNamespace._start_subtitle   s"    *g|Q?????r   c                 0    |                      d           d S )Nr   pop_contentr2   s    r   _end_subtitlezNamespace._end_subtitle   s    $$$$$r   c                 6    |                      d|dd           d S )Nrightsr   r   r   r    s     r   _start_rightszNamespace._start_rights   s"    (G\1=====r   c                 0    |                      d           d S )Nr   r   r2   s    r   _end_rightszNamespace._end_rights   s    """""r   c                 4   | j                             t                                 |                     dd           d| _        d| _        d| _        |                     |d          }|r|                                 }||d<   | 	                    |           d S )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   s    N,,---		&!  +66 	''))GGDM!!!!!r   c                 L    |                      d           d| _        d| _        d S )Nr   r   )r@   r7   
hasContentr2   s    r   	_end_itemzNamespace._end_item  s&    r   c                 2    |                      dd           d S )Nlanguager   rZ   r    s     r   _start_languagezNamespace._start_language	  s    		*a     r   c                 :    |                      d          | _        d S )Nr   )r@   langr2   s    r   _end_languagezNamespace._end_language  s    HHZ((			r   c                 2    |                      dd           d S )Nr^   r   rZ   r    s     r   _start_webmasterzNamespace._start_webmaster      		+q!!!!!r   c                 Z    |                      d           |                     d           d S )Nr^   )r@   rO   r2   s    r   _end_webmasterzNamespace._end_webmaster  s.      -----r   c                 2    |                      dd           d S )N	publishedr   rZ   r    s     r   _start_publishedzNamespace._start_published  r   r   c                 z    |                      d          }|                     dt          |          d           d S )Nr   published_parsedT	overwriter@   _saver   ry   s     r   _end_publishedzNamespace._end_published  s:    %%

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

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

#[%7%74
HHHHHr   c                 2    |                      dd           d S )Nexpiredr   rZ   r    s     r   _start_expirationdatezNamespace._start_expirationdate4  r   r   c                 v    |                      dt          |                     d                    d           d S )Nexpired_parsedr   Tr   )r   r   r@   r2   s    r   _end_expirationdatezNamespace._end_expirationdate7  s6    

#[)1D1D%E%EQU
VVVVVr   c                    |                     d          }|                     d|                     d                    }|                     d          }|                     |||           |                     dd           d S )Ntermschemedomainlabelcategoryr   )r   _add_tagr;   )r   r   r   r   r   s        r   _start_categoryzNamespace._start_category:  ss    {{6""Xw{{8'<'<==G$$dFE***		*a     r   c                     |                      d          }|sd S |                                 }|d         }|r*t          |          r|d         d         s||d         d<   d S |                     |d d            d S )Nr   tagsr$   r   )r@   r6   lenr   )r   rc   r=   r   s       r   _end_categoryzNamespace._end_categoryB  s    $$ 	F##%%v 	-SYY 	-tBx'7 	-$DHVMM%t,,,,,r   c                 N    t          |          |                                 d<   d S )Ncloud)r   r6   r    s     r   _start_cloudzNamespace._start_cloudN  s&    '5g'>'>G$$$r   c                    |                     dd           |d         dk    r|                     dd           n|                     dd           |                                 }|                     |          }d|v r|                     |d                   |d<   | j        p| j        p| j        }|                     dg            | j        r| j        s(|d                             t          |                     d|v rY|
                    d          dk    r<|                     |
                    d                    | j        v r|d         |d	<   d S d S d S |                     d	|           d S )
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33##%%$$W--W"..wv??GFOEE7B''' 	= 	=G##N7$;$;<<<WKK&&+55--gkk&.A.ABBdoUU")&/ 65UU IIfn-----r   c                 0    |                      d           d S )Nr   )r@   r2   s    r   r*   zNamespace._end_linkh  s    r   c                 p    |                     dd          dk    | _        |                     dd           d S )Nispermalinktruer   r   )r   r   r;   r    s     r   _start_guidzNamespace._start_guidk  s6    ";;}f==G		$r   c                     |                      d          }|                     d| j        od|                                 v           | j        r|                     d|           d S d S )Nr   r   r   )r@   r   r   r6   ry   s     r   	_end_guidzNamespace._end_guidp  sm    

<!VV4CTCTCVCV5VWWW? 	& JJvu%%%%%	& 	&r   c                     | j         r5|                     dt          |                                                    S |                     d|d| j        p| j        p| j                   d S )Ntitler   )svgOKunknown_starttaglistitemsr   r   r7   r   r    s     r   _start_titlezNamespace._start_titley  se    : 	I(($w}}2G2GHHH'7L$+:f:fY]Yfgggggr   c                 b    | j         rd S |                     d          }|sd S | j        | _        d S )Nr   )r   r   depthr:   ry   s     r   
_end_titlezNamespace._end_title~  sA    : 	F  )) 	F:r   c                     |                                  }d|v r%| j        sd| _        |                     |           d S |                     d|d| j        p| j        p| j                   d S )Nsummarycontentdescriptionr   )r6   r   _summaryKey_start_contentr   r   r7   r   r<   s      r   _start_descriptionzNamespace._start_description  s{    ##%%(D(((((mWk4;CoRVR^Cobfbopppppr   c                 \    |                      d|d| j        p| j        p| j                   d S )Nr   r   )r   r   r7   r   r    s     r   _start_abstractzNamespace._start_abstract  s4    -,@lt|@l_c_lmmmmmr   c                 ~    | j         dk    r|                                  n|                     d           d | _         d S )Nr   r   r   _end_contentr   r2   s    r   _end_descriptionzNamespace._end_description  sG    y((]+++r   c                 6    |                      d|dd           d S )Ninfor   r   r   r    s     r   _start_infozNamespace._start_info  s"    &'<;;;;;r   c                 0    |                      d           d S )Nr   r   r2   s    r   	_end_infozNamespace._end_info  s         r   c                     |r7|                      |          }d|v r|                     |d                   |d<   t          |          |                                 d<   |                     dd           d S )Nr%   generator_detail	generatorr   )r   r   r   r6   r;   r    s     r   _start_generatorzNamespace._start_generator  s}     	D((11G  "&"2"276?"C"C2@2I2I./		+q!!!!!r   c                 z    |                      d          }|                                 }d|v r||d         d<   d S d S )Nr  r  rY   )r@   r6   rb   s      r   _end_generatorzNamespace._end_generator  sM    %%##%%((27G&'/// )(r   c                     |                                  }d|v r%| j        sd| _        |                     |           d S d| _        |                     | j        |dd           d S )Nr   r   r   r   )r6   r   r   r   r   r<   s      r   _start_summaryzNamespace._start_summary  sr    ##%%(D((((((Dd.qIIIIIr   c                     | j         dk    r|                                  n|                     | j         pd           d | _         d S )Nr   r   r   r2   s    r   _end_summaryzNamespace._end_summary  sO    y((T-:;;;r   c                     |                      |          }|                                 }d|d<   |                    dg                               t	          |                     d S )N	enclosurer   r   )r   r6   r8   rL   r   r<   s      r   _start_enclosurezNamespace._start_enclosure  sa    $$W--##%%$7B''..~g/F/FGGGGGr   c                 v    d|v r|d         | j         d<   |                     dd           d| _        d| _        d S )Nurlr%   sourcer   r$   )
sourcedatar;   r   r:   r    s     r   _start_sourcezNamespace._start_source  sF    G&-enDOF#		(Ar   c                     d| _         |                     d          }|r
|| j        d<   t          j        | j                  |                                 d<   | j                                         d S )Nr   r  r   )r   r@   r  copydeepcopyr6   clearry   s     r   _end_sourcezNamespace._end_source  sj    "" 	-',DOG$(,do(F(FH%r   c                     d| _         |                     d|dd           |                    d          }|r
|| j        d<   |                     dd           d S )Nr   r   r   src)r   r   r   contentparamsr;   )r   r   r  s      r   r   zNamespace._start_content  sc    )WlA>>>kk%   	,(+Du%		)Qr   c                 6    |                      d|dd           d S )Nr   zapplication/xhtml+xmlr   r   r    s     r   _start_bodyzNamespace._start_body  s#    )W.EqIIIIIr   c                 D    d| _         |                     d|dd           d S )Nr   r   r   )r   r   r    s     r   _start_content_encodedz Namespace._start_content_encoded  s)    )Wk1=====r   c                     |                      | j                            d                    dh| j        z  v }|                     d          }|r|                     d|           d S d S )Nr   r   r   r   )r   r  r   r   r   r   )r   copyToSummaryrc   s      r   r   zNamespace._end_content  sw    --d.@.D.DV.L.LMMS_R`cgcrRrs  ++ 	)JJy%(((((	) 	)r   c                 2    |                      dd           d S )Nnewlocationr   rZ   r    s     r   _start_newlocationzNamespace._start_newlocation  s    		-#####r   c                     |                      d          }|                                 }|| j        urd S t          | j        |                                          |d<   d S )Nr"  )r@   r6   feeddatar   baseuristrip)r   r  r=   s      r   _end_newlocationzNamespace._end_newlocation  sZ    hh}%%##%%$-''F!7ciikk!R!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   $   sT         +-13$&24)+$&!#"$ "$&')35  % % %*" " "  & & &  I    " " " (   $N4 4 4 *# # # &$ $ $    
$ 
$ 
$  % % %  & & &   OJ2 2 2 MH  3 3 3@ @ @$N% % % L> > >$# # # N
" 
" 
" L   J! ! !) ) )" " ". . ." " "$M%NK K K !K!L     $O)C C C !M%     I I I     W W W! ! ! &O	- 	- 	- "M? ? ?. . ..     I& & & Gh h h
& & &q q qn n n      %M< < <(3%! ! !&/#" " "8 8 8J J J     H H H            J J J#> > > -O) ) ) I"O' M$ $ $S S S S Sr   r   )	r  	datetimesr   urlsr   utilr   objectr   rP  r   r   <module>rU     s   :  # # # # # # ) ) ) ) ) ) ! ! ! ! ! !VS VS VS VS VS VS VS VS VS VSr   