o
    F'hÌf  ã                   @  sT  d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZmZ ddlmZ ddlmZmZmZ ddlmZ ddlmZ dd	lmZmZmZmZ e e¡Zej Z!G d
d„ de"ƒZ#G dd„ deƒZ$G dd„ deƒZ%G dd„ de"ƒZ&G dd„ de"ƒZ'G dd„ de(ƒZ)G dd„ de)ƒZ*G dd„ de)ƒZ+dd„ Z,dS )z.. include:: ../README.mdé    )ÚannotationsN)Ú	urlencodeÚurlparse)Úurlretrieve)ÚdatetimeÚ	timedeltaÚtimezone)Útimegm)ÚEnum)ÚDictÚ	GeneratorÚListÚOptionalc                   @  sr  e Zd ZU dZded< 	 ded< 	 ded< 	 ded< 	 ded	< 	 ded
< 	 ded< 	 ded< 	 ded< 	 ded< 	 ded< 	 ded< 	 ded< 	 ded< 	 eedg dddddg g dfdEdd„ZdFdd„ZdGdd „ZdGd!d"„Z	dHd$d%„Z
dGd&d'„ZdIdJd*d+„Z	,		-dKdLd1d2„Z	,		-dKdLd3d4„ZdMd5d6„ZdNd9d:„ZdOd=d>„ZG d?d@„ d@eƒZG dAdB„ dBeƒZG dCdD„ dDeƒZdS )PÚResultzÊ
    An entry in an arXiv query results feed.

    See [the arXiv API User's Manual: Details of Atom Results
    Returned](https://arxiv.org/help/api/user-manual#_details_of_atom_results_returned).
    ÚstrÚentry_idr   ÚupdatedÚ	publishedÚtitleúList[Author]ÚauthorsÚsummaryúOptional[str]ÚcommentÚjournal_refÚdoiÚprimary_categoryú	List[str]Ú
categoriesú
List[Link]ÚlinksÚpdf_urlúfeedparser.FeedParserDictÚ_rawÚ Nc                 C  s^   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	|| _
|| _t |¡| _|| _dS )z°
        Constructs an arXiv search result item.

        In most cases, prefer using `Result._from_feed_entry` to parsing and
        constructing `Result`s yourself.
        N)r   r   r   r   r   r   r   r   r   r   r   r    r   Ú_get_pdf_urlr!   r#   )Úselfr   r   r   r   r   r   r   r   r   r   r   r    r#   © r'   úDC:\Users\shubh\Videos\agent\nova\Lib\site-packages\arxiv/__init__.pyÚ__init__J   s   
zResult.__init__ÚentryÚreturnc                 C  s¶   t | dƒs
t d¡‚d}t | dƒr| j}nt d| j¡ t| jt | j¡t | j	¡t
 dd|¡dd„ | jD ƒ| j|  d	¡|  d
¡|  d¡| j d¡dd„ | jD ƒdd„ | jD ƒ| d�S )zk
        Converts a feedparser entry for an arXiv search result feed into a
        Result object.
        ÚidÚ0r   z7Result %s is missing title attribute; defaulting to '0'z\s+ú c                 S  ó   g | ]}t j |¡‘qS r'   )r   ÚAuthorÚ_from_feed_author)Ú.0Úar'   r'   r(   Ú
