Retrieve client settings from environment settings.

        :param \\*\\*kwargs: Arguments that are passed into the client instance
420605
def get_client_settings_env(**_):
    

    return {
        'proxy': os.environ.get('https_proxy'),
        'username': os.environ.get('SL_USERNAME'),
        'api_key': os.environ.get('SL_API_KEY'),
    }
1267088
def get_client_kwargs(self, path):
        
        bucket_name, key = self.split_locator(path)
        kwargs = dict(Bucket=bucket_name)
        if key:
            kwargs['Key'] = key
        return kwargs
226607
def get(self, *args, **kwargs):
        
        return self.session.get(*args, **self.get_kwargs(**kwargs))
113041
def _get_create_kwargs(skip_translate=None,
                       ignore_collisions=False,
                       validate_ip_addrs=True,
                       client_args=None,
                       **kwargs):
    '''
    
    '''

    networks = kwargs.pop('networks', {})
    if kwargs.get('network_mode', '') in networks:
        networks = {kwargs['network_mode']: networks[kwargs['network_mode']]}
    else:
        networks = {}

    kwargs = __utils__['docker.translate_input'](
        salt.utils.docker.translate.container,
        skip_translate=skip_translate,
        ignore_collisions=ignore_collisions,
        validate_ip_addrs=validate_ip_addrs,
        **__utils__['args.clean_kwargs'](**kwargs))

    if networks:
        kwargs['networking_config'] = _create_networking_config(networks)

    if client_args is None:
        try:
            client_args = get_client_args(['create_container', 'host_config'])
        except CommandExecutionError as exc:
            log.error('docker.create: Error getting client args: \'%s\'',
                      exc.__str__(), exc_info=True)
            raise CommandExecutionError(
                'Failed to get client args: {0}'.format(exc))

    full_host_config = {}
    host_kwargs = {}
    create_kwargs = {}
    # Using list() becausee we'll be altering kwargs during iteration
    for arg in list(kwargs):
        if arg in client_args['host_config']:
            host_kwargs[arg] = kwargs.pop(arg)
            continue
        if arg in client_args['create_container']:
            if arg == 'host_config':
                full_host_config.update(kwargs.pop(arg))
            else:
                create_kwargs[arg] = kwargs.pop(arg)
            continue
    create_kwargs['host_config'] = \
        _client_wrapper('create_host_config', **host_kwargs)
    # In the event that a full host_config was passed, overlay it on top of the
    # one we just created.
    create_kwargs['host_config'].update(full_host_config)
    # The "kwargs" dict at this point will only contain unused args
    return create_kwargs, kwargs
960587
def client(self, *args, **kwargs):
        

        return self._makeApiCall(self.funcinfo["client"], *args, **kwargs)
393879
def load_config_from_cli_arguments(self, *args, **kwargs):
        
        self._load_config_from_cli_argument(key='handlers_package', **kwargs)
        self._load_config_from_cli_argument(key='auth', **kwargs)
        self._load_config_from_cli_argument(key='user_stream', **kwargs)
        self._load_config_from_cli_argument(key='min_seconds_between_errors', **kwargs)
        self._load_config_from_cli_argument(key='sleep_seconds_on_consecutive_errors', **kwargs)
808615
def _get_args_kwargs(options, module):
    

    if module == 'emp':
        options = _emp_extra_options(options)
    arg_names, kw_names = _arg_kwarg_lists(module, options['analysis'])

    # Create list of values for arg_names
    args = []
    for arg_name in arg_names:

        if arg_name == 'patch':  # For patch arg, append actual patch obj
            args.append(options['patch'])
            continue
        if arg_name == 'self':  # Ignore self from class methods
            continue
        if arg_name == 'k':  # scipy dists use k and x, we always use x
            arg_name = 'x'

        try:
            exec 'args.append(eval("%s"))' % options[arg_name]
        except SyntaxError: # eval failing because option is a string
            args.append(options[arg_name])
        except:
            raise ValueError, ("Value for required argument %s not provided"
                               % arg_name)

    # Create dict with vals for kw_names
    kwargs = {}
    for kw_name in kw_names:
        if kw_name in options.keys():  # If a value is given for this kwarg
            try:
                exec 'kwargs[kw_name] = eval("%s")' % options[kw_name]
            except SyntaxError:  # eval failing because value is a string
                kwargs[kw_name] = options[kw_name]
            except:
                raise ValueError, ("Value for optional argument %s is invalid"
                                   % kw_name)

    return args, kwargs
