How to use the flattentool.input.FORMATS function in flattentool

To help you get started, we’ve selected a few flattentool examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenDataServices / flatten-tool / flattentool / __init__.py View on Github external
base = None
    elif base_json:
        with open(base_json) as fp:
            base = json.load(fp, object_pairs_hook=OrderedDict)
    else:
        base = OrderedDict()

    base_configuration = parse_sheet_configuration(
        [item.strip() for item in default_configuration.split(",")]
    )

    cell_source_map_data = OrderedDict()
    heading_source_map_data = OrderedDict()

    if metatab_name and not root_is_list:
        spreadsheet_input_class = INPUT_FORMATS[input_format]
        spreadsheet_input = spreadsheet_input_class(
            input_name=input_name,
            timezone_name=timezone_name,
            root_list_path="meta",
            include_sheets=[metatab_name],
            convert_titles=convert_titles,
            vertical_orientation=metatab_vertical_orientation,
            id_name=id_name,
            xml=xml,
            use_configuration=False,
        )
        if metatab_schema:
            parser = SchemaParser(
                schema_filename=metatab_schema, disable_local_refs=disable_local_refs
            )
            parser.parse()
github OpenDataServices / flatten-tool / flattentool / cli.py View on Github external
def create_parser():
    """
    Create an argparse ArgumentParser for our commandline arguments

    Defaults are not set here, but rather given in the appropriate function.

    (This is split out as it's own function primarily so it can be tested.)

    """

    parser = argparse.ArgumentParser()
    subparsers = parser.add_subparsers(dest="subparser_name")

    output_formats = sorted(OUTPUT_FORMATS) + ["all"]
    input_formats = sorted(INPUT_FORMATS)

    parser.add_argument(
        "-v",
        "--verbose",
        action="store_true",
        help="Print detailed output when warnings or errors occur.",
    )

    parser_create_template = subparsers.add_parser(
        "create-template", help="Create a template from the given schema"
    )
    parser_create_template.add_argument(
        "-s",
        "--schema",
        help="Path to the schema file you want to use to create the template",
        required=True,