示例#1
0
文件: main.py 项目: fcharette/confirm
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)
示例#2
0
文件: main.py 项目: Ronan-/confirm
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)
示例#3
0
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)
示例#4
0
文件: main.py 项目: Ronan-/confirm
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)
示例#5
0
文件: main.py 项目: Ronan-/confirm
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)
示例#6
0
def validator_from_config(config, schema_file_path):
    schema = load_schema_file(open(schema_file_path, 'r'))
    return Validation(config, schema)
示例#7
0
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)
示例#8
0
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)
示例#9
0
def validator_from_config(config, schema_file_path):
    schema = load_schema_file(open(schema_file_path, 'r'))
    return Validation(config, schema)
示例#10
0
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)
示例#11
0
文件: main.py 项目: fcharette/confirm
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)
示例#12
0
文件: main.py 项目: fcharette/confirm
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)