def format(str): parts = str.split('=') if len(parts) != 2: raise argparse.ArgumentError('--format', 'Expected --format LANG=FILENAME') lang, filename = parts try: cfg = Config.load(filename) except (IOError, ValueError): raise argparse.ArgumentError('--format', 'Failed to load format file {}'.format(parts[1])) return lang, cfg
def format(str): parts = str.split('=') if len(parts) != 2: raise argparse.ArgumentError('--format', 'Expected --format LANG=FILENAME') lang, filename = parts try: cfg = Config.load(filename) except (IOError, ValueError): raise argparse.ArgumentError( '--format', 'Failed to load format file {}'.format(parts[1])) return lang, cfg
def config(str): return Config.load(str)