コード例 #1
0
    try:
        import simplejson as json
    except ImportError:
        import json
else:
    import json

import six
import six.moves.xmlrpc_client as xmlrpclib

from vnfsvc.openstack.common import gettextutils
from vnfsvc.openstack.common import importutils
from vnfsvc.openstack.common import strutils
from vnfsvc.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,
コード例 #2
0
except ImportError:
    # Python 2.6
    UnsupportedOperation = None

import eventlet
from eventlet import event
from oslo_config import cfg

from vnfsvc.openstack.common import eventlet_backdoor
from vnfsvc.openstack.common.gettextutils import _LE, _LI, _LW
from vnfsvc.openstack.common import importutils
from vnfsvc.openstack.common import log as logging
from vnfsvc.openstack.common import systemd
from vnfsvc.openstack.common import threadgroup

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


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


def _is_daemon():
    # The process group for a foreground process will match the
    # process group of the controlling terminal. If those values do
    # not match, or ioctl() fails on the stdout file handle, we assume
    # the process is running in the background as a daemon.
    # http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics
    try:
コード例 #3
0
ファイル: service.py プロジェクト: hemanthnakkina/vnfsvc
    # Python 2.6
    UnsupportedOperation = None

import eventlet
from eventlet import event
from oslo.config import cfg

from vnfsvc.openstack.common import eventlet_backdoor
from vnfsvc.openstack.common.gettextutils import _LE, _LI, _LW
from vnfsvc.openstack.common import importutils
from vnfsvc.openstack.common import log as logging
from vnfsvc.openstack.common import systemd
from vnfsvc.openstack.common import threadgroup


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


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


def _is_daemon():
    # The process group for a foreground process will match the
    # process group of the controlling terminal. If those values do
    # not match, or ioctl() fails on the stdout file handle, we assume
    # the process is running in the background as a daemon.
    # http://www.gnu.org/software/bash/manual/bashref.html#Job-Control-Basics
    try:
コード例 #4
0
ファイル: jsonutils.py プロジェクト: hemanthnakkina/vnfsvc
    try:
        import simplejson as json
    except ImportError:
        import json
else:
    import json

import six
import six.moves.xmlrpc_client as xmlrpclib

from vnfsvc.openstack.common import gettextutils
from vnfsvc.openstack.common import importutils
from vnfsvc.openstack.common import strutils
from vnfsvc.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.