dnspython  1.16.0
About: dnspython is a DNS toolkit (for Python 2.x) that supports almost all record types.
  Fossies Dox: dnspython-1.16.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

dns._compat Namespace Reference


def maybe_decode (x)
def maybe_encode (x)
def maybe_chr (x)
def maybe_ord (x)
def round_py2_compat (what)


int PY3 = 3
int PY2 = 2
 long = int
 xrange = range
 text_type = str
 binary_type = bytes
tuple string_types = (str,)
 unichr = chr

Function Documentation

◆ maybe_chr()

def dns._compat.maybe_chr (   x)

Definition at line 26 of file _compat.py.

Referenced by dns._compat.maybe_ord(), and dns.rdtypes.IN.APL.APLItem.to_wire().

◆ maybe_decode()

◆ maybe_encode()

def dns._compat.maybe_encode (   x)

Definition at line 24 of file _compat.py.

Referenced by dns.tsigkeyring.from_text(), and dns._compat.maybe_ord().

◆ maybe_ord()

def dns._compat.maybe_ord (   x)

◆ round_py2_compat()

def dns._compat.round_py2_compat (   what)
Python 2 and Python 3 use different rounding strategies in round(). This
function ensures that results are python2/3 compatible and backward
compatible with previous py2 releases
:param what: float
:return: rounded long

Definition at line 47 of file _compat.py.

References dns._compat.long.

Referenced by dns.rdtypes.ANY.LOC._float_to_tuple().

Variable Documentation

◆ binary_type

dns._compat.binary_type = bytes

Definition at line 19 of file _compat.py.

Referenced by dns.entropy.EntropyPool.random_8(), and dns.wiredata.WireData.unwrap().

◆ long

◆ PY2

int dns._compat.PY2 = 2

Definition at line 6 of file _compat.py.

◆ PY3

int dns._compat.PY3 = 3

Definition at line 5 of file _compat.py.

◆ string_types

tuple dns._compat.string_types = (str,)

Definition at line 20 of file _compat.py.

◆ text_type

dns._compat.text_type = str

Definition at line 18 of file _compat.py.

◆ unichr

dns._compat.unichr = chr

Definition at line 21 of file _compat.py.

Referenced by dns.name.from_unicode().

◆ xrange