IO_Converter

IO_Converter

class IO_Converter(object)

The interface to convert easy_config instance to ‘other common config’ instance, and vice versa. Note : the converted results may be slightly different according to the support of target config. For example, argparse doesn’t explicitly provide a way for storing hierachical config, so the converted config will be flattened!

__init__

def __init__()

Constructor of converter. In here, we declare the output/input dispatcher to dispatch the easy_config instance into the indicated subroutine.

cnvt_cfg_to

def cnvt_cfg_to(cfg, target_cfg_type: str, **cnvtr_kwarg)

Convert easy_configer ‘to’ the other common config instance.

Arguments:

  • cfg Configer - Easy_configer instance.

  • target_cfg_type str - A string tag of supported config type. It could be viewed by self.output_dispatcher.keys().

  • cnvtr_kwarg **kwargs - Other keyword arguments attempt to pass to converter subroutine.

Returns:

Any, the target config instance.

cnvt_cfg_from

def cnvt_cfg_from(other_cfg, target_cfg_type: str, **cnvtr_kwarg)

Convert to easy_configer ‘from’ the given common config instance.

Arguments:

  • other_cfg Any - Any supported config instance.

  • target_cfg_type str - A string tag of supported config type. It could be viewed by self.input_dispatcher.keys().

  • cnvtr_kwarg **kwargs - Other keyword arguments attempt to pass to converter subroutine.

Returns:

Configer.