get the client and perform imports not on init, in case there are any
       initialization or import errors. 

       Parameters
       ==========
       quiet: if True, suppress most output about the client
       debug: turn on debugging mode
491410
def get_client(quiet=False, debug=False):
    '''
       

    '''
    from spython.utils import get_singularity_version
    from .base import Client

    Client.quiet = quiet
    Client.debug = debug

    # Do imports here, can be customized
    from .apps import apps
    from .build import build
    from .execute import execute 
    from .help import help
    from .inspect import inspect
    from .instances import ( instances, stopall ) # global instance commands
    from .run import run
    from .pull import pull

    # Actions
    Client.apps = apps
    Client.build = build
    Client.execute = execute
    Client.help = help
    Client.inspect = inspect
    Client.instances = instances
    Client.run = run
    Client.pull = pull

    # Command Groups, Images
    from spython.image.cmd import generate_image_commands  # deprecated
    Client.image = generate_image_commands()

    # Commands Groups, Instances
    from spython.instance.cmd import generate_instance_commands  # instance level commands
    Client.instance = generate_instance_commands()
    Client.instance_stopall = stopall
    Client.instance.version = Client.version

    # Commands Groups, OCI (Singularity version 3 and up)
    if "version 3" in get_singularity_version():
        from spython.oci.cmd import generate_oci_commands
        Client.oci = generate_oci_commands()()  # first () runs function, second
                                                # initializes OciImage class
        Client.oci.debug = Client.debug
        Client.oci.quiet = Client.quiet
        Client.oci.OciImage.quiet = Client.quiet
        Client.oci.OciImage.debug = Client.debug


    # Initialize
    cli = Client()

    # Pass on verbosity
    cli.image.debug = cli.debug
    cli.image.quiet = cli.quiet
    cli.instance.debug = cli.debug
    cli.instance.quiet = cli.quiet 

    return cli
402416
def console
      client_setup({}, true, true)
      puts "Console Connected to #{@client.url}"
      puts "HINT: The @client object is available to you\n\n"
    rescue
      puts "WARNING: Couldn't connect to #{@options['url'] || ENV['ONEVIEWSDK_URL']}\n\n"
    ensure
      require 'pry'
      Pry.config.prompt = proc { '> ' }
      Pry.plugins['stack_explorer'] && Pry.plugins['stack_explorer'].disable!
      Pry.plugins['byebug'] && Pry.plugins['byebug'].disable!
      Pry.start(OneviewSDK::Console.new(@client))
    end
92914
def enable_debug(self):
        """"""

        if not self.connected:
            raise HardwareError("Cannot enable debug if we are not in a connected state")

        self._loop.run_coroutine(self.adapter.open_interface(0, 'debug'))
461980
def run
      Byebug.mode = :standalone

      option_parser.order!($ARGV)
      return if non_script_option? || error_in_script?

      $PROGRAM_NAME = program

      Byebug.run_init_script if init_script

      loop do
        debug_program

        break if quit

        ControlProcessor.new(nil, interface).process_commands
      end
    end
1130792
def get_debug_option(packagename):
    

    try:
        current_debug = get_pkg_version_module(packagename,
                                               fromlist=['debug'])[0]
    except (ImportError, AttributeError):
        current_debug = None

    # Only modify the debug flag if one of the build commands was explicitly
    # run (i.e. not as a sub-command of something else)
    dist = get_dummy_distribution()
    if any(cmd in dist.commands for cmd in ['build', 'build_ext']):
        debug = bool(get_distutils_build_option('debug'))
    else:
        debug = bool(current_debug)

    if current_debug is not None and current_debug != debug:
        build_ext_cmd = dist.get_command_class('build_ext')
        build_ext_cmd._force_rebuild = True

    return debug
522240
def execute_with_client(quiet=False,
                        bootstrap_server=False,
                        create_client=True):
    """"""
    def wrapper(f):

        def wrapper2(self, *args, **kwargs):
            client = self.current_client(
                quiet=quiet,
                bootstrap_server=bootstrap_server,
                create_client=create_client)
            if client and client.running:
                return f(self, client, *args, **kwargs)
        return wrapper2

    return wrapper
1201655
def set_debug(enabled: bool):
    
    global _DEBUG_ENABLED

    if not enabled:
        log('Disabling debug output...', logger_name=_LOGGER_NAME)
        _DEBUG_ENABLED = False
    else:
        _DEBUG_ENABLED = True
        log('Enabling debug output...', logger_name=_LOGGER_NAME)
