Loaders
Contents:
Without the --loader command line option, shef.shef_parser simply outputs the parsed text in one of the
formats described on the User Guide for Package shef-parser 1.10.0 page. With the --loader command line option, the format is:
--loader <loader_name><loader_options>
where:
<loader_name>is the name of the loader module without the_loaderportion (e.g.,abcfor the moduleabc_loader)<loader_options>is zero or more loader options, each in square brackets (e.g.,[opt1][opt2])
An example would be run_shef_parser --loader abc[opt1][opt2]
Workflow Using a Loader
When using a loader, the following happens instead:
The parser constructs a new loader object based on the loader name passed on the command line, passing 3 arguments:
the parser’s logger
the parser’s output object (used if unloading)
whether to append to the output object (used if unloading)
The parser calls the loader’s
set_options(...)method, passing the loader options specified on the command lineIf
--unloadis specified on the command lineThe parser calls the loader’s
unload()method and exits
If
--unloadis not specified on the command lineFor each SHEF value [1], the parser calls the loader’s
set_shef_value(value_str: str)method [2], which then:
Uses the loader’s
time_series_nameproperty to compare the loader-specific time seies identifier of the SHEF value with that of the previous SHEF value (if any).If there was a previous SHEF value and the time series identifier is different, calls the loader’s
load_time_series()method. [3]Appends the SHEF value into the loader’s
_time_seriesvariable
Calls the loader’s
done()method and exits. [4]