<listcomp>†   ó    z+Result._from_feed_entry.<locals>.<listcomp>Zarxiv_commentZarxiv_journal_refZ	arxiv_doiÚtermc                 S  s   g | ]}|  d ¡‘qS )r6   )Úget)r2   Útagr'   r'   r(   r4   Œ   s    c                 S  r/   r'   )r   ÚLinkÚ_from_feed_link©r2   Úlinkr'   r'   r(   r4   �   r5   )r   r   r   r   r   r   r   r   r   r   r   r    r#   )Úhasattrr   ÚMissingFieldErrorr   ÚloggerÚwarningr,   Ú_to_datetimeZupdated_parsedZpublished_parsedÚreÚsubr   r   r7   Zarxiv_primary_categoryÚtagsr    )r*   r   r'   r'   r(   Ú_from_feed_entryq   s*   





ózResult._from_feed_entryc                 C  ó   | j S ©N)r   ©r&   r'   r'   r(   Ú__str__‘   ó   zResult.__str__c                 C  sn   d  t| ƒt| jƒt| jƒt| jƒt| jƒt| jƒt| jƒt| j	ƒt| j
ƒt| jƒt| jƒt| jƒt| jƒ¡S )Nz�{}(entry_id={}, updated={}, published={}, title={}, authors={}, summary={}, comment={}, journal_ref={}, doi={}, primary_category={}, categories={}, links={}))ÚformatÚ
_classnameÚreprr   r   r   r   r   r   r   r   r   r   r   r    rH   r'   r'   r(   Ú__repr__”   s"   óüzResult.__repr__Úboolc                 C  s   t |tƒr| j|jkS dS ©NF)Ú
isinstancer   r   ©r&   Úotherr'   r'   r(   Ú__eq__©   s   
zResult.__eq__c                 C  s   | j  d¡d S )a;  
        Returns the short ID for this result.

        + If the result URL is `"https://arxiv.org/abs/2107.05580v1"`,
        `result.get_short_id()` returns `2107.05580v1`.

        + If the result URL is `"https://arxiv.org/abs/quant-ph/0201082v1"`,
        `result.get_short_id()` returns `"quant-ph/0201082v1"` (the pre-March
        2007 arXiv identifier format).

        For an explanation of the difference between arXiv's legacy and current
        identifiers, see [Understanding the arXiv
        identifier](https://arxiv.org/help/arxiv_identifier).
        zarxiv.org/abs/éÿÿÿÿ)r   ÚsplitrH   r'   r'   r(   Úget_short_id®   s   zResult.get_short_idÚpdfÚ	extensionc                 C  s6   | j r| j nd}d |  ¡  dd¡t dd|¡|g¡S )zK
        A default `to_filename` function for the extension given.
        ZUNTITLEDÚ.ú/Ú_z[^\w])r   ÚjoinrW   ÚreplacerB   rC   )r&   rY   Znonempty_titler'   r'   r(   Ú_get_default_filename¿   s   ýÿzResult._get_default_filenameú./úexport.arxiv.orgÚdirpathÚfilenameÚdownload_domainc                 C  s:   |s|   ¡ }tj ||¡}t | j|¡}t||ƒ\}}|S )z’
        Downloads the PDF for this result to the specified directory.

        The filename is generated by calling `to_filename(self)`.
        )r_   ÚosÚpathr]   r   Ú_substitute_domainr!   r   )r&   rb   rc   rd   rf   r!   Úwritten_pathr\   r'   r'   r(   Údownload_pdfÌ   s   zResult.download_pdfc           	      C  sH   |s|   d¡}tj ||¡}t | j|¡}| dd¡}t||ƒ\}}|S )z¥
        Downloads the source tarfile for this result to the specified
        directory.

        The filename is generated by calling `to_filename(self)`.
        ztar.gzz/pdf/z/src/)	r_   re   rf   r]   r   rg   r!   r^   r   )	r&   rb   rc   rd   rf   r!   Zsrc_urlrh   r\   r'   r'   r(   Údownload_sourceÞ   s   
zResult.download_sourcec                 C  sB   dd„ | D ƒ}t |ƒdkrdS t |ƒdkrt d|d ¡ |d S )zë
        Finds the PDF link among a result's links and returns its URL.

        Should only be called once for a given `Result`, in its constructor.
        After construction, the URL should be available in `Result.pdf_url`.
        c                 S  s   g | ]
}|j d kr|j‘qS ©rX   )r   Úhrefr;   r'   r'   r(   r4   ú   s    z'Result._get_pdf_url.<locals>.<listcomp>r   Né   z'Result has multiple PDF links; using %s)Úlenr?   r@   )r    Zpdf_urlsr'   r'   r(   r%   ó   s   zResult._get_pdf_urlÚtsútime.struct_timec                 C  s   t jt| ƒtjd�S )zè
        Converts a UTC time.struct_time into a time-zone-aware datetime.

        This will be replaced with feedparser functionality [when it becomes
        available](https://github.com/kurtmckee/feedparser/issues/212).
        )Útz)r   Úfromtimestampr	   r   Úutc)ro   r'   r'   r(   rA     s   zResult._to_datetimeÚurlÚdomainc                 C  s   t | ƒ}|j|d� ¡ S )z
        Replaces the domain of the given URL with the specified domain.

        This is useful for testing purposes.
        )Únetloc)r   Ú_replaceÚgeturl)rt   ru   Ú
