Server IP : 85.214.239.14 / Your IP : 18.118.27.199 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /srv/modoboa/env/lib64/python3.5/site-packages/dns/ |
Upload File : |
import sys import decimal from decimal import Context PY3 = sys.version_info[0] == 3 PY2 = sys.version_info[0] == 2 if PY3: long = int xrange = range else: long = long # pylint: disable=long-builtin xrange = xrange # pylint: disable=xrange-builtin # unicode / binary types if PY3: text_type = str binary_type = bytes string_types = (str,) unichr = chr def maybe_decode(x): return x.decode() def maybe_encode(x): return x.encode() def maybe_chr(x): return x def maybe_ord(x): return x else: text_type = unicode # pylint: disable=unicode-builtin, undefined-variable binary_type = str string_types = ( basestring, # pylint: disable=basestring-builtin, undefined-variable ) unichr = unichr # pylint: disable=unichr-builtin def maybe_decode(x): return x def maybe_encode(x): return x def maybe_chr(x): return chr(x) def maybe_ord(x): return ord(x) def 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 """ d = Context( prec=len(str(long(what))), # round to integer with max precision rounding=decimal.ROUND_HALF_UP ).create_decimal(str(what)) # str(): python 2.6 compat return long(d)