|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /lib/python2.7/site-packages/pygeoip/ |
Upload File : |
�
p�\c @ s2 d Z d Z d d l Z d d l Z d d l Z d d l m Z d d l m Z y d d l Z Wn e
k
ry d Z n Xd d l m
Z
m Z d d l m Z m Z d d l m Z e r� e n e Z e j Z e j Z e j Z e j Z d e f d
� � YZ d e f d � � YZ d
e f d � � YZ d S( s�
Copyright (c) 2010-2014 Jennifer Ennis, William Tisäter.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
s 0.3.2i����N( t floor( t Lock( t utilt const( t PY2t PY3( t time_zone_by_country_and_regiont
GeoIPErrorc B s e Z d Z RS( s\
Thin wrapper of `Exception`, will be thrown in case of an
unrecoverable error.
( t __name__t
__module__t __doc__( ( ( s3 /tmp/pip-install-yqhNPm/pygeoip/pygeoip/__init__.pyR - s t _GeoIPMetaclassc B s e Z i Z e � Z d � Z RS( c O s� t | � d k r | d } n d | k r8 | d } n d S| j d t � sg t t | � j | | � SzE | j j � | | j k r� t t | � j | | � | j | <n Wd | j j
� X| j | S( s�
Singleton method to gets an instance without reparsing
the database, the filename is being used as cache key.
i t filenamet cacheN( t lent Nonet gett Truet superR t __call__t _instance_lockt acquiret
_instancest release( t clst argst kwargsR ( ( s3 /tmp/pip-install-yqhNPm/pygeoip/pygeoip/__init__.pyR 9 s
)( R R R R R R ( ( ( s3 /tmp/pip-install-yqhNPm/pygeoip/pygeoip/__init__.pyR 5 s t GeoIPc B s e Z e Z e e d � Z d � Z d � Z d � Z d � Z
d � Z d � Z d � Z
d � Z d � Z d
� Z d � Z d � Z d
� Z d � Z d � Z d � Z d � Z e Z e Z e Z e Z d � Z d � Z d � Z d � Z d � Z d � Z! RS( c C s~ t � | _ | | _ d | _ | j t j @ri t d k ri d d l } | j d � | j t j M_ n | j t j @r� t
j | d t � } t j
} t j | j � d d | �| _ d | _ | j � n� | j t j @r-t
j | d t � } | j � | _ t j | j � | _ d | _ | j � n! t
j | d t � | _ d | _ z | j j � | j � Wd | j j � Xd S(
s�
Create and return an GeoIP instance.
:arg filename: File path to a GeoIP database
:arg flags: Flags that affect how the database is processed.
Currently supported flags are STANDARD (default),
MEMORY_CACHE (preload the whole file into memory) and
MMAP_CACHE (access the file via mmap)
:arg cache: Used in tests to skip instance caching
i����Ns/ MMAP_CACHE cannot be used without a mmap modulet rbi t accesst
MMAP_CACHEt MEMORY_CACHEt STANDARD( R t _lockt _flagsR t _netmaskR R t mmapt warningst warnt codecst opent ENCODINGt ACCESS_READt filenot _fpt _typet closeR t readt _memoryR t str2fpR t _setup_segmentsR ( t selfR t flagsR
R% t fR ( ( s3 /tmp/pip-install-yqhNPm/pygeoip/pygeoip/__init__.pyt __init__U s2
!
c C s� t j | _ t j | _ t j | _ | j j � } | j j d t
j � xDt t j
� D]3} t d � d } | j j d � } t r� t | � t k r� | j t � } n t r� | j t � } t | � t k r� | j t � } q� n | | k rv| j j d � } t | � | _ | j d k r5| j d 8_ n | j t j k rVt j | _ n| j t j k rwt j | _ n� | j t j t j t j t j t j t j! t j"