yadg package

Subpackages

Submodules

yadg.main module

yadg.main.run_with_arguments()

Main execution function.

This is the function executed when yadg is launched using the executable. The function has three subcommands:

  • process: processes a given schema into a datagram.

  • update: updates a given schema or datagram to the current version.

  • preset: creates a schema from a preset file and a target folder.

yadg.main.set_loglevel(delta)

yadg.subcommands module

yadg.subcommands.preset(args)

The preset subcommand of yadg.

This function requires the args.preset and args.folder arguments. If args.folder is an existing folder and args.preset a valid schema file (with appropriately formated "import" and "calfile" entries), this function will prepend the specified args.folder to all paths in the args.preset, convert them to absolute paths, and save the resulting schema in the supplied args.outfile.

Alternatively, if args.process is specified, the created schema will be directly processed into a datagram, which is then saved in args.outfile.

Return type

None

yadg.subcommands.process(args)

The process subcommand of yadg.

This function first checks that the supplied args.infile exists, is a valid schema, and if yes, proceeds to process the schema into a datagram. If this is successful, the datagram is checked for validity and written out into args.outfile (which is “datagram.json” by default).

Return type

None

yadg.subcommands.update(args)

The update subcommand of yadg.

This function requires the args.type argument, which defines whether the object to be updated is a datagram or a schema. Generally, updating a schema and then re-processing the raw data is preferred to updating a datagram.

If the supplied args.infile exists, and can be parsed as a json, it will be passed to yadg.dgutils.update_object() to perform the update. If the update is successful, the object is checked for validity and written out into args.outfile (which is the args.infile with a “.new.json” suffix by default).

Return type

None