File: //opt/alt/python38/lib64/python3.8/site-packages/maxminddb/__pycache__/__init__.cpython-38.pyc
U
�Ʊ^ � @ s� d dl Z d dlZzd dlZW n ek
r6 de_Y nX d dlmZmZm Z m
Z
mZmZ d dl
mZ efdd�Zdd� ZdZd Zd
ZdZdZdS )
� N)� MODE_AUTO� MODE_MMAP�
MODE_MMAP_EXT� MODE_FILE�MODE_MEMORY�MODE_FD)�InvalidDatabaseErrorc C sp t jott jd�}|tkr|s&|tkr>|s2td��t j�| �S |tttt t
fkr^t j�| |�S td�|���dS )a Open a Maxmind DB database
Arguments:
database -- A path to a valid MaxMind DB file such as a GeoIP2 database
file, or a file descriptor in the case of MODE_FD.
mode -- mode to open the database with. Valid mode are:
* MODE_MMAP_EXT - use the C extension with memory map.
* MODE_MMAP - read from memory map. Pure Python.
* MODE_FILE - read database as standard file. Pure Python.
* MODE_MEMORY - load database into memory. Pure Python.
* MODE_FD - the param passed via database is a file descriptor, not
a path. This mode implies MODE_MEMORY.
* MODE_AUTO - tries MODE_MMAP_EXT, MODE_MMAP, MODE_FILE in that
order. Default mode.
�ReaderzEMODE_MMAP_EXT requires the maxminddb.extension module to be availablezUnsupported open mode: {0}N)
� maxminddb� extension�hasattrr r �
ValueErrorr r r r r �reader�format)�database�modeZ
has_extension� r �E/opt/alt/python38/lib64/python3.8/site-packages/maxminddb/__init__.py�
open_database s �r c C s t | �S )zBThis exists for backwards compatibility. Use open_database instead)r )r r r r r 2 s r r
z1.5.4zGregory OschwaldzApache License, Version 2.0z!Copyright 2013-2019 Maxmind, Inc.)�osZmaxminddb.readerr
Zmaxminddb.extension�ImportErrorr Zmaxminddb.constr r r r r r Zmaxminddb.decoderr r r � __title__�__version__�
__author__�__license__�
__copyright__r r r r �<module> s