Generates keyword arguments for creating a new Docker client instance.

        :return: Keyword arguments as defined through this configuration.
        :rtype: dict
164915
def get_init_kwargs(self):
        
        init_kwargs = {}
        for k in self.init_kwargs:
            if k in self.core_property_set:
                init_kwargs[k] = getattr(self, k)
            elif k in self:
                init_kwargs[k] = self[k]
        return init_kwargs
288024
def _build_arguments(self):
        
        self._parser.add_argument(
            '-a', '--alias',
            required=False,
            default='default',
            type=str,
            help='registry alias created in freight-forwarder.yml. Example: tune_dev'
        )
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()
883435
def generate_readme(self):
        
        print("## Examples of settings runtime params")
        print("### Command-line parameters")
        print("```")
        self.generate_command()
        print("```")
        print("###  Environment variables")
        print("```")
        self.generate_env()
        print("```")
        print("###  ini file")
        print("```")
        self.generate_ini()
        print("```")
        print("###  docker run")
        print("```")
        self.generate_docker_run()
        print("```")
        print("###  docker compose")
        print("```")
        self.generate_docker_compose()
        print("```")
        print("###  kubernetes")
        print("```")
        self.generate_kubernetes()
        print("```")
        print("###  drone plugin")
        print("```")
        self.generate_drone_plugin()
        print("```")
444534
def build_all(cls, list_of_kwargs):
        
        return cls.add_all([
            cls.new(**kwargs) for kwargs in list_of_kwargs], commit=False)
111847
def gather_verify_arguments(self):
        
        _ctx = self.service_context
        kwargs = {
            'client_id': _ctx.client_id, 'iss': _ctx.issuer,
            'keyjar': _ctx.keyjar, 'verify': True,
            'skew': _ctx.clock_skew
        }

        for attr, param in IDT2REG.items():
            try:
                kwargs[attr] = _ctx.registration_response[param]
            except KeyError:
                pass

        try:
            kwargs['allow_missing_kid'] = self.service_context.allow[
                'missing_kid']
        except KeyError:
            pass

        return kwargs
68455
def _do_create_keywords(args, kw):
    
    v = kw.get('varlist', ())
    # prevent varlist="FOO" from being interpreted as ['F', 'O', 'O']
    if is_String(v): v = (v,)
    kw['varlist'] = tuple(v)
    if args:
        # turn positional args into equivalent keywords
        cmdstrfunc = args[0]
        if cmdstrfunc is None or is_String(cmdstrfunc):
            kw['cmdstr'] = cmdstrfunc
        elif callable(cmdstrfunc):
            kw['strfunction'] = cmdstrfunc
        else:
            raise SCons.Errors.UserError(
                'Invalid command display variable type. '
                'You must either pass a string or a callback which '
                'accepts (target, source, env) as parameters.')
        if len(args) > 1:
            kw['varlist'] = tuple(SCons.Util.flatten(args[1:])) + kw['varlist']
    if kw.get('strfunction', _null) is not _null \
                      and kw.get('cmdstr', _null) is not _null:
        raise SCons.Errors.UserError(
            'Cannot have both strfunction and cmdstr args to Action()')
1348575
def parse_args(self):
        
        parser = ArgumentParser(description='',
                                formatter_class=RawTextHelpFormatter)
        parser.add_argument("--generate", action="store", dest='generate',
                            choices=['command', 'docker-run', 'docker-compose',
                                     'ini', 'env', 'kubernetes', 'readme', 'drone-plugin'],
                            help="Generate a template ")
        parser.add_argument("--settings", action="store", dest='settings',
                            help="Specify a settings file. (ie settings.dev)")
        for key, value in self.spec.items():
            if value['type'] in [str, int, float]:
                parser.add_argument(f"--{key.lower()}", action="store", dest=key,
                                    type=value['type'],
                                    choices=value.get("choices"),
                                    help=self.help(value))
            elif value['type'] == bool:
                parser.add_argument(f"--{key.lower()}", action="store", dest=key,
                                    type=lambda x:bool(strtobool(x)),
                                    choices=value.get("choices"),
                                    help=self.help(value))
            elif value['type'] == list:
                parser.add_argument(f"--{key.lower()}", action="store", dest=key,
                                    nargs='+',
                                    choices=value.get("choices"),
                                    help=self.help(value))
            elif value['type'] == dict:
                parser.add_argument(f"--{key.lower()}", action="store", dest=key,
                                    type=json.loads,
                                    choices=value.get("choices"),
                                    help=self.help(value))
        args, _unknown = parser.parse_known_args()
        return args