633945
def _on_run(self):
        '''  '''

        try:
            while True:
                try:
                    try:
                        cmd = self.cmdQueue.get(1, 0.1)
                    except _queue.Empty:
                        if self.killReceived:
                            try:
                                self.sock.shutdown(SHUT_WR)
                                self.sock.close()
                            except:
                                pass

                            return  # break if queue is empty and killReceived
                        else:
                            continue
                except:
                    # pydev_log.info('Finishing debug communication...(1)')
                    # when liberating the thread here, we could have errors because we were shutting down
                    # but the thread was still not liberated
                    return
                cmd.send(self.sock)

                if cmd.id == CMD_EXIT:
                    break
                if time is None:
                    break  # interpreter shutdown
                time.sleep(self.timeout)
        except Exception:
            GlobalDebuggerHolder.global_dbg.finish_debugging_session()
            if DebugInfoHolder.DEBUG_TRACE_LEVEL >= 0:
                pydev_log_exception()
224632
def client(self):
        
        if not hasattr(self, "_client"):
            self._client = connections.get_connection("default")
        return self._client
1098752
def chat(client):
    
    global SERVER_RUN
    msg = client.get_command()
    print '%s says, "%s"' % (client.addrport(), msg)

    for guest in CLIENT_LIST:
        if guest != client:
            guest.send('%s says, %s\n' % (client.addrport(), msg))
        else:
            guest.send('You say, %s\n' % msg)

    cmd = msg.lower()
    ## bye = disconnect
    if cmd == 'bye':
        client.active = False
    ## shutdown == stop the server
    elif cmd == 'shutdown':
        SERVER_RUN = False
1164216
def _init_client():
    
    if client is not None:
        return

    global _mysql_kwargs, _table_name
    _mysql_kwargs = {
        'host': __opts__.get('mysql.host', '127.0.0.1'),
        'user': __opts__.get('mysql.user', None),
        'passwd': __opts__.get('mysql.password', None),
        'db': __opts__.get('mysql.database', _DEFAULT_DATABASE_NAME),
        'port': __opts__.get('mysql.port', 3306),
        'unix_socket': __opts__.get('mysql.unix_socket', None),
        'connect_timeout': __opts__.get('mysql.connect_timeout', None),
        'autocommit': True,
    }
    _table_name = __opts__.get('mysql.table_name', _table_name)
    # TODO: handle SSL connection parameters

    for k, v in _mysql_kwargs.items():
        if v is None:
            _mysql_kwargs.pop(k)
    kwargs_copy = _mysql_kwargs.copy()
    kwargs_copy['passwd'] = "<hidden>"
    log.info("mysql_cache: Setting up client with params: %r", kwargs_copy)
    # The MySQL client is created later on by run_query
    _create_table()
182157
def instantiate_client(_unused_client, _unused_to_delete):
    """"""

    # [START client_create_default]
    from google.cloud import logging

    client = logging.Client()
    # [END client_create_default]

    credentials = object()
    # [START client_create_explicit]
    from google.cloud import logging

    client = logging.Client(project="my-project", credentials=credentials)
58968
def get_client(client=None):
    
    global _client

    tmp_client = client is not None
    if not tmp_client:
        config = getattr(django_settings, "ELASTIC_APM", {})
        client = config.get("CLIENT", default_client_class)

    if _client[0] != client:
        client_class = import_string(client)
        instance = client_class()
        if not tmp_client:
            _client = (client, instance)
        return instance
    return _client[1]
173557
def debug(evals,feed_dict=None,breakpoints=None,break_immediately=False,session=None):
	
	global _dbsession
	_dbsession=debug_session.DebugSession(session)
	return _dbsession.run(evals,feed_dict,breakpoints,break_immediately)
23217
def init_debug(self):
        """"""
        import signal

        def debug_trace(sig, frame):
            """Interrupt running process, and provide a python prompt for interactive
            debugging."""

            self.log('Trace signal received')
            self.log(''.join(traceback.format_stack(frame)))

        signal.signal(signal.SIGUSR2, debug_trace)
1184984
def quiet
      if Calabash::Logger.log_levels.include?(:debug)
        puts Color.blue('Turned off debug logging.')
        Calabash::Logger.log_levels.delete(:debug)
      else
        puts Color.blue('Debug logging is already turned off.')
      end

      true
    end
782838
def get(self, session):
        
        idle = self.idle_connections
        if idle:
            connection = idle.pop(0)
            connection.lock(session)
            if self.idle_start:
                with self._lock:
                    self.idle_start = None
            return connection.handle
        raise NoIdleConnectionsError(self.id)