38505
def _load_settings_from_source(self, source):
        
        if not source:
            pass
        elif source == 'env_settings_uri':
            for env_settings_uri_key in self.env_settings_uri_keys:
                env_settings_uri = self._search_environ(env_settings_uri_key)
                if env_settings_uri:
                    logger.debug('Found {} in the environment.'.format(env_settings_uri_key))
                    yield env_settings_uri, self._load_settings_from_uri(env_settings_uri)
                #end if
            #end for

        elif source == 'env':
            logger.debug('Loaded {} settings from the environment.'.format(len(os.environ)))
            yield source, dict(os.environ.items())

        elif isinstance(source, ParseResult):
            settings = self._load_settings_from_uri(source)
            yield source, settings

        elif isinstance(source, str):
            try: spec = importlib.util.find_spec(source)
            except (AttributeError, ImportError): spec = None

            settings = self._load_settings_from_spec(spec, name=source)
            if settings is None:
                _, ext = os.path.splitext(source)
                with uri_open(source, 'rb') as f:
                    yield source, self._load_settings_from_file(f, ext=ext)
            else:
                yield source, settings
            #end if

        elif hasattr(source, 'read'):
            yield source.name, self._load_settings_from_file(source)

        elif hasattr(source, 'items'):
            source_type = type(source).__name__
            for dict_settings_uri_key in self.dict_settings_uri_keys:
                if dict_settings_uri_key and dict_settings_uri_key in source and source[dict_settings_uri_key]:
                    logger.debug('Found {} in the dict-like object <{}>.'.format(dict_settings_uri_key, source_type))
                    yield from self._load_settings_from_source(source[dict_settings_uri_key])
                #end if
            #end for

            logger.debug('Loaded {} settings from dict-like object <{}>.'.format(len(source), source_type))
            yield self._get_unique_name(source_type), source

        else:
            source_type = type(source).__name__
            for object_settings_uri_key in self.object_settings_uri_keys:
                if object_settings_uri_key and hasattr(source, object_settings_uri_key) and getattr(source, object_settings_uri_key):
                    logger.debug('Found {} in the object <{}>.'.format(object_settings_uri_key, source_type))
                    yield from self._load_settings_from_source(getattr(source, object_settings_uri_key))
                #end if
            #end for

            settings = dict((k, v) for k, v in source.__dict__.items() if not k.startswith('__'))
            logger.debug('Loaded {} settings from object <{}>.'.format(len(settings), source_type))
            yield self._get_unique_name(source_type), settings
41194
def get_kwargs(self, **kwargs):
        
        version = kwargs.pop("version", "v1")
        if version == "v1":
            base = kwargs.pop("base", "/api")
        elif "/" in version:
            base = kwargs.pop("base", "/apis")
        else:
            if "base" not in kwargs:
                raise TypeError("unknown API version; base kwarg must be specified.")
            base = kwargs.pop("base")
        bits = [base, version]
        # Overwrite (default) namespace from context if it was set
        if "namespace" in kwargs:
            n = kwargs.pop("namespace")
            if n is not None:
                if n:
                    namespace = n
                else:
                    namespace = self.config.namespace
                if namespace:
                    bits.extend([
                        "namespaces",
                        namespace,
                    ])
        url = kwargs.get("url", "")
        if url.startswith("/"):
            url = url[1:]
        bits.append(url)
        kwargs["url"] = self.url + posixpath.join(*bits)
        return kwargs
46265
def client(cls, config):
        
        if not hasattr(cls, "_client"):
            cls._client = statsd.StatsClient(config.STATSD_HOST, config.STATSD_PORT, config.STATSD_PREFIX)
        return cls._client
1252417
def get_settings_from_environment(environ):
    ''''''
    settings = {}
    for name, value in environ.items():
        if not name.startswith('DJANGO_'):
            continue
        name = name.replace('DJANGO_', '', 1)
        if _ignore_setting(name):
            continue
        try:
            settings[name] = ast.literal_eval(value)
        except (SyntaxError, ValueError) as err:
            LOGGER.warn("Unable to parse setting %s=%s (%s)", name, value, err)
    return settings
1184897
def get_settings_list(self):
        """"""
        return [
            self.source,
            self.output,
            self.kwargs,
            self.post_processors,
        ]
1278569
def method_args(self, context, **kwargs):
        
        try:
            _args = self.conf[context].copy()
        except KeyError:
            _args = kwargs
        else:
            _args.update(kwargs)
        return _args
342462
def get_kwargs(grid, kwargs, phenotypes=False):
    
    denom = None
    if "denom" in kwargs:
        denom = kwargs["denom"]

    if "palette" in kwargs:
        palette = kwargs["palette"]
        if denom is None:
            denom = len(palette)
    elif "environment" in kwargs or isinstance(grid, EnvironmentFile):
        if "environment" in kwargs:
            env = kwargs["environment"]
        else:
            env = grid

        if phenotypes:
            palette = env.task_palette
            if denom is None:
                denom = len(env.tasks)
        else:
            palette = env.resource_palette
            if denom is None:
                denom = len(env.resources)

    else:
        length = get_pallete_length(grid)
        palette = sns.hls_palette(length, s=1)
        denom = length

    return denom, palette
860366
def settings(**kwargs):
    
    from pyemma import config

    old_settings = {}
    try:
        # remember old setting, set new one. May raise ValueError, if invalid setting is given.
        for k, v in kwargs.items():
            old_settings[k] = getattr(config, k)
            setattr(config, k, v)
        yield
    finally:
        # restore old settings
        for k, v in old_settings.items():
            setattr(config, k, v)
276567
def get_django_settings(cls, name, default=None):
        # pylint: disable=access-member-before-definition
        
        if hasattr(cls, '__django_settings__'):
            return getattr(cls.__django_settings__, name, default)
        from django.conf import settings
        cls.__django_settings__ = settings
        return cls.get_django_settings(name)
1365438
def _get_config(self, host, port, unix_socket, auth, config_key):
        

        client = self._client(host, port, unix_socket, auth)
        if client is None:
            return None

        config_value = client.config_get(config_key)
        del client
        return config_value