657993
def yieldArgs(self, keyArgs):
        try:
            keyArgs = keyArgs._asdict() if keyArgs else {}
        except AttributeError:
            pass
        logger.debug('Args: %s', keyArgs)
        
        for (name, typeObj) in self._types.items():
            logger.debug('Yielding %s: %s', name, typeObj)
            for arg in typeObj.yieldArgs(keyArgs.get(name, None)):
                yield arg
635066
def load_plugins():
        
        plugin_cls = {}
        for entry_point in pkg_resources.iter_entry_points('docker_interface.plugins'):
            cls = entry_point.load()
            assert cls.COMMANDS is not None, \
                "plugin '%s' does not define its commands" % entry_point.name
            assert cls.ORDER is not None, \
                "plugin '%s' does not define its priority" % entry_point.name
            plugin_cls[entry_point.name] = cls
        return plugin_cls
880177
def generate_example():
    
    cmd_args = sys.argv[1:]
    parser = argparse.ArgumentParser(description='Confpy example generator.')
    parser.add_argument(
        '--module',
        action='append',
        help='A python module which should be imported.',
    )
    parser.add_argument(
        '--file',
        action='append',
        help='A python file which should be evaled.',
    )
    parser.add_argument(
        '--format',
        default='JSON',
        choices=('JSON', 'INI'),
        help='The output format of the configuration file.',
    )

    args = parser.parse_args(cmd_args)

    for module in args.module or ():

        __import__(module)

    for source_file in args.file or ():

        cfg = pyfile.PythonFile(path=source_file).config

    cfg = config.Configuration()

    print(example.generate_example(cfg, ext=args.format))
583660
def _connect_docker(spec):
    
    return {
        'method': 'docker',
        'kwargs': {
            'username': spec.remote_user(),
            'container': spec.remote_addr(),
            'python_path': spec.python_path(),
            'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
            'remote_name': get_remote_name(spec),
        }
    }
131589
def create(self, **kwargs):
        
        self.service.create(**kwargs)

        predix.config.set_env_value(self.use_class, 'url',
                self.service.settings.data['url'])
        predix.config.set_env_value(self.use_class, 'access_key_id',
                self.service.settings.data['access_key_id'])
        predix.config.set_env_value(self.use_class, 'bucket_name',
                self.service.settings.data['bucket_name'])
        predix.config.set_env_value(self.use_class, 'host',
                self.service.settings.data['host'])
        predix.config.set_env_value(self.use_class, 'secret_access_key',
                self.service.settings.data['secret_access_key'])
979928
def get_args(self, client):
        
        default_args = self.default_args(client)

        if self.method_args or self.optional_args:
            optional_args = getattr(self, 'optional_args', tuple())
            args = []
            for arg in (self.method_args + optional_args):
                if hasattr(self, arg):
                    obj = getattr(self, arg)
                    if hasattr(obj, 'struct'):
                        args.append(obj.struct)
                    else:
                        args.append(obj)
            args = list(default_args) + args
        else:
            args = default_args

        return args
507431
def from_args(cls, **kwargs):
        
        # Create a VSGSuite for each filename on the command line.
        if kwargs.get('suite_commands', None) == 'generate':
            filenames = kwargs.pop('configuration_filenames', [])
            return [cls.from_file(f) for f in filenames]

        # Create a VSGSuit from the target directory and override commands
        if kwargs.get('suite_commands', None) == 'auto':
            type = kwargs.get('suite_type', None)
            return [cls.from_directory('', type, **kwargs)]

        # Create nothing.
        return []
45920
def gather_verify_arguments(self):
        

        kwargs = {'client_id': self.service_context.client_id,
                  'iss': self.service_context.issuer,
                  'keyjar': self.service_context.keyjar,
                  'verify': True}
        return kwargs
866677
def get_client_kwargs(self, path):
        
        container, obj = self.split_locator(path)
        kwargs = dict(container=container)
        if obj:
            kwargs['obj'] = obj
        return kwargs