ó
    Ö›‘hÇ  ã                   óŽ   • S r SSKJr  SSKJrJr  SSKJrJr  SSK	J
r
  SSKJr  SSKJr  S rS	 r " S
 S\R"                  5      rg)z
hosts(5) support.
é    )Údefer)ÚisIPAddressÚisIPv6Address)ÚcommonÚdns)Úfailure)ÚnativeString)ÚFilePathc                 ó&  • / n U R                  5       R                  5       nUR                  5       nU H±  nUR	                  S5      nUS:w  a  USU nU(       d  M(  UR                  5       nUR                  5       USS  Vs/ s H  owR                  5       PM     sn;   d  Mo   [        US   5      n[        U5      (       d  [        U5      (       d  M   UR                  U5        M³     U$ ! [         a    Us $ f = fs  snf ! [         a     MÛ  f = f)a�  
Search the given file, which is in hosts(5) standard format, for addresses
associated with a given name.

@param hostsFile: The name of the hosts(5)-format file to search.
@type hostsFile: L{FilePath}

@param name: The name to search for.
@type name: C{bytes}

@return: L{None} if the name is not found in the file, otherwise a
    C{str} giving the address in the file associated with the name.
ó   #éÿÿÿÿNé   r   )Ú
getContentÚ
splitlinesÚBaseExceptionÚlowerÚfindÚsplitr	   Ú
ValueErrorr   r   Úappend)	Ú	hostsFileÚnameÚresultsÚlinesÚlineÚidxÚpartsÚsÚmaybeIPs	            ÚWC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/names/hosts.pyÚsearchFileForAllr!      sþ   € ð €GðØ×$Ñ$Ó&×1Ñ1Ó3ˆð �:‰:‹<€DÛˆØ�i‰i˜‹oˆØ�"‹9Ø˜˜�:ˆDÞÙØ—
‘
“ˆà�:‰:‹<¨u°Q°R©yÓ9ªy¨!ŸG™GžI©yÑ9Õ9ðÜ& u¨Q¡xÓ0�ô ˜7×#Ñ#¤}°W×'=Ó'=Ø—‘˜wÖ'ñ ð €Nøô' ó ØŠðüò :øô ó Úðús)   „C+ ÂC=Â$DÃ+C:Ã9C:Ä
DÄDc                 óF   • [        [        U 5      U5      nU(       a  US   $ g)aŠ  
Grep given file, which is in hosts(5) standard format, for an address
entry with a given name.

@param file: The name of the hosts(5)-format file to search.
@type file: C{str} or C{bytes}

@param name: The name to search for.
@type name: C{bytes}

@return: L{None} if the name is not found in the file, otherwise a
    C{str} giving the first address in the file associated with
    the name.
r   N)r!   r
   )Úfiler   Ú	addressess      r    ÚsearchFileForr%   9   s$   € ô !¤¨$£°Ó6€IÞØ˜‰|ÐØó    c                   óL   • \ rS rSrSrSS jrS rS rS rSS jr	SS	 jr
\	rS
rg)ÚResolveréN   z1
A resolver that services hosts(5) format files.
c                 óZ   • [         R                  R                  U 5        Xl        X l        g ©N)r   ÚResolverBaseÚ__init__r#   Úttl)Úselfr#   r.   s      r    r-   ÚResolver.__init__S   s    € Ü×Ñ×$Ñ$ TÔ*ØŒ	Ø�r&   c                 ól   ^ ^• [        UU 4S j[        [        T R                  5      T5       5       5      $ )z^
Return a tuple of L{dns.RRHeader} instances for all of the IPv4
addresses in the hosts file.
c              3   ó  >#   • U  Hv  n[        U5      (       d  M  [        R                  " T[        R                  [        R                  TR
                  [        R                  " UTR
                  5      5      v •  Mx     g 7fr+   )r   r   ÚRRHeaderÚAÚINr.   ÚRecord_A©Ú.0Úaddrr   r/   s     €€r    Ú	<genexpr>Ú%Resolver._aRecords.<locals>.<genexpr>]   sR   øé € ð 
âC�Ü˜4× ó VŒC�LŠL˜œsŸu™u¤c§f¡f¨d¯h©h¼¿ºÀTÈ4Ï8É8Ó8T×UÐUÚCùó   ƒB›A&B©Útupler!   r
   r#   ©r/   r   s   ``r    Ú	_aRecordsÚResolver._aRecordsX   s/   ù€ ô
 õ 
ä(¬°$·)±)Ó)<¸dÔCó
ó 
ð 	
r&   c                 ól   ^ ^• [        UU 4S j[        [        T R                  5      T5       5       5      $ )z^
Return a tuple of L{dns.RRHeader} instances for all of the IPv6
addresses in the hosts file.
c              3   ó  >#   • U  Hv  n[        U5      (       d  M  [        R                  " T[        R                  [        R                  TR
                  [        R                  " UTR
                  5      5      v •  Mx     g 7fr+   )r   r   r3   ÚAAAAr5   r.   ÚRecord_AAAAr7   s     €€r    r:   Ú(Resolver._aaaaRecords.<locals>.<genexpr>h   s\   øé € ð 
ò D�Ü˜T×"ó	ŒC�LŠLØ”c—h‘h¤§¡¨¯©´#·/²/À$ÈÏÉÓ2Q÷ð ò Dùr<   r=   r?   s   ``r    Ú_aaaaRecordsÚResolver._aaaaRecordsc   s1   ù€ ô
 õ 
ô )¬°$·)±)Ó)<¸dÔCó	
ó 
ð 	
r&   c                 ó¾   • U(       a  [         R                  " USS45      $ [         R                  " [        R                  " [
        R                  " U5      5      5      $ )aö  
Generate a response for the given name containing the given result
records, or a failure if there are no result records.

@param name: The DNS name the response is for.
@type name: C{str}

@param records: A tuple of L{dns.RRHeader} instances giving the results
    that will go into the response.

@return: A L{Deferred} which will fire with a three-tuple of result
    records, authority records, and additional records, or which will
    fail with L{dns.DomainError} if there are no result records.
© )r   ÚsucceedÚfailr   ÚFailurer   ÚDomainError)r/   r   Úrecordss      r    Ú_respondÚResolver._respondp   s>   € ö Ü—=’= '¨2¨rÐ!2Ó3Ð3Ü�zŠzœ'Ÿ/š/¬#¯/ª/¸$Ó*?Ó@ÓAÐAr&   Nc                 ón   • [         R                  " U5      nU R                  XR                  U5      5      $ )zU
Read any IPv4 addresses from C{self.file} and return them as
L{Record_A} instances.
)r   ÚdomainStringrP   r@   ©r/   r   Útimeouts      r    ÚlookupAddressÚResolver.lookupAddressƒ   s,   € ô
 ×Ò Ó%ˆØ�}‰}˜T§>¡>°$Ó#7Ó8Ð8r&   c                 ón   • [         R                  " U5      nU R                  XR                  U5      5      $ )zX
Read any IPv6 addresses from C{self.file} and return them as
L{Record_AAAA} instances.
)r   rS   rP   rG   rT   s      r    ÚlookupIPV6AddressÚResolver.lookupIPV6Address‹   s.   € ô
 ×Ò Ó%ˆØ�}‰}˜T×#4Ñ#4°TÓ#:Ó;Ð;r&   )r#   r.   )s
   /etc/hostsi  r+   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r-   r@   rG   rP   rV   rY   ÚlookupAllRecordsÚ__static_attributes__rJ   r&   r    r(   r(   N   s.   † ñôò
	
ò
òBô&9ô<ð %Ór&   r(   N)r_   Útwisted.internetr   Útwisted.internet.abstractr   r   Útwisted.namesr   r   Útwisted.pythonr   Útwisted.python.compatr	   Útwisted.python.filepathr
   r!   r%   r,   r(   rJ   r&   r    Ú<module>rh      s=   ðñ
õ
 #ß @ß %Ý "Ý .Ý ,ò$òNô*I%ˆv×"Ñ"õ I%r&   