AlkantarClanX12
Current Path : /lib/python3.6/site-packages/dns/__pycache__/ |
Current File : //lib/python3.6/site-packages/dns/__pycache__/rdata.cpython-36.pyc |
3 �b�W�: � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddl Zddl ZddlZddlm Z mZmZ dZefdd�ZdZefd d �Zed�Zdd � Zdd� ZG dd� de�ZG dd� de�Zi ZdZdd� Zddd�Zddd�ZdS )a� DNS rdata. @var _rdata_modules: A dictionary mapping a (rdclass, rdtype) tuple to the module which implements that type. @type _rdata_modules: dict @var _module_prefix: The prefix to use when forming modules names. The default is 'dns.rdtypes'. Changing this value will break the library. @type _module_prefix: string @var _hex_chunk: At most this many octets that will be represented in each chunk of hexstring that _hexify() produces before whitespace occurs. @type _hex_chunk: int� )�BytesION� )�xrange�string_types� text_type� c s4 t j| ��dj� �fdd�tdt��� �D ��j� S )a Convert a binary string into its hex encoding, broken up into chunks of I{chunksize} characters separated by a space. @param data: the binary string @type data: string @param chunksize: the chunk size. Default is L{dns.rdata._hex_chunksize} @rtype: string � c s g | ]}�||� � �qS � r )�.0�i)� chunksize�liner �/usr/lib/python3.6/rdata.py� <listcomp>6 s z_hexify.<locals>.<listcomp>r )�binasciiZhexlify�join�range�len�decode)�datar r )r r r �_hexify+ s r c s4 t j| ��dj� �fdd�tdt��� �D ��j� S )a$ Convert a binary string into its base64 encoding, broken up into chunks of I{chunksize} characters separated by a space. @param data: the binary string @type data: string @param chunksize: the chunk size. Default is L{dns.rdata._base64_chunksize} @rtype: string r c s g | ]}�||� � �qS r r )r r )r r r r r I s z_base64ify.<locals>.<listcomp>r )�base64Z b64encoder r r r )r r r )r r r � _base64ify= s r s "\c C s~ t | t�r| j� } t | t�s$t| �} d}xP| D ]H}|tkrL|dt|� 7 }q.|dkrj|dk rj|t|�7 }q.|d| 7 }q.W |S )z�Escape the characters in a quoted string which need it. @param qstring: the string @type qstring: string @returns: the escaped string @rtype: string � �\r � z\%03d)� isinstancer �encode� bytearray� __escaped�chr)Zqstring�text�cr r r � _escapifyO s r# c C sF x8t t| �d dd�D ] }| | dkr| d|d � S qW | dd� S )z�Determine the index of greatest byte that isn't all zeros, and return the bitmap that contains all the bytes less than that index. @param what: a string of octets representing a bitmap. @type what: string @rtype: string r r ���r$ )r r )Zwhatr r r r �_truncate_bitmaph s r% c @ s� e Zd ZdZddgZdd� Zdd� Zdd � Zd.dd �Zd/dd�Z d0dd�Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zed1d(d)��Zed2d*d+��Zd3d,d-�Zd S )4�Rdataz(Base class for all DNS rdata types. �rdclass�rdtypec C s || _ || _dS )z�Initialize an rdata. @param rdclass: The rdata class @type rdclass: int @param rdtype: The rdata type @type rdtype: int N)r'