parsed_urlr'   r'   r(   rg   
  s   zResult._substitute_domainc                   @  sN   e Zd ZU dZded< 	 ddd„Zdd	d
„Zddd„Zddd„Zddd„Z	dS )úResult.AuthorzJ
        A light inner class for representing a result's authors.
        r   Únamec                 C  s
   || _ dS )zÉ
            Constructs an `Author` with the specified name.

            In most cases, prefer using `Author._from_feed_author` to parsing
            and constructing `Author`s yourself.
            N©r{   )r&   r{   r'   r'   r(   r)     s   
zResult.Author.__init__Úfeed_authorr"   r+   c                 C  s   t  | j¡S )z°
            Constructs an `Author` with the name specified in an author object
            from a feed entry.

            See usage in `Result._from_feed_entry`.
            )r   r0   r{   )r}   r'   r'   r(   r1   $  s   zResult.Author._from_feed_authorc                 C  rF   rG   r|   rH   r'   r'   r(   rI   -  rJ   zResult.Author.__str__c                 C  ó   d  t| ƒt| jƒ¡S ©Nz{}({}))rK   rL   rM   r{   rH   r'   r'   r(   rN   0  ó   zResult.Author.__repr__rO   c                 C  ó   t |tjƒr| j|jkS dS rP   )rQ   r   r0   r{   rR   r'   r'   r(   rT   3  ó   zResult.Author.__eq__N)r{   r   )r}   r"   r+   rz   ©r+   r   ©r+   rO   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r)   r1   rI   rN   rT   r'   r'   r'   r(   r0     s   
 

	
	
r0   c                   @  st   e Zd ZU dZded< 	 ded< 	 ded< 	 ded< 	 			ddd	d
„Zddd„Zddd„Zddd„Zddd„Z	dS )úResult.LinkzH
        A light inner class for representing a result's links.
        r   rl   r   r   ÚrelÚcontent_typeNc                 C  s   || _ || _|| _|| _dS )zÉ
            Constructs a `Link` with the specified link metadata.

            In most cases, prefer using `Link._from_feed_link` to parsing and
            constructing `Link`s yourself.
            N©rl   r   r‹   rŒ   )r&   rl   r   r‹   rŒ   r'   r'   r(   r)   F  s   
zResult.Link.__init__Ú	feed_linkr"   r+   c                 C  s&   t j| j|  d¡|  d¡|  d¡d�S )z¯
            Constructs a `Link` with link metadata specified in a link object
            from a feed entry.

            See usage in `Result._from_feed_entry`.
            r   r‹   rŒ   r�   )r   r9   rl   r7   )rŽ   r'   r'   r(   r:   X  s   üzResult.Link._from_feed_linkc                 C  rF   rG   )rl   rH   r'   r'   r(   rI   f  rJ   zResult.Link.__str__c                 C  s.   d  t| ƒt| jƒt| jƒt| jƒt| jƒ¡S )Nz){}({}, title={}, rel={}, content_type={}))rK   rL   rM   rl   r   r‹   rŒ   rH   r'   r'   r(   rN   i  s   ûzResult.Link.__repr__rO   c                 C  r�   rP   )rQ   r   r9   rl   rR   r'   r'   r(   rT   r  r‚   zResult.Link.__eq__)NNN)rl   r   r   r   r‹   r   rŒ   r   )rŽ   r"   r+   rŠ   rƒ   r„   )
