Handlers
PyFDL provides a set of functions to read and write files. These functions will pick the appropriate handler based on path.suffix or handler name.
pyfdl.read_from_file(path, handler_name=None, **handler_kwargs)
Handler agnostic function for producing an FDL from a file. A suitable handler will be
chosen based on path or handler_name.
| Parameters: |
|
|---|
| Returns: |
|
|---|
pyfdl.read_from_string(s, handler_name='fdl', **handler_kwargs)
Handler agnostic function for producing an FDL based on a string. A suitable handler will be
chosen based on handler_name. Defaults to "fdl".
| Parameters: |
|
|---|
| Returns: |
|
|---|
pyfdl.write_to_file(fdl, path, handler_name=None, **handler_kwargs)
Handler agnostic function to write a file based on an FDL. A suitable handler will be chosen based
on path or handler_name
| Parameters: |
|
|---|
pyfdl.write_to_string(fdl, handler_name='fdl', **handler_kwargs)
Handler agnostic function for producing a string representation of an FDL. A suitable handler will
be chosen based on handler_name.
| Parameters: |
|
|---|
Returns:
FDLHandler
This is the built-in handler for reading and writing fdl files. No need to call this directly. Use the functions above.
pyfdl.handlers.fdl_handler
FDLHandler()
The default built-in FDL handler. Takes care of reading and writing FDL files
read_from_file(path, validate=True)
Read an FDL from a file.
| Parameters: |
|
|---|
| Raises: |
|
|---|
| Returns: |
|
|---|
read_from_string(s, validate=True)
Read an FDL from a string.
| Parameters: |
|
|---|
| Raises: |
|
|---|
| Returns: |
|
|---|
write_to_file(fdl, path, validate=True, indent=2)
Dump an FDL to a file.
| Parameters: |
|
|---|
| Raises: |
|
|---|
write_to_string(fdl, validate=True, indent=2)
Dump an FDL to string
| Parameters: |
|
|---|
| Raises: |
|
|---|
| Returns: |
|
|---|
register_plugin(registry)
Mandatory function to register handler in the registry. Called by the PluginRegistry itself.
| Parameters: |
|
|---|