args_dict

Contents

args_dict#

args_dict(args_l: list[dict], kwargs) dict[source]#

This function converts a single in-house S3 configuration to a dictionary containing ready to use key/value parameters.

The input is a list of dict to process. Each dictionary can contain the following key: - name: The name of the key in the output dict. If not given, the name of the key is the value of kwargs. - kwargs: The name of the kwargs argument whose value is taken to set the value in output dict. - env: The name of the envrionment variable whose value is taken to set the value in output dict. - prefix: A prefix prefixed to the value in the ouput dict.

For example, if the environment variable “AWS_PROFILE” is unset, the following input: args_l = [{“name”: “AWS_PROFILE”, “kwargs”: “profile_name”, “env”: “AWS_PROFILE”}], kwargs={“profile_name”: “unistra”} will output: {“AWS_PROFILE”: “unistra”}

Here is the order of precedence from least to greatest (the last listed configuration variables override all other variables):

  1. Value from kwargs.

  2. Default value from key “default”.

  3. Value from environment variable.

If no value is found, the output dict will not contain the wanted parameter.

Parameters:
  • args_l – A list of parameters to extract. Each element will give a single key/value parameter.

  • kwargs – Considered kwargs input to set parameters.

Returns: