관리-도구
편집 파일: decoder.cpython-311.pyc
� P�Dg] � � � d Z ddlZddlmZmZmZmZmZ ddlZn # e $ r dZY nw xY wddl mZ ddlm Z ddlmZ G d� d� � ZdS ) zl maxminddb.decoder ~~~~~~~~~~~~~~~~~ This package contains code for decoding the MaxMind DB data section. � N)�cast�Dict�List�Tuple�Union��InvalidDatabaseError)� FileBuffer)�Recordc �r � e Zd ZdZ d deedef dededd fd �Z dedede ee ef fd �Z dedede eef fd�Zdedede eef fd�Zdedede eef fd�Zdedede eef fd�Zdedede eef fd�Zdedede eeef ef fd�Zdedede eef fd�Zdedede eef fd�Zdedede eef fd�Zeeeeeeeeeee eed� Zdede eef fd�Zdede eef fd�Zedededd fd�� � Zdededede eef fd�Zd S )!�Decoderz.Decoder for the data section of the MaxMind DBr F�database_bufferz mmap.mmap�pointer_base�pointer_test�returnNc �0 � || _ || _ || _ dS )a Created a Decoder for a MaxMind DB Arguments: database_buffer -- an mmap'd MaxMind DB file. pointer_base -- the base number to use when decoding a pointer pointer_test -- used for internal unit testing of pointer code N)� _pointer_test�_buffer� _pointer_base)�selfr r r s �q/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/maxminddb/decoder.py�__init__zDecoder.__init__ s! � � *���&���)����� �size�offsetc � � g }t |� � D ]/}| � |� � \ }}|� |� � �0||fS �N)�range�decode�append)r r r �array�_�values r � _decode_arrayzDecoder._decode_array, sP � ����t��� � �A�"�k�k�&�1�1�O�U�F��L�L�������f�}�r c � � |dk |fS )Nr � )r r r s r �_decode_booleanzDecoder._decode_boolean3 s � ��q�y�&� � r c �. � ||z }| j ||� |fS r )r �r r r � new_offsets r � _decode_byteszDecoder._decode_bytes6 s"