def migrate(schema_file, config_file): '''Migrates a configuration file using a confirm schema.''' schema = load_schema_file(open(schema_file, 'r')) config = load_config_file(config_file, open(config_file, 'r').read()) config = append_existing_values(schema, config) migrated_config = generate_config_parser(config) migrated_config.write(sys.stdout)
def load_validation_from_files(schema_file_path, config_file_path): schema = load_schema_file(open(schema_file_path, 'r')) config = load_config_file(config_file_path, open(config_file_path, 'r').read()) return Validation(config, schema)
def generate(schema_file, all_options): '''Generates a template configuration file from a confirm schema.''' schema = load_schema_file(open(schema_file, 'r')) config_parser = generate_config_parser(schema, include_all=all_options) config_parser.write(sys.stdout)
def document(schema_file): '''Generate reStructuredText documentation from a confirm schema.''' schema = load_schema_file(open(schema_file, 'r')) documentation = generate_documentation(schema) sys.stdout.write(documentation)
def validator_from_config(config, schema_file_path): schema = load_schema_file(open(schema_file_path, 'r')) return Validation(config, schema)
def validator_from_config_parser(config_parser, schema_file_path): schema = load_schema_file(open(schema_file_path, 'r')) config = config_parser_to_dict(config_parser) return Validation(config, schema)
def validator_from_config_file(config_file_path, schema_file_path): schema = load_schema_file(open(schema_file_path, 'r')) config = load_config_file(config_file_path, open(config_file_path, 'r').read()) return Validation(config, schema)