Convert old style options into arguments to boto3.session.Session.
11788
def convert_aws_args(aws_args):
    """"""
    if not isinstance(aws_args, dict):
        raise errors.InvalidConfiguration(
            'Elastic DocManager config option "aws" must be a dict'
        )
    old_session_kwargs = dict(
        region="region_name",
        access_id="aws_access_key_id",
        secret_key="aws_secret_access_key",
    )
    new_kwargs = {}
    for arg in aws_args:
        if arg in old_session_kwargs:
            new_kwargs[old_session_kwargs[arg]] = aws_args[arg]
        else:
            new_kwargs[arg] = aws_args[arg]
    return new_kwargs
1194816
def parse_arguments():
    """"""
    parser = create_parser()
    args = parser.parse_args()
    if not args.role_requirements_old_commit:
        args.role_requirements_old_commit = args.role_requirements
    if not args.rpc_product_old_commit:
        args.rpc_product_old_commit = args.rpc_product
    return args
1284878
def parse_options(self, kwargs):
        """"""
        kwargs = {camelize(key): value for key, value in kwargs.items()}
        for key in kwargs.keys():
            assert key in self.valid_options, (
                'The option {} is not in the available options: {}.'
                .format(key, ', '.join(self.valid_options))
            )
            assert isinstance(kwargs[key], self.valid_options[key]), (
                'The option {} must be one of the following types: {}.'
                .format(key, self.valid_options[key])
            )
        return kwargs
656337
def _convert_template_option(template):
    '''
    '''

    option = {}
    extraction_method = template.get('extraction_method')
    if extraction_method == 'guess':
        option['guess'] = True
    elif extraction_method == 'lattice':
        option['lattice'] = True
    elif extraction_method == 'stream':
        option['stream'] = True

    option['pages'] = template.get('page')
    option['area'] = [round(template['y1'], 3), round(template['x1'], 3), round(template['y2'], 3), round(template['x2'], 3)]

    return option
1257456
def option(name, help=""):
    """"""
    def decorator(func):
        options = getattr(func, "options", [])
        _option = Param(name, help)
        # Insert at the beginning so the apparent order is preserved
        options.insert(0, _option)
        func.options = options
        return func

    return decorator
805804
def _opt_to_args(cls, opt, val):
        
        no_value = (
            "alloptions", "all-logs", "batch", "build", "debug",
            "experimental", "list-plugins", "list-presets", "list-profiles",
            "noreport", "quiet", "verify"
        )
        count = ("verbose",)
        if opt in no_value:
            return ["--%s" % opt]
        if opt in count:
            return ["--%s" % opt for d in range(0, int(val))]
        return ["--" + opt + "=" + val]
1153125
def func_old_kwargs(a, b=None, **kwargs):  # pylint: disable=invalid-name
    """"""

    # We extract a specific optional parameter from **kwargs
    try:
        c = kwargs['c']
    except KeyError:
        c = None

    return a, b, c
1339347
def get_old_options(cli, image):
    
    return {
        'cmd': dockerapi.inspect_config(cli, image, 'Cmd'),
        'entrypoint': dockerapi.inspect_config(cli, image, 'Entrypoint'),
    }
200056
def put(self, *args, **kwargs):
        
        return self.session.put(*args, **self.get_kwargs(**kwargs))
699348
def get_boto_session(
        region,
        aws_access_key_id=None,
        aws_secret_access_key=None,
        aws_session_token=None
        ):
    """"""
    return boto3.session.Session(
        region_name=region,
        aws_secret_access_key=aws_secret_access_key,
        aws_access_key_id=aws_access_key_id,
        aws_session_token=aws_session_token
    )
22388
def option(current_kwargs, **kwargs):
    

    tmp_kwargs = dict((key, current_kwargs.get(key)) for key, value in kwargs.items())
    current_kwargs.update(kwargs)
    yield
    current_kwargs.update(tmp_kwargs)
963966
def scoped_session_decorator(func):
    """"""
    @wraps(func)
    def wrapper(*args, **kwargs):
        from wallace.db import session as wallace_session
        with sessions_scope(wallace_session) as session:
            from psiturk.db import db_session as psi_session
            with sessions_scope(psi_session) as session_psiturk:
                # The sessions used in func come from the funcs globals, but
                # they will be proxied thread locals vars from the session
                # registry, and will therefore be identical to those returned
                # by the context managers above.
                logger.debug('Running worker %s in scoped DB sessions',
                             func.__name__)
                return func(*args, **kwargs)
    return wrapper
671525
def _get_options(self, style):
        
        return [self.opt[o][style]['name'] for o in self.opt]
574775
def compat_kwargs(kwargs):
    """"""
    warn_deprecations(kwargs)
    for old, new in RENAMED_VARS.items():
        if old in kwargs:
            kwargs[new] = kwargs[old]
            # update cross references
            for c_old, c_new in RENAMED_VARS.items():
                if c_new == new:
                    kwargs[c_old] = kwargs[new]
536813
def curargs(self):
        
        #This is where we update the arguments to new dictionary versions when the code
        #is updated with new features etc. so that the older, serialized sessions don't
        #break.
        if (self.active not in self._version_check or 
            self.group not in self._version_check[self.active]):
            if ("version" not in self.args[self.active][self.group] or
                self.args[self.active][self.group]["version"] < self._template_args["version"]):
                for key in self._template_args:
                    if key not in self.args[self.active][self.group]:
                        self.args[self.active][self.group][key] = self._template_args[key]
                self.args[self.active][self.group]["version"] = self._template_args["version"]

            if self.active not in self._version_check:
                self._version_check[self.active] = [self.group]
            else:
                self._version_check[self.active].append(self.group)

        return self.args[self.active][self.group]
474610
private static Options getRunOptionsWithoutDeprecatedOptions(Options options) {
		Options o = getProgramSpecificOptionsWithoutDeprecatedOptions(options);
		o.addOption(SAVEPOINT_PATH_OPTION);
		return o.addOption(SAVEPOINT_ALLOW_NON_RESTORED_OPTION);
	}
284648
def set_vars(self, *args, **kwargs):
        
        kwargs.update(dict(*args))
        old_values = {vname: self.input.get(vname) for vname in kwargs}
        self.input.set_vars(**kwargs)
        if kwargs or old_values:
            self.history.info("Setting input variables: %s" % str(kwargs))
            self.history.info("Old values: %s" % str(old_values))

        return old_values