r…   r†   r‡   rˆ   r‰   r)   r:   rI   rN   rT   r'   r'   r'   r(   r9   8  s$   
 û


	r9   c                   @  s8   e Zd ZU dZded< 	 ded< 	 dd„ Zddd	„Zd
S )zResult.MissingFieldErrorzg
        An error indicating an entry is unparseable because it lacks required
        fields.
        r   Úmissing_fieldÚmessagec                 C  s   || _ d| _d S )Nz&Entry from arXiv missing required info)r�   r�   )r&   r�   r'   r'   r(   r)   ‚  s   
z!Result.MissingFieldError.__init__r+   c                 C  r~   r   )rK   rL   rM   r�   rH   r'   r'   r(   rN   †  r€   z!Result.MissingFieldError.__repr__Nrƒ   )r…   r†   r‡   rˆ   r‰   r)   rN   r'   r'   r'   r(   r>   w  s   
 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"   )r*   r"   r+   r   rƒ   r„   rk   )rY   r   r+   r   )r`   r$   ra   )rb   r   rc   r   rd   r   r+   r   )r    r   r+   r   )ro   rp   r+   r   )rt   r   ru   r   r+   r   )r…   r†   r‡   rˆ   r‰   Ú_DEFAULT_TIMEr)   rE   rI   rN   rT   rW   r_   ri   rj   r%   rA   rg   Úobjectr0   r9   Ú	Exceptionr>   r'   r'   r'   r(   r      s~   
 ò
'
 


üü


		%?r   c                   @  s   e Zd ZdZdZdZdZdS )ÚSortCriterionzÒ
    A SortCriterion identifies a property by which search results can be
    sorted.

    See [the arXiv API User's Manual: sort order for return
    results](https://arxiv.org/help/api/user-manual#sort).
    Z	relevanceZlastUpdatedDateZsubmittedDateN)r…   r†   r‡   rˆ   Ú	RelevanceZLastUpdatedDateZSubmittedDater'   r'   r'   r(   r”   Š  s
    r”   c                   @  s   e Zd ZdZdZdZdS )Ú	SortOrderzô
    A SortOrder indicates order in which search results are sorted according
    to the specified arxiv.SortCriterion.

    See [the arXiv API User's Manual: sort order for return
    results](https://arxiv.org/help/api/user-manual#sort).
    Z	ascendingZ
descendingN)r…   r†   r‡   rˆ   Z	AscendingÚ
Descendingr'   r'   r'   r(   r–   ˜  s    r–   c                   @  sˆ   e Zd ZU dZded< 	 ded< 	 ded< 	 ded	< 	 d
ed< 	 dg dejejfddd„Z	ddd„Z
ddd„Zd dd„Zd!d"dd„ZdS )#ÚSearchz¦
    A specification for a search of arXiv's database.

    To run a search, use `Search.run` to use a default client or `Client.run`
    with a specific client.
    r   Úqueryr   Úid_listú
int | NoneÚmax_resultsr”   Úsort_byr–   Ú
sort_orderr$   Nc                 C  s0   || _ || _|tjkrdn|| _|| _|| _dS )zM
        Constructs an arXiv API search with the specified criteria.
        N)r™   rš   ÚmathÚinfrœ   r�   rž   )r&   r™   rš   rœ   r�   rž   r'   r'   r(   r)   Ë  s
   
zSearch.__init__r+   c                 C  ó   t | ƒS rG   ©rM   rH   r'   r'   r(   rI   Ý  ó   zSearch.__str__c              	   C  s6   d  t| ƒt| jƒt| jƒt| jƒt| jƒt| jƒ¡S )NzC{}(query={}, id_list={}, max_results={}, sort_by={}, sort_order={}))rK   rL   rM   r™   rš   rœ   r�   rž   rH   r'   r'   r(   rN   á  s   úzSearch.__repr__úDict[str, str]c                 C  s    | j d | j¡| jj| jjdœS )zx
        Returns a dict of search parameters that should be included in an API
        request for this search.
        ú,)Zsearch_queryrš   ZsortByZ	sortOrder)r™   r]   rš   r�   Úvaluerž   rH   r'   r'   r(   Ú	_url_argsë  s
   
üzSearch._url_argsr   ÚoffsetÚintúGenerator[Result, None, None]c                 C  s    t jdtdd� tƒ j| |d�S )zÞ
        Executes the specified search using a default arXiv API client. For info
        on default behavior, see `Client.__init__` and `Client.results`.

        **Deprecated** after 2.0.0; use `Client.results`.
        zGThe 'Search.results' method is deprecated, use 'Client.results' insteadé   )Ú
stacklevel)r¨   )ÚwarningsÚwarnÚDeprecationWarningÚClientÚresults)r&   r¨   r'   r'   r(   r±   ÷  s   ýzSearch.results)
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—   r)   rI   rN   r§   r±   r'   r'   r'   r(   r˜   ¥  s,   
 	ú



r˜   c                   @  s    e Zd ZU dZdZ	 ded< 	 ded< 	 ded< 	 ded	< d
ed< d/d0dd„Zd1dd„Zd1dd„Zd2d3dd„Z	d2d3dd„Z
d4d!d"„Z	d5d6d)d*„Zd7d,d-„Zd.S )8r°   zœ
    Specifies a strategy for fetching results from arXiv's API.

    This class obscures pagination and retry logic, and exposes
    `Client.results`.
    z%https://export.arxiv.org/api/query?{}r©   Ú	page_sizeÚfloatÚdelay_secondsÚnum_retriesr   Ú_last_request_dtzrequests.SessionÚ_sessionéd   ç      @é   c                 C  s&   || _ || _|| _d| _t ¡ | _dS )ag  
        Constructs an arXiv API client with the specified options.

        Note: the default parameters should provide a robust request strategy
        for most use cases. Extreme page sizes, delays, or retries risk
        violating the arXiv [API Terms of Use](https://arxiv.org/help/api/tou),
        brittle behavior, and inconsistent results.
        N)r³   rµ   r¶   r·   ÚrequestsÚSessionr¸   )r&   r³   rµ   r¶   r'   r'   r(   r)   (  s
   	zClient.__init__r+   r   c                 C  r¡   rG   r¢   rH   r'   r'   r(   rI   7  r£   zClient.__str__c                 C  ó&   d  t| ƒt| jƒt| jƒt| jƒ¡S )Nz2{}(page_size={}, delay_seconds={}, num_retries={}))rK   rL   rM   r³   rµ   r¶   rH   r'   r'   r(   rN   ;  s   üzClient.__repr__r   Úsearchr˜   r¨   rª   c                 C  s<   |j r|j | nd}|r|dk rtdƒS t |  ||¡|¡S )ab  
        Uses this client configuration to fetch one page of the search results
        at a time, yielding the parsed `Result`s, until `max_results` results
        have been yielded or there are no more search results.

        If all tries fail, raises an `UnexpectedEmptyPageError` or `HTTPError`.

        Setting a nonzero `offset` discards leading records in the result set.
        When `offset` is greater than or equal to `search.max_results`, the full
        result set is discarded.

        For more on using generators, see
        [Generators](https://wiki.python.org/moin/Generators).
        Nr   r'   )rœ   ÚiterÚ	itertoolsÚisliceÚ_results)r&   r¿   r¨   Úlimitr'   r'   r(   r±   C  s   zClient.resultsc                 c  sî   � |   ||| j¡}| j|dd�}|jst d¡ d S t|jjƒ}t dt	|jƒ|¡ |jru|jD ]#}zt
 |¡V  W q0 t
jyS } zt d|¡ W Y d }~q0d }~ww |t	|jƒ7 }||krad S |   ||| j¡}| j|dd�}|js-d S d S )NT)Ú
first_pagez)Got empty first page; stopping generationz&Got first page: %d of %d total resultszSkipping partial result: %sF)Ú_format_urlr³   Ú_parse_feedÚentriesr?   Úinfor©   ÚfeedZopensearch_totalresultsrn   r   rE   r>   r@   )r&   r¿   r¨   Úpage_urlrÊ   Útotal_resultsr*   Úer'   r'   r(   rÃ   W  s4   €
ý
€ÿözClient._resultsÚstartc                 C  s(   |  ¡ }| ||dœ¡ | j t|ƒ¡S )zŽ
        Construct a request API for search that returns up to `page_size`
        results starting with the result at index `start`.
        )rÎ   rœ   )r§   ÚupdateÚquery_url_formatrK   r   )r&   r¿   rÎ   r³   Zurl_argsr'   r'   r(   rÆ   p  s   þÿzClient._format_urlTrt   rÅ   rO   Ú
_try_indexr"   c              
   C  s€   z	| j |||d�W S  tttjjfy? } z%|| jk r2t d||¡ | j	|||d d�W  Y d}~S t d||¡ |‚d}~ww )z¼
        Fetches the specified URL and parses it with feedparser.

        If a request fails or is unexpectedly empty, retries the request up to
        `self.num_retries` times.
        )rÅ   Ú	try_indexzGot error (try %d): %srm   )rÅ   rÑ   NzGiving up (try %d): %s)
Ú_Client__try_parse_feedÚ	HTTPErrorÚUnexpectedEmptyPageErrorr¼   Ú
exceptionsÚConnectionErrorr¶   r?   ÚdebugrÇ   )r&   rt   rÅ   rÑ   Úerrr'   r'   r(   rÇ   ~  s   	ý
 €÷zClient._parse_feedrÒ   c           	      C  sæ   | j dur't| jd�}t ¡ | j  }||k r'||  ¡ }t d|¡ t 	|¡ t d|||¡ | j
j|ddid�}t ¡ | _ |jtjjkrLt|||jƒ‚t |j¡}t|jƒdkra|sat|||ƒ‚|jrqt d	d
|v rn|jnd¡ |S )zà
        Recursive helper for _parse_feed. Enforces `self.delay_seconds`: if that
        number of seconds has not passed since `_parse_feed` was last called,
        sleeps until delay_seconds seconds have passed.
        N)ÚsecondszSleeping: %f secondsz(Requesting page (first: %r, try: %d): %sz
user-agentzarxiv.py/2.2.0)Úheadersr   z Bozo feed; consider handling: %sÚbozo_exception)r·   r   rµ   r   ÚnowÚtotal_secondsr?   rÉ   ÚtimeÚsleepr¸   r7   Ústatus_coder¼   ÚcodesÚOKrÔ   Ú
feedparserÚparseÚcontentrn   rÈ   rÕ   Zbozor@   rÜ   )	r&   rt   rÅ   rÒ   ÚrequiredZsince_last_requestZto_sleepÚresprÊ   r'   r'   r(   Z__try_parse_feed”  s*   


þzClient.__try_parse_feedN)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   )Tr   )rt   r   rÅ   rO   rÑ   r©   r+   r"   )rt   r   rÅ   rO   rÒ   r©   r+   r"   )r…   r†   r‡   rˆ   rÐ   r‰   r)   rI   rN   r±   rÃ   rÆ   rÇ   rÓ   r'   r'   r'   r(   r°     s*   
 


ÿr°   c                      sL   e Zd ZU dZded< 	 ded< 	 ded< 	 d‡ fdd„Zdd
d„Z‡  ZS )Ú
ArxivErrorz$This package's base Exception class.r   rt   r©   Úretryr�   c                   s$   || _ || _|| _tƒ  | j¡ dS )zZ
        Constructs an `ArxivError` encountered while fetching the specified URL.
        N)rt   rê   r�   Úsuperr)   )r&   rt   rê   r�   ©Ú	__class__r'   r(   r)   É  s   zArxivError.__init__r+   c                 C  s   d  | j| j¡S )Nz{} ({}))rK   r�   rt   rH   r'   r'   r(   rI   Ò  s   zArxivError.__str__)rt   r   rê   r©   r�   r   rƒ   )r…   r†   r‡   rˆ   r‰   r)   rI   Ú__classcell__r'   r'   rì   r(   ré   ¼  s   
 	ré   c                      s8   e Zd ZU dZded< 	 d‡ fdd	„Zddd„Z‡  ZS )rÕ   a  
    An error raised when a page of results that should be non-empty is empty.

    This should never happen in theory, but happens sporadically due to
    brittleness in the underlying arXiv API; usually resolved by retries.

    See `Client.results` for usage.
    r"   Úraw_feedrt   r   rê   r©   c                   s    || _ || _tƒ  ||d¡ dS )z}
        Constructs an `UnexpectedEmptyPageError` encountered for the specified
        API URL after `retry` tries.
        z&Page of results was unexpectedly emptyN)rt   rï   rë   r)   )r&   rt   rê   rï   rì   r'   r(   r)   æ  s   z!UnexpectedEmptyPageError.__init__r+   c                 C  r¾   ©Nz{}({}, {}, {}))rK   rL   rM   rt   rê   rï   rH   r'   r'   r(   rN   ï  ó   ÿz!UnexpectedEmptyPageError.__repr__)rt   r   rê   r©   rï   r"   rƒ   ©r…   r†   r‡   rˆ   r‰   r)   rN   rî   r'   r'   rì   r(   rÕ   Ö  s   
 		rÕ   c                      s8   e Zd ZU dZded< 	 d‡ fdd„Zdd
d„Z‡  ZS )rÔ   zm
    A non-200 status encountered while fetching a page of results.

    See `Client.results` for usage.
    r©   Ústatusrt   r   rê   c                   s(   || _ || _tƒ  ||d | j¡¡ dS )z�
        Constructs an `HTTPError` for the specified status code, encountered for
        the specified API URL after `retry` tries.
        z Page request resulted in HTTP {}N)rt   ró   rë   r)   rK   )r&   rt   rê   ró   rì   r'   r(   r)   ÿ  s   
ýzHTTPError.__init__r+   c                 C  r¾   rð   )rK   rL   rM   rt   rê   ró   rH   r'   r'   r(   rN     rñ   zHTTPError.__repr__)rt   r   rê   r©   ró   r©   rƒ   rò   r'   r'   rì   r(   rÔ   õ  s   
 rÔ   c                 C  s   d  | jj¡S )zAA helper function for use in __repr__ methods: arxiv.Result.Link.zarxiv.{})rK   rí   r‡   )Úor'   r'   r(   rL     s   rL   )-rˆ   Ú
__future__r   Úloggingrß   rÁ   rä   re   rŸ   rB   r¼   r­   Úurllib.parser   r   Úurllib.requestr   r   r   r   Úcalendarr	   Úenumr
   Útypingr   r   r   r   Ú	getLoggerr…   r?   Úminr‘   r’   r   r”   r–   r˜   r°   r“   ré   rÕ   rÔ   rL   r'   r'   r'   r(   Ú<module>   s>    
  pa 7