Beispiel #1
0
import sys
import time

import eventlet
from eventlet import event
import logging as std_logging
from oslo.config import cfg

from ripcord.openstack.common import eventlet_backdoor
from ripcord.openstack.common.gettextutils import _  # noqa
from ripcord.openstack.common import importutils
from ripcord.openstack.common import log as logging
from ripcord.openstack.common import threadgroup


rpc = importutils.try_import('ripcord.openstack.common.rpc')
CONF = cfg.CONF
LOG = logging.getLogger(__name__)


def _sighup_supported():
    return hasattr(signal, 'SIGHUP')


def _is_sighup(signo):
    return _sighup_supported() and signo == signal.SIGHUP


def _signo_to_signame(signo):
    signals = {signal.SIGTERM: 'SIGTERM',
               signal.SIGINT: 'SIGINT'}
Beispiel #2
0
import inspect
import itertools
import json
try:
    import xmlrpclib
except ImportError:
    # NOTE(jd): xmlrpclib is not shipped with Python 3
    xmlrpclib = None

import six

from ripcord.openstack.common import gettextutils
from ripcord.openstack.common import importutils
from ripcord.openstack.common import timeutils

netaddr = importutils.try_import("netaddr")

_nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod,
                     inspect.isfunction, inspect.isgeneratorfunction,
                     inspect.isgenerator, inspect.istraceback, inspect.isframe,
                     inspect.iscode, inspect.isbuiltin, inspect.isroutine,
                     inspect.isabstract]

_simple_types = (six.string_types + six.integer_types
                 + (type(None), bool, float))


def to_primitive(value, convert_instances=False, convert_datetime=True,
                 level=0, max_depth=3):
    """Convert a complex object into primitives.