ó
    ]š‘h·$  ã                   óØ   • S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SSKJr  S	/r SSKrS
r\SS/-  r1 Skr " S S\5      r " S S5      rg! \ a    Sr N$f = f)aU  
This module houses the GeoIP2 object, a wrapper for the MaxMind GeoIP2(R)
Python API (https://geoip2.readthedocs.io/). This is an alternative to the
Python GeoIP2 interface provided by MaxMind.

GeoIP(R) is a registered trademark of MaxMind, Inc.

For IP-based geolocation, this module requires the GeoLite2 Country and City
datasets, in binary format (CSV will not work!). The datasets may be
downloaded from MaxMind at https://dev.maxmind.com/geoip/geoip2/geolite2/.
Grab GeoLite2-Country.mmdb.gz and GeoLite2-City.mmdb.gz, and unzip them in the
directory corresponding to settings.GEOIP_PATH.
é    N)Úsettings)ÚValidationError)Úvalidate_ipv46_address)Úto_path)ÚRemovedInDjango60Warning)Úcached_propertyÚ
HAS_GEOIP2TÚGeoIP2ÚGeoIP2ExceptionF>   úGeoIP2-CityúGeoLite2-CityúDBIP-City-LiteúGeoIP2-CountryúGeoLite2-CountryúDBIP-Country-Litec                   ó   • \ rS rSrSrg)r   é1   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    Ú]C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\django/contrib/gis/geoip2.pyr   r   1   s   † Úr   c                   óâ   • \ rS rSrSrSrSrSrSr\	" \\\\\45      r
SrSrSS jrS	 rS
 r\S 5       r\S 5       r\S 5       rSS.S jrS rS rS rS rSS jrS rS rS r\S 5       rSrg)r
   é5   r   é   é   é   é   Nc                 ó$  • X R                   ;  a  [        SU-  5      eU=(       d    [        [        SS5      nU=(       d    [        [        SS5      nU=(       d    [        [        SS5      nU(       d  [        S5      e[	        U5      nXU-  X-  4 HB  nUR                  5       (       d  M  Xl        [        R                  R                  XS	9U l
          O   [        S
5      eU R                  R                  nU[        ;  a  [        SU 35      eg)aÁ  
Initialize the GeoIP object. No parameters are required to use default
settings. Keyword arguments may be passed in to customize the locations
of the GeoIP datasets.

* path: Base directory to where GeoIP data is located or the full path
    to where the city or country data files (*.mmdb) are located.
    Assumes that both the city and country data sets are located in
    this directory; overrides the GEOIP_PATH setting.

* cache: The cache settings when opening up the GeoIP datasets. May be
    an integer in (0, 1, 2, 4, 8) corresponding to the MODE_AUTO,
    MODE_MMAP_EXT, MODE_MMAP, MODE_FILE, and MODE_MEMORY,
    `GeoIPOptions` C API settings,  respectively. Defaults to 0,
    meaning MODE_AUTO.

* country: The name of the GeoIP country data file. Defaults to
    'GeoLite2-Country.mmdb'; overrides the GEOIP_COUNTRY setting.

* city: The name of the GeoIP city data file. Defaults to
    'GeoLite2-City.mmdb'; overrides the GEOIP_CITY setting.
z Invalid GeoIP caching option: %sÚ
GEOIP_PATHNÚ
GEOIP_CITYzGeoLite2-City.mmdbÚGEOIP_COUNTRYzGeoLite2-Country.mmdbzDGeoIP path must be provided via parameter or the GEOIP_PATH setting.)Úmodez@Path must be a valid database or directory containing databases.z#Unable to handle database edition: )Úcache_optionsr   Úgetattrr   r   Úis_fileÚ_pathÚgeoip2ÚdatabaseÚReaderÚ_readerÚ	_metadataÚdatabase_typeÚSUPPORTED_DATABASE_TYPES)ÚselfÚpathÚcacheÚcountryÚcityr0   s         r   Ú__init__ÚGeoIP2.__init__H   s  € ð. ×*Ñ*Ó*Ü!Ð"DÀuÑ"LÓMÐMà×<”wœx¨°tÓ<ˆØ×L”wœx¨Ð7KÓLˆØ×XœW¤X¨Ð@WÓXˆæÜ!ØVóð ô �t‹}ˆð  $™;¨©Ó7ˆDØ�|‰|�~‹~Ø!”
Ü%Ÿ™×5Ñ5°dÐ5ÐG�”Ùñ	 8ô "ØRóð ð Ÿ™×4Ñ4ˆØÔ 8Ó8Ü!Ð$GÈÀÐ"WÓXÐXð 9r   c                 ó\   • U R                   (       a  U R                   R                  5         g g ©N)r.   Úclose©r2   s    r   Ú__del__ÚGeoIP2.__del__|   s   € à�<�<Ø�L‰L×ÑÕ ð r   c                 ó¦   • U R                   nSUR                   SUR                   3nSU R                  R                   SU SU R
                   S3$ )NÚvÚ.Ú<z [z	] _path='z'>)r/   Úbinary_format_major_versionÚbinary_format_minor_versionÚ	__class__r   r*   )r2   ÚmÚversions      r   Ú__repr__ÚGeoIP2.__repr__�   sU   € Ø�N‰NˆØ�a×3Ñ3Ð4°A°a×6SÑ6SÐ5TÐUˆØ�4—>‘>×*Ñ*Ð+¨2¨g¨Y°iÀÇ
Á
¸|È2ÐNÐNr   c                 ó6   • U R                   R                  5       $ r:   )r.   Úmetadatar<   s    r   r/   ÚGeoIP2._metadata†   s   € à�|‰|×$Ñ$Ó&Ð&r   c                 ó4   • SU R                   R                  ;   $ )NÚCity©r/   r0   r<   s    r   Úis_cityÚGeoIP2.is_cityŠ   s   € à˜Ÿ™×5Ñ5Ñ5Ð5r   c                 ó4   • SU R                   R                  ;   $ )NÚCountryrO   r<   s    r   Ú
is_countryÚGeoIP2.is_countryŽ   s   € à˜DŸN™N×8Ñ8Ñ8Ð8r   F©Úrequire_cityc                ó$  • [        U[        [        R                  [        R                  45      (       d!  [        S[        U5      R                  -  5      eU(       a)  U R                  (       d  [        SU R                   35      e[        U[        5      (       a   [        U5        U R                  (       a  U R                  R                   OU R                  R"                  nU" U5      $ ! [         a    [        R                  " U5      n Ngf = f)NzSGeoIP query must be a string or instance of IPv4Address or IPv6Address, not type %szInvalid GeoIP city data file: )Ú
isinstanceÚstrÚ	ipaddressÚIPv4AddressÚIPv6AddressÚ	TypeErrorÚtyper   rP   r   r*   r   r   ÚsocketÚgethostbynamer.   r6   r5   )r2   ÚqueryrW   Úfunctions       r   Ú_queryÚGeoIP2._query’   sÑ   € Ü˜%¤#¤y×'<Ñ'<¼i×>SÑ>SÐ!T×UÑUÜð+Ü-1°%«[×-AÑ-AñBóð ö
  §§Ü!Ð$BÀ4Ç:Á:À,Ð"OÓPÐPä�eœS×!Ñ!ð4Ü& uÔ-ð
 )-¯¯�4—<‘<×$Ò$¸$¿,¹,×:NÑ:NˆÙ˜‹Ðøô #ó 4ä×,Ò,¨UÓ3’ð4ús   ÂC, Ã, DÄDc                 óF  • U R                  USS9nUR                  (       a  UR                  S   OSn0 SUR                  R                  _SUR                  R
                  _SUR                  R                  _SUR                  R
                  _S	UR                  R                  _S
UR                  R
                  _SUR                  R                  _SUR                  R                  _SUR                  R                  _SUR                  R                  _SUR                  R                  _SU(       a  UR                  OS_SU(       a  UR
                  OS_SUR                  R                  _SUR                  R                  _SU(       a  UR                  _$ S_$ )z¥
Return a dictionary of city information for the given IP address or
Fully Qualified Domain Name (FQDN). Some information in the dictionary
may be undefined (None).
TrV   r   NÚaccuracy_radiusr6   Úcontinent_codeÚcontinent_nameÚcountry_codeÚcountry_nameÚis_in_european_unionÚlatitudeÚ	longitudeÚ
metro_codeÚpostal_codeÚregion_codeÚregion_nameÚ	time_zoneÚdma_codeÚregion)rd   ÚsubdivisionsÚlocationrg   r6   ÚnameÚ	continentÚcoder5   Úiso_coderl   rm   rn   ro   Úpostalrs   )r2   rb   Úresponseru   s       r   r6   ÚGeoIP2.city¦   s³  € ð —;‘;˜u°4�;Ð8ˆØ-5×-B×-B�×&Ñ& qÒ)Èˆð
Ø˜x×0Ñ0×@Ñ@ð
à�H—M‘M×&Ñ&ð
ð ˜h×0Ñ0×5Ñ5ð
ð ˜h×0Ñ0×5Ñ5ð	
ð
 ˜H×,Ñ,×5Ñ5ð
ð ˜H×,Ñ,×1Ñ1ð
ð # H×$4Ñ$4×$IÑ$Ið
ð ˜×)Ñ)×2Ñ2ð
ð ˜×*Ñ*×4Ñ4ð
ð ˜(×+Ñ+×6Ñ6ð
ð ˜8Ÿ?™?×/Ñ/ð
ð ®f˜6Ÿ?š?¸$ð
ð ®&˜6Ÿ;š;°dð
ð ˜×*Ñ*×4Ñ4ð
ð  ˜×)Ñ)×4Ñ4ð!
ð" ®�f—o‘oð#
ð 	
ð" 6:ð#
ð 	
r   c                 ó*   • U R                  U5      S   $ )z9Return the country code for the given IP Address or FQDN.rj   ©r5   ©r2   rb   s     r   rj   ÚGeoIP2.country_codeÂ   ó   € à�|‰|˜EÓ" >Ñ2Ð2r   c                 ó*   • U R                  U5      S   $ )z9Return the country name for the given IP Address or FQDN.rk   r€   r�   s     r   rk   ÚGeoIP2.country_nameÆ   rƒ   r   c                 óú   • U R                  USS9nUR                  R                  UR                  R                  UR                  R
                  UR                  R                  UR                  R                  S.$ )zÄ
Return a dictionary with the country code and name when given an
IP address or a Fully Qualified Domain Name (FQDN). For example, both
'24.124.1.80' and 'djangoproject.com' are valid parameters.
FrV   )rh   ri   rj   rk   rl   )rd   ry   rz   rx   r5   r{   rl   )r2   rb   r}   s      r   r5   ÚGeoIP2.countryÊ   sk   € ð —;‘;˜u°5�;Ð9ˆà&×0Ñ0×5Ñ5Ø&×0Ñ0×5Ñ5Ø$×,Ñ,×5Ñ5Ø$×,Ñ,×1Ñ1Ø$,×$4Ñ$4×$IÑ$Iñ
ð 	
r   c                 ó„   ^• [         R                  " S[        SS9  U R                  U5      m[	        U4S jU 5       5      $ )Nz<GeoIP2.coords() is deprecated. Use GeoIP2.lon_lat() instead.r   ©Ú
stacklevelc              3   ó.   >#   • U  H
  nTU   v •  M     g 7fr:   r   )Ú.0ÚoÚdatas     €r   Ú	<genexpr>Ú GeoIP2.coords.<locals>.<genexpr>à   s   øé € Ð/¢h �T˜!–W¢hùs   ƒ)ÚwarningsÚwarnr   r6   Útuple)r2   rb   ÚorderingrŽ   s      @r   ÚcoordsÚGeoIP2.coordsÙ   s9   ø€ Ü�ŠØJÜ$Øò	
ð
 �y‰y˜ÓˆÜÔ/¡hÓ/Ó/Ð/r   c                 ó8   • U R                  U5      nUS   US   4$ )z@Return a tuple of the (longitude, latitude) for the given query.rn   rm   ©r6   ©r2   rb   rŽ   s      r   Úlon_latÚGeoIP2.lon_latâ   s%   € à�y‰y˜ÓˆØ�KÑ  $ zÑ"2Ð2Ð2r   c                 ó8   • U R                  U5      nUS   US   4$ )z@Return a tuple of the (latitude, longitude) for the given query.rm   rn   r˜   r™   s      r   Úlat_lonÚGeoIP2.lat_lonç   s%   € à�y‰y˜ÓˆØ�JÑ  kÑ!2Ð2Ð2r   c                 ó:   • SSK Jn  U" U R                  U5      SS9$ )z/Return a GEOS Point object for the given query.r   )ÚPointiæ  )Úsrid)Údjango.contrib.gis.geosr    rš   )r2   rb   r    s      r   ÚgeosÚGeoIP2.geosì   s   € õ 	2á�T—\‘\ %Ó(¨tÑ4Ð4r   c                 óL   • [         R                  " S[        SS9  [        X5      $ )Nz2GeoIP2.open() is deprecated. Use GeoIP2() instead.r   r‰   )r‘   r’   r   r
   )ÚclsÚ	full_pathr4   s      r   ÚopenÚGeoIP2.openó   s$   € ä�ŠØ@Ü$Øò	
ô
 �iÓ'Ð'r   )r*   r.   )Nr   NN))rn   rm   ) r   r   r   r   Ú	MODE_AUTOÚMODE_MMAP_EXTÚ	MODE_MMAPÚ	MODE_FILEÚMODE_MEMORYÚ	frozensetr'   r*   r.   r7   r=   rH   r   r/   rP   rT   rd   r6   rj   rk   r5   r•   rš   r�   r£   Úclassmethodr¨   r   r   r   r   r
   r
   5   sÕ   † ð €Ià€Mà€Ià€Ià€KÙØ	�M 9¨i¸ÐEó€Mð €EØ€Gô2Yòh!ò
Oð
 ñ'ó ð'ð ñ6ó ð6ð ñ9ó ð9ð -2õ ò(
ò83ò3ò
ô0ò3ò
3ò
5ð ñ(ó ó(r   )Ú__doc__r[   r`   r‘   Údjango.confr   Údjango.core.exceptionsr   Údjango.core.validatorsr   Údjango.utils._osr   Údjango.utils.deprecationr   Údjango.utils.functionalr   Ú__all__Úgeoip2.databaser+   r	   ÚImportErrorr1   Ú	Exceptionr   r
   r   r   r   Ú<module>r¼      sƒ   ðñó Û Û å  Ý 2Ý 9Ý $Ý =Ý 3àˆ.€ð-Ûð €JØ�Ð+Ð,Ñ,€Gò
Ð ô	�iô 	÷E(ò E(øð/ ó Ø‚Jðús   ·A ÁA)Á(A)